mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 17:04:55 +00:00
Refactor ResId into CAssetId
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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&);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user