2015-08-17 22:05:00 +00:00
|
|
|
#include "CGameState.hpp"
|
2015-08-23 23:58:07 +00:00
|
|
|
#include "IOStreams.hpp"
|
2016-03-28 08:54:02 +00:00
|
|
|
#include "zeus/Math.hpp"
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 22:05:00 +00:00
|
|
|
{
|
|
|
|
|
2016-08-14 21:11:44 +00:00
|
|
|
CGameState::CGameState()
|
|
|
|
{
|
2016-08-15 20:58:07 +00:00
|
|
|
x98_playerState.reset(new CPlayerState());
|
|
|
|
x9c_transManager.reset(new CWorldTransManager());
|
2016-08-14 21:11:44 +00:00
|
|
|
x228_25_deferPowerupInit = true;
|
|
|
|
}
|
|
|
|
|
2016-03-19 19:19:43 +00:00
|
|
|
CGameState::CGameState(CBitStreamReader& stream)
|
2016-06-30 19:33:38 +00:00
|
|
|
{
|
2016-08-14 21:11:44 +00:00
|
|
|
x228_25_deferPowerupInit = true;
|
|
|
|
|
2016-06-30 19:33:38 +00:00
|
|
|
for (u32 i = 0; i < 128; i++)
|
|
|
|
stream.ReadEncoded(8);
|
|
|
|
u32 tmp = stream.ReadEncoded(32);
|
|
|
|
double val1 = *(reinterpret_cast<float*>(&tmp));
|
|
|
|
bool val2 = stream.ReadEncoded(1);
|
|
|
|
stream.ReadEncoded(1);
|
|
|
|
tmp = stream.ReadEncoded(32);
|
|
|
|
double val3 = *(reinterpret_cast<float*>(&tmp));
|
|
|
|
tmp = stream.ReadEncoded(32);
|
|
|
|
double val4 = *(reinterpret_cast<float*>(&tmp));
|
|
|
|
tmp = stream.ReadEncoded(32);
|
|
|
|
double val5 = *(reinterpret_cast<float*>(&tmp));
|
|
|
|
|
|
|
|
CPlayerState tmpPlayer(stream);
|
|
|
|
float currentHealth = tmpPlayer.GetHealthInfo().GetHP();
|
|
|
|
}
|
2015-08-20 02:52:07 +00:00
|
|
|
|
2016-08-23 00:52:51 +00:00
|
|
|
void CGameState::SetCurrentWorldId(unsigned int id)
|
2015-08-20 02:52:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-28 08:54:02 +00:00
|
|
|
void CGameState::SetTotalPlayTime(float time)
|
|
|
|
{
|
|
|
|
xa0_playTime = zeus::clamp<double>(0.0, time, 359999.0);
|
|
|
|
}
|
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
CWorldState& CGameState::StateForWorld(ResId mlvlId)
|
|
|
|
{
|
|
|
|
auto it = x88_worldStates.begin();
|
|
|
|
for (; it != x88_worldStates.end() ; ++it)
|
|
|
|
{
|
|
|
|
if (it->GetWorldAssetId() == mlvlId)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (it == x88_worldStates.end())
|
|
|
|
{
|
|
|
|
x88_worldStates.emplace_back(mlvlId);
|
|
|
|
return x88_worldStates.back();
|
|
|
|
}
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|