This commit is contained in:
Jack Andersen 2017-08-12 22:19:33 -10:00
commit 02f8f77b57
177 changed files with 830 additions and 729 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ version.h
docs/*
.idea/dictionaries
.idea/workspace.xml
.idea/misc.xml

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" IGNORE_OUTSIDE_FILES="true" PROJECT_DIR="$PROJECT_DIR$" />
</project>

View File

@ -9,7 +9,7 @@ namespace DataSpec
struct ITweakGunRes : ITweak
{
using ResId = int64_t;
using ResId = urde::CAssetId;
enum class EBeamId
{
Power,

View File

@ -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;

View File

@ -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)

View File

@ -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<urde::IObj> 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<urde::IObj> 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::AsyncTask>
ProjectResourceFactoryBase::LoadResourceAsync(const urde::SObjectTag& tag,
std::unique_ptr<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 {};
@ -789,7 +789,7 @@ ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
u32 size, u32 off,
std::unique_ptr<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 {};
@ -800,7 +800,7 @@ ProjectResourceFactoryBase::LoadResourcePartAsync(const urde::SObjectTag& tag,
std::shared_ptr<ProjectResourceFactoryBase::AsyncTask>
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<u8[]> 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<u8[]> ProjectResourceFactoryBase::LoadResourceSync(const urde::S
std::unique_ptr<u8[]> 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<std::mutex> lk(const_cast<ProjectResourceFactoryBase*>(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()));
}
}

View File

@ -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<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;

View File

@ -47,8 +47,8 @@ namespace urde
class MP1OriginalIDs
{
std::vector<std::pair<ResId, ResId>> m_origToNew;
std::vector<std::pair<ResId, ResId>> m_newToOrig;
std::vector<std::pair<CAssetId, CAssetId>> m_origToNew;
std::vector<std::pair<CAssetId, CAssetId>> m_newToOrig;
public:
MP1OriginalIDs(CInputStream& in)
@ -57,20 +57,20 @@ public:
m_origToNew.reserve(count);
for (u32 i=0 ; i<count ; ++i)
{
ResId a = in.readUint32Big();
ResId b = in.readUint32Big();
CAssetId a = in.readUint32Big();
CAssetId b = in.readUint32Big();
m_origToNew.push_back(std::make_pair(a, b));
}
m_newToOrig.reserve(count);
for (u32 i=0 ; i<count ; ++i)
{
ResId a = in.readUint32Big();
ResId b = in.readUint32Big();
CAssetId a = in.readUint32Big();
CAssetId b = in.readUint32Big();
m_newToOrig.push_back(std::make_pair(a, b));
}
}
ResId TranslateOriginalToNew(ResId id) const
CAssetId TranslateOriginalToNew(CAssetId id) const
{
auto search = rstl::binary_find(m_origToNew.cbegin(), m_origToNew.cend(), id,
[](const auto& id) { return id.first; });
@ -79,7 +79,7 @@ public:
return search->second;
}
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);
}

View File

@ -18,8 +18,8 @@ public:
void GetTagListForFile(const char* pakName, std::vector<SObjectTag>& out) const;
void Shutdown();
ResId TranslateOriginalToNew(ResId id) const;
ResId TranslateNewToOriginal(ResId id) const;
CAssetId TranslateOriginalToNew(CAssetId id) const;
CAssetId TranslateNewToOriginal(CAssetId id) const;
};
}

View File

@ -7,7 +7,7 @@ namespace urde
CAudioSys* CAudioSys::g_SharedSys = nullptr;
static std::unordered_map<std::string, TLockedToken<CAudioGroupSet>> mpGroupSetDB;
static std::unordered_map<ResId, std::string> mpGroupSetResNameDB;
static std::unordered_map<CAssetId, std::string> mpGroupSetResNameDB;
static const std::string mpDefaultInvalidString = "NULL";
TLockedToken<CAudioGroupSet> CAudioSys::FindGroupSet(const std::string& name)
@ -18,7 +18,7 @@ TLockedToken<CAudioGroupSet> 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<CAudioGroupSet>& set, const std::string& name, ResId id)
bool CAudioSys::SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& set, const std::string& name, CAssetId id)
{
if (!FindGroupSet(name))
{

View File

@ -79,9 +79,9 @@ public:
}
static TLockedToken<CAudioGroupSet> FindGroupSet(const std::string& name);
static const std::string& SysGetGroupSetName(ResId id);
static bool SysLoadGroupSet(CSimplePool* pool, ResId id);
static bool SysLoadGroupSet(const TLockedToken<CAudioGroupSet>& 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<CAudioGroupSet>& 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);

View File

@ -13,12 +13,12 @@ public:
{
u16 x0_setupId;
u16 x2_groupId;
ResId x4_agscId;
CAssetId x4_agscId;
std::unique_ptr<u8[]> 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);
};

View File

@ -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 ; i<numWorlds ; ++i)
@ -1076,7 +1076,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
if (x9c_worldIdx != oldWldIdx)
{
ResId curMlvl = g_GameState->CurrentWorldAssetId();
CAssetId curMlvl = g_GameState->CurrentWorldAssetId();
for (int i=0 ; i<x14_dummyWorlds.size() ; ++i)
{
auto& wld = x14_dummyWorlds[i];
@ -1110,18 +1110,18 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
{
x2fc_textpane_hint->TextSupport().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<CGuiTextPane*>(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<CTexturedQuadFilter>& hintBeaconFilters = const_cast<CAutoMapper&>(*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<hintOpts.GetHintStates().size() ; ++i)

View File

@ -108,16 +108,16 @@ public:
Type x0_type;
union
{
ResId x4_worldId;
CAssetId x4_worldId;
TAreaId x4_areaId;
float x4_float;
};
bool x8_processing = false;
SAutoMapperHintStep(PanToArea, TAreaId areaId) : x0_type(Type::PanToArea), x4_areaId(areaId) {}
SAutoMapperHintStep(PanToWorld, ResId worldId) : x0_type(Type::PanToWorld), x4_worldId(worldId) {}
SAutoMapperHintStep(PanToWorld, CAssetId worldId) : x0_type(Type::PanToWorld), x4_worldId(worldId) {}
SAutoMapperHintStep(SwitchToUniverse) : x0_type(Type::SwitchToUniverse), x4_worldId(0) {}
SAutoMapperHintStep(SwitchToWorld, ResId worldId) : x0_type(Type::SwitchToWorld), x4_worldId(worldId) {}
SAutoMapperHintStep(SwitchToWorld, CAssetId worldId) : x0_type(Type::SwitchToWorld), x4_worldId(worldId) {}
SAutoMapperHintStep(ShowBeacon, float val) : x0_type(Type::ShowBeacon), x4_float(val) {}
SAutoMapperHintStep(ZoomIn) : x0_type(Type::ZoomIn), x4_worldId(0) {}
SAutoMapperHintStep(ZoomOut) : x0_type(Type::ZoomOut), x4_worldId(0) {}
@ -127,7 +127,7 @@ public:
{
u32 x0_showBeacon;
float x4_beaconAlpha;
ResId x8_worldId;
CAssetId x8_worldId;
TAreaId xc_areaId;
};
@ -174,10 +174,10 @@ private:
TLockedToken<CTexture> x3c_hintBeacon;
std::vector<CTexturedQuadFilter> m_hintBeaconFilters;
rstl::reserved_vector<TLockedToken<CTexture>, 5> x48_mapIcons;
ResId x74_areaHintDescId = -1;
CAssetId x74_areaHintDescId = -1;
TLockedToken<CStringTable> x78_areaHintDesc;
u32 x84_ = 0;
ResId x88_mapAreaStringId = -1;
CAssetId x88_mapAreaStringId = -1;
TLockedToken<CStringTable> 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&);

View File

@ -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);

View File

@ -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<zeus::CTransform> 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<CMapArea> x4_hexagonToken;
std::vector<CMapWorldData> 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)

View File

@ -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 ; i<areaCount ; ++i)
{
ResId mapaId = in.readUint32Big();
CAssetId mapaId = in.readUint32Big();
x0_areas.emplace_back(mapaId, EMapAreaList::Unloaded,
x0_areas.empty() ? nullptr : &x0_areas.back());
}

View File

@ -74,7 +74,7 @@ public:
EMapAreaList x10_list;
CMapAreaData* x14_next;
public:
CMapAreaData(ResId areaRes, EMapAreaList list, CMapAreaData* next);
CMapAreaData(CAssetId areaRes, EMapAreaList list, CMapAreaData* next);
void Lock() { x0_area.Lock(); }
void Unlock() { x0_area.Unlock(); }
bool IsLoaded() const { return x0_area.IsLoaded(); }

View File

@ -5,7 +5,7 @@
namespace urde
{
CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, ResId mlvlId)
CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, CAssetId mlvlId)
{
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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<SHintLocation> 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<SHintLocation>& GetLocations() const { return x20_locations; }
};

View File

@ -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<ResId, TEditorId>& pair) -> bool
[&](const std::pair<CAssetId, TEditorId>& 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<ResId, TEditorId>& pair) -> bool
[&](const std::pair<CAssetId, TEditorId>& pair) -> bool
{
return pair.first == mlvlId && pair.second == cineId;
});
@ -361,7 +361,7 @@ void CGameOptions::SetControls(int controls)
ResetControllerAssets(controls);
}
static const std::pair<ResId, ResId> CStickToDPadRemap[] =
static const std::pair<CAssetId, CAssetId> CStickToDPadRemap[] =
{
{0x2A13C23E, 0xF13452F8},
{0xA91A7703, 0xC042EC91},
@ -370,7 +370,7 @@ static const std::pair<ResId, ResId> CStickToDPadRemap[] =
{0xCD7B1ACA, 0x8ADA8184},
};
static const std::pair<ResId, ResId> CStickOutlineToDPadRemap[] =
static const std::pair<CAssetId, CAssetId> CStickOutlineToDPadRemap[] =
{
{0x1A29C0E6, 0xF13452F8},
{0x5D9F9796, 0xC042EC91},
@ -379,7 +379,7 @@ static const std::pair<ResId, ResId> CStickOutlineToDPadRemap[] =
{0x409AA72E, 0x8ADA8184},
};
static std::pair<ResId, ResId> TranslatePairToNew(const std::pair<ResId, ResId>& p)
static std::pair<CAssetId, CAssetId> TranslatePairToNew(const std::pair<CAssetId, CAssetId>& 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<ResId, ResId>& a, const std::pair<ResId, ResId>& b)
[](const std::pair<CAssetId, CAssetId>& a, const std::pair<CAssetId, CAssetId>& b)
{ return a.first < b.first; });
}
}

View File

@ -57,7 +57,7 @@ class CPersistentOptions
friend class CGameState;
u8 x0_[98] = {};
bool x68_[64] = {};
std::vector<std::pair<ResId, TEditorId>> xac_cinematicStates; /* (MLVL, Cinematic) */
std::vector<std::pair<CAssetId, TEditorId>> 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<std::pair<ResId, ResId>> x6c_controlTxtrMap;
std::vector<std::pair<CAssetId, CAssetId>> 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<std::pair<ResId, ResId>>& GetControlTXTRMap() const { return x6c_controlTxtrMap; }
const std::vector<std::pair<CAssetId, CAssetId>>& GetControlTXTRMap() const { return x6c_controlTxtrMap; }
static void TryRestoreDefaults(const CFinalInput& input, int category,
int option, bool frontend, bool forceRestore);

