diff options
| author | robojumper <robojumper@gmail.com> | 2025-09-13 10:34:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-13 10:34:51 +0200 |
| commit | a30123ac3d0f998fdc62027092fa63e256b2e163 (patch) | |
| tree | a135258721741ad01fb8fe964ef7a309f8d2fce9 /include | |
| parent | e97f2d6a4ad0c75a3f1c5eced7656b89b81633ae (diff) | |
| parent | 0a4acf1dc838f4a10629d1e5b64cc442e5fcedc6 (diff) | |
Merge pull request #228 from robojumper/lyt-pause-components
More pause menu UI components
Diffstat (limited to 'include')
26 files changed, 997 insertions, 73 deletions
diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h index 25bdf8f5..1a437a67 100644 --- a/include/d/a/d_a_item.h +++ b/include/d/a/d_a_item.h @@ -68,6 +68,10 @@ public: static s32 getRupeeCounter(); static u32 getCurrentWalletCapacity(); + static u32 getExtraWalletCount(); + + static u32 getHeartContainerHealthCount(); + static u32 getGratitudeCrystalCount(); static u32 getKeyPieceCount(); static u32 getSmallKeyCount(); @@ -94,7 +98,13 @@ public: static void healLink(u32 amount, bool); // move to dAcPy_c + static bool isPerformingInitialCollection() { + return sIsPerformingInitialCollection; + } + private: + static bool sIsPerformingInitialCollection; + /* 0x334 */ UNKTYPE *mpMdl; // Model has its own handling system /* 0x338 */ dShadowCircle_c mShdw; /* 0x340 */ mVec3_c mField_0x340; diff --git a/include/d/a/d_a_itembase.h b/include/d/a/d_a_itembase.h index 90e81c14..231f92f8 100644 --- a/include/d/a/d_a_itembase.h +++ b/include/d/a/d_a_itembase.h @@ -148,7 +148,7 @@ enum ITEM_ID { /* 0x08C */ ITEM_BIG_BUG_NET = 140, /* 0x08D */ ITEM_FARON_GRASSHOPPER = 141, /* 0x08E */ ITEM_WOODLAND_RHINO_BEETLE = 142, - /* 0x08F */ ITEM_DEKU_HORNET_ = 143, + /* 0x08F */ ITEM_DEKU_HORNET = 143, /* 0x090 */ ITEM_SKYLOFT_MANTIS = 144, /* 0x091 */ ITEM_VOLCANIC_LADYBUG = 145, /* 0x092 */ ITEM_BLESSED_BUTTERFLY = 146, diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 9050140b..2672af43 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -58,6 +58,9 @@ public: void setBeetleBackAnim(); s32 getBeetleWarningTimeLeft(); + // Item select/equip/use functions [0x801E3160 - 0x801E7AD0] ? + static s32 calcItemWheelSelection(bool reset, s32 numOptions); + public: f32 getField_0x4564() const { return field_0x4564; diff --git a/include/d/d_cs_base.h b/include/d/d_cs_base.h index 54eedd01..8c7972c8 100644 --- a/include/d/d_cs_base.h +++ b/include/d/d_cs_base.h @@ -9,6 +9,7 @@ #include "m/m2d.h" #include "m/m_angle.h" #include "m/m_vec.h" +#include "nw4r/lyt/lyt_pane.h" class dCsBase_c : public dCs_c { public: @@ -39,6 +40,10 @@ public: return mCursorIf.getHit(); } + dCursorInterface_c *getCursorIf() { + return &mCursorIf; + } + static dCsBase_c *GetInstance() { return sInstance; } @@ -47,6 +52,10 @@ public: mCursorStick.setShouldBeOn(visible); } + void setCursorStickTargetPane(const nw4r::lyt::Pane *target) { + mCursorStick.setTargetPane(target); + } + private: static dCsBase_c *sInstance; void setCurrentLyt(int lyt); diff --git a/include/d/d_cs_game.h b/include/d/d_cs_game.h index fddae87d..861a4a04 100644 --- a/include/d/d_cs_game.h +++ b/include/d/d_cs_game.h @@ -317,10 +317,14 @@ public: mCursorActive = val; } + // TODO - maybe a system for overriding cursor type void setNextCursorType(CursorType_e cs) { - mNextCursor = 1; + mNextCursor = true; mNextCursorType = cs; } + void offNextCursor() { + mNextCursor = false; + } void changeState(const sFStateID_c<lytItemCursor_c> &newState); @@ -361,6 +365,12 @@ public: }; void setNextCursorType(lytItemCursor_c::CursorType_e); + void setCursorTypeNoneMaybe(); + void setCursorTypePointer(); + + void offNextCursor() { + mCursor.offNextCursor(); + } static dCsGame_c *sInstance; diff --git a/include/d/d_pad_nav.h b/include/d/d_pad_nav.h index d481f0d0..882ec64e 100644 --- a/include/d/d_pad_nav.h +++ b/include/d/d_pad_nav.h @@ -38,13 +38,33 @@ inline bool isPointerVisible() { return sIsPointerVisible; } +inline bool isPrevPointerVisible() { + return sPrevIsPointerVisible; +} + inline bool isCursorStickVisible() { return sIsCursorStickVisible; } +inline s32 getFSStickNavDirection() { + return sFSStickNavDirection; +} + +inline bool isMplsNavLeftGesture() { + return sIsMplsNavLeftGesture; +} + +inline bool isMplsNavRightGesture() { + return sIsMplsNavRightGesture; +} + +inline bool isMplsNavGesture() { + return isMplsNavLeftGesture() || isMplsNavRightGesture(); +} + void init(); void calc(); -void setNavEnabled(bool navEnabled, bool autoReturnToPointerNav); +void setNavEnabled(bool navEnabled, bool disableAutoReturnToPointerNav); // I really wish these returned enums but the codegen requires not-enums s32 getFSStickDirection(); diff --git a/include/d/d_stage_mgr.h b/include/d/d_stage_mgr.h index 49e97c78..57aad744 100644 --- a/include/d/d_stage_mgr.h +++ b/include/d/d_stage_mgr.h @@ -7,6 +7,7 @@ #include "d/d_bzs_types.h" #include "d/d_dylink.h" #include "d/d_fader.h" +#include "egg/gfx/eggCpuTexture.h" #include "egg/gfx/eggScreen.h" #include "m/m_allocator.h" #include "m/m_dvd.h" @@ -78,6 +79,10 @@ public: return sInstance; } + EGG::CpuTexture *getField_0x8898() { + return field_0x8898; + } + bool checkFlag0x88A0(u32 flag) const { return (field_0x88A0 & flag) != 0; } @@ -190,7 +195,10 @@ private: /* 0x8694 */ dTimeAreaMgr_c mTimeAreaMgr; // ... - u8 ___[446]; + u8 ___[438]; + /* 0x8898 */ EGG::CpuTexture *field_0x8898; + + u8 _0x889C[4]; /* 0x88A0 */ u32 field_0x88A0; /* 0x88A4 */ SizedString<16> mDemoName; diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index fc19bfb9..ed6994c7 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -79,6 +79,20 @@ protected: u32 mFlags; }; +/** + * A layout with some utility functions, and a system + * for integrating LibMS text into NW4R's LYT. + * + * * If a TextBox has an integer userdatum "embed", this sets the text identified by the + * LibMS label of the same name as the text box (e.g. `T_back_00`) + * * If the integer is non-zero (it always seems to be for Skyward Sword!), + * `:00` is appended to the label name (e.g. `T_back_00:00`). + * * Game code can call a function to reload this text with a custom integer to select + * a specific variant. E.g. `T_newFile_00:00` -> "New Adventure", `T_newFile_00:01` -> "Hero Mode" + * * If a TextBox has a string userdatum "copy", the value identifies another textbox + * whose name is used instead. This is often used for text shadow, where a separate + * textbox is used for the shadow. + */ class LytBase_c : public Multi_c { public: LytBase_c(); @@ -93,8 +107,8 @@ public: dWindow_c *getWindow(const char *name); nw4r::lyt::Group *findGroupByName(const char *name); - bool fn_800AB940(const char *name, int arg); - bool fn_800AB9A0(dTextBox_c *textbox, int arg); + bool loadTextVariant(const char *name, int arg); + bool loadTextVariant(dTextBox_c *textbox, int arg); bool fn_800ABE50(dTextBox_c *textbox, wchar_t *destBuf, u32 maxLen); @@ -102,16 +116,16 @@ private: void setPropertiesRecursive(nw4r::lyt::Pane *pane, f32, f32, f32, f32, f32); void setProperties(nw4r::lyt::Pane *pane, f32, f32, f32, f32, f32); dTextBox_c *getTextBoxViaUserData(nw4r::lyt::Pane *pane, const char *name); - bool fn_800ABB80(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg); - bool fn_800ABCE0(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg); + bool loadTextVariantCopy(dTextBox_c *targetTextBox, dTextBox_c *sourceTextBox, int arg); + bool setText(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *targetTextBox, dTextBox_c *sourceTextBox, int arg); - bool fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, u32 maxLen); + bool fn_800AC040(dTextBox_c *targetTextBox, dTextBox_c *sourceTextBox, wchar_t *destBuf, u32 maxLen); bool fn_800AC1AC( - const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, wchar_t *destBuf, + const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *targetTextBox, dTextBox_c *sourceTextBox, wchar_t *destBuf, u32 maxLen ); MsbtInfo *getMsbtInfo() const; - bool fn_800AB930(dTextBox_c *box); + bool loadText(dTextBox_c *box); /* 0x8C */ MsbtInfo *mpMsbtInfo; }; diff --git a/include/d/lyt/d_lyt_base.h b/include/d/lyt/d_lyt_base.h new file mode 100644 index 00000000..fb4ffd8c --- /dev/null +++ b/include/d/lyt/d_lyt_base.h @@ -0,0 +1,25 @@ +#ifndef D_LYT_BASE_H +#define D_LYT_BASE_H + +#include "common.h" +#include "d/d_base.h" +#include "m/m_allocator.h" + +class dLytBase_c : public dBase_c { +public: + dLytBase_c(); + virtual ~dLytBase_c(); + + /* 0x4C */ virtual bool build(); + +protected: + bool allocateLytWork1Heap(const char *name, bool exp); + void removeLyt(); + +private: + /* 0x68 */ mHeapAllocator_c mAllocator; + /* 0x84 */ UNKWORD field_0x84; + /* 0x88 */ u8 field_0x88; +}; + +#endif diff --git a/include/d/lyt/d_lyt_common_arrow.h b/include/d/lyt/d_lyt_common_arrow.h index 1cfe53b7..ccab07b9 100644 --- a/include/d/lyt/d_lyt_common_arrow.h +++ b/include/d/lyt/d_lyt_common_arrow.h @@ -14,6 +14,12 @@ public: dLytCommonArrow_c(); virtual ~dLytCommonArrow_c() {} + enum Arrow_e { + ARROW_LEFT = 0, + ARROW_RIGHT = 1, + ARROW_NONE = 2, + }; + bool build(); STATE_FUNC_DECLARE(dLytCommonArrow_c, None); @@ -29,31 +35,51 @@ public: bool requestIn(); bool requestOut(); + void unk() { + field_0x6B8 = mPointedAtArrow; + } + + s32 getField_0x6B8() const { + return field_0x6B8; + } + + nw4r::lyt::Bounding *getArrowBounding(s32 idx) const { + return mpBoundings[idx]; + } + + void setField_0x6B8(s32 v) { + field_0x6B8 = v; + } + + void setBackwards(bool b) { + mBackwards = b; + } + bool fn_80168760(); + private: void setTranslate(const Vec *); - bool fn_80168760(); void displayElement(s32, f32); void unbindAt(s32); void tickDown(d2d::AnmGroup_c *); - void fn_80168880(); - UI_STATE_MGR_DECLARE(dLytCommonArrow_c); + void checkPointAtPane(); + + /* 0x04 */ UI_STATE_MGR_DECLARE(dLytCommonArrow_c); /* 0x40 */ d2d::LytBase_c mLytBase; d2d::ResAccIf_c mResAcc; - d2d::AnmGroup_c mAnmGroups[0x9]; + d2d::AnmGroup_c mAnmGroups[9]; dCursorHitCheckLyt_c mCsHitCheck; - nw4r::lyt::Bounding *mBoundingL; - nw4r::lyt::Bounding *mBoundingR; - s32 mType; - s32 field_0x6B4; - s32 field_0x6B8; - s32 field_0x6BC; - s32 field_0x6C0; - s32 mTimer; - u8 mInRequested; - u8 mOutRequested; - u8 field_0x6CA; - u8 field_0x6CB; - u8 field_0x6CC; + /* 0x6A8 */ nw4r::lyt::Bounding *mpBoundings[2]; + /* 0x6B0 */ s32 mType; + /* 0x6B4 */ s32 mPointedAtArrow; + /* 0x6B8 */ s32 field_0x6B8; + /* 0x6BC */ s32 field_0x6BC; + /* 0x6C0 */ s32 field_0x6C0; + /* 0x6C4 */ s32 mTimer; + /* 0x6C8 */ bool mInRequested; + /* 0x6C9 */ bool mOutRequested; + /* 0x6CA */ bool mIsChangingState; + /* 0x6CB */ bool mVisible; + /* 0x6CC */ bool mBackwards; }; #endif diff --git a/include/d/lyt/d_lyt_common_icon_item_maps.h b/include/d/lyt/d_lyt_common_icon_item_maps.h index 52456d34..248ada9c 100644 --- a/include/d/lyt/d_lyt_common_icon_item_maps.h +++ b/include/d/lyt/d_lyt_common_icon_item_maps.h @@ -15,6 +15,24 @@ #define LYT_CMN_BugLanayruAnt (10) // [10] tr_bugIcon_10.tpl #define LYT_CMN_BugEldinRoller (11) // [11] tr_bugIcon_11.tpl +// Treasure +#define LYT_CMN_HORNET_LARVAE (0) // [ 1] uk_soaHachisu_00.tpl +#define LYT_CMN_BIRD_FEATHER (1) // [ 2] uk_sobHaneA_00.tpl +#define LYT_CMN_TUMBLEWEED (2) // [ 3] uk_socTumble_00.tpl +#define LYT_CMN_LIZALFOS_TAIL (3) // [ 0] tr_sozaiIcon_03.tpl +#define LYT_CMN_ELDIN_ORE (4) // [ 4] uk_soeKoseki_00.tpl +#define LYT_CMN_ANCIENT_FLOWER (5) // [ 5] uk_sofHana_00.tpl +#define LYT_CMN_AMBER_RELIC (6) // [ 6] uk_sogMagatamaA_00.tpl +#define LYT_CMN_DUSK_RELOC (7) // [ 7] uk_sohMagatamaB_00.tpl +#define LYT_CMN_JELLY_BLOB (8) // [ 8] uk_soiPuyo_00.tpl +#define LYT_CMN_MONSTER_CLAW (9) // [ 9] uk_sojClaw_00.tpl +#define LYT_CMN_MONSTER_HORN (10) // [11] uk_solHorn_00.tpl +#define LYT_CMN_ORNAMENTAL_SKULL (11) // [10] uk_sokDokuroA_00.tpl +#define LYT_CMN_EVIL_CRYSTAL (12) // [12] uk_somEvil_00.tpl +#define LYT_CMN_BLUE_BIRD_FEATHER (13) // [13] uk_sonHaneB_00.tpl +#define LYT_CMN_GOLDEN_SKULL (14) // [14] uk_sooDokuroB_00.tpl +#define LYT_CMN_GODDESS_PLUME (15) // [15] uk_sopGoddess_00.tpl + // Items #define LYT_CMN_ItemBombBag (0) // [ 8] uc_bomb_00.tpl #define LYT_CMN_ItemBow (1) // [ 9] uc_bowA_00.tpl @@ -34,7 +52,7 @@ #define LYT_CMN_ItemBigBugnet (15) // [14] uc_netB_00.tpl #define LYT_CMN_ItemBoatCannon (16) // [ 7] uc_boatCannon_00.tpl #define LYT_CMN_ItemHarp (17) // [ 0] tr_tategoto_00.tpl -#define LYT_CMN_ItemInvalid (18) // ------------------------- +#define LYT_CMN_ItemInvalid (18) // ------------------------- // Pouch Items #define LYT_CMN_PouchPotionHealyh (0) // [12] uc_bottleKusuriA_00.tpl @@ -113,6 +131,6 @@ #define LYT_CMN_DowsingZelda (19) // [13] tr_dauzTarget_19.tpl #define LYT_CMN_DowsingTrialGate (20) // [14] tr_dauzTarget_20.tpl #define LYT_CMN_DowsingNewPlantSpecies (21) // [15] tr_dauzTarget_21.tpl -#define LYT_CMN_DowsingInvalid (22) // ------------------------- +#define LYT_CMN_DowsingInvalid (22) // ------------------------- #endif diff --git a/include/d/lyt/d_lyt_common_icon_material.h b/include/d/lyt/d_lyt_common_icon_material.h index a6922592..8febea8a 100644 --- a/include/d/lyt/d_lyt_common_icon_material.h +++ b/include/d/lyt/d_lyt_common_icon_material.h @@ -8,26 +8,18 @@ #include "nw4r/lyt/lyt_bounding.h" #include "s/s_State.hpp" -class dLytCommonIconMaterialPartBase_c { -public: - virtual ~dLytCommonIconMaterialPartBase_c() {} - virtual nw4r::lyt::Pane *getPane() = 0; - virtual d2d::LytBase_c *getLyt() = 0; - virtual const char *getName() const = 0; -}; - /** Material - Bug */ -class dLytCommonIconMaterialPart1_c : public dLytCommonIconMaterialPartBase_c { +class dLytCommonIconMaterialPart1_c { public: dLytCommonIconMaterialPart1_c() {} virtual ~dLytCommonIconMaterialPart1_c() {} - virtual nw4r::lyt::Pane *getPane() override { + virtual nw4r::lyt::Pane *getPane() { return mLyt.getLayout()->GetRootPane(); } - virtual d2d::LytBase_c *getLyt() override { + virtual d2d::LytBase_c *getLyt() { return &mLyt; } - virtual const char *getName() const override { + virtual const char *getName() const { return mLyt.getName(); } @@ -78,17 +70,17 @@ private: }; /** Material - Treasure */ -class dLytCommonIconMaterialPart2_c : public dLytCommonIconMaterialPartBase_c { +class dLytCommonIconMaterialPart2_c { public: dLytCommonIconMaterialPart2_c() {} virtual ~dLytCommonIconMaterialPart2_c() {} - virtual nw4r::lyt::Pane *getPane() override { + virtual nw4r::lyt::Pane *getPane() { return mLyt.getLayout()->GetRootPane(); } - virtual d2d::LytBase_c *getLyt() override { + virtual d2d::LytBase_c *getLyt() { return &mLyt; } - virtual const char *getName() const override { + virtual const char *getName() const { return mLyt.getName(); } @@ -185,6 +177,9 @@ public: const nw4r::lyt::Bounding *getBounding() const; + STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytCommonIconMaterial_c); + STATE_MGR_DEFINE_UTIL_ISSTATE(dLytCommonIconMaterial_c); + private: STATE_FUNC_DECLARE(dLytCommonIconMaterial_c, None); STATE_FUNC_DECLARE(dLytCommonIconMaterial_c, In); diff --git a/include/d/lyt/d_lyt_common_title.h b/include/d/lyt/d_lyt_common_title.h new file mode 100644 index 00000000..9d74f6bf --- /dev/null +++ b/include/d/lyt/d_lyt_common_title.h @@ -0,0 +1,83 @@ +#ifndef D_LYT_COMMON_TITLE_H +#define D_LYT_COMMON_TITLE_H + +#include "common.h" +#include "d/lyt/d2d.h" +#include "s/s_State.hpp" +#include "sized_string.h" + +/** + * 2D UI - Common - Title + * + * Used on title screen and pause menu. + */ +class dLytCommonTitle_c { +public: + dLytCommonTitle_c(); + virtual ~dLytCommonTitle_c() {} + + bool build(); + bool remove(); + bool execute(); + bool draw(); + + enum SetMode_e { + SET_00 = 0, + SET_01 = 1, + SET_CAPTION_IMMEDIATELY = 2, + SET_OUT = 3, + }; + + bool set(s32 arg, const char *title, const char *caption); + const char *setSubTitle(s32 msgIdx); + const char *setSysTitle(s32 msgIdx); + const char *setSysCaption(s32 msgIdx); + + void setField_0x680(UNKWORD val) { + field_0x680 = val; + } + + void setInputInOut(bool inOut) { + mInputInOut = inOut; + } + +private: + void gotoStateNone(); + void startAnim(int idx); + void stopAnim(int idx); + void playBackwards(d2d::AnmGroup_c &anm); + + void applyText(); + void applyTextChange(s32 arg); + + void applyTitle(s32 arg); + void applyCaption(s32 arg); + + d2d::AnmGroup_c &getAnm(int idx) { + return mAnm[idx]; + } + + STATE_FUNC_DECLARE(dLytCommonTitle_c, None); + STATE_FUNC_DECLARE(dLytCommonTitle_c, In); + STATE_FUNC_DECLARE(dLytCommonTitle_c, Wait); + STATE_FUNC_DECLARE(dLytCommonTitle_c, Out); + STATE_FUNC_DECLARE(dLytCommonTitle_c, Change); + + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytCommonTitle_c); + /* 0x040 */ d2d::LytBase_c mLyt; + /* 0x0D0 */ d2d::ResAccIf_c mResAcc; + /* 0x440 */ d2d::AnmGroup_c mAnm[8]; + /* 0x640 */ SizedString<0x20> mTitle; + /* 0x660 */ SizedString<0x20> mCaption; + + /* 0x680 */ UNKWORD field_0x680; + /* 0x680 */ UNKWORD mSetMode; + /* 0x688 */ s32 mStep; + /* 0x68C */ bool mChangeRequest; + /* 0x68D */ bool field_0x68D; + /* 0x68E */ bool mVisible; + /* 0x68F */ bool field_0x68F; + /* 0x690 */ bool mInputInOut; +}; + +#endif diff --git a/include/d/lyt/d_lyt_control_game.h b/include/d/lyt/d_lyt_control_game.h index 1c43e800..52098e3c 100644 --- a/include/d/lyt/d_lyt_control_game.h +++ b/include/d/lyt/d_lyt_control_game.h @@ -16,11 +16,44 @@ public: void somehowRelatedToEnteringLightPillars(s32, s32, s32); void fn_802CCD40(bool); + void fn_802D04F0(); static dLytControlGame_c *getInstance() { return sInstance; } + s32 getCurrentPauseDisp() const { + return mCurrentPauseDisp; + } + + void setCurrentPauseDisp(s32 value) { + mCurrentPauseDisp = value; + } + + void setPauseDisp00Tab(s32 tab) { + mPauseDisp00Tab = tab; + } + + s32 getPauseDisp00Tab() const { + return mPauseDisp00Tab; + } + + u16 getItemForPauseDemo() const { + return mItemForPauseDemo; + } + + u16 getItemCountForPauseDemo() const { + return mItemCountForPauseDemo; + } + + bool isPauseDemo() const { + return mIsPauseDemo; + } + + u8 getPauseDemoDisp() const { + return mPauseDemoDisp; + } + STATE_FUNC_DECLARE(dLytControlGame_c, Normal); STATE_FUNC_DECLARE(dLytControlGame_c, Pause_SetRes); STATE_FUNC_DECLARE(dLytControlGame_c, Pause_SyncRes); @@ -37,7 +70,21 @@ public: private: /* 0x00068 */ UI_STATE_MGR_DECLARE(dLytControlGame_c); - + /* 0x000A4 */ u8 _0x000A4[0x15C2C - 0x000A4]; + + /* 0x15C2C */ s32 mCurrentPauseDisp; + /* 0x15C30 */ s32 mPauseDisp00Tab; + + /* 0x15C34 */ u8 _0x15C34[0x15C60 - 0x15C34]; + + /* 0x15C60 */ u16 mItemForPauseDemo; + + /* 0x15C62 */ u8 _0x15C62[0x15C64 - 0x15C62]; + + /* 0x15C64 */ u16 mItemCountForPauseDemo; + /* 0x15C66 */ u8 field_0x15C66; + /* 0x15C67 */ bool mIsPauseDemo; + /* 0x15C68 */ u8 mPauseDemoDisp; static dLytControlGame_c *sInstance; }; diff --git a/include/d/lyt/d_lyt_cursor_stick.h b/include/d/lyt/d_lyt_cursor_stick.h index 1d24cd50..ab8bdb6b 100644 --- a/include/d/lyt/d_lyt_cursor_stick.h +++ b/include/d/lyt/d_lyt_cursor_stick.h @@ -23,7 +23,7 @@ public: static bool drawDirectly(); void setPriority(u8 priority); - void setTargetPane(nw4r::lyt::Pane *pane); + void setTargetPane(const nw4r::lyt::Pane *pane); void setShouldBeOn(bool value) { mShouldBeOn = value; @@ -47,7 +47,7 @@ private: /* 0x3AC */ d2d::dLytSub mLyt; /* 0x440 */ d2d::AnmGroup_c mAnm[1]; /* 0x480 */ nw4r::lyt::Pane *mpPanes[5]; - /* 0x494 */ nw4r::lyt::Pane *mpTargetPane; + /* 0x494 */ const nw4r::lyt::Pane *mpTargetPane; /* 0x498 */ bool mShouldBeOn; }; diff --git a/include/d/lyt/d_lyt_pause.h b/include/d/lyt/d_lyt_pause.h new file mode 100644 index 00000000..033ee400 --- /dev/null +++ b/include/d/lyt/d_lyt_pause.h @@ -0,0 +1,273 @@ +#ifndef D_LYT_PAUSE_H +#define D_LYT_PAUSE_H + +#include "common.h" +#include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_base.h" +#include "egg/gfx/eggCpuTexture.h" +#include "egg/gfx/eggTextureBuffer.h" +#include "nw4r/lyt/lyt_bounding.h" +#include "s/s_State.hpp" + +class dLytPauseBack_c; +class dLytPauseInfo_c; +class dLytPauseText_c; +class dLytCommonArrow_c; +class dLytPauseDisp00_c; +class dLytPauseDisp01_c; + +class dLytPauseMain_c { +public: + dLytPauseMain_c(); + virtual ~dLytPauseMain_c() {} + + bool build(); + bool remove(); + bool execute(); + bool draw(); + void drawDirectly(); + + void loadBgTextureUnused(); + void loadBgTexture(); + + void requestIn(); + void requestOut(); + void requestChange(); + void requestSelect(); + void requestRingToggle(); + + bool hasSelection() const; + void updateTitle(); + + bool isChangingState() const { + return mIsChangingState; + } + + dLytCommonArrow_c *getArrow() const { + return mpArrow; + } + +private: + STATE_FUNC_DECLARE(dLytPauseMain_c, None); + STATE_FUNC_DECLARE(dLytPauseMain_c, In); + STATE_FUNC_DECLARE(dLytPauseMain_c, Wait); + STATE_FUNC_DECLARE(dLytPauseMain_c, Change); + STATE_FUNC_DECLARE(dLytPauseMain_c, Select); + STATE_FUNC_DECLARE(dLytPauseMain_c, Ring); + STATE_FUNC_DECLARE(dLytPauseMain_c, GetDemo); + STATE_FUNC_DECLARE(dLytPauseMain_c, Out); + + /* 0x04 */ UI_STATE_MGR_DECLARE(dLytPauseMain_c); + /* 0x40 */ dLytPauseBack_c *mpPauseBack; + /* 0x44 */ dLytPauseDisp00_c *mpDisp00; + /* 0x48 */ dLytPauseDisp01_c *mpDisp01; + /* 0x4C */ dLytPauseInfo_c *mpPauseInfo; + /* 0x50 */ dLytPauseText_c *mpPauseText; + /* 0x54 */ dLytCommonArrow_c *mpArrow; + /* 0x58 */ s32 mTimer; + /* 0x5C */ s32 mStep; + /* 0x60 */ u8 mPartStateChangeFlags; + /* 0x61 */ bool mInRequest; + /* 0x62 */ bool mOutRequest; + /* 0x63 */ bool mIsChangingState; + /* 0x64 */ bool mChangeRequest; + /* 0x65 */ bool mSelectRequest; + /* 0x66 */ bool mRingToggleRequest; +}; + +class dLytPauseMgr_c : public dLytBase_c { +public: + dLytPauseMgr_c(); + ~dLytPauseMgr_c(); + + enum Disp_e { + DISP_00_INVENTORY = 0, + DISP_01_COLLECTION = 1, + + DISP_MAX, + }; + + enum Tab_e { + TAB_ITEM = 0, + TAB_POUCH = 1, + TAB_DOWSING = 2, + + TAB_MAX = 3, + }; + + /* 0x08 */ virtual int create() override; + /* 0x14 */ virtual int doDelete() override; + /* 0x20 */ virtual int execute() override; + /* 0x2C */ virtual int draw() override; + /* 0x4C */ virtual bool build() override; + + static dLytPauseMgr_c *GetInstance() { + return sInstance; + } + + d2d::ResAccIf_c *getResAcc1() { + return &mResAcc1; + } + + d2d::ResAccIf_c *getResAcc2() { + return &mResAcc2; + } + + EGG::CpuTexture *getBgTexture() { + return mpBgTexture; + } + + bool isNavLeft() const { + return mIsNavLeft; + } + + bool getField_0x0832() const { + return field_0x0832; + } + + void setField_0x0837(bool b) { + field_0x0837 = b; + } + + bool getField_0x0838() const { + return field_0x0838; + } + + bool getField_0x083B() const { + return field_0x083B; + } + + bool getField_0x083C() const { + return field_0x083C; + } + + void setField_0x083C(bool b) { + field_0x083C = b; + } + + bool getField_0x083D() const { + return field_0x083D; + } + + void setField_0x083D(bool b) { + field_0x083D = b; + } + + bool getField_0x083E() const { + return field_0x083E; + } + + void setField_0x083E(bool b) { + field_0x083E = b; + } + + bool getField_0x0840() const { + return field_0x0840; + } + + bool isStateWait() const; + + s32 getCurrentDisp00Tab() const { + return mCurrentDisp00Tab; + } + + enum SelectionType_e { + SELECT_BWHEEL = 0, + SELECT_POUCH = 1, + SELECT_DOWSING = 2, + SELECT_INSECT = 4, + SELECT_QUEST_MATERIAL = 5, + SELECT_ITEM = 6, + SELECT_CATEGORY = 7, + SELECT_FIRE = 8, + SELECT_RING = 9, + SELECT_NONE = 10, + }; + + void setSelection(SelectionType_e type, u16 id, bool restricted); + + bool isCurrentSelectionRestricted() const { + return mCurrentSelectionIsRestricted; + } + SelectionType_e getCurrentSelectionType() const { + return mCurrentSelectionType; + } + + s32 getCurrentSelectionId() const { + return mCurrentSelectionId; + } + + u8 getCurrentSelectionTab() const { + return mCurrentSelectionTab; + } + + void setCurrentSelectionTab(u8 tab) { + mCurrentSelectionTab = tab; + } + + nw4r::lyt::Bounding *getArrowBounding(int idx) const; + void setSelectedArrowBounding(int idx); + + static void setSelectHand(f32 rotation, f32 length); + + void preDrawStage(); + void postDrawStage(); + + void inRequest(); + + static f32 sDisp00ArrowRotation; + static f32 sDisp00ArrowLength; + +private: + bool checkSelectRing(); + bool checkChangeDisp(); + bool checkRing(); + void changeSavedDisp(); + void saveTabFlag(); + + STATE_FUNC_DECLARE(dLytPauseMgr_c, None); + STATE_FUNC_DECLARE(dLytPauseMgr_c, In); + STATE_FUNC_DECLARE(dLytPauseMgr_c, Wait); + STATE_FUNC_DECLARE(dLytPauseMgr_c, Change); + STATE_FUNC_DECLARE(dLytPauseMgr_c, Select); + STATE_FUNC_DECLARE(dLytPauseMgr_c, Ring); + STATE_FUNC_DECLARE(dLytPauseMgr_c, GetDemo); + STATE_FUNC_DECLARE(dLytPauseMgr_c, Out); + + static dLytPauseMgr_c *sInstance; + + /* 0x008C */ UI_STATE_MGR_DECLARE(dLytPauseMgr_c); + /* 0x00C8 */ d2d::ResAccIf_c mResAcc1; + /* 0x0438 */ d2d::ResAccIf_c mResAcc2; + /* 0x07A8 */ dLytPauseMain_c mMain; + + /* 0x0810 */ EGG::TextureBuffer *mpTexture0x0810; + /* 0x0814 */ EGG::TextureBuffer *mpBgTexture; + /* 0x0818 */ SelectionType_e mCurrentSelectionType; + /* 0x081C */ SelectionType_e mPrevSelectionType; + /* 0x0820 */ s32 mCurrentDisp00Tab; + /* 0x0824 */ s32 mCurrentDisp00HeldRing; + /* 0x0828 */ s32 mSavedPauseDisp; + /* 0x082C */ u16 mCurrentSelectionId; + /* 0x082E */ u16 mPrevSelectionId; + /* 0x0830 */ bool mInRequest; + /* 0x0831 */ bool mIsNavLeft; + /* 0x0832 */ bool field_0x0832; + /* 0x0833 */ u8 mCurrentSelectionTab; + /* 0x0834 */ u8 mTimer; + /* 0x0835 */ u8 field_0x0835; + /* 0x0836 */ bool field_0x0836; + /* 0x0837 */ bool field_0x0837; + /* 0x0838 */ bool field_0x0838; + /* 0x0839 */ bool field_0x0839; + /* 0x083A */ bool field_0x083A; + /* 0x083B */ bool field_0x083B; + /* 0x083C */ bool field_0x083C; + /* 0x083D */ bool field_0x083D; + /* 0x083E */ bool field_0x083E; + /* 0x083F */ bool field_0x083F; + /* 0x0840 */ bool field_0x0840; + /* 0x0841 */ bool mCurrentSelectionIsRestricted; +}; + +#endif diff --git a/include/d/lyt/d_lyt_pause_back.h b/include/d/lyt/d_lyt_pause_back.h new file mode 100644 index 00000000..fc556a73 --- /dev/null +++ b/include/d/lyt/d_lyt_pause_back.h @@ -0,0 +1,46 @@ +#ifndef D_LYT_PAUSE_BACK_H +#define D_LYT_PAUSE_BACK_H + +#include "d/lyt/d2d.h" +#include "s/s_State.hpp" + +/** 2D UI - Pause menu - Background */ +class dLytPauseBack_c { +public: + dLytPauseBack_c(); + virtual ~dLytPauseBack_c() {} + + bool build(); + bool remove(); + bool execute(); + bool draw(); + + void loadBgTexture(); + void requestIn(); + void requestOut(); + + bool isChangingState() const { + return mIsChangingState; + } + +private: + void startAnim(int idx); + void stopAnim(int idx); + + STATE_FUNC_DECLARE(dLytPauseBack_c, None); + STATE_FUNC_DECLARE(dLytPauseBack_c, In); + STATE_FUNC_DECLARE(dLytPauseBack_c, Wait); + STATE_FUNC_DECLARE(dLytPauseBack_c, Out); + + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytPauseBack_c); + /* 0x040 */ d2d::LytBase_c mLyt; + /* 0x0D0 */ d2d::AnmGroup_c mAnm[2]; + + /* 0x150 */ s32 mOutStep; + /* 0x154 */ bool mInRequest; + /* 0x155 */ bool mOutRequest; + /* 0x156 */ bool mIsChangingState; + /* 0x157 */ bool mVisible; +}; + +#endif diff --git a/include/d/lyt/d_lyt_pause_disp_00.h b/include/d/lyt/d_lyt_pause_disp_00.h index aaacf9dc..d0892bb4 100644 --- a/include/d/lyt/d_lyt_pause_disp_00.h +++ b/include/d/lyt/d_lyt_pause_disp_00.h @@ -4,6 +4,7 @@ #include "d/d_cursor_hit_check.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_common_icon_item.h" +#include "nw4r/lyt/lyt_bounding.h" #include "s/s_State.hpp" class dLytPauseDisp00_c { @@ -11,7 +12,20 @@ public: dLytPauseDisp00_c(); virtual ~dLytPauseDisp00_c() {} - void init(); + bool build(); + bool remove(); + bool execute(); + bool draw(); + + void drawDirectly(); + void requestIn(bool scroll); + void requestOut(bool scroll); + void requestSelect(); + void requestRingToggle(); + void requestUnselect(); + + bool requestSelectGuide(); + bool requestSelectMpls(); STATE_FUNC_DECLARE(dLytPauseDisp00_c, None); STATE_FUNC_DECLARE(dLytPauseDisp00_c, In); @@ -21,16 +35,79 @@ public: STATE_FUNC_DECLARE(dLytPauseDisp00_c, GetDemo); STATE_FUNC_DECLARE(dLytPauseDisp00_c, Out); + bool isChangingState() const { + return mIsChangingState; + } + + bool hasSelection() const { + return mHasSelection; + } + private: - void displayElement(int idx, float value); - - STATE_MGR_DECLARE(dLytPauseDisp00_c); - d2d::LytBase_c mLytBase; - d2d::AnmGroup_c field_0x00D0[0x7E]; - dLytCommonIconItem_c field_0x2050[0x18]; - /* 0xE110 */ d2d::SubPaneList mSubpanes; - d2d::SubPaneListNode field_0xE11C[0x18]; - dCursorHitCheckLyt_c field_0xE29C; + void setAnm(int idx, f32 value); + void stopAnm(int idx); + void playBackwards(d2d::AnmGroup_c &anm); + + // Initial setup + void setupDisp(); + void setupInventoryWheel(); + void setupHeartPieces(); + void setupWallets(); + void setupMitts(); + void setupSailcloth(); + void setupWaterDragonScale(); + void setupFireshieldEarrings(); + void setupSongsAndLifeTree(); + void setupTabletTriforce(); + void setupSword(); + void setupStoneOfTrials(); + + // Dynamic setup + void setupRingIcons(s32 tab); + + s32 updateSelection(); + s32 getPointerPane() const; + bool isPointingAtRingIcon(); + + void hideItemIcons(); + u16 getPointedItemSpecial(s32 paneIdx, bool *pLocked); + + enum LoadRingTextCmd_e { + RING_TEXT_RELEASE_TO_CONFIRM = 0, + RING_TEXT_INITIAL_TAB = 1, + RING_TEXT_CURRENT_TAB = 2, + }; + + void executeCall(); + void playOnOffTabAnim(); + void loadRingText(u32 cmd); + + /* 0x0004 */ STATE_MGR_DECLARE(dLytPauseDisp00_c); + /* 0x0040 */ d2d::LytBase_c mLyt; + /* 0x00D0 */ d2d::AnmGroup_c mAnm[126]; + /* 0x2050 */ dLytCommonIconItem_c mIcons[24]; + /* 0xE110 */ d2d::SubPaneList mSubpaneList; + /* 0xE11C */ d2d::SubPaneListNode mSubpanes[24]; + /* 0xE29C */ dCursorHitCheckLyt_c mCsHitCheck; + /* 0xE2C4 */ nw4r::lyt::Bounding *mpBoundings[37]; + + /* 0xE358 */ s32 mStep; + /* 0xE35C */ s32 mPrevNavTarget; + /* 0xE360 */ s32 mCurrentNavTarget; + /* 0xE364 */ s32 mCallTimerMaybe; + /* 0xE368 */ s32 mGetDemoTimer; + /* 0xE36C */ bool mInRequest; + /* 0xE36D */ bool mOutRequest; + /* 0xE36E */ bool mIsChangingState; + /* 0xE36F */ bool mIsVisible; + /* 0xE370 */ bool mDoScrollAnim; + /* 0xE371 */ bool mHasSelection; + /* 0xE372 */ bool mSelectToggleRequest; + /* 0xE373 */ bool mSelectGuideRequest; + /* 0xE374 */ bool mStopCallRequest; + /* 0xE375 */ bool mSelectMplsRequest; + /* 0xE376 */ bool mReverseTabChangeAnim; + /* 0xE377 */ bool mRingToggleRequest; }; #endif diff --git a/include/d/lyt/d_lyt_pause_disp_01.h b/include/d/lyt/d_lyt_pause_disp_01.h index 49b4cd97..c1c8fe49 100644 --- a/include/d/lyt/d_lyt_pause_disp_01.h +++ b/include/d/lyt/d_lyt_pause_disp_01.h @@ -1,9 +1,11 @@ #ifndef LYT_PAUSE_DISP_01_H #define LYT_PAUSE_DISP_01_H +#include "common.h" #include "d/d_cursor_hit_check.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_common_icon_material.h" +#include "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" class dLytPauseDisp01_c { @@ -11,7 +13,16 @@ public: dLytPauseDisp01_c(); virtual ~dLytPauseDisp01_c() {} - void init(); + bool build(); + bool remove(); + bool execute(); + bool draw(); + + void drawDirectly(); + void requestIn(bool scroll); + void requestOut(bool scroll); + void requestSelect(); + void requestUnselect(); STATE_FUNC_DECLARE(dLytPauseDisp01_c, None); STATE_FUNC_DECLARE(dLytPauseDisp01_c, In); @@ -20,16 +31,58 @@ public: STATE_FUNC_DECLARE(dLytPauseDisp01_c, GetDemo); STATE_FUNC_DECLARE(dLytPauseDisp01_c, Out); + bool isChangingState() const { + return mIsChangingState; + } + + bool hasSelection() const { + return mHasSelection; + } + private: - void displayElement(int idx, float value); - - /* 0x0004 */ STATE_MGR_DECLARE(dLytPauseDisp01_c); - /* 0x0040 */ d2d::LytBase_c mLytBase; - /* 0x00D0 */ d2d::AnmGroup_c field_0x00D0[15]; - /* 0x0490 */ dLytCommonIconMaterial_c field_0x2050[28]; - /* 0x96B0 */ d2d::SubPaneList mSubpanes; - /* 0x96BC */ d2d::SubPaneListNode field_0xE11C[28]; - /* 0x987C */ dCursorHitCheckLyt_c field_0xE29C; + void setAnm(int idx, f32 value); + void stopAnm(int idx); + + void setupDisp(); + void setupInsects(); + void setupMaterials(); + + void showInsectsAndMaterials(); + s32 updateSelection(); + s32 getPointerPane() const; + void hideInsectsAndMaterials(); + + bool shouldInsectBeDisplayed(s32 insectIdx) const; + u16 getInsectItemId(s32 insectIdx) const; + s32 getInsectIcon(s32 insectIdx) const; + s32 getInsectCountByIndex(s32 insectIdx) const; + + u16 getQuestItemId(s32 questItemIndex) const; + + bool shouldMaterialBeDisplayed(s32 materialIdx) const; + u16 getMaterialItemId(s32 materialIdx) const; + s32 getMaterialIcon(s32 materialIdx) const; + s32 getMaterialCountByIndex(s32 materialIdx) const; + + /* 0x0004 */ UI_STATE_MGR_DECLARE(dLytPauseDisp01_c); + /* 0x0040 */ d2d::LytBase_c mLyt; + /* 0x00D0 */ d2d::AnmGroup_c mAnm[15]; + /* 0x0490 */ dLytCommonIconMaterial_c mIcons[28]; + /* 0x96B0 */ d2d::SubPaneList mSubpaneList; + /* 0x96BC */ d2d::SubPaneListNode mSubpanes[28]; + /* 0x987C */ dCursorHitCheckLyt_c mCsHitCheck; + /* 0x98A4 */ nw4r::lyt::Pane *mpPanes[6]; + /* 0x98BC */ s32 mStep; + /* 0x98C0 */ s32 mPrevNavTarget; + /* 0x98C4 */ s32 mCurrentNavTarget; + /* 0x98C8 */ s32 mGetDemoTimer; + /* 0x98CC */ bool mInRequest; + /* 0x98CD */ bool mOutRequest; + /* 0x98CE */ bool mIsChangingState; + /* 0x98CF */ bool mIsVisible; + /* 0x98D0 */ bool mDoScrollAnim; + /* 0x98D1 */ bool mHasSelection; + /* 0x98D2 */ bool mSelectToggle; }; #endif diff --git a/include/d/lyt/d_lyt_pause_info.h b/include/d/lyt/d_lyt_pause_info.h new file mode 100644 index 00000000..eae38963 --- /dev/null +++ b/include/d/lyt/d_lyt_pause_info.h @@ -0,0 +1,53 @@ +#ifndef D_LYT_PAUSE_INFO_H +#define D_LYT_PAUSE_INFO_H + +#include "d/lyt/d2d.h" +#include "s/s_State.hpp" + +class dLytCommonTitle_c; + +/** 2D UI - Pause menu - title and button help */ +class dLytPauseInfo_c { +public: + dLytPauseInfo_c(); + virtual ~dLytPauseInfo_c() {} + + bool build(); + bool remove(); + bool execute(); + bool draw(); + + void requestIn(); + void requestOut(); + void updateTitle(); + + void setInputInOut(bool inOut); + + bool isChangingState() const { + return mIsChangingState; + } + +private: + void updateCaption(); + void startAnim(int idx); + void stopAnim(int idx); + void playBackwards(d2d::AnmGroup_c &anm); + + STATE_FUNC_DECLARE(dLytPauseInfo_c, None); + STATE_FUNC_DECLARE(dLytPauseInfo_c, In); + STATE_FUNC_DECLARE(dLytPauseInfo_c, Wait); + STATE_FUNC_DECLARE(dLytPauseInfo_c, Out); + + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytPauseInfo_c); + /* 0x040 */ dLytCommonTitle_c *mpTitle; + /* 0x044 */ d2d::LytBase_c mLyt; + /* 0x0D4 */ d2d::AnmGroup_c mAnm[3]; + /* 0x194 */ s32 mStep; + /* 0x198 */ bool mInRequest; + /* 0x199 */ bool mOutRequest; + /* 0x19A */ bool mIsChangingState; + /* 0x19B */ bool field_0x19B; + /* 0x19C */ bool mInputInOut; +}; + +#endif diff --git a/include/d/lyt/d_lyt_pause_text.h b/include/d/lyt/d_lyt_pause_text.h new file mode 100644 index 00000000..83961c1e --- /dev/null +++ b/include/d/lyt/d_lyt_pause_text.h @@ -0,0 +1,61 @@ +#ifndef D_LYT_PAUSE_TEXT_H +#define D_LYT_PAUSE_TEXT_H + +#include "common.h" +#include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_common_a_btn.h" +#include "s/s_State.hpp" +#include "sized_string.h" + +/** 2D UI - Pause menu - item info popup */ +class dLytPauseText_c { +public: + static const char *getCurrentPauseLabel(SizedString<32> &buf); + static const wchar_t *getCurrentPausePopupName(); + static const wchar_t *getCurrentPausePopupCaption(); + + dLytPauseText_c(); + virtual ~dLytPauseText_c() {} + + bool build(); + bool remove(); + bool execute(); + bool draw(); + + void requestIn(); + void requestOut(); + + bool isChangingState() const { + return mIsChangingState; + } + +private: + void startAnim(int idx); + void stopAnim(int idx); + void updateText(); + + bool isCurrentItemWallet() const; + void calcTextLines(dTextBox_c *textBox, const wchar_t *text); + + STATE_FUNC_DECLARE(dLytPauseText_c, None); + STATE_FUNC_DECLARE(dLytPauseText_c, In); + STATE_FUNC_DECLARE(dLytPauseText_c, Wait); + STATE_FUNC_DECLARE(dLytPauseText_c, Out); + + /* 0x004 */ UI_STATE_MGR_DECLARE(dLytPauseText_c); + /* 0x040 */ d2d::LytBase_c mLyt; + /* 0x0D0 */ d2d::AnmGroup_c mAnm[3]; + /* 0x190 */ d2d::ResAccIf_c mResAcc; + /* 0x500 */ dLytCommonABtn_c mABtn; + /* 0x6B0 */ d2d::SubPaneList mSubpaneList; + /* 0x6BC */ d2d::SubPaneListNode mSubpanes[1]; + /* 0x6CC */ s32 mStep; + /* 0x6D0 */ f32 mLineSpace; + /* 0x6D4 */ u8 mNumTextLines; + /* 0x6D5 */ bool mInRequest; + /* 0x6D6 */ bool mOutRequest; + /* 0x6D7 */ bool mIsChangingState; + /* 0x6D8 */ bool field_0x6D8; +}; + +#endif diff --git a/include/d/lyt/d_lyt_util_items.h b/include/d/lyt/d_lyt_util_items.h index 7f832a40..12f029a5 100644 --- a/include/d/lyt/d_lyt_util_items.h +++ b/include/d/lyt/d_lyt_util_items.h @@ -2,19 +2,96 @@ #define D_LYT_UTIL_ITEMS_H #include "common.h" +#include "sized_string.h" #include "toBeSorted/dowsing_target.h" +enum LytItemNumberColor_e { + LYT_ITEM_COLOR_GOLD = 0, + LYT_ITEM_COLOR_RED = 1, + LYT_ITEM_COLOR_GREEN = 2, + LYT_ITEM_COLOR_NONE = 3, +}; + +enum SongLifeTreeSeedStatus_e { + SONG_LIFETREE_NONE = 0, + SONG_LIFETREE_HAS_SOTH_PARTS_OR_SEED = 1, + SONG_LIFETREE_HAS_SOTH = 2, +}; + +u8 getSongLifeTreeStatus(); + +/** 0: no sword, 6: TMS */ +s32 getCurrentSwordLevel(); +u16 getCurrentSwordItemId(); +bool isSwordRestrictedBokoBase(); + +u16 getCurrentGoddessHarpItemId(); +bool isHarpRestrictedBokoBase(); + +u16 getCurrentEarringsItemId(); + +u16 getTabletItemIdForIndex(s32 index); + +u16 getTriforceItemIdForIndex(s32 index); + +u16 getSongItemIdForIndex(s32 index); + +bool hasGoddessHarp(); + +bool hasSong(s32 index); + +bool hasWaterDragonScale(); +u16 getCurrentWaterDragonScaleItemId(); +bool isWaterDragonScaleRestricted(); + +bool hasSailcloth(); + +s32 getCurrentMittsLevel(); +u16 getCurrentMittsItemId(); +bool isMittsRestricted(); + +u16 getCurrentSailclothItemId(); + +u16 getCurrentWalletItemId(); + +u16 getCurrentHeartPieceItemId(); + +void getItemLabel(s32 itemId, SizedString<32> &buf); +void getCaptionItemLabel(s32 itemId, SizedString<32> &buf); +void getDowsingLabel(s32 itemId, SizedString<32> &buf); +void getPauseCategoryLabel(s32 itemId, SizedString<32> &buf); + +const wchar_t *getItemText(s32 itemId); +const wchar_t *getCaptionItemText(s32 itemId); +const wchar_t *getDowsingText(s32 itemId); +const wchar_t *getPauseCategoryText(s32 itemId); + bool isPouchBocoburinLocked(); +// TODO - these return types may require some work + u8 getPouchItemForSlot(s32 slot, bool unk); bool hasPouchSlot(s32 slot, bool unk); s32 getPouchItemAmount(s32 slot, bool unk); u8 getPouchItemNumberColor(s32 slot, bool unk); f32 getShieldDurability(s32 slot, bool unk); +u32 getPouchItemIdForIndex(s32 slot, bool unk); +// TODO - rename and make sense of these DowsingTarget::DowsingSlot dowsingSlotForIndex(s32 index); -s32 getLytIndexForDowsingIndex(s32 index); +u8 getLytIndexForDowsingIndex(s32 index); u16 getDowsingItemIdForIndex(s32 index); +bool hasDowsingInIndex(s32 index); + +// B-Wheel +s32 getBWheelSlotForIndex(s32 index); +bool isBWheelIndexWithNumber(s32 index); +s32 getNumberForBWheelIndex(s32 index); +s32 getItemLevelForBWheelIndex(s32 index); +u8 getLytItemIdForBWheelIndex(s32 index); +bool isBWheelIndexBocoburinLocked(s32 index, bool unk); +u8 getNumberColorForBWheelIndex(s32 index); +u16 getBWheelItemIdForIndex(s32 index); /** * FR: -1, 0, 1 singular, else plural diff --git a/include/d/lyt/meter/d_lyt_meter.h b/include/d/lyt/meter/d_lyt_meter.h index 00bc98d4..a5826546 100644 --- a/include/d/lyt/meter/d_lyt_meter.h +++ b/include/d/lyt/meter/d_lyt_meter.h @@ -264,6 +264,10 @@ public: return mMain.field_0x13750; } + void setMeterField_0x13750(s32 value) { + mMain.field_0x13750 = value; + } + u8 getMeterField_0x13770() const { return mMain.field_0x13770; } diff --git a/include/d/lyt/meter/d_lyt_meter_item_select.h b/include/d/lyt/meter/d_lyt_meter_item_select.h index d64e7eae..18390b1d 100644 --- a/include/d/lyt/meter/d_lyt_meter_item_select.h +++ b/include/d/lyt/meter/d_lyt_meter_item_select.h @@ -213,8 +213,8 @@ private: void fn_800EF8C0(bool); bool isWheelBlockedByCurrentAction(); void setBtnText(s32); - bool fn_800F01B0(s32) const; - bool fn_800F01E0(s32) const; + bool hasBWheelItem(s32) const; + bool isBocoburinLocked(s32) const; bool isSlotBocoburinLocked(s32); void fn_800F0310(); bool fn_800F0030() const; diff --git a/include/m/m_vec.h b/include/m/m_vec.h index f5dd02ef..401c04c3 100644 --- a/include/m/m_vec.h +++ b/include/m/m_vec.h @@ -315,6 +315,10 @@ public: mVec2_c operator-(const mVec2_c &v) const { return mVec2_c(x - v.x, y - v.y); } + + f32 squareDistanceTo(const mVec2_c &other) const { + return (*this - other).squaredLength(); + } }; #endif diff --git a/include/sized_string.h b/include/sized_string.h index 44e26ebe..2bcec9b9 100644 --- a/include/sized_string.h +++ b/include/sized_string.h @@ -37,6 +37,10 @@ struct SizedString { return mChars; } + void empty() { + mChars[0] = '\0'; + } + void operator=(const char *src) { if (src != mChars) { mChars[0] = '\0'; @@ -100,7 +104,7 @@ struct SizedString { template <size_t Size> struct SizedWString { SizedWString() { - mChars[0] = '\0'; + mChars[0] = L'\0'; } wchar_t mChars[Size]; @@ -113,6 +117,10 @@ struct SizedWString { return mChars; } + void empty() { + mChars[0] = L'\0'; + } + int sprintf(const wchar_t *fmt, ...) { va_list args; va_start(args, fmt); |
