Fix IGetAreaId and rename GetAreaId to GetAreaIndex

This commit is contained in:
Phillip Stephens 2020-10-20 03:03:11 -07:00
parent 3ffa15cfa3
commit a8d8eb0dde
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
7 changed files with 18 additions and 18 deletions

View File

@ -2004,7 +2004,7 @@ void CStateManager::UpdateAreaSounds() {
occState = area.GetOcclusionState(); occState = area.GetOcclusionState();
} }
if (occState == CGameArea::EOcclusionState::Visible) { if (occState == CGameArea::EOcclusionState::Visible) {
areas.push_back(area.GetAreaId()); areas.push_back(area.GetAreaIndex());
} }
} }
CSfxManager::SetActiveAreas(areas); CSfxManager::SetActiveAreas(areas);

View File

@ -183,7 +183,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
} }
zeus::CVector3f vec; zeus::CVector3f vec;
if (!x298_24_dirty && x294_aid == area.GetAreaId()) { if (!x298_24_dirty && x294_aid == area.GetAreaIndex()) {
/* Early return if not ready for update */ /* Early return if not ready for update */
if (mgr.GetInputFrameIdx() - x2a4_lastUpdateFrame < x2a8_areaUpdateFramePeriod) if (mgr.GetInputFrameIdx() - x2a4_lastUpdateFrame < x2a8_areaUpdateFramePeriod)
return false; return false;
@ -193,7 +193,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
return false; return false;
x2c0_lastActorPos = vec; x2c0_lastActorPos = vec;
} else { } else {
if (x294_aid != area.GetAreaId()) if (x294_aid != area.GetAreaIndex())
x2d8_brightLightIdx = -1; x2d8_brightLightIdx = -1;
x2a4_lastUpdateFrame = sFrameSchedulerCount + mgr.GetInputFrameIdx(); x2a4_lastUpdateFrame = sFrameSchedulerCount + mgr.GetInputFrameIdx();
vec = aabb.center() + x2ac_actorPosBias; vec = aabb.center() + x2ac_actorPosBias;
@ -203,7 +203,7 @@ bool CActorLights::BuildAreaLightList(const CStateManager& mgr, const CGameArea&
/* Reset lighting state */ /* Reset lighting state */
x2d4_worldLightingLevel = worldLightingLevel; x2d4_worldLightingLevel = worldLightingLevel;
x298_24_dirty = false; x298_24_dirty = false;
x294_aid = area.GetAreaId(); x294_aid = area.GetAreaIndex();
x29c_shadowLightArrIdx = -1; x29c_shadowLightArrIdx = -1;
x288_ambientColor = zeus::skClear; x288_ambientColor = zeus::skClear;

View File

@ -306,7 +306,7 @@ CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion) {
aabb.readBoundingBoxBig(in); aabb.readBoundingBoxBig(in);
xc_mrea = in.readUint32Big(); xc_mrea = in.readUint32Big();
if (mlvlVersion > 15) if (mlvlVersion > 15)
x10_areaId = in.readUint32Big(); x10_areaId = CAssetId(in);
u32 attachAreaCount = in.readUint32Big(); u32 attachAreaCount = in.readUint32Big();
x44_attachedAreaIndices.reserve(attachAreaCount); x44_attachedAreaIndices.reserve(attachAreaCount);
@ -332,7 +332,7 @@ std::pair<std::unique_ptr<u8[]>, s32> CDummyGameArea::IGetScriptingMemoryAlways(
return GetScriptingMemoryAlways(*this); return GetScriptingMemoryAlways(*this);
} }
TAreaId CDummyGameArea::IGetAreaId() const { return x10_areaId; } CAssetId CDummyGameArea::IGetAreaId() const { return x10_areaId; }
CAssetId CDummyGameArea::IGetAreaAssetId() const { return xc_mrea; } CAssetId CDummyGameArea::IGetAreaAssetId() const { return xc_mrea; }
@ -354,9 +354,9 @@ CGameArea::CGameArea(CInputStream& in, int idx, int mlvlVersion) : x4_selfIdx(id
x84_mrea = in.readUint32Big(); x84_mrea = in.readUint32Big();
if (mlvlVersion > 15) if (mlvlVersion > 15)
x88_areaId = in.readInt32Big(); x88_areaId = CAssetId(in);
else else
x88_areaId = -1; x88_areaId = CAssetId();
const u32 attachedCount = in.readUint32Big(); const u32 attachedCount = in.readUint32Big();
x8c_attachedAreaIndices.reserve(attachedCount); x8c_attachedAreaIndices.reserve(attachedCount);
@ -782,7 +782,7 @@ bool CGameArea::Invalidate(CStateManager* mgr) {
} }
if (mgr) if (mgr)
mgr->PrepareAreaUnload(GetAreaId()); mgr->PrepareAreaUnload(GetAreaIndex());
#if 0 #if 0
dword_805a8eb0 -= GetPostConstructedSize(); dword_805a8eb0 -= GetPostConstructedSize();
@ -797,7 +797,7 @@ bool CGameArea::Invalidate(CStateManager* mgr) {
KillmAreaData(); KillmAreaData();
ClearTokenList(); ClearTokenList();
if (mgr) if (mgr)
mgr->AreaUnloaded(GetAreaId()); mgr->AreaUnloaded(GetAreaIndex());
return true; return true;
} }

View File

@ -47,7 +47,7 @@ class CDummyGameArea final : public IGameArea {
int x4_mlvlVersion; int x4_mlvlVersion;
CAssetId x8_nameSTRG; CAssetId x8_nameSTRG;
CAssetId xc_mrea; CAssetId xc_mrea;
TAreaId x10_areaId; CAssetId x10_areaId;
zeus::CTransform x14_transform; zeus::CTransform x14_transform;
std::vector<u16> x44_attachedAreaIndices; std::vector<u16> x44_attachedAreaIndices;
std::vector<Dock> x54_docks; std::vector<Dock> x54_docks;
@ -56,7 +56,7 @@ public:
CDummyGameArea(CInputStream& in, int idx, int mlvlVersion); CDummyGameArea(CInputStream& in, int idx, int mlvlVersion);
std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const override; std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const override;
TAreaId IGetAreaId() const override; CAssetId IGetAreaId() const override;
CAssetId IGetAreaAssetId() const override; CAssetId IGetAreaAssetId() const override;
bool IIsActive() const override; bool IIsActive() const override;
TAreaId IGetAttachedAreaId(int) const override; TAreaId IGetAttachedAreaId(int) const override;
@ -278,8 +278,8 @@ public:
void SetLoadPauseState(bool paused); void SetLoadPauseState(bool paused);
std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const override; std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const override;
TAreaId GetAreaId() const { return x4_selfIdx; } CAssetId GetAreaIndex() const { return x4_selfIdx; }
TAreaId IGetAreaId() const override { return x4_selfIdx; } CAssetId IGetAreaId() const override { return x88_areaId; }
CAssetId IGetAreaAssetId() const override { return x84_mrea; } CAssetId IGetAreaAssetId() const override { return x84_mrea; }
bool IIsActive() const override; bool IIsActive() const override;
TAreaId IGetAttachedAreaId(int) const override; TAreaId IGetAttachedAreaId(int) const override;

View File

@ -16,7 +16,7 @@ void CMorphBallShadow::GatherAreas(const CStateManager& mgr) {
if (area.IsPostConstructed()) if (area.IsPostConstructed())
occState = area.GetPostConstructed()->x10dc_occlusionState; occState = area.GetPostConstructed()->x10dc_occlusionState;
if (occState == CGameArea::EOcclusionState::Visible) if (occState == CGameArea::EOcclusionState::Visible)
x18_areas.push_back(area.GetAreaId()); x18_areas.push_back(area.GetAreaIndex());
} }
} }
@ -105,7 +105,7 @@ bool CMorphBallShadow::AreasValid(const CStateManager& mgr) const {
continue; continue;
if (it == x18_areas.end()) if (it == x18_areas.end())
return false; return false;
if (*it != area.GetAreaId()) if (*it != area.GetAreaIndex())
return false; return false;
++it; ++it;
} }

View File

@ -364,7 +364,7 @@ CScriptDoor::EDoorOpenCondition CScriptDoor::GetDoorOpenCondition(CStateManager&
} }
for (const CGameArea& aliveArea : *world) { for (const CGameArea& aliveArea : *world) {
if (aliveArea.GetAreaId() == area->GetAreaId()) { if (aliveArea.GetAreaIndex() == area->GetAreaIndex()) {
continue; continue;
} }

View File

@ -49,7 +49,7 @@ public:
}; };
virtual std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const = 0; virtual std::pair<std::unique_ptr<u8[]>, s32> IGetScriptingMemoryAlways() const = 0;
virtual TAreaId IGetAreaId() const = 0; virtual CAssetId IGetAreaId() const = 0;
virtual CAssetId IGetAreaAssetId() const = 0; virtual CAssetId IGetAreaAssetId() const = 0;
virtual bool IIsActive() const = 0; virtual bool IIsActive() const = 0;
virtual TAreaId IGetAttachedAreaId(int) const = 0; virtual TAreaId IGetAttachedAreaId(int) const = 0;