diff --git a/.gitignore b/.gitignore
index 535ad007f..0d9d52976 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ version.h
docs/*
.idea/dictionaries
.idea/workspace.xml
+.idea/misc.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 674375dd3..000000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp
index 6f8b0c4f5..def186cb7 100644
--- a/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp
+++ b/DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp
@@ -9,7 +9,7 @@ namespace DataSpec
struct ITweakGunRes : ITweak
{
- using ResId = int64_t;
+ using ResId = urde::CAssetId;
enum class EBeamId
{
Power,
diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp
index f3d30b2ea..abe22c3c9 100644
--- a/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp
+++ b/DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp
@@ -10,7 +10,7 @@ namespace DataSpec
struct ITweakPlayerRes : ITweak
{
- using ResId = uint64_t;
+ using ResId = urde::CAssetId;
using EBeamId = urde::CPlayerState::EBeamId;
ResId x4_saveStationIcon;
diff --git a/DataSpec/DNAMP1/MLVL.cpp b/DataSpec/DNAMP1/MLVL.cpp
index 10a81ee3b..ef45afdbe 100644
--- a/DataSpec/DNAMP1/MLVL.cpp
+++ b/DataSpec/DNAMP1/MLVL.cpp
@@ -270,8 +270,8 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
{
addedPaths.insert(path.hash());
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(path, btok);
- if (tag.id != -1)
- areaOut.deps.emplace_back(tag.id, tag.type);
+ if (tag.id.IsValid())
+ areaOut.deps.emplace_back(tag.id.Value(), tag.type);
}
}
}
@@ -309,14 +309,14 @@ bool MLVL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPat
{
addedPaths.insert(path.hash());
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(path, btok);
- if (tag.id != -1)
- areaOut.deps.emplace_back(tag.id, tag.type);
+ if (tag.id.IsValid())
+ areaOut.deps.emplace_back(tag.id.Value(), tag.type);
}
}
urde::SObjectTag tag = g_curSpec->BuildTagFromPath(areaPath, btok);
- if (tag.id != -1)
- areaOut.deps.emplace_back(tag.id, tag.type);
+ if (tag.id.IsValid())
+ areaOut.deps.emplace_back(tag.id.Value(), tag.type);
}
++areaIdx;
@@ -369,7 +369,7 @@ bool MLVL::CookMAPW(const hecl::ProjectPath& outPath,
fo.writeUint32Big(1);
fo.writeUint32Big(mapaTags.size());
for (const urde::SObjectTag& mapa : mapaTags)
- fo.writeUint32Big(mapa.id);
+ fo.writeUint32Big(u32(mapa.id.Value()));
int64_t rem = fo.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
diff --git a/Editor/ProjectResourceFactoryBase.cpp b/Editor/ProjectResourceFactoryBase.cpp
index 0dce7d771..78bde7854 100644
--- a/Editor/ProjectResourceFactoryBase.cpp
+++ b/Editor/ProjectResourceFactoryBase.cpp
@@ -11,7 +11,7 @@ static void WriteTag(athena::io::YAMLDocWriter& cacheWriter,
const SObjectTag& pathTag, const hecl::ProjectPath& path)
{
char idStr[9];
- snprintf(idStr, 9, "%08X", uint32_t(pathTag.id));
+ snprintf(idStr, 9, "%08X", uint32_t(pathTag.id.Value()));
if (auto v = cacheWriter.enterSubVector(idStr))
{
cacheWriter.writeString(nullptr, pathTag.type.toString().c_str());
@@ -26,7 +26,7 @@ static void WriteNameTag(athena::io::YAMLDocWriter& nameWriter,
const std::string& name)
{
char idStr[9];
- snprintf(idStr, 9, "%08X", uint32_t(pathTag.id));
+ snprintf(idStr, 9, "%08X", uint32_t(pathTag.id.Value()));
nameWriter.writeString(name.c_str(), idStr);
}
@@ -137,7 +137,7 @@ void ProjectResourceFactoryBase::BackgroundIndexRecursiveCatalogs(const hecl::Pr
static void DumpCacheAdd(const SObjectTag& pathTag, const hecl::ProjectPath& path)
{
fprintf(stderr, "%s %08X %s\n",
- pathTag.type.toString().c_str(), uint32_t(pathTag.id),
+ pathTag.type.toString().c_str(), uint32_t(pathTag.id.Value()),
path.getRelativePathUTF8().c_str());
}
#endif
@@ -466,13 +466,13 @@ CFactoryFnReturn ProjectResourceFactoryBase::BuildSync(const SObjectTag& tag,
CFactoryFnReturn ret =
m_factoryMgr.MakeObjectFromMemory(tag, std::move(memBuf), length, false, paramXfer, selfRef);
Log.report(logvisor::Info, "sync-built %.4s %08X",
- tag.type.toString().c_str(), u32(tag.id));
+ tag.type.toString().c_str(), u32(tag.id.Value()));
return ret;
}
CFactoryFnReturn ret = m_factoryMgr.MakeObject(tag, *fr, paramXfer, selfRef);
Log.report(logvisor::Info, "sync-built %.4s %08X",
- tag.type.toString().c_str(), u32(tag.id));
+ tag.type.toString().c_str(), u32(tag.id.Value()));
return ret;
}
@@ -681,7 +681,7 @@ std::unique_ptr ProjectResourceFactoryBase::Build(const urde::SObjec
const urde::CVParamTransfer& paramXfer,
CObjectReference* selfRef)
{
- if (tag.id == kInvalidResId || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
const hecl::ProjectPath* resPath = nullptr;
@@ -715,14 +715,14 @@ std::unique_ptr ProjectResourceFactoryBase::Build(const urde::SObjec
*task.xc_targetObjPtr = newObj.get();
Log.report(logvisor::Warning, "spin-built %.4s %08X",
task.x0_tag.type.toString().c_str(),
- u32(task.x0_tag.id));
+ u32(task.x0_tag.id.Value()));
m_asyncLoadList.erase(asyncSearch);
return newObj;
}
Log.report(logvisor::Error, "unable to spin-build %.4s %08X",
task.x0_tag.type.toString().c_str(),
- u32(task.x0_tag.id));
+ u32(task.x0_tag.id.Value()));
m_asyncLoadList.erase(asyncSearch);
return {};
}
@@ -748,7 +748,7 @@ void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag,
urde::IObj** objOut,
CObjectReference* selfRef)
{
- if (tag.id == kInvalidResId || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
BuildAsyncInternal(tag, paramXfer, objOut, selfRef);
@@ -756,7 +756,7 @@ void ProjectResourceFactoryBase::BuildAsync(const urde::SObjectTag& tag,
u32 ProjectResourceFactoryBase::ResourceSize(const SObjectTag& tag)
{
- if (tag.id == kInvalidResId || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id on type '%s'", tag.type.toString().c_str());
/* Ensure resource at requested path is indexed and not cooking */
@@ -776,7 +776,7 @@ std::shared_ptr
ProjectResourceFactoryBase::LoadResourceAsync(const urde::SObjectTag& tag,
std::unique_ptr& target)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
if (m_asyncLoadList.find(tag) != m_asyncLoadList.end())
return {};
@@ -789,7 +789,7 @@ ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
u32 size, u32 off,
std::unique_ptr& target)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
if (m_asyncLoadList.find(tag) != m_asyncLoadList.end())
return {};
@@ -800,7 +800,7 @@ ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
std::shared_ptr
ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag, u32 size, u32 off, u8* target)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
if (m_asyncLoadList.find(tag) != m_asyncLoadList.end())
return {};
@@ -810,7 +810,7 @@ ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag, u
std::unique_ptr ProjectResourceFactoryBase::LoadResourceSync(const urde::SObjectTag& tag)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
/* Ensure resource at requested path is indexed and not cooking */
@@ -829,7 +829,7 @@ std::unique_ptr ProjectResourceFactoryBase::LoadResourceSync(const urde::S
std::unique_ptr ProjectResourceFactoryBase::LoadResourcePartSync(const urde::SObjectTag& tag,
u32 size, u32 off)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
/* Ensure resource at requested path is indexed and not cooking */
@@ -854,7 +854,7 @@ void ProjectResourceFactoryBase::CancelBuild(const urde::SObjectTag& tag)
bool ProjectResourceFactoryBase::CanBuild(const urde::SObjectTag& tag)
{
- if ((tag.id & 0xffffffff) == 0xffffffff || !tag.id)
+ if (!tag.id.IsValid())
Log.report(logvisor::Fatal, "attempted to access null id");
const hecl::ProjectPath* resPath = nullptr;
@@ -896,9 +896,9 @@ const urde::SObjectTag* ProjectResourceFactoryBase::GetResourceIdByName(const ch
return &search->second;
}
-FourCC ProjectResourceFactoryBase::GetResourceTypeById(ResId id) const
+FourCC ProjectResourceFactoryBase::GetResourceTypeById(CAssetId id) const
{
- if ((id & 0xffffffff) == 0xffffffff || !id)
+ if (!id.IsValid())
return {};
std::unique_lock lk(const_cast(this)->m_backgroundIndexMutex);
@@ -1006,7 +1006,7 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(
*task.xc_targetObjPtr = newObj.release();
Log.report(logvisor::Info, "async-built %.4s %08X",
task.x0_tag.type.toString().c_str(),
- u32(task.x0_tag.id));
+ u32(task.x0_tag.id.Value()));
}
else if (task.xc_targetDataPtr)
{
@@ -1014,14 +1014,14 @@ bool ProjectResourceFactoryBase::AsyncPumpTask(
*task.xc_targetDataPtr = std::move(task.x10_loadBuffer);
Log.report(logvisor::Info, "async-loaded %.4s %08X",
task.x0_tag.type.toString().c_str(),
- u32(task.x0_tag.id));
+ u32(task.x0_tag.id.Value()));
}
else if (task.xc_targetDataRawPtr)
{
/* Buffer only raw */
Log.report(logvisor::Info, "async-loaded %.4s %08X",
task.x0_tag.type.toString().c_str(),
- u32(task.x0_tag.id));
+ u32(task.x0_tag.id.Value()));
}
}
diff --git a/Editor/ProjectResourceFactoryBase.hpp b/Editor/ProjectResourceFactoryBase.hpp
index b465cd042..de24cf8e5 100644
--- a/Editor/ProjectResourceFactoryBase.hpp
+++ b/Editor/ProjectResourceFactoryBase.hpp
@@ -129,7 +129,7 @@ public:
void CancelBuild(const urde::SObjectTag&);
bool CanBuild(const urde::SObjectTag&);
const urde::SObjectTag* GetResourceIdByName(const char*) const;
- FourCC GetResourceTypeById(ResId id) const;
+ FourCC GetResourceTypeById(CAssetId id) const;
void EnumerateResources(const std::function& lambda) const;
void EnumerateNamedResources(const std::function& lambda) const;
diff --git a/Editor/ProjectResourceFactoryMP1.cpp b/Editor/ProjectResourceFactoryMP1.cpp
index a50a6d86d..317660304 100644
--- a/Editor/ProjectResourceFactoryMP1.cpp
+++ b/Editor/ProjectResourceFactoryMP1.cpp
@@ -47,8 +47,8 @@ namespace urde
class MP1OriginalIDs
{
- std::vector> m_origToNew;
- std::vector> m_newToOrig;
+ std::vector> m_origToNew;
+ std::vector> m_newToOrig;
public:
MP1OriginalIDs(CInputStream& in)
@@ -57,20 +57,20 @@ public:
m_origToNew.reserve(count);
for (u32 i=0 ; isecond;
}
- ResId TranslateNewToOriginal(ResId id) const
+ CAssetId TranslateNewToOriginal(CAssetId id) const
{
auto search = rstl::binary_find(m_newToOrig.cbegin(), m_newToOrig.cend(), id,
[](const auto& id) { return id.first; });
@@ -154,12 +154,12 @@ void ProjectResourceFactoryMP1::Shutdown()
ProjectResourceFactoryBase::Shutdown();
}
-ResId ProjectResourceFactoryMP1::TranslateOriginalToNew(ResId id) const
+CAssetId ProjectResourceFactoryMP1::TranslateOriginalToNew(CAssetId id) const
{
return m_origIds->TranslateOriginalToNew(id);
}
-ResId ProjectResourceFactoryMP1::TranslateNewToOriginal(ResId id) const
+CAssetId ProjectResourceFactoryMP1::TranslateNewToOriginal(CAssetId id) const
{
return m_origIds->TranslateNewToOriginal(id);
}
diff --git a/Editor/ProjectResourceFactoryMP1.hpp b/Editor/ProjectResourceFactoryMP1.hpp
index 051f36986..80e87384d 100644
--- a/Editor/ProjectResourceFactoryMP1.hpp
+++ b/Editor/ProjectResourceFactoryMP1.hpp
@@ -18,8 +18,8 @@ public:
void GetTagListForFile(const char* pakName, std::vector& out) const;
void Shutdown();
- ResId TranslateOriginalToNew(ResId id) const;
- ResId TranslateNewToOriginal(ResId id) const;
+ CAssetId TranslateOriginalToNew(CAssetId id) const;
+ CAssetId TranslateNewToOriginal(CAssetId id) const;
};
}
diff --git a/Runtime/Audio/CAudioSys.cpp b/Runtime/Audio/CAudioSys.cpp
index 03129ae2b..563284704 100644
--- a/Runtime/Audio/CAudioSys.cpp
+++ b/Runtime/Audio/CAudioSys.cpp
@@ -7,7 +7,7 @@ namespace urde
CAudioSys* CAudioSys::g_SharedSys = nullptr;
static std::unordered_map> mpGroupSetDB;
-static std::unordered_map mpGroupSetResNameDB;
+static std::unordered_map mpGroupSetResNameDB;
static const std::string mpDefaultInvalidString = "NULL";
TLockedToken CAudioSys::FindGroupSet(const std::string& name)
@@ -18,7 +18,7 @@ TLockedToken CAudioSys::FindGroupSet(const std::string& name)
return search->second;
}
-const std::string& CAudioSys::SysGetGroupSetName(ResId id)
+const std::string& CAudioSys::SysGetGroupSetName(CAssetId id)
{
auto search = mpGroupSetResNameDB.find(id);
if (search == mpGroupSetResNameDB.cend())
@@ -26,7 +26,7 @@ const std::string& CAudioSys::SysGetGroupSetName(ResId id)
return search->second;
}
-bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, ResId id)
+bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, CAssetId id)
{
if (!FindGroupSet(SysGetGroupSetName(id)))
{
@@ -41,7 +41,7 @@ bool CAudioSys::SysLoadGroupSet(CSimplePool* pool, ResId id)
}
}
-bool CAudioSys::SysLoadGroupSet(const TLockedToken& set, const std::string& name, ResId id)
+bool CAudioSys::SysLoadGroupSet(const TLockedToken& set, const std::string& name, CAssetId id)
{
if (!FindGroupSet(name))
{
diff --git a/Runtime/Audio/CAudioSys.hpp b/Runtime/Audio/CAudioSys.hpp
index 2dc59e6f3..e98b69622 100644
--- a/Runtime/Audio/CAudioSys.hpp
+++ b/Runtime/Audio/CAudioSys.hpp
@@ -79,9 +79,9 @@ public:
}
static TLockedToken FindGroupSet(const std::string& name);
- static const std::string& SysGetGroupSetName(ResId id);
- static bool SysLoadGroupSet(CSimplePool* pool, ResId id);
- static bool SysLoadGroupSet(const TLockedToken& set, const std::string& name, ResId id);
+ static const std::string& SysGetGroupSetName(CAssetId id);
+ static bool SysLoadGroupSet(CSimplePool* pool, CAssetId id);
+ static bool SysLoadGroupSet(const TLockedToken& set, const std::string& name, CAssetId id);
static void SysUnloadAudioGroupSet(const std::string& name);
static bool SysIsGroupSetLoaded(const std::string& name);
static void SysAddGroupIntoAmuse(const std::string& name);
diff --git a/Runtime/Audio/CMidiManager.hpp b/Runtime/Audio/CMidiManager.hpp
index 81b2981f1..5b7d4961f 100644
--- a/Runtime/Audio/CMidiManager.hpp
+++ b/Runtime/Audio/CMidiManager.hpp
@@ -13,12 +13,12 @@ public:
{
u16 x0_setupId;
u16 x2_groupId;
- ResId x4_agscId;
+ CAssetId x4_agscId;
std::unique_ptr x8_arrData;
public:
u16 GetSetupId() const { return x0_setupId; }
u16 GetGroupId() const { return x2_groupId; }
- ResId GetAGSCAssetId() const { return x4_agscId; }
+ CAssetId GetAGSCAssetId() const { return x4_agscId; }
const u8* GetArrData() const { return x8_arrData.get(); }
CMidiData(CInputStream& in);
};
diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp
index 231c70833..1f287aa91 100644
--- a/Runtime/AutoMapper/CAutoMapper.cpp
+++ b/Runtime/AutoMapper/CAutoMapper.cpp
@@ -199,7 +199,7 @@ void CAutoMapper::SetupMiniMapWorld(const CStateManager& mgr)
bool CAutoMapper::HasCurrentMapUniverseWorld() const
{
- ResId mlvlId = x24_world->IGetWorldAssetId();
+ CAssetId mlvlId = x24_world->IGetWorldAssetId();
for (const CMapUniverse::CMapWorldData& wld : *x8_mapu)
if (wld.GetWorldAssetId() == mlvlId)
return true;
@@ -340,7 +340,7 @@ bool CAutoMapper::CanLeaveMapScreen(const CStateManager& mgr) const
return x328_ == 3 && CanLeaveMapScreenInternal(mgr);
}
-void CAutoMapper::SetCurWorldAssetId(ResId mlvlId)
+void CAutoMapper::SetCurWorldAssetId(CAssetId mlvlId)
{
int numWorlds = x8_mapu->GetNumMapWorldDatas();
for (int i=0 ; iCurrentWorldAssetId();
+ CAssetId curMlvl = g_GameState->CurrentWorldAssetId();
for (int i=0 ; iTextSupport().SetText(u"");
std::u16string str = hecl::UTF8ToChar16(
- hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x24_lStick[x2e4_lStickPos])));
+ hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x24_lStick[x2e4_lStickPos].Value())));
str += g_MainStringTable->GetString(46); // Rotate
x300_textpane_instructions->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
- hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos])));
+ hecl::Format("&image=SI,0.6,1.0,%8.8X;", u32(g_tweakPlayerRes->x4c_cStick[x2e8_rStickPos].Value())));
str += g_MainStringTable->GetString(47); // Move
x304_textpane_instructions1->TextSupport().SetText(str);
str = hecl::UTF8ToChar16(
- hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos])));
+ hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[x2ec_lTriggerPos].Value())));
str += g_MainStringTable->GetString(48); // Zoom
str += hecl::UTF8ToChar16(
- hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos])));
+ hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[x2f0_rTriggerPos].Value())));
x308_textpane_instructions2->TextSupport().SetText(str);
}
}
@@ -1200,7 +1200,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr)
std::u16string string;
if (x1bc_state == EAutoMapperState::MapScreenUniverse ||
(x1bc_state == EAutoMapperState::MapScreen && HasCurrentMapUniverseWorld()))
- string = hecl::UTF8ToChar16(hecl::Format("image=%8.8X", u32(g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos])));
+ string = hecl::UTF8ToChar16(hecl::Format("image=%8.8X", u32(g_tweakPlayerRes->x98_aButton[x2f4_aButtonPos].Value())));
right1->TextSupport().SetText(string);
CGuiTextPane* right = static_cast(x28_frmeMapScreen->FindWidget("textpane_right"));
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
@@ -1323,7 +1323,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr)
CompleteMapperStateTransition(mgr);
}
- ResId stringId = x88_mapAreaStringId;
+ CAssetId stringId = x88_mapAreaStringId;
if (IsInMapperState(EAutoMapperState::MapScreenUniverse))
{
IWorld* wld = x14_dummyWorlds[x9c_worldIdx].get();
@@ -1366,7 +1366,7 @@ void CAutoMapper::Update(float dt, const CStateManager& mgr)
if (IsInMapperState(EAutoMapperState::MapScreen))
{
- ResId hintDesc = GetAreaHintDescriptionString(x24_world->IGetAreaAlways(xa0_curAreaId)->IGetAreaAssetId());
+ CAssetId hintDesc = GetAreaHintDescriptionString(x24_world->IGetAreaAlways(xa0_curAreaId)->IGetAreaAssetId());
if (hintDesc != x74_areaHintDescId)
{
x74_areaHintDescId = hintDesc;
@@ -1561,7 +1561,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
}
if (IsInMapperState(EAutoMapperState::MapScreen))
{
- ResId wldMlvl = x24_world->IGetWorldAssetId();
+ CAssetId wldMlvl = x24_world->IGetWorldAssetId();
const CMapWorld* mw = x24_world->IGetMapWorld();
std::vector& hintBeaconFilters = const_cast(*this).m_hintBeaconFilters;
if (hintBeaconFilters.size() < x1f8_hintLocations.size())
@@ -1688,7 +1688,7 @@ void CAutoMapper::SetupHintNavigation()
navigating = true;
x1e0_hintSteps.push_back({SAutoMapperHintStep::ShowBeacon{}, 0.75f});
const CGameHintInfo::CGameHint& nextHint = g_MemoryCardSys->GetHints()[hintOpts.GetNextHintIdx()];
- ResId curMlvl = x24_world->IGetWorldAssetId();
+ CAssetId curMlvl = x24_world->IGetWorldAssetId();
for (const CGameHintInfo::SHintLocation& loc : nextHint.GetLocations())
{
if (loc.x0_mlvlId != curMlvl)
@@ -1721,7 +1721,7 @@ void CAutoMapper::SetupHintNavigation()
}
}
-ResId CAutoMapper::GetAreaHintDescriptionString(ResId mreaId)
+CAssetId CAutoMapper::GetAreaHintDescriptionString(CAssetId mreaId)
{
const CHintOptions& hintOpts = g_GameState->HintOptions();
for (int i=0 ; i x3c_hintBeacon;
std::vector m_hintBeaconFilters;
rstl::reserved_vector, 5> x48_mapIcons;
- ResId x74_areaHintDescId = -1;
+ CAssetId x74_areaHintDescId = -1;
TLockedToken x78_areaHintDesc;
u32 x84_ = 0;
- ResId x88_mapAreaStringId = -1;
+ CAssetId x88_mapAreaStringId = -1;
TLockedToken x8c_mapAreaString; // Used to be optional
u32 x9c_worldIdx = 0;
TAreaId xa0_curAreaId;
@@ -257,7 +257,7 @@ private:
void TransformRenderStatesUniverseToWorld();
void TransformRenderStateWorldToUniverse(SAutoMapperRenderState&);
void SetupHintNavigation();
- ResId GetAreaHintDescriptionString(ResId mreaId);
+ CAssetId GetAreaHintDescriptionString(CAssetId mreaId);
public:
CAutoMapper(CStateManager& stateMgr);
@@ -266,8 +266,8 @@ public:
float GetMapRotationX() const;
float GetMapRotationZ() const;
u32 GetFocusAreaIndex() const;
- ResId GetCurrWorldAssetId() const;
- void SetCurWorldAssetId(ResId mlvlId);
+ CAssetId GetCurrWorldAssetId() const;
+ void SetCurWorldAssetId(CAssetId mlvlId);
void MuteAllLoopedSounds();
void UnmuteAllLoopedSounds();
void ProcessControllerInput(const CFinalInput&, CStateManager&);
diff --git a/Runtime/AutoMapper/CMapUniverse.cpp b/Runtime/AutoMapper/CMapUniverse.cpp
index ced32a707..e05b5f3aa 100644
--- a/Runtime/AutoMapper/CMapUniverse.cpp
+++ b/Runtime/AutoMapper/CMapUniverse.cpp
@@ -32,7 +32,7 @@ CMapUniverse::CMapWorldData::CMapWorldData(CInputStream& in, u32 version)
if (version != 0)
x54_surfColorSelected.readRGBABig(in);
else
- x54_surfColorSelected.fromRGBA32(255 | (x10_worldAssetId & 0xFFFFFF00));
+ x54_surfColorSelected.fromRGBA32(255 | (u32(x10_worldAssetId.Value()) & 0xFFFFFF00));
x58_outlineColorSelected = zeus::CColor::lerp(zeus::CColor::skWhite, x54_surfColorSelected, 0.5f);
x5c_surfColorUnselected = zeus::CColor::lerp(zeus::CColor::skBlack, x54_surfColorSelected, 0.5f);
diff --git a/Runtime/AutoMapper/CMapUniverse.hpp b/Runtime/AutoMapper/CMapUniverse.hpp
index a1fe8edcd..efa0e6852 100644
--- a/Runtime/AutoMapper/CMapUniverse.hpp
+++ b/Runtime/AutoMapper/CMapUniverse.hpp
@@ -19,14 +19,14 @@ public:
{
float x0_alpha;
int x4_wldIdx;
- ResId x8_wldRes;
+ CAssetId x8_wldRes;
int xc_closestHex;
float x10_flashPulse;
const CStateManager& x14_mgr;
const zeus::CTransform& x18_model;
const zeus::CTransform& x1c_view;
public:
- CMapUniverseDrawParms(float alpha, int wldIdx, ResId wldRes, int closestHex,
+ CMapUniverseDrawParms(float alpha, int wldIdx, CAssetId wldRes, int closestHex,
float flashPulse, const CStateManager& mgr,
const zeus::CTransform& model, const zeus::CTransform& view)
: x0_alpha(alpha),
@@ -42,7 +42,7 @@ public:
const zeus::CTransform& GetCameraTransform() const { return x1c_view; }
const zeus::CTransform& GetPaneProjectionTransform() const { return x18_model; }
float GetAlpha() const { return x0_alpha; }
- ResId GetWorldAssetId() const { return x8_wldRes; }
+ CAssetId GetWorldAssetId() const { return x8_wldRes; }
int GetClosestArea() const { return xc_closestHex; }
float GetFlashPulse() const { return x10_flashPulse; }
};
@@ -71,7 +71,7 @@ public:
class CMapWorldData
{
std::string x0_label;
- ResId x10_worldAssetId;
+ CAssetId x10_worldAssetId;
zeus::CTransform x14_transform;
std::vector x44_hexagonXfs;
zeus::CColor x54_surfColorSelected;
@@ -81,7 +81,7 @@ public:
zeus::CVector3f x64_centerPoint = zeus::CVector3f::skZero;
public:
CMapWorldData(CInputStream& in, u32 version);
- ResId GetWorldAssetId() const { return x10_worldAssetId; }
+ CAssetId GetWorldAssetId() const { return x10_worldAssetId; }
const zeus::CVector3f& GetWorldCenterPoint() const { return x64_centerPoint; }
const std::string& GetWorldLabel() const { return x0_label; }
const zeus::CTransform& GetWorldTransform() const { return x14_transform; }
@@ -94,7 +94,7 @@ public:
};
private:
- ResId x0_hexagonId;
+ CAssetId x0_hexagonId;
TLockedToken x4_hexagonToken;
std::vector x10_worldDatas;
zeus::CVector3f x20_universeCenter = zeus::CVector3f::skZero;
@@ -102,7 +102,7 @@ private:
public:
CMapUniverse(CInputStream&, u32);
const CMapWorldData& GetMapWorldData(s32 idx) const { return x10_worldDatas[idx]; }
- const CMapWorldData& GetMapWorldDataByWorldId(ResId id) const
+ const CMapWorldData& GetMapWorldDataByWorldId(CAssetId id) const
{
for (const CMapWorldData& data : x10_worldDatas)
if (data.GetWorldAssetId() == id)
diff --git a/Runtime/AutoMapper/CMapWorld.cpp b/Runtime/AutoMapper/CMapWorld.cpp
index 6c06adbf8..b026413e0 100644
--- a/Runtime/AutoMapper/CMapWorld.cpp
+++ b/Runtime/AutoMapper/CMapWorld.cpp
@@ -8,7 +8,7 @@
namespace urde
{
-CMapWorld::CMapAreaData::CMapAreaData(ResId areaRes, EMapAreaList list, CMapAreaData* next)
+CMapWorld::CMapAreaData::CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapAreaData* next)
: x0_area(g_SimplePool->GetObj(SObjectTag{FOURCC('MAPA'), areaRes})), x10_list(list), x14_next(next)
{}
@@ -22,7 +22,7 @@ CMapWorld::CMapWorld(CInputStream& in)
x20_traversed.resize(areaCount);
for (u32 i=0 ; iGetSaveWorldMemory(mlvlId);
@@ -29,7 +29,7 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, R
x38_mapStationUsed = reader.ReadEncoded(1);
}
-void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, ResId mlvlId) const
+void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const
{
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
diff --git a/Runtime/AutoMapper/CMapWorldInfo.hpp b/Runtime/AutoMapper/CMapWorldInfo.hpp
index 4c246c212..2b9ed3ecb 100644
--- a/Runtime/AutoMapper/CMapWorldInfo.hpp
+++ b/Runtime/AutoMapper/CMapWorldInfo.hpp
@@ -17,8 +17,8 @@ class CMapWorldInfo
bool x38_mapStationUsed = false;
public:
CMapWorldInfo()=default;
- CMapWorldInfo(CBitStreamReader&, const CSaveWorld& saveWorld, ResId mlvlId);
- void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, ResId mlvlId) const;
+ CMapWorldInfo(CBitStreamReader&, const CSaveWorld& saveWorld, CAssetId mlvlId);
+ void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const;
bool IsMapped(TAreaId) const;
void SetIsMapped(TAreaId, bool);
void SetDoorVisited(TEditorId eid, bool val);
diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp
index 610b4f107..cc180e9de 100644
--- a/Runtime/AutoMapper/CMappableObject.cpp
+++ b/Runtime/AutoMapper/CMappableObject.cpp
@@ -162,7 +162,7 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo,
}
else
{
- ResId iconRes;
+ CAssetId iconRes;
zeus::CColor iconColor = zeus::CColor::skWhite;
switch (x0_type)
{
diff --git a/Runtime/CGameHintInfo.hpp b/Runtime/CGameHintInfo.hpp
index 47edad4de..8aa29ef5c 100644
--- a/Runtime/CGameHintInfo.hpp
+++ b/Runtime/CGameHintInfo.hpp
@@ -11,10 +11,10 @@ class CGameHintInfo
public:
struct SHintLocation
{
- ResId x0_mlvlId = -1;
- ResId x4_mreaId = -1;
+ CAssetId x0_mlvlId = -1;
+ CAssetId x4_mreaId = -1;
TAreaId x8_areaId = kInvalidAreaId;
- ResId xc_stringId = -1;
+ CAssetId xc_stringId = -1;
SHintLocation(CInputStream&, s32);
};
@@ -23,7 +23,7 @@ public:
std::string x0_name;
float x10_immediateTime;
float x14_normalTime;
- ResId x18_stringId;
+ CAssetId x18_stringId;
float x1c_textTime;
std::vector x20_locations;
public:
@@ -33,7 +33,7 @@ public:
float GetImmediateTime() const { return x10_immediateTime; }
float GetTextTime() const { return x1c_textTime; }
const std::string& GetName() const { return x0_name; }
- ResId GetStringID() const { return x18_stringId; }
+ CAssetId GetStringID() const { return x18_stringId; }
const std::vector& GetLocations() const { return x20_locations; }
};
diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp
index 1ae94bf1f..67151de98 100644
--- a/Runtime/CGameOptions.cpp
+++ b/Runtime/CGameOptions.cpp
@@ -134,10 +134,10 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const
}
}
-bool CPersistentOptions::GetCinematicState(ResId mlvlId, TEditorId cineId) const
+bool CPersistentOptions::GetCinematicState(CAssetId mlvlId, TEditorId cineId) const
{
auto existing = std::find_if(xac_cinematicStates.cbegin(), xac_cinematicStates.cend(),
- [&](const std::pair& pair) -> bool
+ [&](const std::pair& pair) -> bool
{
return pair.first == mlvlId && pair.second == cineId;
});
@@ -145,10 +145,10 @@ bool CPersistentOptions::GetCinematicState(ResId mlvlId, TEditorId cineId) const
return existing != xac_cinematicStates.cend();
}
-void CPersistentOptions::SetCinematicState(ResId mlvlId, TEditorId cineId, bool state)
+void CPersistentOptions::SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state)
{
auto existing = std::find_if(xac_cinematicStates.cbegin(), xac_cinematicStates.cend(),
- [&](const std::pair& pair) -> bool
+ [&](const std::pair& pair) -> bool
{
return pair.first == mlvlId && pair.second == cineId;
});
@@ -361,7 +361,7 @@ void CGameOptions::SetControls(int controls)
ResetControllerAssets(controls);
}
-static const std::pair CStickToDPadRemap[] =
+static const std::pair CStickToDPadRemap[] =
{
{0x2A13C23E, 0xF13452F8},
{0xA91A7703, 0xC042EC91},
@@ -370,7 +370,7 @@ static const std::pair CStickToDPadRemap[] =
{0xCD7B1ACA, 0x8ADA8184},
};
-static const std::pair CStickOutlineToDPadRemap[] =
+static const std::pair CStickOutlineToDPadRemap[] =
{
{0x1A29C0E6, 0xF13452F8},
{0x5D9F9796, 0xC042EC91},
@@ -379,7 +379,7 @@ static const std::pair CStickOutlineToDPadRemap[] =
{0x409AA72E, 0x8ADA8184},
};
-static std::pair TranslatePairToNew(const std::pair& p)
+static std::pair TranslatePairToNew(const std::pair& p)
{
return {g_ResFactory->TranslateOriginalToNew(p.first),
g_ResFactory->TranslateOriginalToNew(p.second)};
@@ -406,7 +406,7 @@ void CGameOptions::ResetControllerAssets(int controls)
x6c_controlTxtrMap.push_back(TranslatePairToNew(CStickOutlineToDPadRemap[i]));
std::sort(x6c_controlTxtrMap.begin(), x6c_controlTxtrMap.end(),
- [](const std::pair& a, const std::pair& b)
+ [](const std::pair& a, const std::pair& b)
{ return a.first < b.first; });
}
}
diff --git a/Runtime/CGameOptions.hpp b/Runtime/CGameOptions.hpp
index 18c464dcc..6adbc8662 100644
--- a/Runtime/CGameOptions.hpp
+++ b/Runtime/CGameOptions.hpp
@@ -57,7 +57,7 @@ class CPersistentOptions
friend class CGameState;
u8 x0_[98] = {};
bool x68_[64] = {};
- std::vector> xac_cinematicStates; /* (MLVL, Cinematic) */
+ std::vector> xac_cinematicStates; /* (MLVL, Cinematic) */
u32 xbc_autoMapperKeyState = 0;
u32 xc0_frozenFpsCount = 0;
u32 xc4_frozenBallCount = 0;
@@ -82,8 +82,8 @@ public:
CPersistentOptions() = default;
CPersistentOptions(CBitStreamReader& stream);
- bool GetCinematicState(ResId mlvlId, TEditorId cineId) const;
- void SetCinematicState(ResId mlvlId, TEditorId cineId, bool state);
+ bool GetCinematicState(CAssetId mlvlId, TEditorId cineId) const;
+ void SetCinematicState(CAssetId mlvlId, TEditorId cineId, bool state);
u32 GetAutoMapperKeyState() const { return xbc_autoMapperKeyState; }
void SetAutoMapperKeyState(u32 s) { xbc_autoMapperKeyState = s; }
bool GetPlayerLinkedFusion() const { return xd0_24_fusionLinked; }
@@ -136,7 +136,7 @@ class CGameOptions
u16 _dummy = 0;
};
- std::vector> x6c_controlTxtrMap;
+ std::vector> x6c_controlTxtrMap;
public:
CGameOptions();
@@ -177,7 +177,7 @@ public:
bool GetIsHintSystemEnabled() const { return x68_28_hintSystem; }
void SetControls(int controls);
void ResetControllerAssets(int controls);
- const std::vector>& GetControlTXTRMap() const { return x6c_controlTxtrMap; }
+ const std::vector>& GetControlTXTRMap() const { return x6c_controlTxtrMap; }
static void TryRestoreDefaults(const CFinalInput& input, int category,
int option, bool frontend, bool forceRestore);
diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp
index e4bb45523..010d9c6f0 100644
--- a/Runtime/CGameState.cpp
+++ b/Runtime/CGameState.cpp
@@ -75,7 +75,7 @@ void CWorldLayerState::InitializeWorldLayers(const std::vector();
@@ -84,7 +84,7 @@ CWorldState::CWorldState(ResId id)
x14_layerState = std::make_shared();
}
-CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld)
+CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveWorld& saveWorld)
: x0_mlvlId(mlvlId)
{
x4_areaId = reader.ReadEncoded(32);
@@ -97,7 +97,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorl
void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const
{
writer.WriteEncoded(x4_areaId, 32);
- writer.WriteEncoded(x10_desiredAreaAssetId, 32);
+ writer.WriteEncoded(x10_desiredAreaAssetId.Value(), 32);
x8_relayTracker->PutTo(writer, savw);
xc_mapWorldInfo->PutTo(writer, savw, x0_mlvlId);
x14_layerState->PutTo(writer);
@@ -114,7 +114,7 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data)
ret.x20_hardMode = stream.ReadEncoded(1);
stream.ReadEncoded(1);
- ResId origMLVL = stream.ReadEncoded(32);
+ CAssetId origMLVL = stream.ReadEncoded(32);
ret.x8_mlvlId = g_ResFactory->TranslateOriginalToNew(origMLVL);
BitsToDouble conv;
@@ -236,7 +236,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const
writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32);
writer.WriteEncoded(x228_24_hardMode, 1);
writer.WriteEncoded(x228_25_deferPowerupInit, 1);
- writer.WriteEncoded(g_ResFactory->TranslateNewToOriginal(x84_mlvlId), 32);
+ writer.WriteEncoded(g_ResFactory->TranslateNewToOriginal(x84_mlvlId).Value(), 32);
BitsToDouble conv;
conv.doub = xa0_playTime;
@@ -257,7 +257,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const
}
}
-void CGameState::SetCurrentWorldId(ResId id)
+void CGameState::SetCurrentWorldId(CAssetId id)
{
StateForWorld(id);
x84_mlvlId = id;
@@ -269,7 +269,7 @@ void CGameState::SetTotalPlayTime(float time)
xa0_playTime = zeus::clamp(0.0, time, 359999.0);
}
-CWorldState& CGameState::StateForWorld(ResId mlvlId)
+CWorldState& CGameState::StateForWorld(CAssetId mlvlId)
{
auto it = x88_worldStates.begin();
for (; it != x88_worldStates.end() ; ++it)
diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp
index e43342efb..0acecc7be 100644
--- a/Runtime/CGameState.hpp
+++ b/Runtime/CGameState.hpp
@@ -44,21 +44,21 @@ public:
class CWorldState
{
- ResId x0_mlvlId;
+ CAssetId x0_mlvlId;
TAreaId x4_areaId = kInvalidAreaId;
std::shared_ptr x8_relayTracker;
std::shared_ptr xc_mapWorldInfo;
- ResId x10_desiredAreaAssetId;
+ CAssetId x10_desiredAreaAssetId;
std::shared_ptr x14_layerState;
public:
- explicit CWorldState(ResId id);
- CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
- ResId GetWorldAssetId() const { return x0_mlvlId; }
+ explicit CWorldState(CAssetId id);
+ CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveWorld& saveWorld);
+ CAssetId GetWorldAssetId() const { return x0_mlvlId; }
void SetAreaId(TAreaId aid) { x4_areaId = aid; }
TAreaId GetCurrentAreaId() const { return x4_areaId; }
- ResId GetDesiredAreaAssetId() const { return x10_desiredAreaAssetId; }
- void SetDesiredAreaAssetId(ResId id) { x10_desiredAreaAssetId = id; }
+ CAssetId GetDesiredAreaAssetId() const { return x10_desiredAreaAssetId; }
+ void SetDesiredAreaAssetId(CAssetId id) { x10_desiredAreaAssetId = id; }
const std::shared_ptr& RelayTracker() const { return x8_relayTracker; }
const std::shared_ptr& MapWorldInfo() const { return xc_mapWorldInfo; }
const std::shared_ptr& GetLayerState() const { return x14_layerState; }
@@ -71,7 +71,7 @@ class CGameState
bool x0_[128] = {};
u32 x80_;
- ResId x84_mlvlId = kInvalidResId;
+ CAssetId x84_mlvlId;
std::vector x88_worldStates;
std::shared_ptr x98_playerState;
std::shared_ptr x9c_transManager;
@@ -96,16 +96,16 @@ class CGameState
public:
CGameState();
CGameState(CBitStreamReader& stream, u32 saveIdx);
- void SetCurrentWorldId(ResId id);
+ void SetCurrentWorldId(CAssetId id);
std::shared_ptr GetPlayerState() { return x98_playerState; }
std::shared_ptr GetWorldTransitionManager() { return x9c_transManager; }
void SetTotalPlayTime(float time);
CPersistentOptions& SystemOptions() { return xa8_systemOptions; }
CGameOptions& GameOptions() { return x17c_gameOptions; }
CHintOptions& HintOptions() { return x1f8_hintOptions; }
- CWorldState& StateForWorld(ResId mlvlId);
+ CWorldState& StateForWorld(CAssetId mlvlId);
CWorldState& CurrentWorldState() { return StateForWorld(x84_mlvlId); }
- ResId CurrentWorldAssetId() const { return x84_mlvlId; }
+ CAssetId CurrentWorldAssetId() const { return x84_mlvlId; }
void SetHardMode(bool v) { x228_24_hardMode = v; }
bool GetHardMode() const { return x228_24_hardMode; }
void ReadPersistentOptions(CBitStreamReader& r);
@@ -127,7 +127,7 @@ public:
struct GameFileStateInfo
{
double x0_playTime;
- u32 x8_mlvlId;
+ CAssetId x8_mlvlId;
float xc_health;
u32 x10_energyTanks;
u32 x14_timestamp;
diff --git a/Runtime/CInGameTweakManagerBase.hpp b/Runtime/CInGameTweakManagerBase.hpp
index 042cdb1a4..261193998 100644
--- a/Runtime/CInGameTweakManagerBase.hpp
+++ b/Runtime/CInGameTweakManagerBase.hpp
@@ -16,14 +16,14 @@ public:
{
float x0_fadeIn, x4_fadeOut, x8_volume;
std::string xc_fileName;
- ResId x1c_res;
+ CAssetId x1c_res;
Audio(float fadeIn, float fadeOut, float vol, const std::string& fileName, u32 handle)
: x0_fadeIn(fadeIn), x4_fadeOut(fadeOut), x8_volume(vol), xc_fileName(fileName), x1c_res(handle) {}
float GetFadeIn() const { return x0_fadeIn; }
float GetFadeOut() const { return x4_fadeOut; }
float GetVolume() const { return x8_volume; }
const std::string& GetFileName() const { return xc_fileName; }
- ResId GetResId() const { return x1c_res; }
+ CAssetId GetResId() const { return x1c_res; }
static Audio None() { return Audio{0.f, 0.f, 0.f, "", 0}; }
};
enum class EType
@@ -77,11 +77,11 @@ public:
return true;
}
- static std::string GetIdentifierForMidiEvent(ResId world, ResId area,
+ static std::string GetIdentifierForMidiEvent(CAssetId world, CAssetId area,
const std::string& midiObj)
{
return hecl::Format("World %8.8x Area %8.8x MidiObject: %s",
- u32(world), u32(area), midiObj.c_str());
+ u32(world.Value()), u32(area.Value()), midiObj.c_str());
}
};
diff --git a/Runtime/CMakeLists.txt b/Runtime/CMakeLists.txt
index 6f06535aa..ca63735b3 100644
--- a/Runtime/CMakeLists.txt
+++ b/Runtime/CMakeLists.txt
@@ -49,7 +49,7 @@ if(APPLE)
endif()
add_library(RuntimeCommon
- RetroTypes.hpp
+ RetroTypes.hpp RetroTypes.cpp
${CLIENT_SOURCES}
${MP1_SOURCES}
${AUDIO_SOURCES}
diff --git a/Runtime/CMemoryCardSys.cpp b/Runtime/CMemoryCardSys.cpp
index 6db603077..94b210f26 100644
--- a/Runtime/CMemoryCardSys.cpp
+++ b/Runtime/CMemoryCardSys.cpp
@@ -15,7 +15,7 @@ static kabufuda::SystemString g_CardImagePaths[2] = {};
static kabufuda::Card g_CardStates[2] = {};
static kabufuda::ECardResult g_OpResults[2] = {};
-CSaveWorldIntermediate::CSaveWorldIntermediate(ResId mlvl, ResId savw)
+CSaveWorldIntermediate::CSaveWorldIntermediate(CAssetId mlvl, CAssetId savw)
: x0_mlvlId(mlvl), x8_savwId(savw)
{
if (savw == -1)
@@ -43,7 +43,7 @@ bool CSaveWorldIntermediate::InitializePump()
xc_areaIds.push_back(area->IGetAreaId());
}
- ResId mlvlId = wld.IGetWorldAssetId();
+ CAssetId mlvlId = wld.IGetWorldAssetId();
CWorldState& mlvlState = g_GameState->StateForWorld(mlvlId);
x1c_defaultLayerStates = mlvlState.GetLayerState()->x0_areaLayers;
@@ -61,7 +61,7 @@ bool CSaveWorldIntermediate::InitializePump()
return false;
}
-bool CMemoryCardSys::HasSaveWorldMemory(ResId wldId) const
+bool CMemoryCardSys::HasSaveWorldMemory(CAssetId wldId) const
{
auto existingSearch =
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const auto& wld)
@@ -69,7 +69,7 @@ bool CMemoryCardSys::HasSaveWorldMemory(ResId wldId) const
return existingSearch != xc_memoryWorlds.cend();
}
-const CSaveWorldMemory& CMemoryCardSys::GetSaveWorldMemory(ResId wldId) const
+const CSaveWorldMemory& CMemoryCardSys::GetSaveWorldMemory(CAssetId wldId) const
{
auto existingSearch =
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const auto& wld)
@@ -84,13 +84,13 @@ CMemoryCardSys::CMemoryCardSys()
x1c_worldInter.emplace();
x1c_worldInter->reserve(16);
- std::vector> orderedMLVLs;
+ std::vector> orderedMLVLs;
orderedMLVLs.reserve(16);
g_ResFactory->EnumerateNamedResources([&](const std::string& name, const SObjectTag& tag) -> bool
{
if (tag.type == FOURCC('MLVL'))
{
- ResId origId = g_ResFactory->TranslateNewToOriginal(tag.id);
+ CAssetId origId = g_ResFactory->TranslateNewToOriginal(tag.id);
orderedMLVLs.emplace_back(origId, tag.id);
}
return true;
@@ -180,17 +180,17 @@ bool CMemoryCardSys::InitializePump()
return false;
}
-void CMemoryCardSys::CCardFileInfo::LockBannerToken(ResId bannerTxtr, CSimplePool& sp)
+void CMemoryCardSys::CCardFileInfo::LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp)
{
x3c_bannerTex = bannerTxtr;
x40_bannerTok.emplace(sp.GetObj({FOURCC('TXTR'), bannerTxtr}, m_texParam));
}
-CMemoryCardSys::CCardFileInfo::Icon::Icon(ResId id, kabufuda::EAnimationSpeed speed,
+CMemoryCardSys::CCardFileInfo::Icon::Icon(CAssetId id, kabufuda::EAnimationSpeed speed,
CSimplePool& sp, const CVParamTransfer& cv)
: x0_id(id), x4_speed(speed), x8_tex(sp.GetObj({FOURCC('TXTR'), id}, cv)) {}
-void CMemoryCardSys::CCardFileInfo::LockIconToken(ResId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp)
+void CMemoryCardSys::CCardFileInfo::LockIconToken(CAssetId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp)
{
x50_iconToks.emplace_back(iconTxtr, speed, sp, m_texParam);
}
diff --git a/Runtime/CMemoryCardSys.hpp b/Runtime/CMemoryCardSys.hpp
index a016b1bc0..9d4423166 100644
--- a/Runtime/CMemoryCardSys.hpp
+++ b/Runtime/CMemoryCardSys.hpp
@@ -18,17 +18,17 @@ class CSimplePool;
class CSaveWorldMemory
{
friend class CMemoryCardSys;
- ResId x0_strgId = -1;
- ResId x4_savwId = -1;
+ CAssetId x0_strgId = -1;
+ CAssetId x4_savwId = -1;
u32 x8_areaCount;
- std::vector xc_areaIds;
+ std::vector xc_areaIds;
std::vector x1c_defaultLayerStates;
TLockedToken x2c_worldName; /* used to be optional */
TLockedToken x3c_saveWorld; /* used to be optional */
public:
- ResId GetWorldNameId() const { return x0_strgId; }
- ResId GetSaveWorldAssetId() const { return x4_savwId; }
+ CAssetId GetWorldNameId() const { return x0_strgId; }
+ CAssetId GetSaveWorldAssetId() const { return x4_savwId; }
u32 GetAreaCount() const { return x8_areaCount; }
const std::vector& GetDefaultLayerStates() const { return x1c_defaultLayerStates; }
const TLockedToken& GetWorldName() const { return x2c_worldName; }
@@ -44,16 +44,16 @@ public:
class CSaveWorldIntermediate
{
friend class CMemoryCardSys;
- ResId x0_mlvlId;
- ResId x4_strgId;
- ResId x8_savwId;
- std::vector xc_areaIds;
+ CAssetId x0_mlvlId;
+ CAssetId x4_strgId;
+ CAssetId x8_savwId;
+ std::vector xc_areaIds;
std::vector x1c_defaultLayerStates;
std::unique_ptr x2c_dummyWorld;
TLockedToken x34_saveWorld; /* Used to be auto_ptr */
public:
- CSaveWorldIntermediate(ResId mlvl, ResId savw);
+ CSaveWorldIntermediate(CAssetId mlvl, CAssetId savw);
bool InitializePump();
};
@@ -61,9 +61,9 @@ public:
class CMemoryCardSys
{
TLockedToken x0_hints;
- std::vector> xc_memoryWorlds; /* MLVL as key */
+ std::vector> xc_memoryWorlds; /* MLVL as key */
std::experimental::optional> x1c_worldInter; /* used to be auto_ptr of vector */
- std::vector> x20_scanStates;
+ std::vector> x20_scanStates;
rstl::reserved_vector x30_scanCategoryCounts;
public:
@@ -90,19 +90,19 @@ public:
using CardStat = kabufuda::CardStat;
const std::vector& GetHints() const { return x0_hints->GetHints(); }
- const std::vector>& GetMemoryWorlds() const { return xc_memoryWorlds; }
- const std::vector>& GetScanStates() const { return x20_scanStates; }
+ const std::vector>& GetMemoryWorlds() const { return xc_memoryWorlds; }
+ const std::vector>& GetScanStates() const { return x20_scanStates; }
u32 GetScanCategoryCount(CSaveWorld::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; }
- std::vector>::const_iterator LookupScanState(ResId id) const
+ std::vector>::const_iterator LookupScanState(CAssetId id) const
{
return
rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id,
- [](const std::pair& p) { return p.first; });
+ [](const std::pair& p) { return p.first; });
}
- bool HasSaveWorldMemory(ResId wldId) const;
- const CSaveWorldMemory& GetSaveWorldMemory(ResId wldId) const;
+ bool HasSaveWorldMemory(CAssetId wldId) const;
+ const CSaveWorldMemory& GetSaveWorldMemory(CAssetId wldId) const;
CMemoryCardSys();
bool InitializePump();
@@ -111,10 +111,10 @@ public:
{
struct Icon
{
- ResId x0_id;
+ CAssetId x0_id;
kabufuda::EAnimationSpeed x4_speed;
TLockedToken x8_tex;
- Icon(ResId id, kabufuda::EAnimationSpeed speed, CSimplePool& sp, const CVParamTransfer& cv);
+ Icon(CAssetId id, kabufuda::EAnimationSpeed speed, CSimplePool& sp, const CVParamTransfer& cv);
};
enum class EStatus
@@ -129,7 +129,7 @@ public:
CardFileHandle m_handle;
std::string x18_fileName;
std::string x28_comment;
- ResId x3c_bannerTex = -1;
+ CAssetId x3c_bannerTex = -1;
std::experimental::optional> x40_bannerTok;
rstl::reserved_vector x50_iconToks;
std::vector xf4_saveBuffer;
@@ -140,8 +140,8 @@ public:
CCardFileInfo(kabufuda::ECardSlot port, const std::string& name)
: m_handle(port), x18_fileName(name) {}
- void LockBannerToken(ResId bannerTxtr, CSimplePool& sp);
- void LockIconToken(ResId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp);
+ void LockBannerToken(CAssetId bannerTxtr, CSimplePool& sp);
+ void LockIconToken(CAssetId iconTxtr, kabufuda::EAnimationSpeed speed, CSimplePool& sp);
kabufuda::ECardSlot GetCardPort() const { return m_handle.slot; }
int GetFileNo() const { return m_handle.getFileNo(); }
diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp
index 62777cd2f..52de5032c 100644
--- a/Runtime/CPakFile.hpp
+++ b/Runtime/CPakFile.hpp
@@ -46,14 +46,14 @@ private:
u32 x4c_resTableCount = 0;
int x50_ = -1;
std::vector> x54_nameList;
- std::vector x64_depList;
- std::vector> x74_resList;
+ std::vector x64_depList;
+ std::vector> x74_resList;
public:
CPakFile(const std::string& filename, bool buildDepList, bool worldPak);
- const std::vector& GetDepList() const { return x64_depList; }
+ const std::vector& GetDepList() const { return x64_depList; }
const SObjectTag* GetResIdByName(const char* name) const;
- const SResInfo* GetResInfoForLoad(u32 id) { return nullptr; }
- const SResInfo* GetResInfo(u32 id) const { return nullptr; }
+ const SResInfo* GetResInfoForLoad(CAssetId id) { return nullptr; }
+ const SResInfo* GetResInfo(CAssetId id) const { return nullptr; }
u32 GetFakeStaticSize() const { return 0; }
void DataLoad() {}
void InitialHeaderLoad() {}
diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp
index 994a9de86..5eda73fa6 100644
--- a/Runtime/CPlayerState.cpp
+++ b/Runtime/CPlayerState.cpp
@@ -63,18 +63,18 @@ CPlayerState::CPlayerState()
: x188_staticIntf(5)
{
x0_24_alive = true;
- x24_powerups.resize(41);
+ x24_powerups.set_size(41);
}
CPlayerState::CPlayerState(CBitStreamReader& stream)
: x188_staticIntf(5)
{
- x4_ = stream.ReadEncoded(0x20);
+ x4_enabledItems = stream.ReadEncoded(0x20);
u32 tmp = stream.ReadEncoded(0x20);
xc_health.SetHP(*reinterpret_cast(&tmp));
x8_currentBeam = EBeamId(stream.ReadEncoded(CBitStreamReader::GetBitCount(5)));
x20_currentSuit = EPlayerSuit(stream.ReadEncoded(CBitStreamReader::GetBitCount(4)));
- x24_powerups.resize(41);
+ x24_powerups.set_size(41);
for (u32 i = 0; i < x24_powerups.size(); ++i)
{
if (PowerUpMaxValues[i] == 0)
@@ -99,7 +99,7 @@ CPlayerState::CPlayerState(CBitStreamReader& stream)
void CPlayerState::PutTo(CBitStreamWriter& stream)
{
- stream.WriteEncoded(x4_, 32);
+ stream.WriteEncoded(x4_enabledItems, 32);
float hp = xc_health.GetHP();
stream.WriteEncoded(*reinterpret_cast(&hp), 32);
stream.WriteEncoded(u32(x8_currentBeam), CBitStreamWriter::GetBitCount(5));
@@ -222,7 +222,7 @@ void CPlayerState::UpdateStaticInterference(CStateManager& stateMgr, const float
x188_staticIntf.Update(stateMgr, dt);
}
-void CPlayerState::SetScanTime(ResId res, float time)
+void CPlayerState::SetScanTime(CAssetId res, float time)
{
auto it = std::find_if(x170_scanTimes.begin(), x170_scanTimes.end(), [&](const auto& test) -> bool{
return test.first == res;
@@ -232,7 +232,7 @@ void CPlayerState::SetScanTime(ResId res, float time)
it->second = time;
}
-float CPlayerState::GetScanTime(ResId res) const
+float CPlayerState::GetScanTime(CAssetId res) const
{
const auto it = std::find_if(x170_scanTimes.cbegin(), x170_scanTimes.cend(), [&](const auto& test) -> bool{
return test.first == res;
@@ -296,10 +296,22 @@ void CPlayerState::ResetVisor()
bool CPlayerState::ItemEnabled(CPlayerState::EItemType type)
{
if (HasPowerUp(type))
- return x24_powerups[u32(type)].x4_capacity != 0;
+ return (x4_enabledItems & (1 << u32(type)));
return false;
}
+void CPlayerState::EnableItem(CPlayerState::EItemType type)
+{
+ if (HasPowerUp(type))
+ x4_enabledItems |= (1 << u32(type));
+}
+
+void CPlayerState::DisableItem(CPlayerState::EItemType type)
+{
+ if (HasPowerUp(type))
+ x4_enabledItems &= ~(1 << u32(type));
+}
+
bool CPlayerState::HasPowerUp(CPlayerState::EItemType type)
{
if (type < EItemType::Max)
diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp
index 61b93822e..0d8ded947 100644
--- a/Runtime/CPlayerState.hpp
+++ b/Runtime/CPlayerState.hpp
@@ -115,15 +115,15 @@ private:
u32 dummy = 0;
};
- u32 x4_ = 0;
+ u32 x4_enabledItems = 0;
EBeamId x8_currentBeam = EBeamId::Power;
CHealthInfo xc_health = {99.f, 50.f};
EPlayerVisor x14_currentVisor = EPlayerVisor::Combat;
EPlayerVisor x18_transitioningVisor = x14_currentVisor;
float x1c_visorTransitionFactor = 0.2f;
EPlayerSuit x20_currentSuit = EPlayerSuit::Power;
- rstl::reserved_vector x24_powerups;
- rstl::reserved_vector, 846> x170_scanTimes;
+ rstl::prereserved_vector x24_powerups;
+ rstl::reserved_vector, 846> x170_scanTimes;
std::pair x180_scanCompletionRate = {};
CStaticInterference x188_staticIntf;
public:
@@ -147,8 +147,8 @@ public:
EPlayerVisor GetActiveVisor(const CStateManager& stateMgr) const;
void UpdateStaticInterference(CStateManager& stateMgr, const float& dt);
void IncreaseScanTime(u32 time, float val);
- void SetScanTime(ResId res, float time);
- float GetScanTime(ResId time) const;
+ void SetScanTime(CAssetId res, float time);
+ float GetScanTime(CAssetId time) const;
bool GetIsVisorTransitioning() const;
float GetVisorTransitionFactor() const;
void UpdateVisorTransition(float dt);
@@ -175,7 +175,7 @@ public:
void SetPlayerAlive(bool alive) { x0_24_alive = alive; }
void InitializeScanTimes();
CStaticInterference& GetStaticInterference() { return x188_staticIntf; }
- const rstl::reserved_vector, 846>& GetScanTimes() const { return x170_scanTimes; }
+ const rstl::reserved_vector, 846>& GetScanTimes() const { return x170_scanTimes; }
CPlayerState();
CPlayerState(CBitStreamReader& stream);
void PutTo(CBitStreamWriter& stream);
diff --git a/Runtime/CResFactory.hpp b/Runtime/CResFactory.hpp
index fd8163285..ba1913930 100644
--- a/Runtime/CResFactory.hpp
+++ b/Runtime/CResFactory.hpp
@@ -46,7 +46,7 @@ public:
return x4_loader.GetResourceIdByName(name);
}
- FourCC GetResourceTypeById(ResId id) const
+ FourCC GetResourceTypeById(CAssetId id) const
{
return x4_loader.GetResourceTypeById(id);
}
diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp
index dfc9dcc8c..2ca6d4386 100644
--- a/Runtime/CResLoader.cpp
+++ b/Runtime/CResLoader.cpp
@@ -4,7 +4,7 @@
namespace urde
{
-const std::vector* CResLoader::GetTagListForFile(const std::string& name) const
+const std::vector* CResLoader::GetTagListForFile(const std::string& name) const
{
std::string namePak = name + ".pak";
for (const std::unique_ptr& pak : x18_pakLoadedList)
@@ -110,7 +110,7 @@ bool CResLoader::ResourceExists(const SObjectTag& tag)
return FindResource(tag.id);
}
-FourCC CResLoader::GetResourceTypeById(u32 id) const
+FourCC CResLoader::GetResourceTypeById(CAssetId id) const
{
if (FindResource(id))
return x50_cachedResInfo->x0_type;
@@ -149,7 +149,7 @@ void CResLoader::AsyncIdlePakLoading()
}
}
-bool CResLoader::FindResource(u32 id) const
+bool CResLoader::FindResource(CAssetId id) const
{
for (const std::unique_ptr& file : x18_pakLoadedList)
if (const_cast(this)->CacheFromPak(*file, id))
@@ -157,7 +157,7 @@ bool CResLoader::FindResource(u32 id) const
return false;
}
-CPakFile* CResLoader::FindResourceForLoad(u32 id)
+CPakFile* CResLoader::FindResourceForLoad(CAssetId id)
{
for (std::unique_ptr& file : x18_pakLoadedList)
if (CacheFromPakForLoad(*file, id))
@@ -170,7 +170,7 @@ CPakFile* CResLoader::FindResourceForLoad(const SObjectTag& tag)
return FindResourceForLoad(tag.id);
}
-bool CResLoader::CacheFromPakForLoad(CPakFile& file, u32 id)
+bool CResLoader::CacheFromPakForLoad(CPakFile& file, CAssetId id)
{
const CPakFile::SResInfo* info = file.GetResInfoForLoad(id);
if (info)
@@ -182,7 +182,7 @@ bool CResLoader::CacheFromPakForLoad(CPakFile& file, u32 id)
return false;
}
-bool CResLoader::CacheFromPak(const CPakFile& file, u32 id)
+bool CResLoader::CacheFromPak(const CPakFile& file, CAssetId id)
{
const CPakFile::SResInfo* info = file.GetResInfo(id);
if (info)
diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp
index aef4596d8..d7ec499d6 100644
--- a/Runtime/CResLoader.hpp
+++ b/Runtime/CResLoader.hpp
@@ -19,10 +19,10 @@ class CResLoader
std::list> x18_pakLoadedList;
std::list> x30_pakLoadingList;
u32 x44_pakLoadingCount = 0;
- u32 x4c_cachedResId = -1;
+ CAssetId x4c_cachedResId;
const CPakFile::SResInfo* x50_cachedResInfo = nullptr;
public:
- const std::vector* GetTagListForFile(const std::string& name) const;
+ const std::vector* GetTagListForFile(const std::string& name) const;
void AddPakFileAsync(const std::string& name, bool samusPak, bool worldPak);
void AddPakFile(const std::string& name, bool samusPak, bool worldPak);
CInputStream* LoadNewResourcePartSync(const SObjectTag& tag, int offset, int length, void* extBuf);
@@ -34,15 +34,15 @@ public:
bool GetResourceCompression(const SObjectTag& tag);
u32 ResourceSize(const SObjectTag& tag);
bool ResourceExists(const SObjectTag& tag);
- FourCC GetResourceTypeById(u32 id) const;
+ FourCC GetResourceTypeById(CAssetId id) const;
const SObjectTag* GetResourceIdByName(const char* name) const;
bool AreAllPaksLoaded() const;
void AsyncIdlePakLoading();
- bool FindResource(u32 id) const;
- CPakFile* FindResourceForLoad(u32 id);
+ bool FindResource(CAssetId id) const;
+ CPakFile* FindResourceForLoad(CAssetId id);
CPakFile* FindResourceForLoad(const SObjectTag& tag);
- bool CacheFromPakForLoad(CPakFile& file, u32 id);
- bool CacheFromPak(const CPakFile& file, u32 id);
+ bool CacheFromPakForLoad(CPakFile& file, CAssetId id);
+ bool CacheFromPak(const CPakFile& file, CAssetId id);
void MoveToCorrectLoadedList(std::unique_ptr&& file);
};
diff --git a/Runtime/CSaveWorld.hpp b/Runtime/CSaveWorld.hpp
index 2200c6d7a..df4043779 100644
--- a/Runtime/CSaveWorld.hpp
+++ b/Runtime/CSaveWorld.hpp
@@ -14,7 +14,7 @@ public:
using EScanCategory = DataSpec::SAVWCommon::EScanCategory;
struct SScanState
{
- ResId x0_id;
+ CAssetId x0_id;
EScanCategory x4_category;
};
diff --git a/Runtime/CScannableObjectInfo.cpp b/Runtime/CScannableObjectInfo.cpp
index fd3364a1a..dbadf3fab 100644
--- a/Runtime/CScannableObjectInfo.cpp
+++ b/Runtime/CScannableObjectInfo.cpp
@@ -3,7 +3,7 @@
namespace urde
{
-CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, ResId resId) : x0_scannableObjectId(resId)
+CScannableObjectInfo::CScannableObjectInfo(CInputStream& in, CAssetId resId) : x0_scannableObjectId(resId)
{
u32 version = in.readUint32Big();
Load(in, version);
diff --git a/Runtime/CScannableObjectInfo.hpp b/Runtime/CScannableObjectInfo.hpp
index a46e45853..0756b06a0 100644
--- a/Runtime/CScannableObjectInfo.hpp
+++ b/Runtime/CScannableObjectInfo.hpp
@@ -17,7 +17,7 @@ public:
struct SBucket
{
- ResId x0_texture = -1;
+ CAssetId x0_texture = -1;
float x4_appearanceRange = 0.f;
u32 x8_imagePos = 0;
zeus::CVector2i xc_size;
@@ -28,7 +28,7 @@ public:
private:
void Load(CInputStream&, u32);
- ResId x0_scannableObjectId;
+ CAssetId x0_scannableObjectId;
u32 x4_stringId = -1;
float x8_totalDownloadTime = 0.f;
u32 xc_category = 0;
@@ -36,9 +36,9 @@ private:
rstl::reserved_vector x14_buckets;
public:
- CScannableObjectInfo(CInputStream&, ResId);
- ResId GetScannableObjectId() const { return x0_scannableObjectId; }
- ResId GetStringTableId() const { return x4_stringId; }
+ CScannableObjectInfo(CInputStream&, CAssetId);
+ CAssetId GetScannableObjectId() const { return x0_scannableObjectId; }
+ CAssetId GetStringTableId() const { return x4_stringId; }
float GetTotalDownloadTime() const { return x8_totalDownloadTime; }
const SBucket& GetBucket(s32 idx) const { return x14_buckets[idx]; }
u32 GetCategory() const { return xc_category; }
diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp
index 8cb042939..3ae47832c 100644
--- a/Runtime/CStateManager.cpp
+++ b/Runtime/CStateManager.cpp
@@ -1887,7 +1887,7 @@ void CStateManager::Update(float dt)
{
ShowPausedHUDMemo(xf88_, xf8c_);
--xf84_;
- xf88_ = -1;
+ xf88_.Reset();
}
if (!dying && x904_gameState == EGameState::Running && !x870_cameraManager->IsInCinematicCamera())
@@ -2118,7 +2118,7 @@ void CStateManager::PostUpdatePlayer(float dt)
x84c_player->PostUpdate(dt, *this);
}
-void CStateManager::ShowPausedHUDMemo(ResId strg, float time)
+void CStateManager::ShowPausedHUDMemo(CAssetId strg, float time)
{
xf78_hudMessageTime = time;
xf08_pauseHudMessage = strg;
@@ -2142,7 +2142,7 @@ void CStateManager::FrameBegin(s32 frameCount)
x8d4_inputFrameIdx = frameCount;
}
-void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId)
+void CStateManager::InitializeState(CAssetId mlvlId, TAreaId aid, CAssetId mreaId)
{
bool hadRandom = x900_activeRandom != nullptr;
SetActiveRandomToDefault();
@@ -2540,7 +2540,7 @@ std::pair CStateManager::CalculateScanCompletionRate() const
u32 num = 0;
u32 denom = 0;
int idx = 0;
- for (const std::pair& scan : x8b8_playerState->GetScanTimes())
+ for (const std::pair& scan : x8b8_playerState->GetScanTimes())
{
CSaveWorld::EScanCategory category = g_MemoryCardSys->GetScanStates()[idx++].second;
if (category != CSaveWorld::EScanCategory::None && category != CSaveWorld::EScanCategory::Research)
diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp
index adf77d754..57c0553d2 100644
--- a/Runtime/CStateManager.hpp
+++ b/Runtime/CStateManager.hpp
@@ -62,7 +62,7 @@ struct SScriptObjectStream
struct SOnScreenTex
{
- ResId x0_id = -1;
+ CAssetId x0_id = -1;
zeus::CVector2i x4_origin;
zeus::CVector2i xc_extent;
};
@@ -207,7 +207,7 @@ private:
u32 xef0_hintPeriods = 0;
SOnScreenTex xef4_pendingScreenTex;
- ResId xf08_pauseHudMessage = -1;
+ CAssetId xf08_pauseHudMessage = -1;
float xf0c_escapeTimer = 0.f;
float xf10_escapeTotalTime = 0.f;
float xf14_curTimeMod900 = 0.f;
@@ -232,8 +232,8 @@ private:
float xf78_hudMessageTime = 0.f;
CProjectedShadow* xf7c_projectedShadow = nullptr;
u32 xf80_hudMessageFrameCount = 0;
- ResId xf84_ = -1;
- ResId xf88_ = -1;
+ s32 xf84_ = -1;
+ CAssetId xf88_ = -1;
float xf8c_ = 0.f;
EStateManagerTransition xf90_deferredTransition = EStateManagerTransition::InGame;
@@ -361,10 +361,10 @@ public:
void CrossTouchActors();
void ThinkEffectsAndActors(float dt);
void PostUpdatePlayer(float dt);
- void ShowPausedHUDMemo(ResId strg, float time);
+ void ShowPausedHUDMemo(CAssetId strg, float time);
void ClearGraveyard();
void FrameBegin(s32 frameCount);
- void InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId);
+ void InitializeState(CAssetId mlvlId, TAreaId aid, CAssetId mreaId);
void CreateStandardGameObjects();
const std::unique_ptr& GetObjectList() const { return x808_objLists[0]; }
CObjectList* ObjectListById(EGameObjectList type);
@@ -403,7 +403,7 @@ public:
TUniqueId GetSkipCinematicSpecialFunction() const { return xf38_skipCineSpecialFunc; }
void SetSkipCinematicSpecialFunction(TUniqueId id) { xf38_skipCineSpecialFunc = id; }
float GetHUDMessageTime() const { return xf78_hudMessageTime; }
- ResId GetPauseHUDMessage() const { return xf08_pauseHudMessage; }
+ CAssetId GetPauseHUDMessage() const { return xf08_pauseHudMessage; }
void IncrementHUDMessageFrameCounter() { ++xf80_hudMessageFrameCount; }
bool ShouldQuitGame() const { return xf94_25_quitGame; }
void SetShouldQuitGame(bool should) { xf94_25_quitGame = should; }
diff --git a/Runtime/Camera/CCameraFilter.cpp b/Runtime/Camera/CCameraFilter.cpp
index 44c889951..305d1e33f 100644
--- a/Runtime/Camera/CCameraFilter.cpp
+++ b/Runtime/Camera/CCameraFilter.cpp
@@ -40,7 +40,7 @@ void CCameraFilterPass::Update(float dt)
template
void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape,
- float time, const zeus::CColor& color, ResId txtr)
+ float time, const zeus::CColor& color, CAssetId txtr)
{
if (time == 0.f)
{
@@ -65,7 +65,7 @@ void CCameraFilterPass::SetFilter(EFilterType type, EFilterShape shape,
else
{
EFilterType origType = x0_curType;
- ResId origTxtr = x20_nextTxtr;
+ CAssetId origTxtr = x20_nextTxtr;
x1c_nextColor = color;
x14_prevColor = x18_curColor;
@@ -136,7 +136,7 @@ float CCameraFilterPassBase::GetT(bool invert) const
}
void CCameraFilterPassPoly::SetFilter(EFilterType type, EFilterShape shape,
- float time, const zeus::CColor& color, ResId txtr)
+ float time, const zeus::CColor& color, CAssetId txtr)
{
if (!m_filter || m_shape != shape)
{
diff --git a/Runtime/Camera/CCameraFilter.hpp b/Runtime/Camera/CCameraFilter.hpp
index b83dc1ced..d3b475863 100644
--- a/Runtime/Camera/CCameraFilter.hpp
+++ b/Runtime/Camera/CCameraFilter.hpp
@@ -46,13 +46,13 @@ protected:
zeus::CColor x14_prevColor;
zeus::CColor x18_curColor;
zeus::CColor x1c_nextColor;
- ResId x20_nextTxtr = -1;
+ CAssetId x20_nextTxtr = -1;
TLockedToken x24_texObj; // Used to be auto_ptr
float GetT(bool invert) const;
public:
virtual void Update(float dt)=0;
virtual void SetFilter(EFilterType type, EFilterShape shape,
- float time, const zeus::CColor& color, ResId txtr)=0;
+ float time, const zeus::CColor& color, CAssetId txtr)=0;
virtual void DisableFilter(float time)=0;
virtual void Draw() const=0;
};
@@ -64,7 +64,7 @@ class CCameraFilterPass final : public CCameraFilterPassBase
public:
void Update(float dt);
void SetFilter(EFilterType type, EFilterShape shape,
- float time, const zeus::CColor& color, ResId txtr);
+ float time, const zeus::CColor& color, CAssetId txtr);
void DisableFilter(float time);
void Draw() const;
};
@@ -76,7 +76,7 @@ class CCameraFilterPassPoly
public:
void Update(float dt) { if (m_filter) m_filter->Update(dt); }
void SetFilter(EFilterType type, EFilterShape shape,
- float time, const zeus::CColor& color, ResId txtr);
+ float time, const zeus::CColor& color, CAssetId txtr);
void DisableFilter(float time) { if (m_filter) m_filter->DisableFilter(time); }
void Draw() const { if (m_filter) m_filter->Draw(); }
};
diff --git a/Runtime/Character/CAnimData.cpp b/Runtime/Character/CAnimData.cpp
index 30f2c6d43..68724162c 100644
--- a/Runtime/Character/CAnimData.cpp
+++ b/Runtime/Character/CAnimData.cpp
@@ -40,7 +40,7 @@ void CAnimData::InitializeCache()
{
}
-CAnimData::CAnimData(ResId id,
+CAnimData::CAnimData(CAssetId id,
const CCharacterInfo& character,
int defaultAnim, int charIdx, bool loop,
const TLockedToken& layout,
@@ -97,7 +97,7 @@ CAnimData::CAnimData(ResId id,
x1f8_animRoot = treeNode;
}
-ResId CAnimData::GetEventResourceIdForAnimResourceId(ResId id) const
+CAssetId CAnimData::GetEventResourceIdForAnimResourceId(CAssetId id) const
{
return x0_charFactory->GetEventResourceIdForAnimResourceId(id);
}
diff --git a/Runtime/Character/CAnimData.hpp b/Runtime/Character/CAnimData.hpp
index b672b58e0..b6109d5ad 100644
--- a/Runtime/Character/CAnimData.hpp
+++ b/Runtime/Character/CAnimData.hpp
@@ -98,7 +98,7 @@ class CAnimData
u32 x104_ = 0;
zeus::CAABox x108_aabb;
CParticleDatabase x120_particleDB;
- ResId x1d8_selfId;
+ CAssetId x1d8_selfId;
zeus::CVector3f x1dc_alignPos;
zeus::CQuaternion x1e8_alignRot;
std::shared_ptr x1f8_animRoot;
@@ -144,7 +144,7 @@ class CAnimData
int m_drawInstCount;
public:
- CAnimData(ResId,
+ CAnimData(CAssetId,
const CCharacterInfo& character,
int defaultAnim, int charIdx, bool loop,
const TLockedToken& layout,
@@ -156,7 +156,7 @@ public:
const TLockedToken& charFactory,
int drawInstCount);
- ResId GetEventResourceIdForAnimResourceId(ResId) const;
+ CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const;
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
static SAdvancementResults AdvanceAdditiveAnim(std::shared_ptr& anim, const CCharAnimTime& time);
SAdvancementDeltas AdvanceAdditiveAnims(float);
diff --git a/Runtime/Character/CAnimSource.cpp b/Runtime/Character/CAnimSource.cpp
index 26d6a8017..4d400d69a 100644
--- a/Runtime/Character/CAnimSource.cpp
+++ b/Runtime/Character/CAnimSource.cpp
@@ -133,7 +133,7 @@ CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store)
x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount),
x54_evntId(in.readUint32Big())
{
- if (x54_evntId)
+ if (x54_evntId.IsValid())
{
x58_evntData = store.GetObj({SBIG('EVNT'), x54_evntId});
x58_evntData.GetObj();
diff --git a/Runtime/Character/CAnimSource.hpp b/Runtime/Character/CAnimSource.hpp
index 4db67a0ec..d40062dc0 100644
--- a/Runtime/Character/CAnimSource.hpp
+++ b/Runtime/Character/CAnimSource.hpp
@@ -57,7 +57,7 @@ class CAnimSource
std::vector x20_rotationChannels;
std::vector x30_translationChannels;
RotationAndOffsetStorage x40_data;
- ResId x54_evntId;
+ CAssetId x54_evntId;
TCachedToken x58_evntData;
float x60_averageVelocity;
diff --git a/Runtime/Character/CAnimationSet.cpp b/Runtime/Character/CAnimationSet.cpp
index cf950e912..3ab071581 100644
--- a/Runtime/Character/CAnimationSet.cpp
+++ b/Runtime/Character/CAnimationSet.cpp
@@ -45,8 +45,8 @@ CAnimationSet::CAnimationSet(CInputStream& in)
x50_animRes.reserve(animResourcesCount);
for (u32 i=0 ; i> x28_additiveInfo;
CAdditiveAnimationInfo x38_defaultAdditiveInfo;
std::vector x40_halfTransitions;
- std::vector> x50_animRes;
+ std::vector> x50_animRes;
public:
CAnimationSet(CInputStream& in);
@@ -30,7 +30,7 @@ public:
const std::vector& GetHalfTransitions() const { return x40_halfTransitions; }
const std::vector>& GetAdditiveInfo() const { return x28_additiveInfo; }
const CAdditiveAnimationInfo& GetDefaultAdditiveInfo() const { return x38_defaultAdditiveInfo; }
- const std::vector>& GetAnimResIds() const { return x50_animRes; }
+ const std::vector>& GetAnimResIds() const { return x50_animRes; }
};
}
diff --git a/Runtime/Character/CAssetFactory.cpp b/Runtime/Character/CAssetFactory.cpp
index d541dad6a..8f1d61dc4 100644
--- a/Runtime/Character/CAssetFactory.cpp
+++ b/Runtime/Character/CAssetFactory.cpp
@@ -40,7 +40,7 @@ const SObjectTag* CCharacterFactoryBuilder::CDummyFactory::GetResourceIdByName(c
return nullptr;
}
-FourCC CCharacterFactoryBuilder::CDummyFactory::GetResourceTypeById(ResId id) const
+FourCC CCharacterFactoryBuilder::CDummyFactory::GetResourceTypeById(CAssetId id) const
{
return {};
}
diff --git a/Runtime/Character/CAssetFactory.hpp b/Runtime/Character/CAssetFactory.hpp
index 5ea12e53f..33de79ad2 100644
--- a/Runtime/Character/CAssetFactory.hpp
+++ b/Runtime/Character/CAssetFactory.hpp
@@ -22,7 +22,7 @@ public:
void CancelBuild(const SObjectTag&);
bool CanBuild(const SObjectTag&);
const SObjectTag* GetResourceIdByName(const char*) const;
- FourCC GetResourceTypeById(ResId id) const;
+ FourCC GetResourceTypeById(CAssetId id) const;
void EnumerateResources(const std::function& lambda) const;
void EnumerateNamedResources(const std::function& lambda) const;
diff --git a/Runtime/Character/CCharacterFactory.cpp b/Runtime/Character/CCharacterFactory.cpp
index a75adf7cf..dbee90731 100644
--- a/Runtime/Character/CCharacterFactory.cpp
+++ b/Runtime/Character/CCharacterFactory.cpp
@@ -69,7 +69,7 @@ const SObjectTag* CCharacterFactory::CDummyFactory::GetResourceIdByName(const ch
return nullptr;
}
-FourCC CCharacterFactory::CDummyFactory::GetResourceTypeById(ResId id) const
+FourCC CCharacterFactory::CDummyFactory::GetResourceTypeById(CAssetId id) const
{
return {};
}
@@ -125,8 +125,8 @@ CCharacterFactory::CreateCharacter(int charIdx, bool loop,
({FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
rstl::optional_object> iceModel;
- if (charInfo.GetIceModelId() != kInvalidResId &&
- charInfo.GetIceSkinRulesId() != kInvalidResId)
+ if (charInfo.GetIceModelId().IsValid() &&
+ charInfo.GetIceSkinRulesId().IsValid())
iceModel.emplace(const_cast(this)->x70_cacheResPool.GetObj
({FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm));
@@ -136,15 +136,15 @@ CCharacterFactory::CreateCharacter(int charIdx, bool loop,
factory, drawInsts);
}
-ResId CCharacterFactory::GetEventResourceIdForAnimResourceId(ResId id) const
+CAssetId CCharacterFactory::GetEventResourceIdForAnimResourceId(CAssetId id) const
{
auto search = std::find_if(x58_animResources.cbegin(), x58_animResources.cend(),
- [&](const std::pair& elem) -> bool
+ [&](const std::pair& elem) -> bool
{
return id == elem.first;
});
if (search == x58_animResources.cend())
- return kInvalidResId;
+ return CAssetId();
return search->second;
}
@@ -189,7 +189,7 @@ CCharacterFactory::GetCharLayoutInfoDB(CSimplePool& store,
CCharacterFactory::CCharacterFactory(CSimplePool& store,
const CAnimCharacterSet& ancs,
- ResId selfId)
+ CAssetId selfId)
: x4_charInfoDB(GetCharacterInfoDB(ancs)),
x14_charLayoutInfoDB(GetCharLayoutInfoDB(store, x4_charInfoDB)),
x24_sysContext(std::make_shared(
diff --git a/Runtime/Character/CCharacterFactory.hpp b/Runtime/Character/CCharacterFactory.hpp
index 254d231cc..aa2e912a0 100644
--- a/Runtime/Character/CCharacterFactory.hpp
+++ b/Runtime/Character/CCharacterFactory.hpp
@@ -31,7 +31,7 @@ public:
void CancelBuild(const SObjectTag&);
bool CanBuild(const SObjectTag&);
const SObjectTag* GetResourceIdByName(const char*) const;
- FourCC GetResourceTypeById(ResId id) const;
+ FourCC GetResourceTypeById(CAssetId id) const;
void EnumerateResources(const std::function& lambda) const;
void EnumerateNamedResources(const std::function& lambda) const;
@@ -52,8 +52,8 @@ private:
std::vector> x30_animSourceDB;
std::vector> x40_additiveInfo;
CAdditiveAnimationInfo x50_defaultAdditiveInfo;
- std::vector> x58_animResources;
- ResId x68_selfId;
+ std::vector> x58_animResources;
+ CAssetId x68_selfId;
CDummyFactory x6c_dummyFactory;
CSimplePool x70_cacheResPool;
@@ -63,12 +63,12 @@ private:
const std::vector& chars);
public:
- CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, ResId);
+ CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, CAssetId);
std::unique_ptr CreateCharacter(int charIdx, bool loop,
const TLockedToken& factory,
int defaultAnim, int drawInsts) const;
- ResId GetEventResourceIdForAnimResourceId(ResId animId) const;
+ CAssetId GetEventResourceIdForAnimResourceId(CAssetId animId) const;
const CCharacterInfo& GetCharInfo(int charIdx) const { return x4_charInfoDB[charIdx]; }
const CAdditiveAnimationInfo& FindAdditiveInfo(u32 idx) const;
diff --git a/Runtime/Character/CCharacterInfo.hpp b/Runtime/Character/CCharacterInfo.hpp
index 6bdbf0797..a5ecc97d5 100644
--- a/Runtime/Character/CCharacterInfo.hpp
+++ b/Runtime/Character/CCharacterInfo.hpp
@@ -15,18 +15,18 @@ class CCharacterInfo
public:
struct CParticleResData
{
- std::vector x0_part;
- std::vector x10_swhc;
- std::vector x20_elsc;
- std::vector x30_elsc;
+ std::vector x0_part;
+ std::vector x10_swhc;
+ std::vector x20_elsc;
+ std::vector x30_elsc;
CParticleResData(CInputStream& in, u16 tableCount);
};
private:
u16 x0_tableCount;
std::string x4_name;
- ResId x14_cmdl;
- ResId x18_cskr;
- ResId x1c_cinf;
+ CAssetId x14_cmdl;
+ CAssetId x18_cskr;
+ CAssetId x1c_cinf;
std::vector>> x20_animInfo;
CPASDatabase x30_pasDatabase;
CParticleResData x44_partRes;
@@ -34,8 +34,8 @@ private:
std::vector> x88_aabbs;
std::vector>> x98_effects;
- ResId xa8_cmdlOverlay = 0;
- ResId xac_cskrOverlay = 0;
+ CAssetId xa8_cmdlOverlay = 0;
+ CAssetId xac_cskrOverlay = 0;
std::vector xb0_animIdxs;
@@ -43,14 +43,14 @@ public:
CCharacterInfo(CInputStream& in);
const std::string& GetCharacterName() const { return x4_name; }
- ResId GetModelId() const {return x14_cmdl;}
- ResId GetSkinRulesId() const {return x18_cskr;}
- ResId GetCharLayoutInfoId() const {return x1c_cinf;}
+ CAssetId GetModelId() const {return x14_cmdl;}
+ CAssetId GetSkinRulesId() const {return x18_cskr;}
+ CAssetId GetCharLayoutInfoId() const {return x1c_cinf;}
const std::vector>& GetAnimBBoxList() const { return x88_aabbs; }
- ResId GetIceModelId() const {return xa8_cmdlOverlay;}
- ResId GetIceSkinRulesId() const {return xac_cskrOverlay;}
+ CAssetId GetIceModelId() const {return xa8_cmdlOverlay;}
+ CAssetId GetIceSkinRulesId() const {return xac_cskrOverlay;}
const CParticleResData& GetParticleResData() const {return x44_partRes;}
u32 GetAnimationIndex(u32 idx) const { return xb0_animIdxs.at(idx); }
diff --git a/Runtime/Character/CFBStreamedCompression.cpp b/Runtime/Character/CFBStreamedCompression.cpp
index b8d9326a5..f7c9874ae 100644
--- a/Runtime/Character/CFBStreamedCompression.cpp
+++ b/Runtime/Character/CFBStreamedCompression.cpp
@@ -12,7 +12,7 @@ CFBStreamedCompression::CFBStreamedCompression(CInputStream& in, IObjectStore& o
xc_rotsAndOffs = GetRotationsAndOffsets(x0_scratchSize / 4 + 1, in);
- if (x4_evnt)
+ if (x4_evnt.IsValid())
x8_evntToken = objStore.GetObj(SObjectTag{FOURCC('EVNT'), x4_evnt});
x10_averageVelocity = CalculateAverageVelocity(GetPerChannelHeaders());
diff --git a/Runtime/Character/CFBStreamedCompression.hpp b/Runtime/Character/CFBStreamedCompression.hpp
index 9d375f907..94db9474a 100644
--- a/Runtime/Character/CFBStreamedCompression.hpp
+++ b/Runtime/Character/CFBStreamedCompression.hpp
@@ -55,7 +55,7 @@ public:
private:
bool m_pc;
u32 x0_scratchSize;
- ResId x4_evnt;
+ CAssetId x4_evnt;
TLockedToken x8_evntToken;
std::unique_ptr xc_rotsAndOffs;
float x10_averageVelocity;
diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp
index 9901db65c..f56eac423 100644
--- a/Runtime/Character/CModelData.cpp
+++ b/Runtime/Character/CModelData.cpp
@@ -99,13 +99,13 @@ const std::unique_ptr& CModelData::PickStaticModel(EWhichModel which)
return m_normalModelInst;
}
-void CModelData::SetXRayModel(const std::pair& modelSkin)
+void CModelData::SetXRayModel(const std::pair& modelSkin)
{
- if (modelSkin.first)
+ if (modelSkin.first.IsValid())
{
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
{
- if (x10_animData && modelSkin.second &&
+ if (x10_animData && modelSkin.second.IsValid() &&
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
{
x10_animData->SetXRayModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
@@ -122,13 +122,13 @@ void CModelData::SetXRayModel(const std::pair& modelSkin)
}
}
-void CModelData::SetInfraModel(const std::pair& modelSkin)
+void CModelData::SetInfraModel(const std::pair& modelSkin)
{
- if (modelSkin.first)
+ if (modelSkin.first.IsValid())
{
if (g_ResFactory->GetResourceTypeById(modelSkin.first) == SBIG('CMDL'))
{
- if (x10_animData && modelSkin.second &&
+ if (x10_animData && modelSkin.second.IsValid() &&
g_ResFactory->GetResourceTypeById(modelSkin.second) == SBIG('CSKR'))
{
x10_animData->SetInfraModel(g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first}),
diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp
index bb645f2e4..0d9bf863b 100644
--- a/Runtime/Character/CModelData.hpp
+++ b/Runtime/Character/CModelData.hpp
@@ -23,22 +23,22 @@ struct SAdvancementDeltas;
class CStaticRes
{
- ResId x0_cmdlId = 0;
+ CAssetId x0_cmdlId = 0;
zeus::CVector3f x4_scale;
public:
- CStaticRes(ResId id, const zeus::CVector3f& scale)
+ CStaticRes(CAssetId id, const zeus::CVector3f& scale)
: x0_cmdlId(id),
x4_scale(scale)
{}
- ResId GetId() const { return x0_cmdlId; }
+ CAssetId GetId() const { return x0_cmdlId; }
const zeus::CVector3f& GetScale() const { return x4_scale; }
operator bool() const { return x0_cmdlId != 0; }
};
class CAnimRes
{
- ResId x0_ancsId = -1;
+ CAssetId x0_ancsId = -1;
s32 x4_charIdx = -1;
zeus::CVector3f x8_scale;
bool x14_canLoop = false;
@@ -46,7 +46,7 @@ class CAnimRes
s32 x18_defaultAnim = -1; /* NOTE: used to be x1c in demo */
public:
CAnimRes() = default;
- CAnimRes(ResId ancs, s32 charIdx, const zeus::CVector3f& scale, const s32 defaultAnim, bool loop)
+ CAnimRes(CAssetId ancs, s32 charIdx, const zeus::CVector3f& scale, const s32 defaultAnim, bool loop)
: x0_ancsId(ancs),
x4_charIdx(charIdx),
x8_scale(scale),
@@ -55,7 +55,7 @@ public:
{
}
- ResId GetId() const { return x0_ancsId; }
+ CAssetId GetId() const { return x0_ancsId; }
s32 GetCharacterNodeId() const { return x4_charIdx; }
const zeus::CVector3f& GetScale() const { return x8_scale; }
bool CanLoop() const { return x14_canLoop; }
@@ -113,8 +113,8 @@ public:
static EWhichModel GetRenderingModel(const CStateManager& stateMgr);
CSkinnedModel& PickAnimatedModel(EWhichModel which) const;
const std::unique_ptr& PickStaticModel(EWhichModel which) const;
- void SetXRayModel(const std::pair& modelSkin);
- void SetInfraModel(const std::pair& modelSkin);
+ void SetXRayModel(const std::pair& modelSkin);
+ void SetInfraModel(const std::pair& modelSkin);
bool IsDefinitelyOpaque(EWhichModel);
bool GetIsLoop() const;
float GetAnimationDuration(int) const;
diff --git a/Runtime/Character/CParticleDatabase.cpp b/Runtime/Character/CParticleDatabase.cpp
index eee8e0f66..559a0fb2e 100644
--- a/Runtime/Character/CParticleDatabase.cpp
+++ b/Runtime/Character/CParticleDatabase.cpp
@@ -18,21 +18,21 @@ CParticleDatabase::CParticleDatabase()
void CParticleDatabase::CacheParticleDesc(const CCharacterInfo::CParticleResData& desc)
{
- for (ResId id : desc.x0_part)
+ for (CAssetId id : desc.x0_part)
{
auto search = x0_particleDescs.find(id);
if (search == x0_particleDescs.cend())
x0_particleDescs[id] = std::make_shared>(
g_SimplePool->GetObj(SObjectTag{FOURCC('PART'), id}));
}
- for (ResId id : desc.x10_swhc)
+ for (CAssetId id : desc.x10_swhc)
{
auto search = x14_swooshDescs.find(id);
if (search == x14_swooshDescs.cend())
x14_swooshDescs[id] = std::make_shared>(
g_SimplePool->GetObj(SObjectTag{FOURCC('SWHC'), id}));
}
- for (ResId id : desc.x20_elsc)
+ for (CAssetId id : desc.x20_elsc)
{
auto search = x28_electricDescs.find(id);
if (search == x28_electricDescs.cend())
@@ -355,10 +355,10 @@ void CParticleDatabase::SetCEXTValue(const std::string& name, int idx, float val
}
template
-static int _getGraphicLightId(const T& system, const U& desc)
+static s32 _getGraphicLightId(const T& system, const U& desc)
{
if (system->SystemHasLight())
- return desc.GetObjectTag()->id;
+ return s32(desc.GetObjectTag()->id.Value());
return -1;
}
diff --git a/Runtime/Character/CParticleDatabase.hpp b/Runtime/Character/CParticleDatabase.hpp
index 9fe2355da..8e79b58ee 100644
--- a/Runtime/Character/CParticleDatabase.hpp
+++ b/Runtime/Character/CParticleDatabase.hpp
@@ -17,9 +17,9 @@ class CCharLayoutInfo;
class CParticleDatabase
{
- std::map>> x0_particleDescs;
- std::map>> x14_swooshDescs;
- std::map>> x28_electricDescs;
+ std::map>> x0_particleDescs;
+ std::map>> x14_swooshDescs;
+ std::map>> x28_electricDescs;
std::map> x3c_rendererDrawLoop;
std::map> x50_firstDrawLoop;
std::map> x64_lastDrawLoop;
diff --git a/Runtime/Character/CPrimitive.hpp b/Runtime/Character/CPrimitive.hpp
index 1adabc3c6..19ceec0c2 100644
--- a/Runtime/Character/CPrimitive.hpp
+++ b/Runtime/Character/CPrimitive.hpp
@@ -9,12 +9,12 @@ namespace urde
class CPrimitive
{
- ResId x0_animId;
+ CAssetId x0_animId;
u32 x4_animIdx;
std::string x8_animName;
public:
CPrimitive(CInputStream& in);
- ResId GetAnimResId() const { return x0_animId; }
+ CAssetId GetAnimResId() const { return x0_animId; }
u32 GetAnimDbIdx() const { return x4_animIdx; }
const std::string& GetName() const { return x8_animName; }
bool operator<(const CPrimitive& other) const { return x8_animName < other.x8_animName; }
diff --git a/Runtime/Collision/CCollisionResponseData.cpp b/Runtime/Collision/CCollisionResponseData.cpp
index b43f6a32c..bbb66cee6 100644
--- a/Runtime/Collision/CCollisionResponseData.cpp
+++ b/Runtime/Collision/CCollisionResponseData.cpp
@@ -70,7 +70,7 @@ void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionRespons
CSimplePool* resPool)
{
int i = int(type);
- std::vector tracker;
+ std::vector tracker;
tracker.resize(8);
x0_generators[i].emplace(CPF::GetChildGeneratorDesc(in, resPool, tracker).m_token);
}
@@ -86,8 +86,8 @@ bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStre
if (cls == SBIG('NONE'))
return true;
- ResId id = CPF::GetInt(in);
- if (!id)
+ CAssetId id = u64(CPF::GetInt(in));
+ if (!id.IsValid())
return true;
x20_decals[i].emplace(resPool->GetObj({FOURCC('DPSC'), id}));
diff --git a/Runtime/Graphics/CSkinnedModel.cpp b/Runtime/Graphics/CSkinnedModel.cpp
index 2dad5aca9..05824b543 100644
--- a/Runtime/Graphics/CSkinnedModel.cpp
+++ b/Runtime/Graphics/CSkinnedModel.cpp
@@ -20,8 +20,8 @@ CSkinnedModel::CSkinnedModel(TLockedToken model,
m_modelInst = model->MakeNewInstance(shaderIdx, drawInsts);
}
-CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model,
- ResId skinRules, ResId layoutInfo,
+CSkinnedModel::CSkinnedModel(IObjectStore& store, CAssetId model,
+ CAssetId skinRules, CAssetId layoutInfo,
int shaderIdx, int drawInsts)
: CSkinnedModel(store.GetObj(SObjectTag{FOURCC('CMDL'), model}),
store.GetObj(SObjectTag{FOURCC('CSKR'), skinRules}),
@@ -44,8 +44,8 @@ void CSkinnedModel::Draw(const CModelFlags& drawFlags) const
m_modelInst->DrawSurfaces(drawFlags);
}
-CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, ResId model,
- ResId skinRules, ResId layoutInfo,
+CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, CAssetId model,
+ CAssetId skinRules, CAssetId layoutInfo,
int shaderIdx, int drawInsts)
: CSkinnedModel(store, model, skinRules, layoutInfo, shaderIdx, drawInsts)
{
diff --git a/Runtime/Graphics/CSkinnedModel.hpp b/Runtime/Graphics/CSkinnedModel.hpp
index e24e1f90e..1c991820f 100644
--- a/Runtime/Graphics/CSkinnedModel.hpp
+++ b/Runtime/Graphics/CSkinnedModel.hpp
@@ -31,8 +31,8 @@ public:
TLockedToken skinRules,
TLockedToken layoutInfo,
int shaderIdx, int drawInsts);
- CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
- ResId layoutInfo, int shaderIdx, int drawInsts);
+ CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
+ CAssetId layoutInfo, int shaderIdx, int drawInsts);
const TLockedToken& GetModel() const {return x4_model;}
const std::unique_ptr& GetModelInst() const {return m_modelInst;}
@@ -58,8 +58,8 @@ public:
class CMorphableSkinnedModel : public CSkinnedModel
{
public:
- CMorphableSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
- ResId layoutInfo, int shaderIdx, int drawInsts);
+ CMorphableSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
+ CAssetId layoutInfo, int shaderIdx, int drawInsts);
};
}
diff --git a/Runtime/GuiSys/CAuiEnergyBarT01.cpp b/Runtime/GuiSys/CAuiEnergyBarT01.cpp
index 555f69ad2..45cad1e3f 100644
--- a/Runtime/GuiSys/CAuiEnergyBarT01.cpp
+++ b/Runtime/GuiSys/CAuiEnergyBarT01.cpp
@@ -6,7 +6,7 @@
namespace urde
{
-CAuiEnergyBarT01::CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, ResId txtrId)
+CAuiEnergyBarT01::CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId)
: CGuiWidget(parms), xb8_txtrId(txtrId)
{
if (g_GuiSys->GetUsageMode() != CGuiSys::EUsageMode::Two)
@@ -166,7 +166,7 @@ void CAuiEnergyBarT01::SetMaxEnergy(float maxEnergy)
std::shared_ptr CAuiEnergyBarT01::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp)
{
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
- ResId tex = in.readUint32Big();
+ CAssetId tex = in.readUint32Big();
std::shared_ptr ret = std::make_shared(parms, sp, tex);
ret->ParseBaseInfo(frame, in, parms);
return ret;
diff --git a/Runtime/GuiSys/CAuiEnergyBarT01.hpp b/Runtime/GuiSys/CAuiEnergyBarT01.hpp
index 2ad1ef028..4aa7a8eae 100644
--- a/Runtime/GuiSys/CAuiEnergyBarT01.hpp
+++ b/Runtime/GuiSys/CAuiEnergyBarT01.hpp
@@ -21,7 +21,7 @@ public:
Insta
};
private:
- ResId xb8_txtrId;
+ CAssetId xb8_txtrId;
TLockedToken xbc_tex; // Used to be optional
zeus::CColor xcc_emptyColor;
zeus::CColor xd0_filledColor;
@@ -41,7 +41,7 @@ private:
CEnergyBarShader m_energyBarShader;
std::vector m_verts[3];
public:
- CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, ResId txtrId);
+ CAuiEnergyBarT01(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId txtrId);
FourCC GetWidgetTypeID() const { return FOURCC('ENRG'); }
static std::pair DownloadBarCoordFunc(float t);
void Update(float dt);
diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp
index 4215b2ed1..ef332e0e3 100644
--- a/Runtime/GuiSys/CAuiImagePane.cpp
+++ b/Runtime/GuiSys/CAuiImagePane.cpp
@@ -6,7 +6,7 @@
namespace urde
{
-CAuiImagePane::CAuiImagePane(const CGuiWidgetParms& parms, CSimplePool* sp, ResId tex0, ResId tex1,
+CAuiImagePane::CAuiImagePane(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId tex0, CAssetId tex1,
rstl::reserved_vector&& coords,
rstl::reserved_vector&& uvs, bool initTex)
: CGuiWidget(parms), xc8_tex0(tex0), xcc_tex1(tex1), xe0_coords(std::move(coords)),
@@ -190,7 +190,7 @@ bool CAuiImagePane::GetIsFinishedLoadingWidgetSpecific() const
return xb8_tex0Tok.IsLoaded();
}
-void CAuiImagePane::SetTextureID0(ResId tex, CSimplePool* sp)
+void CAuiImagePane::SetTextureID0(CAssetId tex, CSimplePool* sp)
{
xc8_tex0 = tex;
if (!sp)
diff --git a/Runtime/GuiSys/CAuiImagePane.hpp b/Runtime/GuiSys/CAuiImagePane.hpp
index f0e8978fe..d4e22aa83 100644
--- a/Runtime/GuiSys/CAuiImagePane.hpp
+++ b/Runtime/GuiSys/CAuiImagePane.hpp
@@ -13,8 +13,8 @@ class CTexture;
class CAuiImagePane : public CGuiWidget
{
TLockedToken xb8_tex0Tok; // Used to be optional
- ResId xc8_tex0;
- ResId xcc_tex1;
+ CAssetId xc8_tex0;
+ CAssetId xcc_tex1;
zeus::CVector2f xd0_uvBias0;
zeus::CVector2f xd8_uvBias1;
rstl::reserved_vector xe0_coords;
@@ -37,7 +37,7 @@ class CAuiImagePane : public CGuiWidget
void DoDrawImagePane(const zeus::CColor& color, const CTexture& tex,
int frame, float blurAmt, bool noBlur, CTexturedQuadFilterAlpha& quad) const;
public:
- CAuiImagePane(const CGuiWidgetParms& parms, CSimplePool* sp, ResId, ResId,
+ CAuiImagePane(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId, CAssetId,
rstl::reserved_vector&& coords,
rstl::reserved_vector&& uvs, bool initTex);
FourCC GetWidgetTypeID() const { return FOURCC('IMGP'); }
@@ -46,7 +46,7 @@ public:
void Update(float dt);
void Draw(const CGuiWidgetDrawParms& params) const;
bool GetIsFinishedLoadingWidgetSpecific() const;
- void SetTextureID0(ResId tex, CSimplePool* sp);
+ void SetTextureID0(CAssetId tex, CSimplePool* sp);
void SetAnimationParms(const zeus::CVector2f& vec, float interval, float duration);
void SetDeResFactor(float d) { x14c_deResFactor = d; }
void SetFlashFactor(float t) { x150_flashFactor = t; }
diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp
index 5844b9323..97b8ff1ad 100644
--- a/Runtime/GuiSys/CGuiFrame.cpp
+++ b/Runtime/GuiSys/CGuiFrame.cpp
@@ -13,7 +13,7 @@
namespace urde
{
-CGuiFrame::CGuiFrame(ResId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp)
+CGuiFrame::CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp)
: x0_id(id), x8_guiSys(sys), x4c_a(a), x50_b(b), x54_c(c), x58_24_loaded(false)
{
x3c_lights.reserve(8);
@@ -208,7 +208,7 @@ void CGuiFrame::ProcessUserInput(const CFinalInput& input) const
}
}
-std::unique_ptr CGuiFrame::CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp)
+std::unique_ptr CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp)
{
in.readInt32Big();
int a = in.readInt32Big();
diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp
index 1239c1612..5a715ac2d 100644
--- a/Runtime/GuiSys/CGuiFrame.hpp
+++ b/Runtime/GuiSys/CGuiFrame.hpp
@@ -23,7 +23,7 @@ class CGuiFrame
{
friend class CGuiSys;
private:
- ResId x0_id;
+ CAssetId x0_id;
u32 x4_ = 0;
CGuiSys& x8_guiSys;
std::shared_ptr xc_headWidget;
@@ -42,7 +42,7 @@ private:
float m_aspectConstraint = -1.f;
public:
- CGuiFrame(ResId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
+ CGuiFrame(CAssetId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
~CGuiFrame();
CGuiSys& GetGuiSys() {return x8_guiSys;}
@@ -73,7 +73,7 @@ public:
CGuiWidgetIdDB& GetWidgetIdDB() {return x18_idDB;}
- static std::unique_ptr CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp);
+ static std::unique_ptr CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp);
};
std::unique_ptr RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp
index b5862a47e..3da8118aa 100644
--- a/Runtime/GuiSys/CGuiModel.cpp
+++ b/Runtime/GuiSys/CGuiModel.cpp
@@ -8,7 +8,7 @@
namespace urde
{
-CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, ResId modelId, u32 lightMask, bool flag)
+CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag)
: CGuiWidget(parms), x108_modelId(modelId), x10c_lightMask(lightMask)
{
if (!flag || modelId == 0xffffffff ||
@@ -18,7 +18,7 @@ CGuiModel::CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, ResId modelI
xf8_model = sp->GetObj({SBIG('CMDL'), modelId});
}
-std::vector CGuiModel::GetModelAssets() const
+std::vector CGuiModel::GetModelAssets() const
{
return {x108_modelId};
}
@@ -119,7 +119,7 @@ std::shared_ptr CGuiModel::Create(CGuiFrame* frame, CInputStream& in
{
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
- ResId model = in.readUint32Big();
+ CAssetId model = in.readUint32Big();
in.readUint32Big();
u32 lightMask = in.readUint32Big();
diff --git a/Runtime/GuiSys/CGuiModel.hpp b/Runtime/GuiSys/CGuiModel.hpp
index 24aa44559..aa39e4d3d 100644
--- a/Runtime/GuiSys/CGuiModel.hpp
+++ b/Runtime/GuiSys/CGuiModel.hpp
@@ -12,13 +12,13 @@ class CSimplePool;
class CGuiModel : public CGuiWidget
{
TLockedToken xf8_model;
- ResId x108_modelId;
+ CAssetId x108_modelId;
u32 x10c_lightMask;
public:
- CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, ResId modelId, u32 lightMask, bool flag);
+ CGuiModel(const CGuiWidgetParms& parms, CSimplePool* sp, CAssetId modelId, u32 lightMask, bool flag);
FourCC GetWidgetTypeID() const { return FOURCC('MODL'); }
- std::vector