View File

@ -75,7 +75,7 @@ void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Are
x10_saveLayers.clear();
}
CWorldState::CWorldState(ResId id)
CWorldState::CWorldState(CAssetId id)
: x0_mlvlId(id), x4_areaId(0)
{
x8_relayTracker = std::make_shared<CRelayTracker>();
@ -84,7 +84,7 @@ CWorldState::CWorldState(ResId id)
x14_layerState = std::make_shared<CWorldLayerState>();
}
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<double>(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)

View File

@ -44,21 +44,21 @@ public:
class CWorldState
{
ResId x0_mlvlId;
CAssetId x0_mlvlId;
TAreaId x4_areaId = kInvalidAreaId;
std::shared_ptr<CRelayTracker> x8_relayTracker;
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
ResId x10_desiredAreaAssetId;
CAssetId x10_desiredAreaAssetId;
std::shared_ptr<CWorldLayerState> 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<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
const std::shared_ptr<CWorldLayerState>& 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<CWorldState> x88_worldStates;
std::shared_ptr<CPlayerState> x98_playerState;
std::shared_ptr<CWorldTransManager> 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<CPlayerState> GetPlayerState() { return x98_playerState; }
std::shared_ptr<CWorldTransManager> 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;

View File

@ -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());
}
};

View File

@ -49,7 +49,7 @@ if(APPLE)
endif()
add_library(RuntimeCommon
RetroTypes.hpp
RetroTypes.hpp RetroTypes.cpp
${CLIENT_SOURCES}
${MP1_SOURCES}
${AUDIO_SOURCES}

View File

@ -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<std::pair<ResId, ResId>> orderedMLVLs;
std::vector<std::pair<CAssetId, CAssetId>> 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);
}

View File

@ -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<ResId> xc_areaIds;
std::vector<CAssetId> xc_areaIds;
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
TLockedToken<CSaveWorld> 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<CWorldLayers::Area>& GetDefaultLayerStates() const { return x1c_defaultLayerStates; }
const TLockedToken<CStringTable>& 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<ResId> xc_areaIds;
CAssetId x0_mlvlId;
CAssetId x4_strgId;
CAssetId x8_savwId;
std::vector<CAssetId> xc_areaIds;
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
std::unique_ptr<CDummyWorld> x2c_dummyWorld;
TLockedToken<CSaveWorld> 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<CGameHintInfo> x0_hints;
std::vector<std::pair<ResId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
std::vector<std::pair<CAssetId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
std::experimental::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
std::vector<std::pair<ResId, CSaveWorld::EScanCategory>> x20_scanStates;
std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>> x20_scanStates;
rstl::reserved_vector<u32, 6> x30_scanCategoryCounts;
public:
@ -90,19 +90,19 @@ public:
using CardStat = kabufuda::CardStat;
const std::vector<CGameHintInfo::CGameHint>& GetHints() const { return x0_hints->GetHints(); }
const std::vector<std::pair<ResId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; }
const std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; }
const std::vector<std::pair<CAssetId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; }
const std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; }
u32 GetScanCategoryCount(CSaveWorld::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; }
std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>::const_iterator LookupScanState(ResId id) const
std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>>::const_iterator LookupScanState(CAssetId id) const
{
return
rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id,
[](const std::pair<ResId, CSaveWorld::EScanCategory>& p) { return p.first; });
[](const std::pair<CAssetId, CSaveWorld::EScanCategory>& 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<CTexture> 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<TLockedToken<CTexture>> x40_bannerTok;
rstl::reserved_vector<Icon, 8> x50_iconToks;
std::vector<u8> 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(); }

