2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CGAMESTATE_HPP__
|
|
|
|
#define __URDE_CGAMESTATE_HPP__
|
2015-08-17 05:26:58 +00:00
|
|
|
|
2015-08-17 20:33:58 +00:00
|
|
|
#include <memory>
|
2015-08-20 02:52:07 +00:00
|
|
|
#include "CBasics.hpp"
|
2015-08-17 20:33:58 +00:00
|
|
|
#include "CPlayerState.hpp"
|
|
|
|
#include "CGameOptions.hpp"
|
2016-08-23 00:52:51 +00:00
|
|
|
#include "CRelayTracker.hpp"
|
2016-04-16 23:48:29 +00:00
|
|
|
#include "World/CWorldTransManager.hpp"
|
2016-08-23 00:52:51 +00:00
|
|
|
#include "AutoMapper/CMapWorldInfo.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 22:05:00 +00:00
|
|
|
{
|
2016-09-25 01:58:20 +00:00
|
|
|
class CSaveWorldMemory;
|
|
|
|
|
|
|
|
/* TODO: Figure out */
|
|
|
|
class CWorldSomethingState
|
|
|
|
{
|
2016-09-30 22:43:19 +00:00
|
|
|
friend class CSaveWorldIntermediate;
|
2016-09-25 01:58:20 +00:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
class CWorldState
|
|
|
|
{
|
|
|
|
ResId x0_mlvlId;
|
2016-09-25 01:58:20 +00:00
|
|
|
TAreaId x4_areaId = kInvalidAreaId;
|
2016-08-23 00:52:51 +00:00
|
|
|
std::shared_ptr<CRelayTracker> x8_relayTracker;
|
|
|
|
std::shared_ptr<CMapWorldInfo> xc_mapWorldInfo;
|
2016-09-25 01:58:20 +00:00
|
|
|
u32 x10_;
|
|
|
|
std::shared_ptr<CWorldSomethingState> x14_;
|
2016-08-14 03:00:58 +00:00
|
|
|
public:
|
|
|
|
CWorldState(ResId id) : x0_mlvlId(id) {}
|
2016-09-25 01:58:20 +00:00
|
|
|
CWorldState(CBitStreamReader& reader, ResId mlvlId, const CSaveWorld& saveWorld);
|
2016-08-14 03:00:58 +00:00
|
|
|
ResId GetWorldAssetId() const {return x0_mlvlId;}
|
|
|
|
void SetAreaId(TAreaId aid) { x4_areaId = aid; }
|
2016-09-30 22:43:19 +00:00
|
|
|
TAreaId GetCurrentAreaId() const { return x4_areaId; }
|
|
|
|
const std::shared_ptr<CRelayTracker>& RelayTracker() const { return x8_relayTracker; }
|
|
|
|
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
|
|
|
|
const std::shared_ptr<CWorldSomethingState>& GetSomethingElse() const { return x14_; }
|
2016-08-14 03:00:58 +00:00
|
|
|
};
|
|
|
|
|
2015-08-17 05:26:58 +00:00
|
|
|
class CGameState
|
|
|
|
{
|
2016-08-14 21:11:44 +00:00
|
|
|
friend class CStateManager;
|
|
|
|
|
2016-08-15 20:58:07 +00:00
|
|
|
bool x0_[128] = {};
|
2016-08-14 03:00:58 +00:00
|
|
|
ResId x84_mlvlId = -1;
|
|
|
|
std::vector<CWorldState> x88_worldStates;
|
2016-08-15 20:58:07 +00:00
|
|
|
std::shared_ptr<CPlayerState> x98_playerState;
|
|
|
|
std::shared_ptr<CWorldTransManager> x9c_transManager;
|
2016-03-28 08:54:02 +00:00
|
|
|
double xa0_playTime;
|
2016-09-25 01:58:20 +00:00
|
|
|
CPersistentOptions xa8_systemOptions;
|
2016-09-08 02:01:29 +00:00
|
|
|
CGameOptions x17c_gameOptions;
|
2016-09-25 01:58:20 +00:00
|
|
|
CHintOptions x1f8_hintOptions;
|
2016-08-14 21:11:44 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x228_24_;
|
|
|
|
bool x228_25_deferPowerupInit;
|
|
|
|
};
|
|
|
|
u8 _dummy = 0;
|
|
|
|
};
|
2016-09-25 01:58:20 +00:00
|
|
|
|
2015-08-17 20:33:58 +00:00
|
|
|
public:
|
2016-08-14 21:11:44 +00:00
|
|
|
CGameState();
|
2016-03-19 19:19:43 +00:00
|
|
|
CGameState(CBitStreamReader& stream);
|
2016-08-23 00:52:51 +00:00
|
|
|
void SetCurrentWorldId(unsigned int id);
|
2016-08-16 22:49:19 +00:00
|
|
|
std::shared_ptr<CPlayerState> GetPlayerState() {return x98_playerState;}
|
|
|
|
std::shared_ptr<CWorldTransManager> GetWorldTransitionManager() {return x9c_transManager;}
|
2016-03-28 08:54:02 +00:00
|
|
|
void SetTotalPlayTime(float time);
|
2016-09-25 01:58:20 +00:00
|
|
|
CPersistentOptions& SystemOptions() { return xa8_systemOptions; }
|
|
|
|
CGameOptions& GameOptions() { return x17c_gameOptions; }
|
2016-08-14 03:00:58 +00:00
|
|
|
CWorldState& StateForWorld(ResId mlvlId);
|
|
|
|
CWorldState& CurrentWorldState() { return StateForWorld(x84_mlvlId); }
|
2016-08-15 20:58:07 +00:00
|
|
|
ResId CurrentWorldAssetId() const { return x84_mlvlId; }
|
2015-08-17 05:26:58 +00:00
|
|
|
};
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CGAMESTATE_HPP__
|