From 8c2d5eb3a354c2493d1ad4d54715c7b700e018a1 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 30 Jun 2016 12:33:38 -0700 Subject: [PATCH 1/2] Update kaubfuda --- Editor/CMakeLists.txt | 2 +- Runtime/CGameState.cpp | 19 +++++++++++++++++-- Runtime/CGameState.hpp | 2 +- Runtime/CPlayerState.cpp | 18 ++++++++++++++---- Runtime/CPlayerState.hpp | 6 ++++-- Runtime/World/CHealthInfo.hpp | 14 +++++++++++++- kabufuda | 2 +- mpcksum/main.cpp | 2 +- 8 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index 85a6a6694..ccf36a531 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_libraries(urde DNACommon specter specter-fonts freetype ${DATA_SPEC_LIBS} 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 - ${ZLIB_LIBRARIES} ${LZO_LIB} + kabufuda ${ZLIB_LIBRARIES} ${LZO_LIB} ${BOO_SYS_LIBS}) set_target_properties(urde PROPERTIES diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index 2b8503548..bd89613c2 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -6,8 +6,23 @@ namespace urde { 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(&tmp)); + bool val2 = stream.ReadEncoded(1); + stream.ReadEncoded(1); + tmp = stream.ReadEncoded(32); + double val3 = *(reinterpret_cast(&tmp)); + tmp = stream.ReadEncoded(32); + double val4 = *(reinterpret_cast(&tmp)); + tmp = stream.ReadEncoded(32); + double val5 = *(reinterpret_cast(&tmp)); + + CPlayerState tmpPlayer(stream); + float currentHealth = tmpPlayer.GetHealthInfo().GetHP(); +} void CGameState::SetCurrentWorldId(unsigned int id, const std::string& name) { diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 8a8dd1f44..71be31722 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -13,7 +13,7 @@ namespace urde class CGameState { int m_stateFlag = -1; - CPlayerState m_playerState; + CPlayerState x98_playerState; CWorldTransManager x9c_transManager; float m_gameTime = 0.0; CGameOptions m_gameOpts; diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index 6460c6e9b..79a26805a 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -59,7 +59,7 @@ CPlayerState::CPlayerState(CBitStreamReader& stream) { x4_ = stream.ReadEncoded(0x20); u32 tmp = stream.ReadEncoded(0x20); - xc_currentHealth = *reinterpret_cast(&tmp); + xc_health.SetHP(*reinterpret_cast(&tmp)); x8_currentBeam = EBeamId(stream.ReadEncoded(CBitStreamReader::GetBitCount(5))); x20_currentSuit = EPlayerSuit(stream.ReadEncoded(CBitStreamReader::GetBitCount(4))); x24_powerups.resize(41); @@ -90,8 +90,8 @@ CPlayerState::CPlayerState(CBitStreamReader& stream) void CPlayerState::PutTo(CBitStreamWriter &stream) { stream.WriteEncoded(x4_, 32); - u32 tmp = *reinterpret_cast(&xc_currentHealth); - stream.WriteEncoded(tmp, 32); + float hp = xc_health.GetHP(); + stream.WriteEncoded(*reinterpret_cast(&hp), 32); stream.WriteEncoded((u32)x8_currentBeam, CBitStreamWriter::GetBitCount(5)); stream.WriteEncoded((u32)x20_currentSuit, CBitStreamWriter::GetBitCount(4)); for (u32 i = 0; i < x24_powerups.size(); ++i) @@ -175,6 +175,16 @@ u32 CPlayerState::CalculateItemCollectionRate() const return total + GetItemCapacity(EItemType::Wavebuster); } +CHealthInfo& CPlayerState::HealthInfo() +{ + return xc_health; +} + +CHealthInfo CPlayerState::GetHealthInfo() const +{ + return xc_health; +} + CPlayerState::EPlayerSuit CPlayerState::GetCurrentSuit() const { if (GetFusion()) @@ -335,7 +345,7 @@ void CPlayerState::IncrPickup(EItemType type, s32 amount) case EItemType::HealthRefill: { float health = CalculateHealth(amount); - xc_currentHealth = std::min(health, xc_currentHealth + amount); + xc_health.SetHP(std::min(health, xc_health.GetHP() + amount)); } default: break; diff --git a/Runtime/CPlayerState.hpp b/Runtime/CPlayerState.hpp index 16fe978b8..6264dcb0f 100644 --- a/Runtime/CPlayerState.hpp +++ b/Runtime/CPlayerState.hpp @@ -6,6 +6,7 @@ #include "CStaticInterference.hpp" #include "IOStreams.hpp" #include "rstl.hpp" +#include "World/CHealthInfo.hpp" namespace urde { @@ -111,8 +112,7 @@ private: u32 x4_ = 0; EBeamId x8_currentBeam = EBeamId::Power; - float xc_currentHealth = 99.f; - float x10_ = 50.f; + CHealthInfo xc_health = {99.f, 50.f}; EPlayerVisor x14_currentVisor = EPlayerVisor::Combat; EPlayerVisor x18_transitioningVisor = x14_currentVisor; float x1c_visorTransitionFactor = 0.2f; @@ -128,6 +128,8 @@ public: u32 GetMissileCostForAltAttack() const; u32 CalculateItemCollectionRate() const; + CHealthInfo& HealthInfo(); + CHealthInfo GetHealthInfo() const; u32 GetPickupTotal() { return 99; } void SetFusion(bool val) { x0_26_fusion = val; } bool GetFusion() const { return x0_26_fusion; } diff --git a/Runtime/World/CHealthInfo.hpp b/Runtime/World/CHealthInfo.hpp index c3d1a2410..f643e4ef7 100644 --- a/Runtime/World/CHealthInfo.hpp +++ b/Runtime/World/CHealthInfo.hpp @@ -11,8 +11,20 @@ class CHealthInfo float x0_health; float x4_knockbackResistance; 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); - 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;} }; diff --git a/kabufuda b/kabufuda index 2a9c18534..a34b38f8e 160000 --- a/kabufuda +++ b/kabufuda @@ -1 +1 @@ -Subproject commit 2a9c18534a5085763c191c151447d598c0f9e90f +Subproject commit a34b38f8e37d8c07569bc1c480d87d7daf2558b3 diff --git a/mpcksum/main.cpp b/mpcksum/main.cpp index 057bbf8d2..642adae44 100644 --- a/mpcksum/main.cpp +++ b/mpcksum/main.cpp @@ -35,7 +35,7 @@ int main(int argc, char* argv[]) 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; } From dd93eb21a893b52aaa5a0236e18a8a4e72934bc9 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 30 Jun 2016 19:19:38 -0700 Subject: [PATCH 2/2] Update submodules --- hecl | 2 +- kabufuda | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hecl b/hecl index 86391565a..f2472d193 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 86391565a104aba0bf32d2345d1139379af4e486 +Subproject commit f2472d1936775511a6a81882c8ad28c882f790d1 diff --git a/kabufuda b/kabufuda index a34b38f8e..99069bd06 160000 --- a/kabufuda +++ b/kabufuda @@ -1 +1 @@ -Subproject commit a34b38f8e37d8c07569bc1c480d87d7daf2558b3 +Subproject commit 99069bd069a93ab2d98dcd09b799711d2f93754c