View File

@ -46,14 +46,14 @@ private:
u32 x4c_resTableCount = 0;
int x50_ = -1;
std::vector<std::pair<std::string, SObjectTag>> x54_nameList;
std::vector<ResId> x64_depList;
std::vector<std::pair<u32, SResInfo>> x74_resList;
std::vector<CAssetId> x64_depList;
std::vector<std::pair<CAssetId, SResInfo>> x74_resList;
public:
CPakFile(const std::string& filename, bool buildDepList, bool worldPak);
const std::vector<ResId>& GetDepList() const { return x64_depList; }
const std::vector<CAssetId>& 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() {}

View File

@ -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<float*>(&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<u32*>(&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)

View File

@ -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<CPowerUp, 41> x24_powerups;
rstl::reserved_vector<std::pair<ResId, float>, 846> x170_scanTimes;
rstl::prereserved_vector<CPowerUp, 41> x24_powerups;
rstl::reserved_vector<std::pair<CAssetId, float>, 846> x170_scanTimes;
std::pair<u32, u32> 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<std::pair<ResId, float>, 846>& GetScanTimes() const { return x170_scanTimes; }
const rstl::reserved_vector<std::pair<CAssetId, float>, 846>& GetScanTimes() const { return x170_scanTimes; }
CPlayerState();
CPlayerState(CBitStreamReader& stream);
void PutTo(CBitStreamWriter& stream);

View File

@ -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);
}

View File

@ -4,7 +4,7 @@
namespace urde
{
const std::vector<ResId>* CResLoader::GetTagListForFile(const std::string& name) const
const std::vector<CAssetId>* CResLoader::GetTagListForFile(const std::string& name) const
{
std::string namePak = name + ".pak";
for (const std::unique_ptr<CPakFile>& 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<CPakFile>& file : x18_pakLoadedList)
if (const_cast<CResLoader*>(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<CPakFile>& 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)

View File

@ -19,10 +19,10 @@ class CResLoader
std::list<std::unique_ptr<CPakFile>> x18_pakLoadedList;
std::list<std::unique_ptr<CPakFile>> x30_pakLoadingList;
u32 x44_pakLoadingCount = 0;
u32 x4c_cachedResId = -1;
CAssetId x4c_cachedResId;
const CPakFile::SResInfo* x50_cachedResInfo = nullptr;
public:
const std::vector<ResId>* GetTagListForFile(const std::string& name) const;
const std::vector<CAssetId>* 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<CPakFile>&& file);
};

View File

@ -14,7 +14,7 @@ public:
using EScanCategory = DataSpec::SAVWCommon::EScanCategory;
struct SScanState
{
ResId x0_id;
CAssetId x0_id;
EScanCategory x4_category;
};

View File

@ -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);

View File

@ -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<SBucket, 4> 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; }

View File

@ -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<u32, u32> CStateManager::CalculateScanCompletionRate() const
u32 num = 0;
u32 denom = 0;
int idx = 0;
for (const std::pair<u32, float>& scan : x8b8_playerState->GetScanTimes())
for (const std::pair<CAssetId, float>& scan : x8b8_playerState->GetScanTimes())
{
CSaveWorld::EScanCategory category = g_MemoryCardSys->GetScanStates()[idx++].second;
if (category != CSaveWorld::EScanCategory::None && category != CSaveWorld::EScanCategory::Research)

View File

@ -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<CObjectList>& 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; }

View File

@ -40,7 +40,7 @@ void CCameraFilterPass<S>::Update(float dt)
template <class S>
void CCameraFilterPass<S>::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<S>::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)
{

View File

@ -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<CTexture> 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(); }
};

View File

@ -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<CCharLayoutInfo>& 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);
}

View File

@ -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<CAnimTreeNode> 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<CCharLayoutInfo>& layout,
@ -156,7 +156,7 @@ public:
const TLockedToken<CCharacterFactory>& charFactory,
int drawInstCount);
ResId GetEventResourceIdForAnimResourceId(ResId) const;
CAssetId GetEventResourceIdForAnimResourceId(CAssetId) const;
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
static SAdvancementResults AdvanceAdditiveAnim(std::shared_ptr<CAnimTreeNode>& anim, const CCharAnimTime& time);
SAdvancementDeltas AdvanceAdditiveAnims(float);

View File

@ -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();

View File

@ -57,7 +57,7 @@ class CAnimSource
std::vector<u8> x20_rotationChannels;
std::vector<u8> x30_translationChannels;
RotationAndOffsetStorage x40_data;
ResId x54_evntId;
CAssetId x54_evntId;
TCachedToken<CAnimPOIData> x58_evntData;
float x60_averageVelocity;

View File

@ -45,8 +45,8 @@ CAnimationSet::CAnimationSet(CInputStream& in)
x50_animRes.reserve(animResourcesCount);
for (u32 i=0 ; i<animResourcesCount ; ++i)
{
ResId anim = in.readUint32Big();
ResId evnt = in.readUint32Big();
CAssetId anim = in.readUint32Big();
CAssetId evnt = in.readUint32Big();
x50_animRes.emplace_back(anim, evnt);
}
}

View File

@ -19,7 +19,7 @@ class CAnimationSet
std::vector<std::pair<u32, CAdditiveAnimationInfo>> x28_additiveInfo;
CAdditiveAnimationInfo x38_defaultAdditiveInfo;
std::vector<CHalfTransition> x40_halfTransitions;
std::vector<std::pair<ResId, ResId>> x50_animRes;
std::vector<std::pair<CAssetId, CAssetId>> x50_animRes;
public:
CAnimationSet(CInputStream& in);
@ -30,7 +30,7 @@ public:
const std::vector<CHalfTransition>& GetHalfTransitions() const { return x40_halfTransitions; }
const std::vector<std::pair<u32, CAdditiveAnimationInfo>>& GetAdditiveInfo() const { return x28_additiveInfo; }
const CAdditiveAnimationInfo& GetDefaultAdditiveInfo() const { return x38_defaultAdditiveInfo; }
const std::vector<std::pair<ResId, ResId>>& GetAnimResIds() const { return x50_animRes; }
const std::vector<std::pair<CAssetId, CAssetId>>& GetAnimResIds() const { return x50_animRes; }
};
}

View File

@ -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 {};
}

View File

@ -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<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;

View File

