From e8e3de41a17a4dccf258937661e1b06fcdfee8cf Mon Sep 17 00:00:00 2001 From: robojumper Date: Wed, 16 Apr 2025 22:43:03 +0200 Subject: [PATCH] d_lyt_meter_heart halfway --- config/SOUE01/splits.txt | 2 + config/SOUE01/symbols.txt | 38 ++-- include/d/a/d_a_player.h | 8 + include/d/lyt/meter/d_lyt_meter_heart.h | 45 ++++- include/d/lyt/meter/d_lyt_meter_key.h | 6 + include/d/lyt/meter/d_lyt_meter_timer.h | 2 - include/toBeSorted/file_manager.h | 20 ++- src/d/lyt/meter/d_lyt_meter_heart.cpp | 226 ++++++++++++++++++++++++ src/toBeSorted/file_manager.cpp | 12 +- 9 files changed, 319 insertions(+), 40 deletions(-) create mode 100644 src/d/lyt/meter/d_lyt_meter_heart.cpp diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 25a2a6ad..2a2c6759 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -445,7 +445,9 @@ d/lyt/meter/d_lyt_meter_timer.cpp: d/lyt/meter/d_lyt_meter_heart.cpp: .text start:0x8010AEC0 end:0x8010BD48 + .rodata start:0x804E6C28 end:0x804E6CF8 .data start:0x80519F60 end:0x8051A320 + .sdata2 start:0x80579D30 end:0x80579D48 d/lyt/meter/d_lyt_meter_shield_gauge.cpp: .text start:0x8010BD50 end:0x8010CEC8 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index f80167ef..a4203c2e 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -328,17 +328,17 @@ getSelectedPouchSlot__11FileManagerFv = .text:0x8000B620; // type:function size: setShieldPouchSlot__11FileManagerFUc = .text:0x8000B670; // type:function size:0x30 getShieldPouchSlot__11FileManagerFv = .text:0x8000B6A0; // type:function size:0x44 setAirPotionTimer__11FileManagerFUs = .text:0x8000B6F0; // type:function size:0x30 -getAirPotionTimer__11FileManagerFv = .text:0x8000B720; // type:function size:0x44 +getAirPotionTimer__11FileManagerCFv = .text:0x8000B720; // type:function size:0x44 setAirPotionPlusTimer__11FileManagerFUs = .text:0x8000B770; // type:function size:0x30 -getAirPotionPlusTimer__11FileManagerFv = .text:0x8000B7A0; // type:function size:0x44 +getAirPotionPlusTimer__11FileManagerCFv = .text:0x8000B7A0; // type:function size:0x44 setStaminaPotionTimer__11FileManagerFUs = .text:0x8000B7F0; // type:function size:0x30 -getStaminaPotionTimer__11FileManagerFv = .text:0x8000B820; // type:function size:0x44 +getStaminaPotionTimer__11FileManagerCFv = .text:0x8000B820; // type:function size:0x44 setStaminaPotionPlusTimer__11FileManagerFUs = .text:0x8000B870; // type:function size:0x30 -getStaminaPotionPlusTimer__11FileManagerFv = .text:0x8000B8A0; // type:function size:0x44 +getStaminaPotionPlusTimer__11FileManagerCFv = .text:0x8000B8A0; // type:function size:0x44 setGuardianPotionTimer__11FileManagerFUs = .text:0x8000B8F0; // type:function size:0x30 -getGuardianPotionTimer__11FileManagerFv = .text:0x8000B920; // type:function size:0x44 +getGuardianPotionTimer__11FileManagerCFv = .text:0x8000B920; // type:function size:0x44 setGuardianPotionPlusTimer__11FileManagerFUs = .text:0x8000B970; // type:function size:0x30 -getGuardianPotionPlusTimer__11FileManagerFv = .text:0x8000B9A0; // type:function size:0x44 +getGuardianPotionPlusTimer__11FileManagerCFv = .text:0x8000B9A0; // type:function size:0x44 setDowsingSlotIdx__11FileManagerFUc = .text:0x8000B9F0; // type:function size:0x30 getDowsingSlotIdx__11FileManagerFv = .text:0x8000BA20; // type:function size:0x44 setBeaconPos__11FileManagerFUlUlP7mVec3_c = .text:0x8000BA70; // type:function size:0x104 @@ -2472,7 +2472,7 @@ fn_8005BBC0 = .text:0x8005BBC0; // type:function size:0xC turnSoupCold = .text:0x8005BBD0; // type:function size:0x8 addExtraHearts = .text:0x8005BBE0; // type:function size:0x74 AcItem__healLink = .text:0x8005BC60; // type:function size:0x18 -ActorLink__getTotalHealthCapacity = .text:0x8005BC80; // type:function size:0x54 +getCurrentHealthCapacity__7dAcPy_cFv = .text:0x8005BC80; // type:function size:0x54 addDigInteractionTarget = .text:0x8005BCE0; // type:function size:0xC fn_8005BCF0 = .text:0x8005BCF0; // type:function size:0x30 ActorLink__playLinkSound = .text:0x8005BD20; // type:function size:0x40 @@ -6476,18 +6476,18 @@ fn_8010A850 = .text:0x8010A850; // type:function size:0x8 __sinit_\d_lyt_meter_timer_cpp = .text:0x8010A860; // type:function size:0x56C scope:local __dt__31sFStateID_c<16dLytMeterTimer_c>Fv = .text:0x8010ADD0; // type:function size:0x58 isSameName__31sFStateID_c<16dLytMeterTimer_c>CFPCc = .text:0x8010AE30; // type:function size:0x88 -fn_8010AEC0 = .text:0x8010AEC0; // type:function size:0x1AC -fn_8010B070 = .text:0x8010B070; // type:function size:0x8 -fn_8010B080 = .text:0x8010B080; // type:function size:0x44C -fn_8010B4D0 = .text:0x8010B4D0; // type:function size:0x10 -fn_8010B4E0 = .text:0x8010B4E0; // type:function size:0x24 -fn_8010B510 = .text:0x8010B510; // type:function size:0x330 -fn_8010B840 = .text:0x8010B840; // type:function size:0x480 -fn_8010BCC0 = .text:0x8010BCC0; // type:function size:0x28 -getHealthCapacityIncludingHeartMedals2 = .text:0x8010BCF0; // type:function size:0x24 -fn_8010BD20 = .text:0x8010BD20; // type:function size:0x8 -fn_8010BD30 = .text:0x8010BD30; // type:function size:0x8 -fn_8010BD40 = .text:0x8010BD40; // type:function size:0x8 +build__16dLytMeterHeart_cFPQ23d2d10ResAccIf_c = .text:0x8010AEC0; // type:function size:0x1AC +remove__16dLytMeterHeart_cFv = .text:0x8010B070; // type:function size:0x8 +execute__16dLytMeterHeart_cFv = .text:0x8010B080; // type:function size:0x44C +getNumDisplayedHearts__16dLytMeterHeart_cCFv = .text:0x8010B4D0; // type:function size:0x10 +getDisplayedHealthCapacity__16dLytMeterHeart_cCFv = .text:0x8010B4E0; // type:function size:0x24 +realizeHeartsState__16dLytMeterHeart_cFv = .text:0x8010B510; // type:function size:0x330 +executeInternal__16dLytMeterHeart_cFv = .text:0x8010B840; // type:function size:0x480 +getCurrentHealth__16dLytMeterHeart_cCFv = .text:0x8010BCC0; // type:function size:0x28 +getCurrentHealthCapacity__16dLytMeterHeart_cCFv = .text:0x8010BCF0; // type:function size:0x24 +getName__16dLytMeterHeart_cCFv = .text:0x8010BD20; // type:function size:0x8 +getLyt__16dLytMeterHeart_cFv = .text:0x8010BD30; // type:function size:0x8 +getPane__16dLytMeterHeart_cFv = .text:0x8010BD40; // type:function size:0x8 initializeState_Normal__22dLytMeterShieldGauge_cFv = .text:0x8010BD50; // type:function size:0x4 executeState_Normal__22dLytMeterShieldGauge_cFv = .text:0x8010BD60; // type:function size:0x4 finalizeState_Normal__22dLytMeterShieldGauge_cFv = .text:0x8010BD70; // type:function size:0x4 diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 2adfe26a..692bb763 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -251,6 +251,12 @@ public: /* 0x3C8 */ nw4r::g3d::ResFile mSwordRes; /* 0x3CC */ u8 _0x3CC[0x5B4 - 0x3CC]; /* 0x5B4 */ m3d::anmMatClr_c mAnmMatClr; + /* 0x5E0 */ u8 _0x5E0[0x4564 - 0x5E0]; + /* 0x4564 */ f32 field_0x4564; + + f32 getField_0x4564() const { + return field_0x4564; + } f32 getAnmMatClrFrame() const { return mAnmMatClr.getFrame(0); @@ -310,6 +316,8 @@ public: static s32 getCurrentBugNetType(); static bool isItemRestrictedByBokoBase(ITEM_ID item); + + static u32 getCurrentHealthCapacity(); }; #endif diff --git a/include/d/lyt/meter/d_lyt_meter_heart.h b/include/d/lyt/meter/d_lyt_meter_heart.h index 9fa52725..c1e60d93 100644 --- a/include/d/lyt/meter/d_lyt_meter_heart.h +++ b/include/d/lyt/meter/d_lyt_meter_heart.h @@ -2,6 +2,7 @@ #define D_LYT_METER_HEART_H #include "d/lyt/d2d.h" +#include "nw4r/lyt/lyt_pane.h" class dLytMeterHeart_c : public d2d::dSubPane { public: @@ -9,16 +10,46 @@ public: virtual bool build(d2d::ResAccIf_c *resAcc) override; virtual bool remove() override; virtual bool execute() override; - virtual nw4r::lyt::Pane *getPane() override; - virtual d2d::LytBase_c *getLyt() override; - virtual const char *getName() const override; + virtual nw4r::lyt::Pane *getPane() override { + return mLyt.getLayout()->GetRootPane(); + } + virtual d2d::LytBase_c *getLyt() override { + return &mLyt; + } + virtual const char *getName() const override { + return mLyt.getName(); + } virtual ~dLytMeterHeart_c() {} -private: - d2d::dLytSub mLyt; - /* 0xD8 */ d2d::AnmGroup_c mAnm[26]; - /* 0x??? */ u8 padding[0x12DA4 - 0x12D24]; +private: + u8 getCurrentHealth() const; + u8 getCurrentHealthCapacity() const; + void realizeHeartsState(); + void executeInternal(); + s32 getNumDisplayedHearts() const; + s32 getDisplayedHealthCapacity() const; + + /* 0x008 */ d2d::dLytSub mLyt; + /* 0x09C */ d2d::AnmGroup_c mAnm[26]; + /* 0x71C */ nw4r::lyt::Pane *mpHeartPanes[20]; + /* 0x76C */ nw4r::lyt::Pane *mpAlphaPane; + /* 0x770 */ nw4r::lyt::Pane *mpMainPane; + /* 0x774 */ s32 mCurrentHealth; + /* 0x778 */ s32 mCurrentHealthCapacity; + /* 0x77C */ s32 mStoredHealth; + /* 0x780 */ s32 mStoredHealthCapacity; + /* 0x784 */ s32 field_0x784; + /* 0x788 */ s32 field_0x788; + /* 0x78C */ s32 field_0x78C; + /* 0x790 */ s32 field_0x790; + /* 0x794 */ u8 field_0x794; + /* 0x795 */ u8 field_0x795; + /* 0x796 */ u8 field_0x796; + /* 0x797 */ u8 field_0x797; + /* 0x798 */ u8 field_0x798; + /* 0x799 */ u8 field_0x799; + /* 0x79A */ u8 field_0x79A; }; #endif diff --git a/include/d/lyt/meter/d_lyt_meter_key.h b/include/d/lyt/meter/d_lyt_meter_key.h index 57a5c05a..e6f444b2 100644 --- a/include/d/lyt/meter/d_lyt_meter_key.h +++ b/include/d/lyt/meter/d_lyt_meter_key.h @@ -26,6 +26,8 @@ private: STATE_FUNC_DECLARE(dLytMeterKakeraKey_c, Active); STATE_FUNC_DECLARE(dLytMeterKakeraKey_c, Off); + STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytMeterKakeraKey_c); + /* 0x000 */ UI_STATE_MGR_DECLARE(dLytMeterKakeraKey_c); /* 0x03C */ d2d::dLytSub mLyt; /* 0x0D0 */ d2d::AnmGroup_c mAnm[8]; @@ -61,6 +63,8 @@ private: STATE_FUNC_DECLARE(dLytMeterBossKey_c, Active); STATE_FUNC_DECLARE(dLytMeterBossKey_c, Off); + STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytMeterBossKey_c); + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMeterBossKey_c); /* 0x040 */ d2d::dLytSub mLyt; /* 0x0D4 */ d2d::AnmGroup_c mAnm[5]; @@ -94,6 +98,8 @@ private: STATE_FUNC_DECLARE(dLytMeterSmallKey_c, Active); STATE_FUNC_DECLARE(dLytMeterSmallKey_c, Off); + STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytMeterSmallKey_c); + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMeterSmallKey_c); /* 0x040 */ d2d::dLytSub mLyt; /* 0x0D4 */ d2d::AnmGroup_c mAnm[5]; diff --git a/include/d/lyt/meter/d_lyt_meter_timer.h b/include/d/lyt/meter/d_lyt_meter_timer.h index 3630de19..6e4fe817 100644 --- a/include/d/lyt/meter/d_lyt_meter_timer.h +++ b/include/d/lyt/meter/d_lyt_meter_timer.h @@ -4,8 +4,6 @@ #include "d/lyt/d2d.h" #include "m/m_color.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" - class LytMeterTimerPart1_c : public d2d::dSubPane { public: diff --git a/include/toBeSorted/file_manager.h b/include/toBeSorted/file_manager.h index ca69b908..28750912 100644 --- a/include/toBeSorted/file_manager.h +++ b/include/toBeSorted/file_manager.h @@ -149,17 +149,17 @@ public: /* 8000B6A0 */ u8 getShieldPouchSlot(); /* 8000B6F0 */ void setAirPotionTimer(u16 time); - /* 8000B720 */ u16 getAirPotionTimer(); + /* 8000B720 */ u16 getAirPotionTimer() const; /* 8000B770 */ void setAirPotionPlusTimer(u16 time); - /* 8000B7A0 */ u16 getAirPotionPlusTimer(); + /* 8000B7A0 */ u16 getAirPotionPlusTimer() const; /* 8000B7F0 */ void setStaminaPotionTimer(u16 time); - /* 8000B820 */ u16 getStaminaPotionTimer(); + /* 8000B820 */ u16 getStaminaPotionTimer() const; /* 8000B870 */ void setStaminaPotionPlusTimer(u16 time); - /* 8000B8A0 */ u16 getStaminaPotionPlusTimer(); + /* 8000B8A0 */ u16 getStaminaPotionPlusTimer() const; /* 8000B8F0 */ void setGuardianPotionTimer(u16 time); - /* 8000B920 */ u16 getGuardianPotionTimer(); + /* 8000B920 */ u16 getGuardianPotionTimer() const; /* 8000B970 */ void setGuardianPotionPlusTimer(u16 time); - /* 8000B9A0 */ u16 getGuardianPotionPlusTimer(); + /* 8000B9A0 */ u16 getGuardianPotionPlusTimer() const; /* 8000B9F0 */ void setDowsingSlotIdx(u8 idx); /* 8000BA20 */ u8 getDowsingSlotIdx(); @@ -285,6 +285,14 @@ public: return sInstance; } + bool hasGuardianPotionPlus() const { + return getGuardianPotionPlusTimer() != 0; + } + + bool hasGuardianPotionNormal() const { + return getGuardianPotionTimer() != 0; + } + private: static FileManager *sInstance; }; diff --git a/src/d/lyt/meter/d_lyt_meter_heart.cpp b/src/d/lyt/meter/d_lyt_meter_heart.cpp new file mode 100644 index 00000000..480fc46d --- /dev/null +++ b/src/d/lyt/meter/d_lyt_meter_heart.cpp @@ -0,0 +1,226 @@ +#include "d/lyt/meter/d_lyt_meter_heart.h" + +#include "d/a/d_a_player.h" +#include "d/lyt/d2d.h" +#include "toBeSorted/file_manager.h" + +static const d2d::LytBrlanMapping brlanMap[] = { + { "heartAll_00_heat.brlan", "G_heart_00"}, + { "heartAll_00_heat.brlan", "G_heart_01"}, + { "heartAll_00_heat.brlan", "G_heart_02"}, + { "heartAll_00_heat.brlan", "G_heart_03"}, + { "heartAll_00_heat.brlan", "G_heart_04"}, + { "heartAll_00_heat.brlan", "G_heart_05"}, + { "heartAll_00_heat.brlan", "G_heart_06"}, + { "heartAll_00_heat.brlan", "G_heart_07"}, + { "heartAll_00_heat.brlan", "G_heart_08"}, + { "heartAll_00_heat.brlan", "G_heart_09"}, + { "heartAll_00_heat.brlan", "G_heart_10"}, + { "heartAll_00_heat.brlan", "G_heart_11"}, + { "heartAll_00_heat.brlan", "G_heart_12"}, + { "heartAll_00_heat.brlan", "G_heart_13"}, + { "heartAll_00_heat.brlan", "G_heart_14"}, + { "heartAll_00_heat.brlan", "G_heart_15"}, + { "heartAll_00_heat.brlan", "G_heart_16"}, + { "heartAll_00_heat.brlan", "G_heart_17"}, + { "heartAll_00_heat.brlan", "G_heart_18"}, + { "heartAll_00_heat.brlan", "G_heart_19"}, + {"heartAll_00_heartMain.brlan", "G_heartMain_00"}, + { "heartAll_00_drink.brlan", "G_drink_00"}, + { "heartAll_00_mLoop.brlan", "G_mLoop_00"}, + { "heartAll_00_mCaution.brlan", "G_mCaution_00"}, + { "heartAll_00_loop.brlan", "G_loop_00"}, + { "heartAll_00_danger.brlan", "G_danger_00"}, +}; + +#define HEART_ANIM_HEAT_OFFSET 0 +#define HEART_ANIM_MAIN 20 +#define HEART_ANIM_DRINK 21 +#define HEART_ANIM_MLOOP 22 +#define HEART_ANIM_MCAUTION 23 +#define HEART_ANIM_LOOP 24 +#define HEART_ANIM_DANGER 25 + +#define HEART_NUM_ANIMS 26 + +#define HEART_NUM_HEARTS 20 + +static const char *sPaneNames[] = { + "N_heart_00", "N_heart_01", "N_heart_02", "N_heart_03", "N_heart_04", "N_heart_05", "N_heart_06", + "N_heart_07", "N_heart_08", "N_heart_09", "N_heart_10", "N_heart_11", "N_heart_12", "N_heart_13", + "N_heart_14", "N_heart_15", "N_heart_16", "N_heart_17", "N_heart_18", "N_heart_19", + +}; + +bool dLytMeterHeart_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("heartAll_00.brlyt", nullptr); + + for (int i = 0; i < HEART_NUM_ANIMS; i++) { + mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); + mAnm[i].bind(false); + if (i <= HEART_NUM_HEARTS) { + mAnm[i].setAnimEnable(true); + } else { + mAnm[i].setAnimEnable(false); + } + } + + for (int i = 0; i < HEART_NUM_HEARTS; i++) { + mpHeartPanes[i] = mLyt.findPane(sPaneNames[i]); + } + + mpAlphaPane = mLyt.findPane("N_heartAlpha_00"); + mpMainPane = mLyt.findPane("N_heartMain_00"); + + mCurrentHealth = 0; + mCurrentHealthCapacity = 0; + mStoredHealth = 0; + mStoredHealthCapacity = 0; + field_0x784 = 0; + field_0x788 = -1; + field_0x78C = 0; + field_0x790 = 0; + field_0x794 = 0; + field_0x797 = 0; + field_0x798 = 0; + field_0x799 = 0; + field_0x79A = 0; + + mCurrentHealth = getCurrentHealth(); + mCurrentHealthCapacity = getCurrentHealthCapacity(); + mStoredHealth = mCurrentHealth; + mStoredHealthCapacity = mCurrentHealthCapacity; + field_0x794 = 1; + realizeHeartsState(); + field_0x795 = 1; + + mLyt.calc(); + + return true; +} + +bool dLytMeterHeart_c::remove() { + return true; +} + +bool dLytMeterHeart_c::execute() { + if (field_0x78C > 0) { + field_0x78C--; + } + if (field_0x790 > 0) { + field_0x790--; + } + executeInternal(); + + if (field_0x798) { + if (!mAnm[HEART_ANIM_LOOP].isEnabled()) { + mAnm[HEART_ANIM_LOOP].setFrame(0.0f); + mAnm[HEART_ANIM_LOOP].setAnimEnable(true); + } + } else { + if (mAnm[HEART_ANIM_LOOP].isEnabled()) { + mAnm[HEART_ANIM_LOOP].setFrame(0.0f); + mLyt.calc(); + mAnm[HEART_ANIM_LOOP].setAnimEnable(false); + } + } + + if (field_0x799) { + if (dAcPy_c::GetLink2()->getField_0x4564() == 1.0f) { + if (!mAnm[HEART_ANIM_DANGER].isEnabled()) { + mAnm[HEART_ANIM_DANGER].setAnimEnable(true); + } + mAnm[HEART_ANIM_DANGER].setFrame(0.0f); + } + } else { + if (mAnm[HEART_ANIM_DANGER].isEnabled()) { + mAnm[HEART_ANIM_DANGER].setToEnd(); + mLyt.getLayout()->Animate(0); + mLyt.calc(); + mAnm[HEART_ANIM_DANGER].setAnimEnable(false); + } + } + + f32 drinkFrame = 0.0f; + bool hasGuardianPotion = false; + bool hasExpiringGuardianPotion = false; + if (FileManager::GetInstance()->hasGuardianPotionPlus()) { + drinkFrame = 2.0f; + hasGuardianPotion = true; + } else if (FileManager::GetInstance()->hasGuardianPotionNormal()) { + hasGuardianPotion = true; + drinkFrame = 1.0f; + } + + if ((FileManager::GetInstance()->hasGuardianPotionNormal() && + FileManager::GetInstance()->getGuardianPotionTimer() < 600) || + (FileManager::GetInstance()->hasGuardianPotionPlus() && + FileManager::GetInstance()->getGuardianPotionPlusTimer() < 600)) { + hasExpiringGuardianPotion = true; + } + + if (hasGuardianPotion) { + if (!mAnm[HEART_ANIM_MLOOP].isEnabled()) { + mAnm[HEART_ANIM_MLOOP].setFrame(0.0f); + mAnm[HEART_ANIM_MLOOP].setAnimEnable(true); + } + } else if (mAnm[HEART_ANIM_MLOOP].getFrame() < 1.0f) { + mAnm[HEART_ANIM_MLOOP].setFrame(0.0f); + mLyt.getLayout()->Animate(0); + mAnm[HEART_ANIM_MLOOP].setAnimEnable(false); + } + + if (hasGuardianPotion && hasExpiringGuardianPotion) { + if (!mAnm[HEART_ANIM_MCAUTION].isEnabled()) { + mAnm[HEART_ANIM_MCAUTION].setFrame(0.0f); + mAnm[HEART_ANIM_MCAUTION].setAnimEnable(true); + } + } else if (mAnm[HEART_ANIM_MCAUTION].getFrame() < 1.0f) { + mAnm[HEART_ANIM_MCAUTION].setFrame(0.0f); + mLyt.getLayout()->Animate(0); + mAnm[HEART_ANIM_MCAUTION].setAnimEnable(false); + } + + mAnm[HEART_ANIM_DRINK].setFrame(drinkFrame); + mAnm[HEART_ANIM_DRINK].setAnimEnable(true); + + for (int i = 0; i < HEART_NUM_ANIMS; i++) { + if (i > HEART_NUM_HEARTS + 1 && mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + + if (field_0x799 && mAnm[HEART_ANIM_DANGER].isEndReached()) { + mAnm[HEART_ANIM_DANGER].setToEnd(); + mAnm[HEART_ANIM_DANGER].setAnimEnable(false); + } + + mLyt.calc(); + + return true; +} + +s32 dLytMeterHeart_c::getNumDisplayedHearts() const { + return mStoredHealthCapacity / 4; +} + +s32 dLytMeterHeart_c::getDisplayedHealthCapacity() const { + return getNumDisplayedHearts() * 4; +} + +void dLytMeterHeart_c::realizeHeartsState() { + // TODO +} + +void dLytMeterHeart_c::executeInternal() { + // TODO +} + +u8 dLytMeterHeart_c::getCurrentHealth() const { + return FileManager::GetInstance()->getCurrentHealth(); +} + +u8 dLytMeterHeart_c::getCurrentHealthCapacity() const { + return dAcPy_c::getCurrentHealthCapacity(); +} diff --git a/src/toBeSorted/file_manager.cpp b/src/toBeSorted/file_manager.cpp index 752d9f89..266c6e45 100644 --- a/src/toBeSorted/file_manager.cpp +++ b/src/toBeSorted/file_manager.cpp @@ -174,17 +174,17 @@ u16 *FileManager::getStoryFlagsMut() { /* 8000B6A0 */ u8 FileManager::getShieldPouchSlot() {} /* 8000B6F0 */ void FileManager::setAirPotionTimer(u16 time) {} -/* 8000B720 */ u16 FileManager::getAirPotionTimer() {} +/* 8000B720 */ u16 FileManager::getAirPotionTimer() const {} /* 8000B770 */ void FileManager::setAirPotionPlusTimer(u16 time) {} -/* 8000B7A0 */ u16 FileManager::getAirPotionPlusTimer() {} +/* 8000B7A0 */ u16 FileManager::getAirPotionPlusTimer() const {} /* 8000B7F0 */ void FileManager::setStaminaPotionTimer(u16 time) {} -/* 8000B820 */ u16 FileManager::getStaminaPotionTimer() {} +/* 8000B820 */ u16 FileManager::getStaminaPotionTimer() const {} /* 8000B870 */ void FileManager::setStaminaPotionPlusTimer(u16 time) {} -/* 8000B8A0 */ u16 FileManager::getStaminaPotionPlusTimer() {} +/* 8000B8A0 */ u16 FileManager::getStaminaPotionPlusTimer() const {} /* 8000B8F0 */ void FileManager::setGuardianPotionTimer(u16 time) {} -/* 8000B920 */ u16 FileManager::getGuardianPotionTimer() {} +/* 8000B920 */ u16 FileManager::getGuardianPotionTimer() const {} /* 8000B970 */ void FileManager::setGuardianPotionPlusTimer(u16 time) {} -/* 8000B9A0 */ u16 FileManager::getGuardianPotionPlusTimer() {} +/* 8000B9A0 */ u16 FileManager::getGuardianPotionPlusTimer() const {} /* 8000B9F0 */ void FileManager::setDowsingSlotIdx(u8 idx) {} /* 8000BA20 */ u8 FileManager::getDowsingSlotIdx() {}