d_lyt_meter_drink with regswaps in one function (#83)

This commit is contained in:
robojumper
2024-10-28 05:03:08 +01:00
committed by GitHub
parent 6b9d1737d4
commit 1d17e35316
9 changed files with 713 additions and 84 deletions
+4
View File
@@ -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;
+53 -4
View File
@@ -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 @@ private:
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 @@ 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);
@@ -42,8 +85,14 @@ private:
/* 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
View File
@@ -99,6 +99,12 @@ public:
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;
+12 -12
View File
@@ -150,18 +150,18 @@ public:
/* 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();