@ -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<TToken<CMorphableSkinnedModel>> iceModel;
if (charInfo.GetIceModelId() != kInvalidResId &&
charInfo.GetIceSkinRulesId() != kInvalidResId)
if (charInfo.GetIceModelId().IsValid() &&
charInfo.GetIceSkinRulesId().IsValid())
iceModel.emplace(const_cast<CCharacterFactory*>(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<ResId, ResId>& elem) -> bool
[&](const std::pair<CAssetId, CAssetId>& 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<CAnimSysContext>(

View File

@ -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<bool(const SObjectTag&)>& lambda) const;
void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const;
@ -52,8 +52,8 @@ private:
std::vector<TCachedToken<CAllFormatsAnimSource>> x30_animSourceDB;
std::vector<std::pair<u32, CAdditiveAnimationInfo>> x40_additiveInfo;
CAdditiveAnimationInfo x50_defaultAdditiveInfo;
std::vector<std::pair<ResId, ResId>> x58_animResources;
ResId x68_selfId;
std::vector<std::pair<CAssetId, CAssetId>> x58_animResources;
CAssetId x68_selfId;
CDummyFactory x6c_dummyFactory;
CSimplePool x70_cacheResPool;
@ -63,12 +63,12 @@ private:
const std::vector<CCharacterInfo>& chars);
public:
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, ResId);
CCharacterFactory(CSimplePool& store, const CAnimCharacterSet& ancs, CAssetId);
std::unique_ptr<CAnimData> CreateCharacter(int charIdx, bool loop,
const TLockedToken<CCharacterFactory>& 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;

View File

@ -15,18 +15,18 @@ class CCharacterInfo
public:
struct CParticleResData
{
std::vector<ResId> x0_part;
std::vector<ResId> x10_swhc;
std::vector<ResId> x20_elsc;
std::vector<ResId> x30_elsc;
std::vector<CAssetId> x0_part;
std::vector<CAssetId> x10_swhc;
std::vector<CAssetId> x20_elsc;
std::vector<CAssetId> 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<std::pair<u32, std::pair<std::string, std::string>>> x20_animInfo;
CPASDatabase x30_pasDatabase;
CParticleResData x44_partRes;
@ -34,8 +34,8 @@ private:
std::vector<std::pair<std::string, zeus::CAABox>> x88_aabbs;
std::vector<std::pair<std::string, std::vector<CEffectComponent>>> x98_effects;
ResId xa8_cmdlOverlay = 0;
ResId xac_cskrOverlay = 0;
CAssetId xa8_cmdlOverlay = 0;
CAssetId xac_cskrOverlay = 0;
std::vector<u32> 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<std::pair<std::string, zeus::CAABox>>& 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); }

View File

@ -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());

View File

@ -55,7 +55,7 @@ public:
private:
bool m_pc;
u32 x0_scratchSize;
ResId x4_evnt;
CAssetId x4_evnt;
TLockedToken<CAnimPOIData> x8_evntToken;
std::unique_ptr<u32[]> xc_rotsAndOffs;
float x10_averageVelocity;

View File

@ -99,13 +99,13 @@ const std::unique_ptr<CBooModel>& CModelData::PickStaticModel(EWhichModel which)
return m_normalModelInst;
}
void CModelData::SetXRayModel(const std::pair<ResId, ResId>& modelSkin)
void CModelData::SetXRayModel(const std::pair<CAssetId, CAssetId>& 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<ResId, ResId>& modelSkin)
}
}
void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
void CModelData::SetInfraModel(const std::pair<CAssetId, CAssetId>& 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}),

View File

@ -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<CBooModel>& PickStaticModel(EWhichModel which) const;
void SetXRayModel(const std::pair<ResId, ResId>& modelSkin);
void SetInfraModel(const std::pair<ResId, ResId>& modelSkin);
void SetXRayModel(const std::pair<CAssetId, CAssetId>& modelSkin);
void SetInfraModel(const std::pair<CAssetId, CAssetId>& modelSkin);
bool IsDefinitelyOpaque(EWhichModel);
bool GetIsLoop() const;
float GetAnimationDuration(int) const;

View File

@ -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<TLockedToken<CGenDescription>>(
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<TLockedToken<CSwooshDescription>>(
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 <class T, class U>
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;
}

View File

@ -17,9 +17,9 @@ class CCharLayoutInfo;
class CParticleDatabase
{
std::map<ResId, std::shared_ptr<TLockedToken<CGenDescription>>> x0_particleDescs;
std::map<ResId, std::shared_ptr<TLockedToken<CSwooshDescription>>> x14_swooshDescs;
std::map<ResId, std::shared_ptr<TLockedToken<CElectricDescription>>> x28_electricDescs;
std::map<CAssetId, std::shared_ptr<TLockedToken<CGenDescription>>> x0_particleDescs;
std::map<CAssetId, std::shared_ptr<TLockedToken<CSwooshDescription>>> x14_swooshDescs;
std::map<CAssetId, std::shared_ptr<TLockedToken<CElectricDescription>>> x28_electricDescs;
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x3c_rendererDrawLoop;
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x50_firstDrawLoop;
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x64_lastDrawLoop;

View File

@ -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; }

View File

@ -70,7 +70,7 @@ void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionRespons
CSimplePool* resPool)
{
int i = int(type);
std::vector<ResId> tracker;
std::vector<CAssetId> 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}));

View File

@ -20,8 +20,8 @@ CSkinnedModel::CSkinnedModel(TLockedToken<CModel> 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)
{

View File

@ -31,8 +31,8 @@ public:
TLockedToken<CSkinRules> skinRules,
TLockedToken<CCharLayoutInfo> 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<CModel>& GetModel() const {return x4_model;}
const std::unique_ptr<CBooModel>& 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);
};
}

View File

@ -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<CGuiWidget> CAuiEnergyBarT01::Create(CGuiFrame* frame, CInputStream& in, CSimplePool* sp)
{
CGuiWidgetParms parms = ReadWidgetHeader(frame, in);
ResId tex = in.readUint32Big();
CAssetId tex = in.readUint32Big();
std::shared_ptr<CGuiWidget> ret = std::make_shared<CAuiEnergyBarT01>(parms, sp, tex);
ret->ParseBaseInfo(frame, in, parms);
return ret;

View File

@ -21,7 +21,7 @@ public:
Insta
};
private:
ResId xb8_txtrId;
CAssetId xb8_txtrId;
TLockedToken<CTexture> xbc_tex; // Used to be optional
zeus::CColor xcc_emptyColor;
zeus::CColor xd0_filledColor;
@ -41,7 +41,7 @@ private:
CEnergyBarShader m_energyBarShader;
std::vector<CEnergyBarShader::Vertex> 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<zeus::CVector3f, zeus::CVector3f> DownloadBarCoordFunc(float t);
void Update(float dt);

View File

@ -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<zeus::CVector3f, 4>&& coords,
rstl::reserved_vector<zeus::CVector2f, 4>&& 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)

View File

@ -13,8 +13,8 @@ class CTexture;
class CAuiImagePane : public CGuiWidget
{
TLockedToken<CTexture> 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<zeus::CVector3f, 4> 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<zeus::CVector3f, 4>&& coords,
rstl::reserved_vector<zeus::CVector2f, 4>&& 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; }

