mirror of https://github.com/AxioDL/metaforce.git
Attempt 4 to fix ScriptLayerController for Tom
This commit is contained in:
parent
528c96b2c0
commit
b963ce1e85
|
@ -35,7 +35,7 @@ bool CSaveWorldIntermediate::InitializePump() {
|
||||||
xc_areaIds.reserve(areaCount);
|
xc_areaIds.reserve(areaCount);
|
||||||
for (u32 i = 0; i < areaCount; ++i) {
|
for (u32 i = 0; i < areaCount; ++i) {
|
||||||
const IGameArea* area = wld.IGetAreaAlways(i);
|
const IGameArea* area = wld.IGetAreaAlways(i);
|
||||||
xc_areaIds.emplace_back(area->IGetAreaId());
|
xc_areaIds.emplace_back(area->IGetAreaSaveId());
|
||||||
}
|
}
|
||||||
|
|
||||||
CAssetId mlvlId = wld.IGetWorldAssetId();
|
CAssetId mlvlId = wld.IGetWorldAssetId();
|
||||||
|
|
|
@ -24,7 +24,7 @@ class CSaveWorldMemory {
|
||||||
CAssetId x0_strgId;
|
CAssetId x0_strgId;
|
||||||
CAssetId x4_savwId;
|
CAssetId x4_savwId;
|
||||||
u32 x8_areaCount;
|
u32 x8_areaCount;
|
||||||
std::vector<CAssetId> xc_areaIds;
|
std::vector<s32> xc_areaIds;
|
||||||
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
||||||
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
|
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
|
||||||
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */
|
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */
|
||||||
|
@ -48,7 +48,7 @@ class CSaveWorldIntermediate {
|
||||||
CAssetId x0_mlvlId;
|
CAssetId x0_mlvlId;
|
||||||
CAssetId x4_strgId;
|
CAssetId x4_strgId;
|
||||||
CAssetId x8_savwId;
|
CAssetId x8_savwId;
|
||||||
std::vector<CAssetId> xc_areaIds;
|
std::vector<s32> xc_areaIds;
|
||||||
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
|
||||||
std::unique_ptr<CDummyWorld> x2c_dummyWorld;
|
std::unique_ptr<CDummyWorld> x2c_dummyWorld;
|
||||||
TLockedToken<CSaveWorld> x34_saveWorld; /* Used to be auto_ptr */
|
TLockedToken<CSaveWorld> x34_saveWorld; /* Used to be auto_ptr */
|
||||||
|
|
|
@ -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.GetAreaIndex());
|
areas.push_back(area.GetAreaId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CSfxManager::SetActiveAreas(areas);
|
CSfxManager::SetActiveAreas(areas);
|
||||||
|
|
|
@ -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.GetAreaIndex()) {
|
if (!x298_24_dirty && x294_aid == area.GetAreaId()) {
|
||||||
/* 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.GetAreaIndex())
|
if (x294_aid != area.GetAreaId())
|
||||||
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.GetAreaIndex();
|
x294_aid = area.GetAreaId();
|
||||||
x29c_shadowLightArrIdx = -1;
|
x29c_shadowLightArrIdx = -1;
|
||||||
x288_ambientColor = zeus::skClear;
|
x288_ambientColor = zeus::skClear;
|
||||||
|
|
||||||
|
|
|
@ -305,8 +305,11 @@ CDummyGameArea::CDummyGameArea(CInputStream& in, int idx, int mlvlVersion) {
|
||||||
zeus::CAABox aabb;
|
zeus::CAABox aabb;
|
||||||
aabb.readBoundingBoxBig(in);
|
aabb.readBoundingBoxBig(in);
|
||||||
xc_mrea = in.readUint32Big();
|
xc_mrea = in.readUint32Big();
|
||||||
if (mlvlVersion > 15)
|
if (mlvlVersion > 15) {
|
||||||
x10_areaId = CAssetId(in);
|
x10_areaId = in.readUint32Big();
|
||||||
|
} else {
|
||||||
|
x10_areaId = -1;
|
||||||
|
}
|
||||||
|
|
||||||
u32 attachAreaCount = in.readUint32Big();
|
u32 attachAreaCount = in.readUint32Big();
|
||||||
x44_attachedAreaIndices.reserve(attachAreaCount);
|
x44_attachedAreaIndices.reserve(attachAreaCount);
|
||||||
|
@ -332,7 +335,7 @@ std::pair<std::unique_ptr<u8[]>, s32> CDummyGameArea::IGetScriptingMemoryAlways(
|
||||||
return GetScriptingMemoryAlways(*this);
|
return GetScriptingMemoryAlways(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAssetId CDummyGameArea::IGetAreaId() const { return x10_areaId; }
|
s32 CDummyGameArea::IGetAreaSaveId() const { return x10_areaId; }
|
||||||
|
|
||||||
CAssetId CDummyGameArea::IGetAreaAssetId() const { return xc_mrea; }
|
CAssetId CDummyGameArea::IGetAreaAssetId() const { return xc_mrea; }
|
||||||
|
|
||||||
|
@ -354,9 +357,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 = CAssetId(in);
|
x88_areaId = in.readUint32Big();
|
||||||
else
|
else
|
||||||
x88_areaId = CAssetId();
|
x88_areaId = INT_MAX;
|
||||||
|
|
||||||
const u32 attachedCount = in.readUint32Big();
|
const u32 attachedCount = in.readUint32Big();
|
||||||
x8c_attachedAreaIndices.reserve(attachedCount);
|
x8c_attachedAreaIndices.reserve(attachedCount);
|
||||||
|
@ -782,7 +785,7 @@ bool CGameArea::Invalidate(CStateManager* mgr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mgr)
|
if (mgr)
|
||||||
mgr->PrepareAreaUnload(GetAreaIndex());
|
mgr->PrepareAreaUnload(GetAreaId());
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
dword_805a8eb0 -= GetPostConstructedSize();
|
dword_805a8eb0 -= GetPostConstructedSize();
|
||||||
|
@ -797,7 +800,7 @@ bool CGameArea::Invalidate(CStateManager* mgr) {
|
||||||
KillmAreaData();
|
KillmAreaData();
|
||||||
ClearTokenList();
|
ClearTokenList();
|
||||||
if (mgr)
|
if (mgr)
|
||||||
mgr->AreaUnloaded(GetAreaIndex());
|
mgr->AreaUnloaded(GetAreaId());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
CAssetId x10_areaId;
|
s32 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;
|
||||||
CAssetId IGetAreaId() const override;
|
s32 IGetAreaSaveId() 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;
|
||||||
|
@ -104,7 +104,7 @@ class CGameArea final : public IGameArea {
|
||||||
zeus::CTransform x3c_invTransform;
|
zeus::CTransform x3c_invTransform;
|
||||||
zeus::CAABox x6c_aabb;
|
zeus::CAABox x6c_aabb;
|
||||||
CAssetId x84_mrea;
|
CAssetId x84_mrea;
|
||||||
CAssetId x88_areaId;
|
s32 x88_areaId;
|
||||||
std::vector<u16> x8c_attachedAreaIndices;
|
std::vector<u16> x8c_attachedAreaIndices;
|
||||||
std::vector<SObjectTag> x9c_deps1;
|
std::vector<SObjectTag> x9c_deps1;
|
||||||
std::vector<SObjectTag> xac_deps2;
|
std::vector<SObjectTag> xac_deps2;
|
||||||
|
@ -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 GetAreaIndex() const { return x4_selfIdx; }
|
TAreaId GetAreaId() const { return x4_selfIdx; }
|
||||||
CAssetId IGetAreaId() const override { return x88_areaId; }
|
s32 IGetAreaSaveId() 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;
|
||||||
|
|
|
@ -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.GetAreaIndex());
|
x18_areas.push_back(area.GetAreaId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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.GetAreaIndex())
|
if (*it != area.GetAreaId())
|
||||||
return false;
|
return false;
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ CScriptDoor::EDoorOpenCondition CScriptDoor::GetDoorOpenCondition(CStateManager&
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const CGameArea& aliveArea : *world) {
|
for (const CGameArea& aliveArea : *world) {
|
||||||
if (aliveArea.GetAreaIndex() == area->GetAreaIndex()) {
|
if (aliveArea.GetAreaId() == area->GetAreaId()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 CAssetId IGetAreaId() const = 0;
|
virtual s32 IGetAreaSaveId() 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;
|
||||||
|
|
Loading…
Reference in New Issue