2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CGAMESTATE
|
|
|
|
#define _CGAMESTATE
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-08-09 23:03:51 +00:00
|
|
|
#include "MetroidPrime/Player/CGameOptions.hpp"
|
|
|
|
#include "MetroidPrime/Player/CHintOptions.hpp"
|
|
|
|
#include "MetroidPrime/Player/CPlayerState.hpp"
|
|
|
|
#include "MetroidPrime/Player/CSystemOptions.hpp"
|
|
|
|
#include "MetroidPrime/Player/CWorldState.hpp"
|
|
|
|
#include "MetroidPrime/Player/CWorldTransManager.hpp"
|
2022-07-18 22:42:58 +00:00
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
2022-04-10 00:17:06 +00:00
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#include "rstl/rc_ptr.hpp"
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
#include "rstl/vector.hpp"
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
class CGameState {
|
|
|
|
public:
|
|
|
|
CGameState();
|
|
|
|
CGameState(CInputStream& in, int saveIdx);
|
|
|
|
|
2022-10-11 16:08:45 +00:00
|
|
|
void ReadSystemOptions(CInputStream& in);
|
2022-10-11 18:35:41 +00:00
|
|
|
void PutTo(COutputStream& out) const;
|
2022-10-11 16:28:27 +00:00
|
|
|
void WriteSystemOptions(COutputStream& out);
|
2022-10-11 16:08:45 +00:00
|
|
|
|
2022-11-08 23:04:51 +00:00
|
|
|
void SetCurrentWorldId(CAssetId);
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
rstl::rc_ptr< CPlayerState >& PlayerState();
|
2022-11-08 23:04:51 +00:00
|
|
|
CAssetId CurrentWorldAssetId() const;
|
2022-10-11 09:03:10 +00:00
|
|
|
void WriteBackupBuf();
|
2022-04-11 22:42:08 +00:00
|
|
|
|
2022-11-08 23:04:51 +00:00
|
|
|
CWorldState& CurrentWorldState();
|
|
|
|
|
2022-10-11 16:38:13 +00:00
|
|
|
void ImportPersistentOptions(const CSystemOptions&);
|
|
|
|
void ExportPersistentOptions(CSystemOptions&);
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
CSystemOptions& SystemOptions() { return xa8_systemOptions; }
|
|
|
|
CGameOptions& GameOptions() { return x17c_gameOptions; }
|
|
|
|
CHintOptions& HintOptions() { return x1f8_hintOptions; }
|
2022-09-05 04:01:13 +00:00
|
|
|
uint& SaveIdx() { return x20c_saveIdx; }
|
2022-04-10 00:17:06 +00:00
|
|
|
u64& CardSerial() { return x210_cardSerial; }
|
2022-10-09 05:37:23 +00:00
|
|
|
rstl::vector< uchar >& BackupBuf() { return x218_backupBuf; }
|
2022-10-11 16:08:45 +00:00
|
|
|
u32 GetFileIdx() const { return x20c_saveIdx; }
|
|
|
|
void SetFileIdx(u32 idx) { x20c_saveIdx = idx; }
|
2022-10-11 09:03:10 +00:00
|
|
|
void SetCardSerial(u64 serial) { x210_cardSerial = serial; }
|
|
|
|
u64 GetCardSerial() const { return x210_cardSerial; }
|
2022-10-13 23:31:53 +00:00
|
|
|
rstl::rc_ptr< CWorldTransManager >& WorldTransitionManager(); // { return x9c_transManager.GetPtr(); }
|
2022-04-10 00:17:06 +00:00
|
|
|
|
2022-10-10 19:44:11 +00:00
|
|
|
struct GameFileStateInfo {
|
|
|
|
double x0_playTime;
|
|
|
|
CAssetId x8_mlvlId;
|
|
|
|
float xc_health;
|
|
|
|
uint x10_energyTanks;
|
|
|
|
uint x14_timestamp;
|
|
|
|
uint x18_itemPercent;
|
|
|
|
float x1c_scanPercent;
|
|
|
|
bool x20_hardMode;
|
|
|
|
};
|
2022-10-11 17:09:26 +00:00
|
|
|
static GameFileStateInfo LoadGameFileState(const void* data);
|
2022-10-10 19:44:11 +00:00
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
private:
|
|
|
|
rstl::reserved_vector< bool, 128 > x0_;
|
|
|
|
CAssetId x84_mlvlId;
|
|
|
|
rstl::vector< CWorldState > x88_worldStates;
|
|
|
|
rstl::rc_ptr< CPlayerState > x98_playerState;
|
|
|
|
rstl::rc_ptr< CWorldTransManager > x9c_transManager;
|
2022-10-09 05:37:23 +00:00
|
|
|
double xa0_playTime;
|
2022-04-10 00:17:06 +00:00
|
|
|
CSystemOptions xa8_systemOptions;
|
|
|
|
CGameOptions x17c_gameOptions;
|
|
|
|
CHintOptions x1f8_hintOptions;
|
2022-09-05 04:01:13 +00:00
|
|
|
uint x20c_saveIdx;
|
2022-04-10 00:17:06 +00:00
|
|
|
u64 x210_cardSerial;
|
2022-10-09 05:37:23 +00:00
|
|
|
rstl::vector< uchar > x218_backupBuf;
|
2022-04-10 00:17:06 +00:00
|
|
|
bool x228_24_hardMode : 1;
|
|
|
|
bool x228_25_initPowerupsAtFirstSpawn : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern CGameState* gpGameState;
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CGAMESTATE
|