View File

@ -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> CGuiFrame::CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp)
std::unique_ptr<CGuiFrame> CGuiFrame::CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp)
{
in.readInt32Big();
int a = in.readInt32Big();

View File

@ -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<CGuiHeadWidget> 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<CGuiFrame> CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp);
static std::unique_ptr<CGuiFrame> CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp);
};
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,

View File

@ -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<ResId> CGuiModel::GetModelAssets() const
std::vector<CAssetId> CGuiModel::GetModelAssets() const
{
return {x108_modelId};
}
@ -119,7 +119,7 @@ std::shared_ptr<CGuiWidget> 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();

View File

@ -12,13 +12,13 @@ class CSimplePool;
class CGuiModel : public CGuiWidget
{
TLockedToken<CModel> 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<ResId> GetModelAssets() const;
std::vector<CAssetId> GetModelAssets() const;
bool GetIsFinishedLoadingWidgetSpecific() const;
void Touch() const;
void Draw(const CGuiWidgetDrawParms& parms) const;

View File

@ -10,7 +10,7 @@ namespace urde
{
CGuiTextPane::CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim,
const zeus::CVector3f& vec, ResId fontId, const CGuiTextProperties& props,
const zeus::CVector3f& vec, CAssetId fontId, const CGuiTextProperties& props,
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
s32 extentX, s32 extentY)
: CGuiPane(parms, dim, vec), xd4_textSupport(fontId, props, fontCol, outlineCol,

View File

@ -12,7 +12,7 @@ class CGuiTextPane : public CGuiPane
CGuiTextSupport xd4_textSupport;
public:
CGuiTextPane(const CGuiWidgetParms& parms, CSimplePool* sp, const zeus::CVector2f& dim,
const zeus::CVector3f& vec, ResId fontId, const CGuiTextProperties& props,
const zeus::CVector3f& vec, CAssetId fontId, const CGuiTextProperties& props,
const zeus::CColor& col1, const zeus::CColor& col2, s32 padX, s32 padY);
FourCC GetWidgetTypeID() const { return FOURCC('TXPN'); }
@ -20,7 +20,7 @@ public:
const CGuiTextSupport& GetTextSupport() const { return xd4_textSupport; }
void Update(float dt);
bool GetIsFinishedLoadingWidgetSpecific() const;
std::vector<ResId> GetFontAssets() const { return {xd4_textSupport.x5c_fontId}; }
std::vector<CAssetId> GetFontAssets() const { return {xd4_textSupport.x5c_fontId}; }
void SetDimensions(const zeus::CVector2f& dim, bool initVBO);
void ScaleDimensions(const zeus::CVector3f& scale);
void Draw(const CGuiWidgetDrawParms& parms) const;

View File

@ -11,7 +11,7 @@
namespace urde
{
CGuiTextSupport::CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
CGuiTextSupport::CGuiTextSupport(CAssetId fontId, const CGuiTextProperties& props,
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
const zeus::CColor& geomCol, s32 padX, s32 padY, CSimplePool* store,
CGuiWidget::EGuiModelDrawFlags drawFlags)
@ -144,8 +144,8 @@ void CGuiTextSupport::CheckAndRebuildTextBuffer()
g_TextExecuteBuf->AddColor(EColorType::Outline, x28_outlineColor);
std::u16string initStr;
if (x5c_fontId != kInvalidResId)
initStr = hecl::Char16Format(L"&font=%08X;", u32(x5c_fontId));
if (x5c_fontId.IsValid())
initStr = hecl::Char16Format(L"&font=%08X;", u32(x5c_fontId.Value()));
initStr += x0_string;
g_TextParser->ParseText(*g_TextExecuteBuf, initStr.c_str(), initStr.size(), x14_props.xc_txtrMap);
@ -308,7 +308,7 @@ bool CGuiTextSupport::GetIsTextSupportFinishedLoading() const
return _GetIsTextSupportFinishedLoading();
}
void CGuiTextSupport::SetControlTXTRMap(const std::vector<std::pair<ResId, ResId>>* txtrMap)
void CGuiTextSupport::SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap)
{
if (x14_props.xc_txtrMap != txtrMap)
{

View File

@ -67,11 +67,11 @@ class CGuiTextProperties
bool x1_horizontal;
EJustification x4_justification;
EVerticalJustification x8_vertJustification;
const std::vector<std::pair<ResId, ResId>>* xc_txtrMap;
const std::vector<std::pair<CAssetId, CAssetId>>* xc_txtrMap;
public:
CGuiTextProperties(bool wordWrap, bool horizontal, EJustification justification,
EVerticalJustification vertJustification,
const std::vector<std::pair<ResId, ResId>>* txtrMap=nullptr)
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap=nullptr)
: x0_wordWrap(wordWrap), x1_horizontal(horizontal), x4_justification(justification),
x8_vertJustification(vertJustification), xc_txtrMap(txtrMap) {}
};
@ -93,7 +93,7 @@ class CGuiTextSupport
bool x50_typeEnable = false;
float x54_chFadeTime = 0.1f;
float x58_chRate = 10.0f;
ResId x5c_fontId = kInvalidResId;
CAssetId x5c_fontId;
CGuiWidget::EGuiModelDrawFlags m_drawFlags;
std::experimental::optional<CTextRenderBuffer> x60_renderBuf;
std::vector<CToken> x2bc_assets;
@ -108,7 +108,7 @@ class CGuiTextSupport
bool _GetIsTextSupportFinishedLoading() const;
public:
CGuiTextSupport(ResId fontId, const CGuiTextProperties& props,
CGuiTextSupport(CAssetId fontId, const CGuiTextProperties& props,
const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store,
CGuiWidget::EGuiModelDrawFlags drawFlags);
@ -139,7 +139,7 @@ public:
float GetCurTime() const { return x3c_curTime; }
void SetCurTime(float t) { x3c_curTime = t; }
const std::u16string& GetString() const { return x0_string; }
void SetControlTXTRMap(const std::vector<std::pair<ResId, ResId>>* txtrMap);
void SetControlTXTRMap(const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
int GetPageCounter() const { return x304_pageCounter; }
int GetTotalPageCount();
void SetPage(int page);

View File

@ -248,7 +248,7 @@ void CScanDisplay::StartScan(TUniqueId id, const CScannableObjectInfo& scanInfo,
}
}
ResId strId = x14_scannableInfo->GetStringTableId();
CAssetId strId = x14_scannableInfo->GetStringTableId();
if (strId != -1)
x194_scanStr = g_SimplePool->GetObj({FOURCC('STRG'), strId});

View File

@ -92,7 +92,7 @@ bool CTextParser::BeginsWith(const char16_t* str, int len, const char16_t* other
}
void CTextParser::ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap)
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap)
{
if (BeginsWith(str, len, u"font="))
{
@ -198,7 +198,7 @@ void CTextParser::ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len
}
CFontImageDef CTextParser::GetImage(const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap)
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap)
{
int commaCount = 0;
for (int i=0 ; i<len ; ++i)
@ -297,14 +297,14 @@ CFontImageDef CTextParser::GetImage(const char16_t* str, int len,
return CFontImageDef(tex, zeus::CVector2f(1.f, 1.f));
}
ResId CTextParser::GetAssetIdFromString(const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap)
CAssetId CTextParser::GetAssetIdFromString(const char16_t* str, int len,
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap)
{
u8 r = GetColorValue(str);
u8 g = GetColorValue(str + 2);
u8 b = GetColorValue(str + 4);
u8 a = GetColorValue(str + 6);
ResId id = ((r << 24) | (g << 16) | (b << 8) | a) & 0xffffffff;
CAssetId id = ((r << 24) | (g << 16) | (b << 8) | a) & 0xffffffff;
if (len == 16)
{
@ -312,13 +312,13 @@ ResId CTextParser::GetAssetIdFromString(const char16_t* str, int len,
g = GetColorValue(str + 10);
b = GetColorValue(str + 12);
a = GetColorValue(str + 14);
id = (id << 32) | (((r << 24) | (g << 16) | (b << 8) | a) & 0xffffffff);
id = (id.Value() << 32) | (((r << 24) | (g << 16) | (b << 8) | a) & 0xffffffff);
}
if (txtrMap)
{
auto search = rstl::binary_find(txtrMap->begin(), txtrMap->end(), id,
[](const std::pair<ResId, ResId>& a) { return a.first; });
[](const std::pair<CAssetId, CAssetId>& a) { return a.first; });
if (search != txtrMap->end())
id = search->second;
}
@ -332,7 +332,7 @@ TToken<CRasterFont> CTextParser::GetFont(const char16_t* str, int len)
}
void CTextParser::ParseText(CTextExecuteBuffer& out, const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap)
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap)
{
int b=0, e=0;
for (b=0, e=0 ; str[e] && (len == -1 || e < len) ;)

View File

@ -16,20 +16,20 @@ class CTextParser
static u8 GetColorValue(const char16_t* str);
static u32 FromHex(char16_t ch);
static s32 ParseInt(const char16_t* str, int len, bool signVal);
static ResId GetAssetIdFromString(const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap);
static CAssetId GetAssetIdFromString(const char16_t* str, int len,
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
static bool Equals(const char16_t* str, int len, const char16_t* other);
static bool BeginsWith(const char16_t* str, int len, const char16_t* other);
void ParseTag(CTextExecuteBuffer& out, const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap);
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
CFontImageDef GetImage(const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap);
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
TToken<CRasterFont> GetFont(const char16_t* str, int len);
public:
CTextParser(IObjectStore& store) : x0_store(store) {}
void ParseText(CTextExecuteBuffer& out, const char16_t* str, int len,
const std::vector<std::pair<ResId, ResId>>* txtrMap);
const std::vector<std::pair<CAssetId, CAssetId>>* txtrMap);
};
}

