From 1d17e35316b4fe989eae438fe55df64647277107 Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 28 Oct 2024 05:03:08 +0100 Subject: [PATCH] d_lyt_meter_drink with regswaps in one function (#83) --- config/SOUE01/splits.txt | 2 + config/SOUE01/symbols.txt | 110 ++--- include/d/lyt/d2d.h | 4 + include/d/lyt/meter/d_lyt_meter_drink.h | 57 ++- include/m/m2d.h | 6 + include/toBeSorted/file_manager.h | 24 +- src/d/lyt/meter/d_lyt_meter_drink.cpp | 542 ++++++++++++++++++++++++ src/toBeSorted/file_manager.cpp | 24 +- tools/decompctx.py | 28 +- 9 files changed, 713 insertions(+), 84 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 4970d2cb0..3286d0c4c 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -244,7 +244,9 @@ d/lyt/meter/d_lyt_meter_key.cpp: d/lyt/meter/d_lyt_meter_drink.cpp: .text start:0x800E4930 end:0x800E6AC8 .ctors start:0x804DB6F0 end:0x804DB6F4 + .rodata start:0x804E55A0 end:0x804E5640 .data start:0x805148B0 end:0x80514D60 + .sdata2 start:0x80579BA0 end:0x80579BB0 .bss start:0x805AA790 end:0x805AA9D0 d/lyt/meter/d_lyt_meter_remocon_bg.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index be65cf087..8eed7f28a 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -327,17 +327,17 @@ setSelectedPouchSlot__11FileManagerFUc = .text:0x8000B5F0; // type:function size getSelectedPouchSlot__11FileManagerFv = .text:0x8000B620; // type:function size:0x44 setShieldPouchSlot__11FileManagerFUc = .text:0x8000B670; // type:function size:0x30 getShieldPouchSlot__11FileManagerFv = .text:0x8000B6A0; // type:function size:0x44 -setAirPotionTimer__11FileManagerFs = .text:0x8000B6F0; // type:function size:0x30 +setAirPotionTimer__11FileManagerFUs = .text:0x8000B6F0; // type:function size:0x30 getAirPotionTimer__11FileManagerFv = .text:0x8000B720; // type:function size:0x44 -setAirPotionPlusTimer__11FileManagerFs = .text:0x8000B770; // type:function size:0x30 +setAirPotionPlusTimer__11FileManagerFUs = .text:0x8000B770; // type:function size:0x30 getAirPotionPlusTimer__11FileManagerFv = .text:0x8000B7A0; // type:function size:0x44 -setStaminaPotionTimer__11FileManagerFs = .text:0x8000B7F0; // type:function size:0x30 +setStaminaPotionTimer__11FileManagerFUs = .text:0x8000B7F0; // type:function size:0x30 getStaminaPotionTimer__11FileManagerFv = .text:0x8000B820; // type:function size:0x44 -setStaminaPotionPlusTimer__11FileManagerFs = .text:0x8000B870; // type:function size:0x30 +setStaminaPotionPlusTimer__11FileManagerFUs = .text:0x8000B870; // type:function size:0x30 getStaminaPotionPlusTimer__11FileManagerFv = .text:0x8000B8A0; // type:function size:0x44 -setGuardianPotionTimer__11FileManagerFs = .text:0x8000B8F0; // type:function size:0x30 +setGuardianPotionTimer__11FileManagerFUs = .text:0x8000B8F0; // type:function size:0x30 getGuardianPotionTimer__11FileManagerFv = .text:0x8000B920; // type:function size:0x44 -setGuardianPotionPlusTimer__11FileManagerFs = .text:0x8000B970; // type:function size:0x30 +setGuardianPotionPlusTimer__11FileManagerFUs = .text:0x8000B970; // type:function size:0x30 getGuardianPotionPlusTimer__11FileManagerFv = .text:0x8000B9A0; // type:function size:0x44 setDowsingSlotIdx__11FileManagerFUc = .text:0x8000B9F0; // type:function size:0x30 getDowsingSlotIdx__11FileManagerFv = .text:0x8000BA20; // type:function size:0x44 @@ -4792,8 +4792,8 @@ changeState__84sStateMgr_c<15dLytBossGauge_c,20sStateMethodUsr_FI_c,12sFStateFct changeState__84sStateMgr_c<15dLytBirdGauge_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x800D9840; // type:function size:0x10 changeState__85sStateMgr_c<16dLytMeterTimer_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x800D9850; // type:function size:0x10 getStateID__85sStateMgr_c<16dLytMeterTimer_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>CFv = .text:0x800D9860; // type:function size:0x10 -fn_800D9870 = .text:0x800D9870; // type:function size:0x8 -fn_800D9880 = .text:0x800D9880; // type:function size:0x8 +getName__16dLytMeterDrink_cFv = .text:0x800D9870; // type:function size:0x8 +getLyt__16dLytMeterDrink_cFv = .text:0x800D9880; // type:function size:0x8 changeState__85sStateMgr_c<16dLytMeterDrink_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x800D9890; // type:function size:0x10 changeState__90sStateMgr_c<21dLytMeterDrinkParts_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>FRC12sStateIDIf_c = .text:0x800D98A0; // type:function size:0x10 fn_800D98B0 = .text:0x800D98B0; // type:function size:0x8 @@ -5557,45 +5557,45 @@ __dt__34sFStateID_c<19dLytMeterSmallKey_c>Fv = .text:0x800E4720; // type:functio isSameName__34sFStateID_c<19dLytMeterSmallKey_c>CFPCc = .text:0x800E4780; // type:function size:0x88 isSameName__33sFStateID_c<18dLytMeterBossKey_c>CFPCc = .text:0x800E4810; // type:function size:0x88 isSameName__35sFStateID_c<20dLytMeterKakeraKey_c>CFPCc = .text:0x800E48A0; // type:function size:0x88 -fn_800E4930 = .text:0x800E4930; // type:function size:0x9C -fn_800E49D0 = .text:0x800E49D0; // type:function size:0x6C -fn_800E4A40 = .text:0x800E4A40; // type:function size:0x4 -fn_800E4A50 = .text:0x800E4A50; // type:function size:0xA4 -fn_800E4B00 = .text:0x800E4B00; // type:function size:0x9C -fn_800E4BA0 = .text:0x800E4BA0; // type:function size:0x4 -fn_800E4BB0 = .text:0x800E4BB0; // type:function size:0x88 -fn_800E4C40 = .text:0x800E4C40; // type:function size:0x78 -fn_800E4CC0 = .text:0x800E4CC0; // type:function size:0x4 -fn_800E4CD0 = .text:0x800E4CD0; // type:function size:0xA4 -fn_800E4D80 = .text:0x800E4D80; // type:function size:0xB4 -fn_800E4E40 = .text:0x800E4E40; // type:function size:0x4 -fn_800E4E50 = .text:0x800E4E50; // type:function size:0x6C -fn_800E4EC0 = .text:0x800E4EC0; // type:function size:0x74 -fn_800E4F40 = .text:0x800E4F40; // type:function size:0xD4 -fn_800E5020 = .text:0x800E5020; // type:function size:0xE4 -fn_800E5110 = .text:0x800E5110; // type:function size:0x158 -fn_800E5270 = .text:0x800E5270; // type:function size:0x4 -fn_800E5280 = .text:0x800E5280; // type:function size:0x28 -fn_800E52B0 = .text:0x800E52B0; // type:function size:0x4 -fn_800E52C0 = .text:0x800E52C0; // type:function size:0x48 -fn_800E5310 = .text:0x800E5310; // type:function size:0x94 -fn_800E53B0 = .text:0x800E53B0; // type:function size:0x4 -fn_800E53C0 = .text:0x800E53C0; // type:function size:0xC -fn_800E53D0 = .text:0x800E53D0; // type:function size:0x1A4 -fn_800E5580 = .text:0x800E5580; // type:function size:0x4 -fn_800E5590 = .text:0x800E5590; // type:function size:0x90 -fn_800E5620 = .text:0x800E5620; // type:function size:0x1B8 -fn_800E57E0 = .text:0x800E57E0; // type:function size:0x4 -fn_800E57F0 = .text:0x800E57F0; // type:function size:0x48 -fn_800E5840 = .text:0x800E5840; // type:function size:0x94 -fn_800E58E0 = .text:0x800E58E0; // type:function size:0x4 -fn_800E58F0 = .text:0x800E58F0; // type:function size:0x1E8 +initializeState_Invisible__21dLytMeterDrinkParts_cFv = .text:0x800E4930; // type:function size:0x9C +executeState_Invisible__21dLytMeterDrinkParts_cFv = .text:0x800E49D0; // type:function size:0x6C +finalizeState_Invisible__21dLytMeterDrinkParts_cFv = .text:0x800E4A40; // type:function size:0x4 +initializeState_In__21dLytMeterDrinkParts_cFv = .text:0x800E4A50; // type:function size:0xA4 +executeState_In__21dLytMeterDrinkParts_cFv = .text:0x800E4B00; // type:function size:0x9C +finalizeState_In__21dLytMeterDrinkParts_cFv = .text:0x800E4BA0; // type:function size:0x4 +initializeState_Visible__21dLytMeterDrinkParts_cFv = .text:0x800E4BB0; // type:function size:0x88 +executeState_Visible__21dLytMeterDrinkParts_cFv = .text:0x800E4C40; // type:function size:0x78 +finalizeState_Visible__21dLytMeterDrinkParts_cFv = .text:0x800E4CC0; // type:function size:0x4 +initializeState_Out__21dLytMeterDrinkParts_cFv = .text:0x800E4CD0; // type:function size:0xA4 +executeState_Out__21dLytMeterDrinkParts_cFv = .text:0x800E4D80; // type:function size:0xB4 +finalizeState_Out__21dLytMeterDrinkParts_cFv = .text:0x800E4E40; // type:function size:0x4 +init__21dLytMeterDrinkParts_cFv = .text:0x800E4E50; // type:function size:0x6C +execute__21dLytMeterDrinkParts_cFv = .text:0x800E4EC0; // type:function size:0x74 +getDrinkFrame__21dLytMeterDrinkParts_cCFQ221dLytMeterDrinkParts_c11DrinkType_e = .text:0x800E4F40; // type:function size:0xD4 +isDrinkAboutToExpire__21dLytMeterDrinkParts_cCFv = .text:0x800E5020; // type:function size:0xE4 +copy__21dLytMeterDrinkParts_cFP21dLytMeterDrinkParts_cP21dLytMeterDrinkParts_c = .text:0x800E5110; // type:function size:0x158 +initializeState_Invisible__16dLytMeterDrink_cFv = .text:0x800E5270; // type:function size:0x4 +executeState_Invisible__16dLytMeterDrink_cFv = .text:0x800E5280; // type:function size:0x28 +finalizeState_Invisible__16dLytMeterDrink_cFv = .text:0x800E52B0; // type:function size:0x4 +initializeState_In__16dLytMeterDrink_cFv = .text:0x800E52C0; // type:function size:0x48 +executeState_In__16dLytMeterDrink_cFv = .text:0x800E5310; // type:function size:0x94 +finalizeState_In__16dLytMeterDrink_cFv = .text:0x800E53B0; // type:function size:0x4 +initializeState_Wait__16dLytMeterDrink_cFv = .text:0x800E53C0; // type:function size:0xC +executeState_Wait__16dLytMeterDrink_cFv = .text:0x800E53D0; // type:function size:0x1A4 +finalizeState_Wait__16dLytMeterDrink_cFv = .text:0x800E5580; // type:function size:0x4 +initializeState_Move__16dLytMeterDrink_cFv = .text:0x800E5590; // type:function size:0x90 +executeState_Move__16dLytMeterDrink_cFv = .text:0x800E5620; // type:function size:0x1B8 +finalizeState_Move__16dLytMeterDrink_cFv = .text:0x800E57E0; // type:function size:0x4 +initializeState_Out__16dLytMeterDrink_cFv = .text:0x800E57F0; // type:function size:0x48 +executeState_Out__16dLytMeterDrink_cFv = .text:0x800E5840; // type:function size:0x94 +finalizeState_Out__16dLytMeterDrink_cFv = .text:0x800E58E0; // type:function size:0x4 +build__16dLytMeterDrink_cFPQ23d2d10ResAccIf_c = .text:0x800E58F0; // type:function size:0x1E8 remove__16dLytMeterDrink_cFv = .text:0x800E5AE0; // type:function size:0x58 -fn_800E5B40 = .text:0x800E5B40; // type:function size:0xC4 +execute__16dLytMeterDrink_cFv = .text:0x800E5B40; // type:function size:0xC4 draw__16dLytMeterDrink_cFv = .text:0x800E5C10; // type:function size:0x28 -fn_800E5C40 = .text:0x800E5C40; // type:function size:0xD0 -fn_800E5D10 = .text:0x800E5D10; // type:function size:0x44 -fn_800E5D60 = .text:0x800E5D60; // type:function size:0x498 +fn_800E5C40__16dLytMeterDrink_cFi = .text:0x800E5C40; // type:function size:0xD0 +getPartForDrinkType__16dLytMeterDrink_cCFQ221dLytMeterDrinkParts_c11DrinkType_e = .text:0x800E5D10; // type:function size:0x44 +executeInternal__16dLytMeterDrink_cFv = .text:0x800E5D60; // type:function size:0x498 __sinit_\d_lyt_meter_drink_cpp = .text:0x800E6200; // type:function size:0x6F0 scope:local __dt__36sFStateID_c<21dLytMeterDrinkParts_c>Fv = .text:0x800E68F0; // type:function size:0x58 __dt__31sFStateID_c<16dLytMeterDrink_c>Fv = .text:0x800E6950; // type:function size:0x58 @@ -48378,16 +48378,16 @@ LytMeterSmallKey__STATE_WAIT = .bss:0x805AA6A0; // type:object size:0x40 data:4b LytMeterSmallKey__STATE_ON = .bss:0x805AA6E0; // type:object size:0x40 data:4byte LytMeterSmallKey__STATE_ACTIVE = .bss:0x805AA720; // type:object size:0x40 data:4byte LytMeterSmallKey__STATE_OFF = .bss:0x805AA760; // type:object size:0x30 data:4byte -lbl_805AA790 = .bss:0x805AA790; // type:object size:0x10 -LytMeterDrinkParts__STATE_INVISIBLE = .bss:0x805AA7A0; // type:object size:0x40 data:4byte -LytMeterDrinkParts__STATE_IN = .bss:0x805AA7E0; // type:object size:0x40 data:4byte -LytMeterDrinkParts__STATE_VISIBLE = .bss:0x805AA820; // type:object size:0x40 data:4byte -LytMeterDrinkParts__STATE_OUT = .bss:0x805AA860; // type:object size:0x40 data:4byte -LytMeterDrink__STATE_INVISIBLE = .bss:0x805AA8A0; // type:object size:0x40 data:4byte -LytMeterDrink__STATE_IN = .bss:0x805AA8E0; // type:object size:0x40 data:4byte -LytMeterDrink__STATE_WAIT = .bss:0x805AA920; // type:object size:0x40 data:4byte -LytMeterDrink__STATE_MOVE = .bss:0x805AA960; // type:object size:0x40 data:4byte -LytMeterDrink__STATE_OUT = .bss:0x805AA9A0; // type:object size:0x30 data:4byte +lbl_805AA790 = .bss:0x805AA790; // type:object size:0xC scope:local +StateID_Invisible__21dLytMeterDrinkParts_c = .bss:0x805AA7A0; // type:object size:0x30 data:4byte +StateID_In__21dLytMeterDrinkParts_c = .bss:0x805AA7E0; // type:object size:0x30 data:4byte +StateID_Visible__21dLytMeterDrinkParts_c = .bss:0x805AA820; // type:object size:0x30 data:4byte +StateID_Out__21dLytMeterDrinkParts_c = .bss:0x805AA860; // type:object size:0x30 data:4byte +StateID_Invisible__16dLytMeterDrink_c = .bss:0x805AA8A0; // type:object size:0x30 data:4byte +StateID_In__16dLytMeterDrink_c = .bss:0x805AA8E0; // type:object size:0x30 data:4byte +StateID_Wait__16dLytMeterDrink_c = .bss:0x805AA920; // type:object size:0x30 data:4byte +StateID_Move__16dLytMeterDrink_c = .bss:0x805AA960; // type:object size:0x30 data:4byte +StateID_Out__16dLytMeterDrink_c = .bss:0x805AA9A0; // type:object size:0x30 data:4byte lbl_805AA9D0 = .bss:0x805AA9D0; // type:object size:0x10 LytMeterRemoconBg__STATE_WAIT = .bss:0x805AA9E0; // type:object size:0xF0 data:4byte lbl_805AAAD0 = .bss:0x805AAAD0; // type:object size:0x10 diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index 9747f09c5..3741c8864 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -262,6 +262,10 @@ struct AnmGroupBase_c { syncAnmFrame(); } + inline f32 getNextFrame() const { + return mpFrameCtrl->getNextFrame(); + } + private: /* 0x04 */ void *field_0x04; /* 0x08 */ m2d::FrameCtrl_c *mpFrameCtrl; diff --git a/include/d/lyt/meter/d_lyt_meter_drink.h b/include/d/lyt/meter/d_lyt_meter_drink.h index dc229ec1e..43d8a7db7 100644 --- a/include/d/lyt/meter/d_lyt_meter_drink.h +++ b/include/d/lyt/meter/d_lyt_meter_drink.h @@ -1,15 +1,45 @@ #ifndef D_LYT_METER_DRINK_H #define D_LYT_METER_DRINK_H +#include "common.h" #include "d/lyt/d2d.h" +#include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" +// Size 0x54 class dLytMeterDrinkParts_c { + friend class dLytMeterDrink_c; + + enum DrinkType_e { + TYPE_STAMINA, + TYPE_AIR, + TYPE_GUARDIAN, + TYPE_NONE, + }; + + enum DrinkFrame_e { + FRAME_STAMINA, + FRAME_STAMINA_PLUS, + FRAME_AIR, + FRAME_AIR_PLUS, + FRAME_GUARDIAN, + FRAME_GUARDIAN_PLUS, + FRAME_NONE + }; + public: dLytMeterDrinkParts_c() : mStateMgr(*this, sStateID::null) {} ~dLytMeterDrinkParts_c() {} + void init(); + void execute(); + + bool isDrinkAboutToExpire() const; + DrinkFrame_e getDrinkFrame(DrinkType_e ty) const; + void copy(dLytMeterDrinkParts_c *other, dLytMeterDrinkParts_c *third); + private: STATE_FUNC_DECLARE(dLytMeterDrinkParts_c, Invisible); STATE_FUNC_DECLARE(dLytMeterDrinkParts_c, In); @@ -17,7 +47,11 @@ class dLytMeterDrinkParts_c { STATE_FUNC_DECLARE(dLytMeterDrinkParts_c, Out); /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMeterDrinkParts_c); - /* 0x03C */ u8 field_0x03C[0x18]; + /* 0x03C */ d2d::AnmGroup_c *mAnmGroups[3]; + /* 0x048 */ s32 field_0x48; + /* 0x04C */ DrinkType_e mDrinkType; + /* 0x050 */ u8 field_0x50; + /* 0x051 */ u8 field_0x51; }; class dLytMeterDrink_c { @@ -25,14 +59,23 @@ class dLytMeterDrink_c { dLytMeterDrink_c() : mStateMgr(*this, sStateID::null) {} ~dLytMeterDrink_c() {} - virtual void BossKey0x8() {} - virtual void BossKey0xC() {} + virtual d2d::dLytSub *getLyt() { + return &mLyt; + } + virtual const char *getName() { + return mLyt.getName(); + } bool build(d2d::ResAccIf_c *); bool remove(); bool draw(); + bool execute(); private: + bool fn_800E5C40(int); + int getPartForDrinkType(dLytMeterDrinkParts_c::DrinkType_e ty) const; + void executeInternal(); + STATE_FUNC_DECLARE(dLytMeterDrink_c, Invisible); STATE_FUNC_DECLARE(dLytMeterDrink_c, In); STATE_FUNC_DECLARE(dLytMeterDrink_c, Wait); @@ -42,8 +85,14 @@ class dLytMeterDrink_c { /* 0x004 */ UI_STATE_MGR_DECLARE(dLytMeterDrink_c); /* 0x040 */ d2d::dLytSub mLyt; /* 0x0D4 */ d2d::AnmGroup_c mAnmGroups[20]; - /* 0x5D4 */ u8 field_0x5D4[0x5E4 - 0x5D4]; + /* 0x5D4 */ nw4r::lyt::Pane *mpPartPanes[3]; + /* 0x5E0 */ nw4r::lyt::Pane *mpPane; /* 0x5E4 */ dLytMeterDrinkParts_c mParts[3]; + /* 0x6E0 */ mVec3_c field_0x6E0; + /* 0x6EC */ UNKWORD field_0x6EC; + /* 0x6F0 */ s32 field_0x6F0; + /* 0x6F4 */ u8 field_0x6F4; + /* 0x6F5 */ u8 field_0x6F5[3]; }; #endif diff --git a/include/m/m2d.h b/include/m/m2d.h index 2d3a1750e..72349aef4 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -99,6 +99,12 @@ class FrameCtrl_c { setFrame(actualEnd - (ratio * actualEnd)); } + inline f32 getNextFrame() const { + f32 end = mEndFrame; + f32 f = mCurrFrame + 1.0f; + return f >= end ? 0.0f : f; + } + private: inline bool notLooping() const { return (mFlags & FLAG_NO_LOOP) != 0; diff --git a/include/toBeSorted/file_manager.h b/include/toBeSorted/file_manager.h index 89a769aa8..b4f44e6f4 100644 --- a/include/toBeSorted/file_manager.h +++ b/include/toBeSorted/file_manager.h @@ -150,18 +150,18 @@ class FileManager { /* 8000B670 */ void setShieldPouchSlot(u8 slot); /* 8000B6A0 */ u8 getShieldPouchSlot(); - /* 8000B6F0 */ void setAirPotionTimer(s16 time); - /* 8000B720 */ s16 getAirPotionTimer(); - /* 8000B770 */ void setAirPotionPlusTimer(s16 time); - /* 8000B7A0 */ s16 getAirPotionPlusTimer(); - /* 8000B7F0 */ void setStaminaPotionTimer(s16 time); - /* 8000B820 */ s16 getStaminaPotionTimer(); - /* 8000B870 */ void setStaminaPotionPlusTimer(s16 time); - /* 8000B8A0 */ s16 getStaminaPotionPlusTimer(); - /* 8000B8F0 */ void setGuardianPotionTimer(s16 time); - /* 8000B920 */ s16 getGuardianPotionTimer(); - /* 8000B970 */ void setGuardianPotionPlusTimer(s16 time); - /* 8000B9A0 */ s16 getGuardianPotionPlusTimer(); + /* 8000B6F0 */ void setAirPotionTimer(u16 time); + /* 8000B720 */ u16 getAirPotionTimer(); + /* 8000B770 */ void setAirPotionPlusTimer(u16 time); + /* 8000B7A0 */ u16 getAirPotionPlusTimer(); + /* 8000B7F0 */ void setStaminaPotionTimer(u16 time); + /* 8000B820 */ u16 getStaminaPotionTimer(); + /* 8000B870 */ void setStaminaPotionPlusTimer(u16 time); + /* 8000B8A0 */ u16 getStaminaPotionPlusTimer(); + /* 8000B8F0 */ void setGuardianPotionTimer(u16 time); + /* 8000B920 */ u16 getGuardianPotionTimer(); + /* 8000B970 */ void setGuardianPotionPlusTimer(u16 time); + /* 8000B9A0 */ u16 getGuardianPotionPlusTimer(); /* 8000B9F0 */ void setDowsingSlotIdx(u8 idx); /* 8000BA20 */ u8 getDowsingSlotIdx(); diff --git a/src/d/lyt/meter/d_lyt_meter_drink.cpp b/src/d/lyt/meter/d_lyt_meter_drink.cpp index 8e691aaba..7960cce5e 100644 --- a/src/d/lyt/meter/d_lyt_meter_drink.cpp +++ b/src/d/lyt/meter/d_lyt_meter_drink.cpp @@ -1,5 +1,11 @@ #include "d/lyt/meter/d_lyt_meter_drink.h" +#include "common.h" +#include "d/lyt/d2d.h" +#include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" +#include "toBeSorted/file_manager.h" + STATE_DEFINE(dLytMeterDrinkParts_c, Invisible); STATE_DEFINE(dLytMeterDrinkParts_c, In); STATE_DEFINE(dLytMeterDrinkParts_c, Visible); @@ -10,3 +16,539 @@ STATE_DEFINE(dLytMeterDrink_c, In); STATE_DEFINE(dLytMeterDrink_c, Wait); STATE_DEFINE(dLytMeterDrink_c, Move); STATE_DEFINE(dLytMeterDrink_c, Out); + +void dLytMeterDrinkParts_c::initializeState_Invisible() { + if (field_0x51) { + if (mAnmGroups[2]->isFlag2()) { + mAnmGroups[2]->setAnimEnable(false); + } + if (!mAnmGroups[0]->isFlag2()) { + mAnmGroups[0]->setAnimEnable(true); + } + mAnmGroups[0]->setFrame(0.0f); + field_0x48 = 6; + mDrinkType = TYPE_NONE; + field_0x51 = 0; + } +} +void dLytMeterDrinkParts_c::executeState_Invisible() { + if (mAnmGroups[0]->isFlag2()) { + mAnmGroups[0]->setAnimEnable(false); + } + if (field_0x50) { + mStateMgr.changeState(StateID_In); + } +} +void dLytMeterDrinkParts_c::finalizeState_Invisible() {} + +void dLytMeterDrinkParts_c::initializeState_In() { + if (field_0x51) { + if (mAnmGroups[2]->isFlag2()) { + mAnmGroups[2]->setAnimEnable(false); + } + mAnmGroups[0]->setToEnd(); + field_0x51 = 0; + } else { + mAnmGroups[0]->setFrame(0.0f); + } + mAnmGroups[0]->setAnimEnable(true); +} +void dLytMeterDrinkParts_c::executeState_In() { + if (mAnmGroups[0]->isEndReached()) { + mAnmGroups[0]->setAnimEnable(false); + mStateMgr.changeState(StateID_Visible); + } + + if (mAnmGroups[0]->isFlag2()) { + mAnmGroups[0]->play(); + } +} +void dLytMeterDrinkParts_c::finalizeState_In() {} + +void dLytMeterDrinkParts_c::initializeState_Visible() { + if (field_0x51) { + if (mAnmGroups[2]->isFlag2()) { + mAnmGroups[2]->setAnimEnable(false); + } + mAnmGroups[0]->setAnimEnable(true); + mAnmGroups[0]->setToEnd(); + field_0x51 = 0; + } +} + +void dLytMeterDrinkParts_c::executeState_Visible() { + if (mAnmGroups[0]->isFlag2()) { + mAnmGroups[0]->setAnimEnable(false); + } + + if (field_0x48 != getDrinkFrame(mDrinkType)) { + mStateMgr.changeState(StateID_Out); + } +} +void dLytMeterDrinkParts_c::finalizeState_Visible() {} + +void dLytMeterDrinkParts_c::initializeState_Out() { + if (field_0x51) { + if (mAnmGroups[0]->isFlag2()) { + mAnmGroups[0]->setAnimEnable(false); + } + mAnmGroups[2]->setToEnd(); + field_0x51 = 0; + } else { + mAnmGroups[2]->setFrame(0.0f); + } + + mAnmGroups[2]->setAnimEnable(true); +} +void dLytMeterDrinkParts_c::executeState_Out() { + if (mAnmGroups[2]->isEndReached()) { + mAnmGroups[2]->setAnimEnable(false); + field_0x48 = 6; + mDrinkType = TYPE_NONE; + field_0x50 = 0; + mStateMgr.changeState(StateID_Invisible); + } + if (mAnmGroups[2]->isFlag2()) { + mAnmGroups[2]->play(); + } +} +void dLytMeterDrinkParts_c::finalizeState_Out() {} + +void dLytMeterDrinkParts_c::init() { + field_0x50 = 0; + field_0x51 = 0; + field_0x48 = 6; + mDrinkType = TYPE_NONE; + mAnmGroups[1]->setAnimEnable(true); + mStateMgr.changeState(StateID_Invisible); +} + +void dLytMeterDrinkParts_c::execute() { + mStateMgr.executeState(); + if (field_0x48 != 6) { + mAnmGroups[1]->setFrame(field_0x48); + } +} + +dLytMeterDrinkParts_c::DrinkFrame_e dLytMeterDrinkParts_c::getDrinkFrame(dLytMeterDrinkParts_c::DrinkType_e type +) const { + if (type == TYPE_STAMINA) { + if (FileManager::sInstance->getStaminaPotionPlusTimer()) { + return FRAME_STAMINA_PLUS; + } + if (FileManager::sInstance->getStaminaPotionTimer()) { + return FRAME_STAMINA; + } + } + if (type == TYPE_AIR) { + if (FileManager::sInstance->getAirPotionPlusTimer()) { + return FRAME_AIR_PLUS; + } + if (FileManager::sInstance->getAirPotionTimer()) { + return FRAME_AIR; + } + } + if (type == TYPE_GUARDIAN) { + if (FileManager::sInstance->getGuardianPotionPlusTimer()) { + return FRAME_GUARDIAN_PLUS; + } + if (FileManager::sInstance->getGuardianPotionTimer()) { + return FRAME_GUARDIAN; + } + } + return FRAME_NONE; +} + +bool dLytMeterDrinkParts_c::isDrinkAboutToExpire() const { + if (field_0x48 == FRAME_STAMINA_PLUS) { + return FileManager::sInstance->getStaminaPotionPlusTimer() < 600; + } else if (field_0x48 == FRAME_STAMINA) { + return FileManager::sInstance->getStaminaPotionTimer() < 600; + } else if (field_0x48 == FRAME_AIR_PLUS) { + return FileManager::sInstance->getAirPotionPlusTimer() < 600; + } else if (field_0x48 == FRAME_AIR) { + return FileManager::sInstance->getAirPotionTimer() < 600; + } else if (field_0x48 == FRAME_GUARDIAN_PLUS) { + return FileManager::sInstance->getGuardianPotionPlusTimer() < 600; + } else if (field_0x48 == FRAME_GUARDIAN) { + return FileManager::sInstance->getGuardianPotionTimer() < 600; + } + return false; +} + +void dLytMeterDrinkParts_c::copy(dLytMeterDrinkParts_c *other, dLytMeterDrinkParts_c *third) { + field_0x50 = other->field_0x50; + field_0x51 = 1; + field_0x48 = other->field_0x48; + mDrinkType = other->mDrinkType; + mStateMgr.changeState(*other->mStateMgr.getStateID()); + if (third == nullptr) { + other->field_0x50 = 0; + other->field_0x51 = 1; + other->field_0x48 = FRAME_NONE; + other->mDrinkType = TYPE_NONE; + other->mStateMgr.changeState(StateID_Invisible); + } else { + other->field_0x50 = third->field_0x50; + other->field_0x51 = 1; + other->field_0x48 = third->field_0x48; + other->mDrinkType = third->mDrinkType; + other->mStateMgr.changeState(*third->mStateMgr.getStateID()); + + third->field_0x50 = 0; + third->field_0x51 = 1; + third->field_0x48 = FRAME_NONE; + third->mDrinkType = TYPE_NONE; + third->mStateMgr.changeState(StateID_Invisible); + } +} + +static const char *sPanes[] = { + "N_drink_00", + "N_drink_01", + "N_drink_02", +}; + +static const d2d::LytBrlanMapping brlanMap[] = { + { "drink_00_demoIn.brlan", "G_demoInOut_00"}, + { "drink_00_in.brlan", "G_inOut_00"}, + { "drink_00_in.brlan", "G_inOut_01"}, + { "drink_00_in.brlan", "G_inOut_02"}, + { "drink_00_drink.brlan", "G_drink_00"}, + { "drink_00_drink.brlan", "G_drink_01"}, + { "drink_00_drink.brlan", "G_drink_02"}, + { "drink_00_loop.brlan", "G_loop_00"}, + { "drink_00_loop.brlan", "G_loop_01"}, + { "drink_00_loop.brlan", "G_loop_02"}, + {"drink_00_caution.brlan", "G_caution_00"}, + {"drink_00_caution.brlan", "G_caution_01"}, + {"drink_00_caution.brlan", "G_caution_02"}, + { "drink_00_move.brlan", "G_move_00"}, + { "drink_00_move.brlan", "G_move_01"}, + { "drink_00_move.brlan", "G_move_02"}, + { "drink_00_out.brlan", "G_inOut_00"}, + { "drink_00_out.brlan", "G_inOut_01"}, + { "drink_00_out.brlan", "G_inOut_02"}, + {"drink_00_demoOut.brlan", "G_demoInOut_00"}, +}; + +#define LYT_METER_DRINK_OFFSET_ANIM_LOOP 7 +#define LYT_METER_DRINK_OFFSET_ANIM_CAUTION 10 +#define LYT_METER_DRINK_OFFSET_ANIM_MOVE 13 + +#define LYT_METER_DRINK_ANIM_DEMO_OUT 19 + +void dLytMeterDrink_c::initializeState_Invisible() {} +void dLytMeterDrink_c::executeState_Invisible() { + if (field_0x6F4) { + mStateMgr.changeState(StateID_In); + } +} +void dLytMeterDrink_c::finalizeState_Invisible() {} + +void dLytMeterDrink_c::initializeState_In() { + mAnmGroups[0].setAnimEnable(true); + mAnmGroups[0].setFrame(0.0f); +} +void dLytMeterDrink_c::executeState_In() { + if (mAnmGroups[0].isEndReached()) { + mAnmGroups[0].setAnimEnable(false); + mStateMgr.changeState(StateID_Wait); + } + if (mAnmGroups[0].isFlag2()) { + mAnmGroups[0].play(); + } +} +void dLytMeterDrink_c::finalizeState_In() {} + +void dLytMeterDrink_c::initializeState_Wait() { + field_0x6F0 = -1; +} +void dLytMeterDrink_c::executeState_Wait() { + int i5 = -1; + int i7 = -1; + for (int i = 0; i < 3; i++) { + int a = getPartForDrinkType((dLytMeterDrinkParts_c::DrinkType_e)i); + if (fn_800E5C40(i) != 0 && a == 3) { + i5 = i; + } + if (field_0x6F5[i] == 1 && mParts[i].field_0x50 == 0) { + i7 = i; + } + } + + if (i5 >= 0) { + for (int i = 0; i < 3; i++) { + if (mParts[i].field_0x50 == 0 && i7 != i) { + mParts[i].field_0x50 = 1; + mParts[i].field_0x51 = 0; + mParts[i].field_0x48 = mParts[i].getDrinkFrame((dLytMeterDrinkParts_c::DrinkType_e)i5); + mParts[i].mDrinkType = (dLytMeterDrinkParts_c::DrinkType_e)i5; + break; + } + } + } + + switch (i7) { + case 0: + if (mParts[1].field_0x50 != 0) { + field_0x6F0 = i7; + mStateMgr.changeState(StateID_Move); + } + break; + case 1: + if (mParts[2].field_0x50 != 0) { + field_0x6F0 = i7; + mStateMgr.changeState(StateID_Move); + } + break; + } + if (field_0x6F4 == 0) { + mStateMgr.changeState(StateID_Out); + } +} +void dLytMeterDrink_c::finalizeState_Wait() {} + +void dLytMeterDrink_c::initializeState_Move() { + for (int i = field_0x6F0; i < 3; i++) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].setAnimEnable(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].setFrame(0.0f); + } +} +void dLytMeterDrink_c::executeState_Move() { + bool needsCopy = false; + for (int i = field_0x6F0; i < 3; i++) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].isEndReached()) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].setFrame(0.0f); + needsCopy = true; + } + } + + if (needsCopy) { + if (field_0x6F0 == 0) { + if (mParts[1].field_0x50) { + mParts[0].copy(&mParts[1], &mParts[2]); + } + } else if (field_0x6F0 == 1 && mParts[2].field_0x50) { + mParts[1].copy(&mParts[2], nullptr); + } + + mLyt.calc(); + + for (int i = 0; i < 3; i++) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].isFlag2()) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].setAnimEnable(false); + } + } + mStateMgr.changeState(StateID_Wait); + } + + for (int i = 0; i < 3; i++) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].isFlag2()) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_MOVE + i].play(); + } + } +} +void dLytMeterDrink_c::finalizeState_Move() {} + +void dLytMeterDrink_c::initializeState_Out() { + mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].setAnimEnable(true); + mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].setFrame(0.0f); +} +void dLytMeterDrink_c::executeState_Out() { + if (mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].isEndReached()) { + mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].setAnimEnable(false); + mStateMgr.changeState(StateID_Invisible); + } + if (mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].isFlag2()) { + mAnmGroups[LYT_METER_DRINK_ANIM_DEMO_OUT].play(); + } +} +void dLytMeterDrink_c::finalizeState_Out() {} + +bool dLytMeterDrink_c::build(d2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("drink_00.brlyt", nullptr); + for (int i = 0; i < 3; i++) { + mpPartPanes[i] = mLyt.findPane(sPanes[i]); + } + + for (int i = 0; i < 20; i++) { + mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); + mAnmGroups[i].setDirection(false); + mAnmGroups[i].setAnimEnable(false); + } + + for (int i = 0; i < 3; i++) { + mParts[i].mAnmGroups[0] = &mAnmGroups[1 + i]; + mParts[i].mAnmGroups[1] = &mAnmGroups[4 + i]; + mParts[i].mAnmGroups[2] = &mAnmGroups[16 + i]; + mParts[i].init(); + field_0x6F5[i] = mParts[i].field_0x50; + } + + mpPane = mLyt.getLayout()->GetRootPane(); + + field_0x6F0 = -1; + field_0x6F4 = 0; + field_0x6E0.z = 0.0f; + field_0x6E0.y = 0.0f; + field_0x6E0.x = 0.0f; + mpPane->SetTranslate(field_0x6E0); + + mAnmGroups[0].setFrame(0.0f); + mAnmGroups[0].setAnimEnable(true); + mLyt.calc(); + mAnmGroups[0].setAnimEnable(false); + + mStateMgr.changeState(StateID_Invisible); + + return true; +} + +bool dLytMeterDrink_c::execute() { + mStateMgr.executeState(); + + for (int i = 0; i < 3; i++) { + field_0x6F5[i] = mParts[i].field_0x50; + mParts[i].execute(); + } + + executeInternal(); + mpPane->SetTranslate(field_0x6E0); + mLyt.calc(); + return true; +} + +bool dLytMeterDrink_c::remove() { + for (int i = 0; i < 20; i++) { + mAnmGroups[i].unbind(); + mAnmGroups[i].afterUnbind(); + } + + return true; +} + +bool dLytMeterDrink_c::draw() { + mLyt.addToDrawList(); + return true; +} + +int dLytMeterDrink_c::getPartForDrinkType(dLytMeterDrinkParts_c::DrinkType_e ty) const { + for (int i = 0; i < 3; i++) { + if (ty == mParts[i].mDrinkType) { + return i; + } + } + return 3; +} + +bool dLytMeterDrink_c::fn_800E5C40(int i) { + if ((i == 0 || i == 3) && (FileManager::sInstance->getStaminaPotionTimer() != 0 || + FileManager::sInstance->getStaminaPotionPlusTimer() != 0)) { + return true; + } + + if ((i == 1 || i == 3) && + (FileManager::sInstance->getAirPotionTimer() != 0 || FileManager::sInstance->getAirPotionPlusTimer() != 0)) { + return true; + } + + if ((i == 2 || i == 3) && (FileManager::sInstance->getGuardianPotionTimer() != 0 || + FileManager::sInstance->getGuardianPotionPlusTimer() != 0)) { + return true; + } + + return false; +} + +void dLytMeterDrink_c::executeInternal() { + bool bHasNotSoonExpiringDrink = false; + bool bHasSoonExpiringDrink = false; + bool drinksLast[3]; + + f32 frameLoop = 0.0f; + f32 frameCaution = 0.0f; + + for (int i = 0; i < 3; i++) { + if (!mParts[i].isDrinkAboutToExpire()) { + drinksLast[i] = true; + bHasNotSoonExpiringDrink = true; + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].isFlag2()) { + frameLoop = mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].getNextFrame(); + } + } else { + drinksLast[i] = false; + bHasSoonExpiringDrink = true; + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].isFlag2()) { + frameCaution = mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].getNextFrame(); + } + } + } + + if (bHasNotSoonExpiringDrink) { + for (int i = 0; i < 3; i++) { + if (drinksLast[i] == true) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].isFlag2()) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].play(); + } else { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setAnimEnable(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setFrame(frameLoop); + } + + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].isFlag2()) { + bool oldVisible = mpPartPanes[i]->IsVisible(); + mpPartPanes[i]->SetVisible(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setFrame(0.0f); + mLyt.calc(); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setAnimEnable(false); + mpPartPanes[i]->SetVisible(oldVisible); + } + } + } + } else { + for (int i = 0; i < 3; i++) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].isFlag2()) { + bool oldVisible = mpPartPanes[i]->IsVisible(); + mpPartPanes[i]->SetVisible(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setFrame(0.0f); + mLyt.calc(); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setAnimEnable(false); + mpPartPanes[i]->SetVisible(oldVisible); + } + } + } + + if (bHasSoonExpiringDrink) { + for (int i = 0; i < 3; i++) { + if (drinksLast[i] == false) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].isFlag2()) { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].play(); + } else { + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setAnimEnable(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setFrame(frameCaution); + } + + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].isFlag2()) { + bool oldVisible = mpPartPanes[i]->IsVisible(); + mpPartPanes[i]->SetVisible(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setFrame(0.0f); + mLyt.calc(); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_LOOP + i].setAnimEnable(false); + mpPartPanes[i]->SetVisible(oldVisible); + } + } + } + } else { + for (int i = 0; i < 3; i++) { + if (mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].isFlag2()) { + bool oldVisible = mpPartPanes[i]->IsVisible(); + mpPartPanes[i]->SetVisible(true); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setFrame(0.0f); + mLyt.calc(); + mAnmGroups[LYT_METER_DRINK_OFFSET_ANIM_CAUTION + i].setAnimEnable(false); + mpPartPanes[i]->SetVisible(oldVisible); + } + } + } +} diff --git a/src/toBeSorted/file_manager.cpp b/src/toBeSorted/file_manager.cpp index cc5376dda..b78b9fa67 100644 --- a/src/toBeSorted/file_manager.cpp +++ b/src/toBeSorted/file_manager.cpp @@ -171,18 +171,18 @@ u16 *FileManager::getStoryFlagsMut() { /* 8000B670 */ void FileManager::setShieldPouchSlot(u8 slot) {} /* 8000B6A0 */ u8 FileManager::getShieldPouchSlot() {} -/* 8000B6F0 */ void FileManager::setAirPotionTimer(s16 time) {} -/* 8000B720 */ s16 FileManager::getAirPotionTimer() {} -/* 8000B770 */ void FileManager::setAirPotionPlusTimer(s16 time) {} -/* 8000B7A0 */ s16 FileManager::getAirPotionPlusTimer() {} -/* 8000B7F0 */ void FileManager::setStaminaPotionTimer(s16 time) {} -/* 8000B820 */ s16 FileManager::getStaminaPotionTimer() {} -/* 8000B870 */ void FileManager::setStaminaPotionPlusTimer(s16 time) {} -/* 8000B8A0 */ s16 FileManager::getStaminaPotionPlusTimer() {} -/* 8000B8F0 */ void FileManager::setGuardianPotionTimer(s16 time) {} -/* 8000B920 */ s16 FileManager::getGuardianPotionTimer() {} -/* 8000B970 */ void FileManager::setGuardianPotionPlusTimer(s16 time) {} -/* 8000B9A0 */ s16 FileManager::getGuardianPotionPlusTimer() {} +/* 8000B6F0 */ void FileManager::setAirPotionTimer(u16 time) {} +/* 8000B720 */ u16 FileManager::getAirPotionTimer() {} +/* 8000B770 */ void FileManager::setAirPotionPlusTimer(u16 time) {} +/* 8000B7A0 */ u16 FileManager::getAirPotionPlusTimer() {} +/* 8000B7F0 */ void FileManager::setStaminaPotionTimer(u16 time) {} +/* 8000B820 */ u16 FileManager::getStaminaPotionTimer() {} +/* 8000B870 */ void FileManager::setStaminaPotionPlusTimer(u16 time) {} +/* 8000B8A0 */ u16 FileManager::getStaminaPotionPlusTimer() {} +/* 8000B8F0 */ void FileManager::setGuardianPotionTimer(u16 time) {} +/* 8000B920 */ u16 FileManager::getGuardianPotionTimer() {} +/* 8000B970 */ void FileManager::setGuardianPotionPlusTimer(u16 time) {} +/* 8000B9A0 */ u16 FileManager::getGuardianPotionPlusTimer() {} /* 8000B9F0 */ void FileManager::setDowsingSlotIdx(u8 idx) {} /* 8000BA20 */ u8 FileManager::getDowsingSlotIdx() {} diff --git a/tools/decompctx.py b/tools/decompctx.py index 290946f18..a857b8a25 100644 --- a/tools/decompctx.py +++ b/tools/decompctx.py @@ -21,9 +21,35 @@ include_dirs = [ os.path.join(root_dir, "include"), # Add additional include directories here + os.path.join(root_dir, "src"), + os.path.join(root_dir, "src", "PowerPC_EABI_Support", "MetroTRK"), + os.path.join( + root_dir, "src", "PowerPC_EABI_Support", "MSL", "MSL_C", "MSL_Common", "Include" + ), + os.path.join( + root_dir, + "src", + "PowerPC_EABI_Support", + "MSL", + "MSL_C", + "MSL_Common_Embedded", + "Math", + "Include", + ), + os.path.join(root_dir, "src", "PowerPC_EABI_Support", "MSL", "MSL_C", "PPC_EABI"), + os.path.join( + root_dir, + "src", + "PowerPC_EABI_Support", + "MSL", + "MSL_C++", + "MSL_Common", + "Include", + ), + os.path.join(root_dir, "src", "PowerPC_EABI_Support", "Runtime", "Inc"), ] -include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]$') +include_pattern = re.compile(r'^#\s*include\s*[<"](.+?)[>"]') guard_pattern = re.compile(r"^#\s*ifndef\s+(.*)$") defines = set()