mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
8e43027b1d
|
@ -41,7 +41,7 @@ target_link_libraries(urde
|
||||||
DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS}
|
DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS}
|
||||||
hecl-database hecl-runtime hecl-backend hecl-frontend hecl-hmdl hecl-blender hecl-common
|
hecl-database hecl-runtime hecl-backend hecl-frontend hecl-hmdl hecl-blender hecl-common
|
||||||
athena-core nod logvisor athena-libyaml amuse boo ${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
athena-core nod logvisor athena-libyaml amuse boo ${PNG_LIB} libjpeg-turbo squish xxhash zeus
|
||||||
${ZLIB_LIBRARIES} ${LZO_LIB}
|
kabufuda ${ZLIB_LIBRARIES} ${LZO_LIB}
|
||||||
${BOO_SYS_LIBS})
|
${BOO_SYS_LIBS})
|
||||||
|
|
||||||
set_target_properties(urde PROPERTIES
|
set_target_properties(urde PROPERTIES
|
||||||
|
|
|
@ -6,8 +6,23 @@ namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CGameState::CGameState(CBitStreamReader& stream)
|
CGameState::CGameState(CBitStreamReader& stream)
|
||||||
: m_stateFlag(stream.readUint32Big()), m_playerState(stream), m_gameTime(stream.readFloatBig())
|
{
|
||||||
{}
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
void CGameState::SetCurrentWorldId(unsigned int id, const std::string& name)
|
void CGameState::SetCurrentWorldId(unsigned int id, const std::string& name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace urde
|
||||||
class CGameState
|
class CGameState
|
||||||
{
|
{
|
||||||
int m_stateFlag = -1;
|
int m_stateFlag = -1;
|
||||||
CPlayerState m_playerState;
|
CPlayerState x98_playerState;
|
||||||
CWorldTransManager x9c_transManager;
|
CWorldTransManager x9c_transManager;
|
||||||
float m_gameTime = 0.0;
|
float m_gameTime = 0.0;
|
||||||
CGameOptions m_gameOpts;
|
CGameOptions m_gameOpts;
|
||||||
|
|
|
@ -59,7 +59,7 @@ CPlayerState::CPlayerState(CBitStreamReader& stream)
|
||||||
{
|
{
|
||||||
x4_ = stream.ReadEncoded(0x20);
|
x4_ = stream.ReadEncoded(0x20);
|
||||||
u32 tmp = stream.ReadEncoded(0x20);
|
u32 tmp = stream.ReadEncoded(0x20);
|
||||||
xc_currentHealth = *reinterpret_cast<float*>(&tmp);
|
xc_health.SetHP(*reinterpret_cast<float*>(&tmp));
|
||||||
x8_currentBeam = EBeamId(stream.ReadEncoded(CBitStreamReader::GetBitCount(5)));
|
x8_currentBeam = EBeamId(stream.ReadEncoded(CBitStreamReader::GetBitCount(5)));
|
||||||
x20_currentSuit = EPlayerSuit(stream.ReadEncoded(CBitStreamReader::GetBitCount(4)));
|
x20_currentSuit = EPlayerSuit(stream.ReadEncoded(CBitStreamReader::GetBitCount(4)));
|
||||||
x24_powerups.resize(41);
|
x24_powerups.resize(41);
|
||||||
|
@ -90,8 +90,8 @@ CPlayerState::CPlayerState(CBitStreamReader& stream)
|
||||||
void CPlayerState::PutTo(CBitStreamWriter &stream)
|
void CPlayerState::PutTo(CBitStreamWriter &stream)
|
||||||
{
|
{
|
||||||
stream.WriteEncoded(x4_, 32);
|
stream.WriteEncoded(x4_, 32);
|
||||||
u32 tmp = *reinterpret_cast<int*>(&xc_currentHealth);
|
float hp = xc_health.GetHP();
|
||||||
stream.WriteEncoded(tmp, 32);
|
stream.WriteEncoded(*reinterpret_cast<int*>(&hp), 32);
|
||||||
stream.WriteEncoded((u32)x8_currentBeam, CBitStreamWriter::GetBitCount(5));
|
stream.WriteEncoded((u32)x8_currentBeam, CBitStreamWriter::GetBitCount(5));
|
||||||
stream.WriteEncoded((u32)x20_currentSuit, CBitStreamWriter::GetBitCount(4));
|
stream.WriteEncoded((u32)x20_currentSuit, CBitStreamWriter::GetBitCount(4));
|
||||||
for (u32 i = 0; i < x24_powerups.size(); ++i)
|
for (u32 i = 0; i < x24_powerups.size(); ++i)
|
||||||
|
@ -175,6 +175,16 @@ u32 CPlayerState::CalculateItemCollectionRate() const
|
||||||
return total + GetItemCapacity(EItemType::Wavebuster);
|
return total + GetItemCapacity(EItemType::Wavebuster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CHealthInfo& CPlayerState::HealthInfo()
|
||||||
|
{
|
||||||
|
return xc_health;
|
||||||
|
}
|
||||||
|
|
||||||
|
CHealthInfo CPlayerState::GetHealthInfo() const
|
||||||
|
{
|
||||||
|
return xc_health;
|
||||||
|
}
|
||||||
|
|
||||||
CPlayerState::EPlayerSuit CPlayerState::GetCurrentSuit() const
|
CPlayerState::EPlayerSuit CPlayerState::GetCurrentSuit() const
|
||||||
{
|
{
|
||||||
if (GetFusion())
|
if (GetFusion())
|
||||||
|
@ -335,7 +345,7 @@ void CPlayerState::IncrPickup(EItemType type, s32 amount)
|
||||||
case EItemType::HealthRefill:
|
case EItemType::HealthRefill:
|
||||||
{
|
{
|
||||||
float health = CalculateHealth(amount);
|
float health = CalculateHealth(amount);
|
||||||
xc_currentHealth = std::min(health, xc_currentHealth + amount);
|
xc_health.SetHP(std::min(health, xc_health.GetHP() + amount));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "CStaticInterference.hpp"
|
#include "CStaticInterference.hpp"
|
||||||
#include "IOStreams.hpp"
|
#include "IOStreams.hpp"
|
||||||
#include "rstl.hpp"
|
#include "rstl.hpp"
|
||||||
|
#include "World/CHealthInfo.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -111,8 +112,7 @@ private:
|
||||||
|
|
||||||
u32 x4_ = 0;
|
u32 x4_ = 0;
|
||||||
EBeamId x8_currentBeam = EBeamId::Power;
|
EBeamId x8_currentBeam = EBeamId::Power;
|
||||||
float xc_currentHealth = 99.f;
|
CHealthInfo xc_health = {99.f, 50.f};
|
||||||
float x10_ = 50.f;
|
|
||||||
EPlayerVisor x14_currentVisor = EPlayerVisor::Combat;
|
EPlayerVisor x14_currentVisor = EPlayerVisor::Combat;
|
||||||
EPlayerVisor x18_transitioningVisor = x14_currentVisor;
|
EPlayerVisor x18_transitioningVisor = x14_currentVisor;
|
||||||
float x1c_visorTransitionFactor = 0.2f;
|
float x1c_visorTransitionFactor = 0.2f;
|
||||||
|
@ -128,6 +128,8 @@ public:
|
||||||
u32 GetMissileCostForAltAttack() const;
|
u32 GetMissileCostForAltAttack() const;
|
||||||
u32 CalculateItemCollectionRate() const;
|
u32 CalculateItemCollectionRate() const;
|
||||||
|
|
||||||
|
CHealthInfo& HealthInfo();
|
||||||
|
CHealthInfo GetHealthInfo() const;
|
||||||
u32 GetPickupTotal() { return 99; }
|
u32 GetPickupTotal() { return 99; }
|
||||||
void SetFusion(bool val) { x0_26_fusion = val; }
|
void SetFusion(bool val) { x0_26_fusion = val; }
|
||||||
bool GetFusion() const { return x0_26_fusion; }
|
bool GetFusion() const { return x0_26_fusion; }
|
||||||
|
|
|
@ -11,8 +11,20 @@ class CHealthInfo
|
||||||
float x0_health;
|
float x0_health;
|
||||||
float x4_knockbackResistance;
|
float x4_knockbackResistance;
|
||||||
public:
|
public:
|
||||||
|
CHealthInfo(float hp)
|
||||||
|
: x0_health(hp),
|
||||||
|
x4_knockbackResistance(0.f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CHealthInfo(float hp, float resist)
|
||||||
|
: x0_health(hp),
|
||||||
|
x4_knockbackResistance(resist)
|
||||||
|
{}
|
||||||
|
|
||||||
CHealthInfo(CInputStream& in);
|
CHealthInfo(CInputStream& in);
|
||||||
float GetHealth() const {return x0_health;}
|
void SetHP(float hp) { x0_health = hp; }
|
||||||
|
float GetHP() const {return x0_health;}
|
||||||
float GetKnockbackResistance() const {return x4_knockbackResistance;}
|
float GetKnockbackResistance() const {return x4_knockbackResistance;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (in.length() != 8256)
|
if (in.length() != 8256)
|
||||||
{
|
{
|
||||||
printf("File too small expected 8,256 bytes got %llu", in.length());
|
printf("File too small expected 8,256 bytes got %" PRIu64, in.length());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue