2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 17:47:43 +00:00

Further CGameState imps

This commit is contained in:
Jack Andersen
2016-09-24 15:58:20 -10:00
parent b02b6a4d09
commit 7f987ab10e
23 changed files with 575 additions and 22 deletions

View File

@@ -10,16 +10,44 @@
#include "AutoMapper/CMapWorldInfo.hpp"
namespace urde
{
class CSaveWorldMemory;
/* TODO: Figure out */
class CWorldSomethingState
{
std::vector<u32> x0_;
u32 x10_bitCount = 0;
std::vector<u32> x14_;
public:
CWorldSomethingState(CBitStreamReader& reader, const CSaveWorld& saveWorld)
{
u32 bitCount = reader.ReadEncoded(10);
u32 wordCount = (bitCount + 31) / 32;
x14_.resize(wordCount);
for (u32 i=0 ; i<bitCount ; ++i)
{
++x10_bitCount;
bool bit = reader.ReadEncoded(1);
if (bit)
x14_[i / 32] |= 1 << (i % 32);
else
x14_[i / 32] &= ~(1 << (i % 32));
}
}
};
class CWorldState
{
ResId x0_mlvlId;
TAreaId x4_areaId;
TAreaId x4_areaId = kInvalidAreaId;
std::shared_ptr<CRelayTracker> x8_relayTracker;
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
/* std::shared_ptr<> x14_ */
u32 x10_;
std::shared_ptr<CWorldSomethingState> x14_;
public:
CWorldState(ResId id) : x0_mlvlId(id) {}
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
ResId GetWorldAssetId() const {return x0_mlvlId;}
void SetAreaId(TAreaId aid) { x4_areaId = aid; }
const TAreaId& GetCurrentAreaId() const { return x4_areaId; }
@@ -37,8 +65,9 @@ class CGameState
std::shared_ptr<CPlayerState> x98_playerState;
std::shared_ptr<CWorldTransManager> x9c_transManager;
double xa0_playTime;
CPersistentOptions xa8_systemOptions;
CGameOptions x17c_gameOptions;
/* x1f8_ */
CHintOptions x1f8_hintOptions;
union
{
@@ -49,6 +78,7 @@ class CGameState
};
u8 _dummy = 0;
};
public:
CGameState();
CGameState(CBitStreamReader& stream);
@@ -56,6 +86,8 @@ public:
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; }
CWorldState& StateForWorld(ResId mlvlId);
CWorldState& CurrentWorldState() { return StateForWorld(x84_mlvlId); }
ResId CurrentWorldAssetId() const { return x84_mlvlId; }