From 85358450a7d80a02ab2eba25bf42f903b8f3b5e5 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Fri, 14 Oct 2022 01:37:09 +0300 Subject: [PATCH] Match and link CHealthInfo Former-commit-id: a859570ce003aa9b520bdcde7b3221fdd88f5ef9 --- configure.py | 2 +- include/MetroidPrime/CHealthInfo.hpp | 3 +++ obj_files.mk | 2 +- src/MetroidPrime/CHealthInfo.cpp | 10 ++++++++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/MetroidPrime/CHealthInfo.cpp diff --git a/configure.py b/configure.py index ec610e9f..214b6b68 100755 --- a/configure.py +++ b/configure.py @@ -280,7 +280,7 @@ LIBS = [ "MetroidPrime/HUD/CHudBallInterface", "MetroidPrime/Tweaks/CTweakGuiColors", "MetroidPrime/ScriptObjects/CFishCloud", - "MetroidPrime/CHealthInfo", + ["MetroidPrime/CHealthInfo", True], "MetroidPrime/Player/CGameState", "MetroidPrime/ScriptObjects/CScriptVisorFlare", "MetroidPrime/ScriptObjects/CScriptWorldTeleporter", diff --git a/include/MetroidPrime/CHealthInfo.hpp b/include/MetroidPrime/CHealthInfo.hpp index 721f5a3d..15e53aba 100644 --- a/include/MetroidPrime/CHealthInfo.hpp +++ b/include/MetroidPrime/CHealthInfo.hpp @@ -3,9 +3,12 @@ #include "types.h" +class CInputStream; class CHealthInfo { public: CHealthInfo(float hp, float resist) : x0_health(hp), x4_knockbackResistance(resist) {} + explicit CHealthInfo(CInputStream&); + void SetHP(float hp) { x0_health = hp; } void SetKnockbackResistance(float resist) { x4_knockbackResistance = resist; } float GetHP() const { return x0_health; } diff --git a/obj_files.mk b/obj_files.mk index 56866900..588c21ad 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -247,7 +247,7 @@ METROIDPRIME :=\ $(BUILD_DIR)/asm/MetroidPrime/HUD/CHudBallInterface.o\ $(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakGuiColors.o\ $(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CFishCloud.o\ - $(BUILD_DIR)/asm/MetroidPrime/CHealthInfo.o\ + $(BUILD_DIR)/src/MetroidPrime/CHealthInfo.o\ $(BUILD_DIR)/asm/MetroidPrime/Player/CGameState.o\ $(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptVisorFlare.o\ $(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptWorldTeleporter.o\ diff --git a/src/MetroidPrime/CHealthInfo.cpp b/src/MetroidPrime/CHealthInfo.cpp new file mode 100644 index 00000000..4a6f723d --- /dev/null +++ b/src/MetroidPrime/CHealthInfo.cpp @@ -0,0 +1,10 @@ +#include "MetroidPrime/CHealthInfo.hpp" + +#include "Kyoto/Streams/CInputStream.hpp" + +CHealthInfo::CHealthInfo(CInputStream& in) +{ + in.ReadLong(); + x0_health = in.ReadFloat(); + x4_knockbackResistance = in.ReadFloat(); +}