View File

@ -30,7 +30,7 @@ public:
virtual void CancelBuild(const SObjectTag&)=0;
virtual bool CanBuild(const SObjectTag&)=0;
virtual const SObjectTag* GetResourceIdByName(const char*) const=0;
virtual FourCC GetResourceTypeById(ResId id) const=0;
virtual FourCC GetResourceTypeById(CAssetId id) const=0;
virtual void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const=0;
virtual void EnumerateNamedResources(const std::function<bool(const std::string&, const SObjectTag&)>& lambda) const=0;
@ -43,8 +43,8 @@ public:
virtual void GetTagListForFile(const char* pakName, std::vector<SObjectTag>& out) const {}
virtual ResId TranslateOriginalToNew(ResId id) const { return -1; }
virtual ResId TranslateNewToOriginal(ResId id) const { return -1; }
virtual CAssetId TranslateOriginalToNew(CAssetId id) const { return -1; }
virtual CAssetId TranslateNewToOriginal(CAssetId id) const { return -1; }
};
}

View File

@ -42,6 +42,7 @@ public:
virtual void Shutdown()=0;
virtual boo::IWindow* GetMainWindow() const=0;
virtual void SetFlowState(EFlowState) = 0;
virtual size_t GetExpectedIdSize() const = 0;
};
}

View File

