Skip to content

Commit

Permalink
d_lyt_meter_drink with regswaps in one function (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper authored Oct 28, 2024
1 parent 6b9d173 commit 1d17e35
Show file tree
Hide file tree
Showing 9 changed files with 713 additions and 84 deletions.
2 changes: 2 additions & 0 deletions config/SOUE01/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
110 changes: 55 additions & 55 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions include/d/lyt/d2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
57 changes: 53 additions & 4 deletions include/d/lyt/meter/d_lyt_meter_drink.h
Original file line number Diff line number Diff line change
@@ -1,38 +1,81 @@
#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);
STATE_FUNC_DECLARE(dLytMeterDrinkParts_c, Visible);
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 {
public:
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);
Expand All @@ -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
6 changes: 6 additions & 0 deletions include/m/m2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions include/toBeSorted/file_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 1d17e35

Please sign in to comment.