@ -25,7 +25,7 @@ static const char* ArtifactPieceModels[] =
"CMDL_Piece12" // Newborn
};
static const ResId ArtifactHeadScans[] =
static const CAssetId ArtifactHeadScans[] =
{
0x32C9DDCE, // Truth
0xB45DAF60, // Strength
@ -55,16 +55,16 @@ CArtifactDoll::CArtifactDoll()
x0_models.push_back(g_SimplePool->GetObj(ArtifactPieceModels[i]));
}
int CArtifactDoll::GetArtifactHeadScanIndex(ResId scanId)
int CArtifactDoll::GetArtifactHeadScanIndex(CAssetId scanId)
{
ResId orig = g_ResFactory->TranslateNewToOriginal(scanId);
CAssetId orig = g_ResFactory->TranslateNewToOriginal(scanId);
for (int i=0 ; i<12 ; ++i)
if (ArtifactHeadScans[i] == orig)
return i;
return -1;
}
ResId CArtifactDoll::GetArtifactHeadScanFromItemType(CPlayerState::EItemType item)
CAssetId CArtifactDoll::GetArtifactHeadScanFromItemType(CPlayerState::EItemType item)
{
if (item < CPlayerState::EItemType::ArtifactOfTruth || item > CPlayerState::EItemType::ArtifactOfNewborn)
return -1;
@ -78,7 +78,7 @@ void CArtifactDoll::UpdateArtifactHeadScan(const CStateManager& mgr, float delta
{
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType(i + 29)))
{
ResId newId = g_ResFactory->TranslateOriginalToNew(ArtifactHeadScans[i]);
CAssetId newId = g_ResFactory->TranslateOriginalToNew(ArtifactHeadScans[i]);
playerState.SetScanTime(newId, std::min(playerState.GetScanTime(newId) + delta, 1.f));
}
}
@ -115,7 +115,7 @@ void CArtifactDoll::Draw(float alpha, const CStateManager& mgr,
{
if (ArtifactHeadScans[i] != -1)
{
ResId newId = g_ResFactory->TranslateOriginalToNew(ArtifactHeadScans[i]);
CAssetId newId = g_ResFactory->TranslateOriginalToNew(ArtifactHeadScans[i]);
float interp = (playerState.GetScanTime(newId) - 0.5f) * 2.f;
if (interp < 0.5f)
color = zeus::CColor::lerp(ArtifactPreColor, zeus::CColor::skWhite, 2.f * interp);

View File

@ -22,8 +22,8 @@ class CArtifactDoll
void UpdateActorLights();
public:
CArtifactDoll();
static int GetArtifactHeadScanIndex(ResId scanId);
static ResId GetArtifactHeadScanFromItemType(CPlayerState::EItemType item);
static int GetArtifactHeadScanIndex(CAssetId scanId);
static CAssetId GetArtifactHeadScanFromItemType(CPlayerState::EItemType item);
static void UpdateArtifactHeadScan(const CStateManager& mgr, float delta);
static void CompleteArtifactHeadScan(const CStateManager& mgr);
void Draw(float alpha, const CStateManager& mgr, bool inArtifactCategory, int selectedArtifact);

View File

@ -14,7 +14,7 @@ CFaceplateDecoration::CFaceplateDecoration(CStateManager& stateMgr) {}
void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr)
{
ResId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
CAssetId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
if (txtrId == -1)
{
if (xc_ready)

View File

@ -13,7 +13,7 @@ namespace MP1
class CFaceplateDecoration
{
ResId x0_id;
CAssetId x0_id;
TToken<CTexture> x4_tex;
bool xc_ready = false;
std::experimental::optional<CTexturedQuadFilter> m_texFilter;

View File

@ -722,7 +722,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
}
}
void CInGameGuiManager::ShowPauseGameHudMessage(CStateManager& stateMgr, ResId pauseMsg, float time)
void CInGameGuiManager::ShowPauseGameHudMessage(CStateManager& stateMgr, CAssetId pauseMsg, float time)
{
x124_pauseGameHudMessage = pauseMsg;
x128_pauseGameHudTime = time;

View File

@ -73,7 +73,7 @@ private:
std::vector<u32> xd8_;
std::vector<CToken> xe8_pauseResources;
CCameraFilterPass<CColoredQuadFilter> xf8_camFilter;
ResId x124_pauseGameHudMessage = -1;
CAssetId x124_pauseGameHudMessage = -1;
float x128_pauseGameHudTime = 0.f;
std::list<CToken> x12c_;
u32 x140_ = 0;
@ -138,7 +138,7 @@ public:
CArchitectureQueue& archQueue);
void PreDraw(CStateManager& stateMgr, bool cameraActive);
void Draw(CStateManager& stateMgr);
void ShowPauseGameHudMessage(CStateManager& stateMgr, ResId pauseMsg, float time);
void ShowPauseGameHudMessage(CStateManager& stateMgr, CAssetId pauseMsg, float time);
void PauseGame(CStateManager& stateMgr, EInGameGuiState state);
void StartFadeIn();
bool WasInGame() const { return x1bc_prevState >= EInGameGuiState::Zero && x1bc_prevState <= EInGameGuiState::InGame; }

View File

@ -29,7 +29,7 @@ CLogBookScreen::~CLogBookScreen()
CMain::EnsureWorldPakReady(g_GameState->CurrentWorldAssetId());
}
bool CLogBookScreen::IsScanComplete(CSaveWorld::EScanCategory category, ResId scan,
bool CLogBookScreen::IsScanComplete(CSaveWorld::EScanCategory category, CAssetId scan,
const CPlayerState& playerState)
{
float time = playerState.GetScanTime(scan);
@ -45,7 +45,7 @@ void CLogBookScreen::InitializeLogBook()
x19c_scanCompletes[i].reserve(g_MemoryCardSys->GetScanCategoryCount(CSaveWorld::EScanCategory(i + 1)));
CPlayerState& playerState = *x4_mgr.GetPlayerState();
for (const std::pair<ResId, CSaveWorld::EScanCategory>& scanState : g_MemoryCardSys->GetScanStates())
for (const std::pair<CAssetId, CSaveWorld::EScanCategory>& scanState : g_MemoryCardSys->GetScanStates())
{
if (scanState.second == CSaveWorld::EScanCategory::None)
continue;
@ -54,14 +54,14 @@ void CLogBookScreen::InitializeLogBook()
}
std::sort(x19c_scanCompletes[4].begin(), x19c_scanCompletes[4].end(),
[](const std::pair<ResId, bool>& a, std::pair<ResId, bool>& b)
[](const std::pair<CAssetId, bool>& a, std::pair<CAssetId, bool>& b)
{
return CArtifactDoll::GetArtifactHeadScanIndex(a.first) <
CArtifactDoll::GetArtifactHeadScanIndex(b.first);
});
auto viewIt = x200_viewScans.begin();
for (std::vector<std::pair<ResId, bool>>& category : x19c_scanCompletes)
for (std::vector<std::pair<CAssetId, bool>>& category : x19c_scanCompletes)
{
std::vector<std::pair<TLockedToken<CScannableObjectInfo>,
TLockedToken<CStringTable>>>& viewScans = *viewIt++;
@ -75,7 +75,7 @@ void CLogBookScreen::InitializeLogBook()
void CLogBookScreen::UpdateRightTitles()
{
std::vector<std::pair<ResId, bool>>& category =
std::vector<std::pair<CAssetId, bool>>& category =
x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
for (int i=0 ; xd8_textpane_titles.size() ; ++i)
{
@ -184,7 +184,7 @@ void CLogBookScreen::PumpArticleLoad()
bool CLogBookScreen::IsScanCategoryReady(CSaveWorld::EScanCategory category) const
{
CPlayerState& playerState = *x4_mgr.GetPlayerState();
for (const std::pair<ResId, CSaveWorld::EScanCategory>& scanState : g_MemoryCardSys->GetScanStates())
for (const std::pair<CAssetId, CSaveWorld::EScanCategory>& scanState : g_MemoryCardSys->GetScanStates())
{
if (scanState.second != category)
continue;
@ -454,9 +454,9 @@ void CLogBookScreen::UpdateRightTable()
{
CPauseScreenBase::UpdateRightTable();
x1f0_curViewScans.clear();
std::vector<std::pair<ResId, bool>>& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
std::vector<std::pair<CAssetId, bool>>& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
x1f0_curViewScans.reserve(category.size());
for (std::pair<ResId, bool>& scan : category)
for (std::pair<CAssetId, bool>& scan : category)
x1f0_curViewScans.push_back(std::make_pair(g_SimplePool->GetObj({FOURCC('SCAN'), scan.first}),
TLockedToken<CStringTable>{}));

View File

@ -12,7 +12,7 @@ namespace MP1
class CLogBookScreen : public CPauseScreenBase
{
rstl::reserved_vector<std::vector<std::pair<ResId, bool>>, 5> x19c_scanCompletes;
rstl::reserved_vector<std::vector<std::pair<CAssetId, bool>>, 5> x19c_scanCompletes;
std::vector<std::pair<TCachedToken<CScannableObjectInfo>,
TCachedToken<CStringTable>>> x1f0_curViewScans;
rstl::reserved_vector<std::vector<std::pair<TLockedToken<CScannableObjectInfo>,
@ -48,7 +48,7 @@ class CLogBookScreen : public CPauseScreenBase
int NextSurroundingArticleIndex(int cur) const;
bool IsArtifactCategorySelected() const;
int GetSelectedArtifactHeadScanIndex() const;
static bool IsScanComplete(CSaveWorld::EScanCategory category, ResId scan, const CPlayerState& playerState);
static bool IsScanComplete(CSaveWorld::EScanCategory category, CAssetId scan, const CPlayerState& playerState);
public:
CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);

View File

@ -288,13 +288,13 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
case EFlowState::Default:
case EFlowState::StateSetter:
{
ResId mlvlId = g_GameState->CurrentWorldAssetId();
CAssetId mlvlId = g_GameState->CurrentWorldAssetId();
if (g_MemoryCardSys->HasSaveWorldMemory(mlvlId))
{
const CSaveWorldMemory& savwMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
if (savwMem.GetWorldNameId() != -1)
{
ResId wtMgrFont = g_ResFactory->TranslateOriginalToNew(0xB7BBD0B4);
CAssetId wtMgrFont = g_ResFactory->TranslateOriginalToNew(0xB7BBD0B4);
g_GameState->GetWorldTransitionManager()->EnableTransition(wtMgrFont,
savwMem.GetWorldNameId(),
1, false, 0.1f, 16.f, 1.f);

View File

@ -148,8 +148,8 @@ void CMemoryCardDriver::SGameFileSlot::LoadGameState(u32 idx)
CMemoryCardDriver::SFileInfo::SFileInfo(kabufuda::ECardSlot port, const std::string& name)
: x0_fileInfo(port), x14_name(name) {}
CMemoryCardDriver::CMemoryCardDriver(kabufuda::ECardSlot cardPort, ResId saveBanner,
ResId saveIcon0, ResId saveIcon1, bool importPersistent)
CMemoryCardDriver::CMemoryCardDriver(kabufuda::ECardSlot cardPort, CAssetId saveBanner,
CAssetId saveIcon0, CAssetId saveIcon1, bool importPersistent)
: x0_cardPort(cardPort), x4_saveBanner(saveBanner),
x8_saveIcon0(saveIcon0), xc_saveIcon1(saveIcon1), x19d_importPersistent(importPersistent)
{

View File

@ -124,9 +124,9 @@ private:
};
kabufuda::ECardSlot x0_cardPort;
ResId x4_saveBanner;
ResId x8_saveIcon0;
ResId xc_saveIcon1;
CAssetId x4_saveBanner;
CAssetId x8_saveIcon0;
CAssetId xc_saveIcon1;
EState x10_state = EState::Initial;
EError x14_error = EError::OK;
s32 x18_cardFreeBytes = 0;
@ -142,8 +142,8 @@ private:
bool x19d_importPersistent;
public:
CMemoryCardDriver(kabufuda::ECardSlot cardPort, ResId saveBanner,
ResId saveIcon0, ResId saveIcon1, bool importPersistent);
CMemoryCardDriver(kabufuda::ECardSlot cardPort, CAssetId saveBanner,
CAssetId saveIcon0, CAssetId saveIcon1, bool importPersistent);
void NoCardFound();
const CGameState::GameFileStateInfo* GetGameFileStateInfo(int idx);

View File

@ -13,7 +13,7 @@ namespace urde
namespace MP1
{
CMessageScreen::CMessageScreen(ResId msg, float delayTime)
CMessageScreen::CMessageScreen(CAssetId msg, float delayTime)
: x74_delayTime(delayTime)
{
x78_24_exit = false;

View File

@ -40,7 +40,7 @@ class CMessageScreen
float x74_delayTime;
bool x78_24_exit : 1;
public:
CMessageScreen(ResId msg, float time);
CMessageScreen(CAssetId msg, float time);
void ProcessControllerInput(const CFinalInput& input);
bool Update(float dt, float blurAmt);
void Draw() const;

View File

@ -206,11 +206,11 @@ void CPauseScreen::ProcessControllerInput(const CStateManager& mgr, const CFinal
}
}
x38_textpane_l1->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[input.DLTrigger()])));
x3c_textpane_r->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger()])));
x48_textpane_return->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart()])));
x50_textpane_back->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA()])));
x4c_textpane_next->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB()])));
x38_textpane_l1->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x74_lTrigger[input.DLTrigger()].Value())));
x3c_textpane_r->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x80_rTrigger[input.DRTrigger()].Value())));
x48_textpane_return->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x8c_startButton[input.DStart()].Value())));
x50_textpane_back->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->x98_aButton[input.DA()].Value())));
x4c_textpane_next->TextSupport().SetText(hecl::Format("&image=%8.8X;", u32(g_tweakPlayerRes->xa4_bButton[input.DB()].Value())));
}
void CPauseScreen::TransitionComplete()

View File

@ -42,7 +42,7 @@ private:
CGuiTextPane* x48_textpane_return = nullptr;
CGuiTextPane* x4c_textpane_next = nullptr;
CGuiTextPane* x50_textpane_back = nullptr;
ResId x54_frmePauseScreenId;
CAssetId x54_frmePauseScreenId;
u32 x58_frmePauseScreenBufSz;
std::unique_ptr<u8[]> x5c_frmePauseScreenBuf;
std::shared_ptr<ProjectResourceFactoryBase::AsyncTask> x60_loadTok;

View File

@ -59,7 +59,7 @@ void CPauseScreenBase::InitializeFrameGlue()
x184_textpane_yicon = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_yicon"));
x188_textpane_ytext = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_ytext"));
x184_textpane_yicon->TextSupport().SetText(hecl::UTF8ToChar16(hecl::Format("&image=%8.8X;",
u32(g_tweakPlayerRes->xbc_yButton[0]))));
u32(g_tweakPlayerRes->xbc_yButton[0].Value()))));
x188_textpane_ytext->TextSupport().SetText(xc_pauseStrg.GetString(99));
x188_textpane_ytext->SetColor(g_tweakGuiColors->GetPauseItemAmberColor());
x18c_slidergroup_slider = static_cast<CGuiSliderGroup*>(x8_frame.FindWidget("slidergroup_slider"));

View File

@ -1824,7 +1824,7 @@ void CSamusHud::SetMessage(const std::u16string& text, const CHUDMemoParms& info
}
}
void CSamusHud::InternalDeferHintMemo(ResId strg, u32 strgIdx, const CHUDMemoParms& info)
void CSamusHud::InternalDeferHintMemo(CAssetId strg, u32 strgIdx, const CHUDMemoParms& info)
{
x548_hudMemoParms = info;
x550_hudMemoString = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), strg});

View File

@ -277,12 +277,12 @@ public:
SetMessage(text, info);
}
void SetMessage(const std::u16string& text, const CHUDMemoParms& info);
static void DeferHintMemo(ResId strg, u32 strgIdx, const CHUDMemoParms& info)
static void DeferHintMemo(CAssetId strg, u32 strgIdx, const CHUDMemoParms& info)
{
if (g_SamusHud)
g_SamusHud->InternalDeferHintMemo(strg, strgIdx, info);
}
void InternalDeferHintMemo(ResId strg, u32 strgIdx, const CHUDMemoParms& info);
void InternalDeferHintMemo(CAssetId strg, u32 strgIdx, const CHUDMemoParms& info);
CGuiFrame* GetBaseHudFrame() const { return x274_loadedFrmeBaseHud; }
};

View File

@ -685,7 +685,7 @@ CSaveGameScreen::CSaveGameScreen(ESaveContext saveCtx, u64 serial)
x93_inGame = bool(saveCtx);
x70_saveWorlds.reserve(g_MemoryCardSys->GetMemoryWorlds().size());
for (const std::pair<ResId, CSaveWorldMemory>& wld : g_MemoryCardSys->GetMemoryWorlds())
for (const std::pair<CAssetId, CSaveWorldMemory>& wld : g_MemoryCardSys->GetMemoryWorlds())
{
x70_saveWorlds.push_back(
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), wld.second.GetSaveWorldAssetId()}));

Some files were not shown because too many files have changed in this diff Show More