From c5e28a00bfeec92866d67e5adf38070526c6b419 Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 15 May 2025 22:32:05 +0200 Subject: [PATCH 1/4] dLytDoButton_c cleanup start --- config/SOUE01/splits.txt | 1 + config/SOUE01/symbols.txt | 12 +- include/d/lyt/d_lyt_do_button.h | 126 +++++++++- include/d/lyt/d_lyt_unknowns.h | 187 +++++++++++--- include/m/m2d.h | 9 +- src/d/lyt/d_lyt_common_arrow.cpp | 6 +- src/d/lyt/d_lyt_do_button.cpp | 252 ++++++++++++++++++- src/d/lyt/d_lyt_do_button_related.cpp | 2 +- src/d/lyt/d_lyt_pause_disp_00.cpp | 2 +- src/d/lyt/meter/d_lyt_meter.cpp | 42 ++-- src/d/lyt/meter/d_lyt_meter_a_btn.cpp | 40 +-- src/d/lyt/meter/d_lyt_meter_action_table.inc | 157 +++++++++++- src/d/lyt/meter/d_lyt_meter_cross_btn.cpp | 44 ++-- src/d/lyt/meter/d_lyt_meter_dowsing.cpp | 18 +- src/d/lyt/meter/d_lyt_meter_item_select.cpp | 56 ++--- src/d/lyt/meter/d_lyt_meter_nun_stk.cpp | 22 +- src/d/lyt/meter/d_lyt_meter_nunchaku_bg.cpp | 20 +- src/d/lyt/meter/d_lyt_meter_plus_btn.cpp | 14 +- src/d/lyt/meter/d_lyt_meter_remocon_bg.cpp | 6 +- src/d/lyt/meter/d_lyt_meter_z_btn.cpp | 18 +- src/m/m2d.cpp | 4 +- 21 files changed, 833 insertions(+), 205 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index f41d3819..92b31f9d 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -691,6 +691,7 @@ d/lyt/d_lyt_do_button.cpp: .ctors start:0x804DB728 end:0x804DB72C .rodata start:0x804E6D60 end:0x804E7080 .data start:0x8051A5A8 end:0x8051AC00 + .sdata start:0x80572520 end:0x80572530 .sbss start:0x80575468 end:0x80575470 .bss start:0x805ACE10 end:0x805ACF78 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index f2cbc469..130810cc 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -6065,7 +6065,7 @@ executeState_Off__24dLytMeterCrossBtnParts_cFv = .text:0x800F9170; // type:funct finalizeState_Off__24dLytMeterCrossBtnParts_cFv = .text:0x800F91E0; // type:function size:0x4 init__24dLytMeterCrossBtnParts_cFv = .text:0x800F91F0; // type:function size:0x80 execute__24dLytMeterCrossBtnParts_cFb = .text:0x800F9270; // type:function size:0x4C8 -setMessage__24dLytMeterCrossBtnParts_cFl = .text:0x800F9740; // type:function size:0x508 +setMessage__24dLytMeterCrossBtnParts_cFQ218LytDoButtonRelated8Act_IE_e = .text:0x800F9740; // type:function size:0x508 initializeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C50; // type:function size:0x4 executeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C60; // type:function size:0x4 finalizeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C70; // type:function size:0x4 @@ -6526,14 +6526,14 @@ finalizeState_Wait__14dLytDobutton_cFv = .text:0x8010D350; // type:function size initializeState_Out__14dLytDobutton_cFv = .text:0x8010D360; // type:function size:0x88 executeState_Out__14dLytDobutton_cFv = .text:0x8010D3F0; // type:function size:0x8C finalizeState_Out__14dLytDobutton_cFv = .text:0x8010D480; // type:function size:0x4 -init__14dLytDobutton_cFPQ23m2d10ResAccIf_c = .text:0x8010D490; // type:function size:0x1D4 +build__14dLytDobutton_cFPQ23m2d10ResAccIf_c = .text:0x8010D490; // type:function size:0x1D4 remove__14dLytDobutton_cFv = .text:0x8010D670; // type:function size:0x50 execute__14dLytDobutton_cFv = .text:0x8010D6C0; // type:function size:0x80C draw__14dLytDobutton_cFv = .text:0x8010DED0; // type:function size:0x28 -fn_8010DF00 = .text:0x8010DF00; // type:function size:0x4CC +realize__14dLytDobutton_cFv = .text:0x8010DF00; // type:function size:0x4CC fn_8010E3D0 = .text:0x8010E3D0; // type:function size:0x1F0 setActionTextStuffInternal__14dLytDobutton_cFllb = .text:0x8010E5C0; // type:function size:0x10 -fn_8010E5D0__14dLytDobutton_cCFv = .text:0x8010E5D0; // type:function size:0x8 +getActionInternal__14dLytDobutton_cCFv = .text:0x8010E5D0; // type:function size:0x8 fn_8010E5E0__14dLytDobutton_cCFv = .text:0x8010E5E0; // type:function size:0x1C __sinit_\d_lyt_do_button_cpp = .text:0x8010E600; // type:function size:0x410 scope:local __dt__29sFStateID_c<14dLytDobutton_c>Fv = .text:0x8010EA10; // type:function size:0x58 @@ -6543,8 +6543,8 @@ fn_8010EB30 = .text:0x8010EB30; // type:function size:0x40 __ct__18LytDoButtonRelatedFv = .text:0x8010EB70; // type:function size:0x14 build__18LytDoButtonRelatedFPQ23d2d10ResAccIf_c = .text:0x8010EB90; // type:function size:0x70 remove__18LytDoButtonRelatedFv = .text:0x8010EC00; // type:function size:0x8 -fn_8010EC10__18LytDoButtonRelatedFQ218LytDoButtonRelated8Action_eb = .text:0x8010EC10; // type:function size:0x134 -fn_8010ED50__18LytDoButtonRelatedFQ218LytDoButtonRelated8Action_eb = .text:0x8010ED50; // type:function size:0x110 +fn_8010EC10__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010EC10; // type:function size:0x134 +fn_8010ED50__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010ED50; // type:function size:0x110 convertDoButton__18LytDoButtonRelatedFl = .text:0x8010EE60; // type:function size:0xE8 fn_8010EF50 = .text:0x8010EF50; // type:function size:0x3C build__16dLytCommonABtn_cFPQ23d2d10ResAccIf_c = .text:0x8010EF90; // type:function size:0xAC diff --git a/include/d/lyt/d_lyt_do_button.h b/include/d/lyt/d_lyt_do_button.h index b2313ab1..efe6d25e 100644 --- a/include/d/lyt/d_lyt_do_button.h +++ b/include/d/lyt/d_lyt_do_button.h @@ -3,10 +3,111 @@ #include "common.h" #include "d/lyt/d2d.h" +#include "d/lyt/d_textbox.h" +#include "nw4r/lyt/lyt_pane.h" #include "s/s_State.hpp" class dLytDobutton_c { public: + enum Act_Do_e { + ACT_DO_CLIMB_UP = 0, + ACT_DO_JUMP = 1, + ACT_DO_DROP_DOWN = 2, + ACT_DO_LET_GO = 3, + ACT_DO_OPEN = 4, + ACT_DO_PUT_DOWN = 5, + ACT_DO_THROW = 6, + ACT_DO_BURROW = 7, + ACT_DO_ROLL = 8, + ACT_DO_9 = 9, + ACT_DO_MOVE = 10, + ACT_DO_GRAB = 11, + ACT_DO_SHOOT = 12, + ACT_DO_13 = 13, + ACT_DO_14 = 14, + ACT_DO_15 = 15, + ACT_DO_TALK = 16, + ACT_DO_EXAMINE = 17, + ACT_DO_DRAW = 18, + ACT_DO_19 = 19, + ACT_DO_BLOW = 20, + ACT_DO_21 = 21, + ACT_DO_22 = 22, + ACT_DO_SWIM = 23, + ACT_DO_LEAP = 24, + ACT_DO_DASH = 25, + ACT_DO_GET_OUT = 26, + ACT_DO_27 = 27, + ACT_DO_PICK_UP = 28, + ACT_DO_SIT = 29, + ACT_DO_STAND = 30, + ACT_DO_DIG = 31, + ACT_DO_32 = 32, + ACT_DO_33 = 33, + ACT_DO_BREAK_FREE = 34, + ACT_DO_35 = 35, + ACT_DO_36 = 36, + ACT_DO_PLANT = 37, + ACT_DO_CATCH = 38, + ACT_DO_SPEED_UP = 39, + ACT_DO_SAILCLOTH = 40, + ACT_DO_PUT_AWAY = 41, + ACT_DO_EMERGE = 42, + ACT_DO_INSERT = 43, + ACT_DO_44 = 44, + ACT_DO_TURN = 45, + ACT_DO_PUSH_IN = 46, + ACT_DO_47 = 47, + ACT_DO_DRAW_BOW = 48, + ACT_DO_49 = 49, + ACT_DO_50 = 50, + ACT_DO_51 = 51, + ACT_DO_SWING = 52, + ACT_DO_BALANCE = 53, + ACT_DO_JOSTLE = 54, + ACT_DO_55 = 55, + ACT_DO_SLEEP = 56, + ACT_DO_DROP = 57, + ACT_DO_LAUNCH = 58, + ACT_DO_READ = 59, + ACT_DO_WHIP = 60, + ACT_DO_PULL = 61, + ACT_DO_DRINK = 62, + ACT_DO_63 = 63, + ACT_DO_GET_IN = 64, + ACT_DO_FIRE = 65, + ACT_DO_ATTACK = 66, + ACT_DO_FATAL_BLOW = 67, + ACT_DO_JUMP_DOWN = 68, + ACT_DO_STRUM = 69, + ACT_DO_70 = 70, + ACT_DO_RELEASE = 71, + ACT_DO_GRAB_2 = 72, + ACT_DO_READY_STANCE = 73, + ACT_DO_REMOVE = 74, + ACT_DO_READY_SWORD = 75, + ACT_DO_THRUST_SWORD = 76, + ACT_DO_USE = 77, + ACT_DO_SCOOP = 78, + ACT_DO_79 = 79, + ACT_DO_80 = 80, + ACT_DO_LOOK = 81, + ACT_DO_DOWSE = 82, + ACT_DO_PILOT = 83, + ACT_DO_LOOK_DOWN = 84, + ACT_DO_DIVE = 85, + ACT_DO_SELECT = 86, + ACT_DO_GRAB_3 = 87, + ACT_DO_MOVE_2 = 88, + ACT_DO_ACCELERATE = 89, + ACT_DO_CHARGE = 90, + ACT_DO_LEAN = 91, + ACT_DO_PRESS = 92, + + ACT_DO_NONE = 93, + ACT_DO_INVALID = 94, + }; + dLytDobutton_c() : mStateMgr(*this, sStateID::null) { sInstance = this; } @@ -14,7 +115,7 @@ public: sInstance = nullptr; } - bool init(m2d::ResAccIf_c *resAcc); + bool build(m2d::ResAccIf_c *resAcc); bool remove(); bool execute(); bool draw(); @@ -27,7 +128,7 @@ public: if (sInstance != nullptr) { return sInstance->field_0x47C; } else { - return 0x5E; + return ACT_DO_INVALID; } } @@ -55,24 +156,26 @@ public: } } - static s32 getFn0x8010E5D0() { + static s32 getAction() { if (sInstance != nullptr) { - return sInstance->fn_8010E5D0(); + return sInstance->getActionInternal(); } else { - return 0x5E; + return ACT_DO_INVALID; } } - + static void setActionTextStuff(s32 p1, s32 p2, bool p3) { if (sInstance != nullptr) { sInstance->setActionTextStuffInternal(p1, p2, p3); } } - + private: void setActionTextStuffInternal(s32, s32, bool); - s32 fn_8010E5D0() const; + s32 getActionInternal() const; s32 fn_8010E5E0() const; + void fn_8010E3D0(bool); + void realize(); static dLytDobutton_c *sInstance; @@ -87,7 +190,8 @@ private: UI_STATE_MGR_DECLARE(dLytDobutton_c); /* 0x040 */ d2d::dLytSub mLyt; /* 0x0D4 */ d2d::AnmGroup_c mAnmGroups[12]; - /* 0x3D4 */ u8 field_0x3D4[0x470 - 0x3D4]; + /* 0x3D4 */ nw4r::lyt::Pane *mpPanes[37]; + /* 0x468 */ dTextBox_c *mpTextBoxes[2]; /* 0x470 */ s32 mDoActionToShow; /* 0x474 */ s32 field_0x474; /* 0x478 */ s32 field_0x478; @@ -96,7 +200,9 @@ private: /* 0x484 */ s32 mNextDoActionToShow; /* 0x488 */ s32 field_0x488; /* 0x48C */ s32 field_0x48C; - /* 0x490 */ s32 field_0x490; + /* 0x490 */ u8 field_0x490; + /* 0x491 */ u8 field_0x491; + /* 0x492 */ u8 field_0x492; }; #endif diff --git a/include/d/lyt/d_lyt_unknowns.h b/include/d/lyt/d_lyt_unknowns.h index 7df0a225..36022564 100644 --- a/include/d/lyt/d_lyt_unknowns.h +++ b/include/d/lyt/d_lyt_unknowns.h @@ -17,19 +17,156 @@ public: return sInstance; } - enum Action_e { - DO_DASH = 0x5F, + enum Act_IE_e { + ACT_IE_INFO_CLIMB_UP = 0, + ACT_IE_INFO_JUMP = 1, + ACT_IE_INFO_DROP_DOWN = 2, + ACT_IE_INFO_LET_GO = 3, + ACT_IE_INFO_OPEN = 4, + ACT_IE_INFO_DROP = 5, + ACT_IE_INFO_THROW = 6, + ACT_IE_INFO_BURROW = 7, + ACT_IE_INFO_ROLL = 8, + ACT_IE_INFO_9 = 9, + ACT_IE_INFO_MOVE = 10, + ACT_IE_INFO_GRAB = 11, + ACT_IE_INFO_SHOOT = 12, + ACT_IE_INFO_13 = 13, + ACT_IE_INFO_14 = 14, + ACT_IE_INFO_15 = 15, + ACT_IE_INFO_TALK = 16, + ACT_IE_INFO_EXAMINE = 17, + ACT_IE_INFO_DRAW = 18, + ACT_IE_INFO_19 = 19, + ACT_IE_INFO_BLOW = 20, + ACT_IE_INFO_21 = 21, + ACT_IE_INFO_22 = 22, + ACT_IE_INFO_SWIM = 23, + ACT_IE_INFO_LEAP = 24, + ACT_IE_INFO_DASH = 25, + ACT_IE_INFO_GET_OUT = 26, + ACT_IE_INFO_27 = 27, + ACT_IE_INFO_PICK_UP = 28, + ACT_IE_INFO_SIT = 29, + ACT_IE_INFO_STAND = 30, + ACT_IE_INFO_DIG = 31, + ACT_IE_INFO_32 = 32, + ACT_IE_INFO_33 = 33, + ACT_IE_INFO_BREAK_FREE = 34, + ACT_IE_INFO_35 = 35, + ACT_IE_INFO_36 = 36, + ACT_IE_INFO_PLANT = 37, + ACT_IE_INFO_CATCH = 38, + ACT_IE_INFO_SPEED_UP = 39, + ACT_IE_INFO_SAILCLOTH = 40, + ACT_IE_INFO_PUT_AWAY = 41, + ACT_IE_INFO_EMERGE = 42, + ACT_IE_INFO_INSERT = 43, + ACT_IE_INFO_44 = 44, + ACT_IE_INFO_TURN = 45, + ACT_IE_INFO_ALIGN = 46, + ACT_IE_INFO_47 = 47, + ACT_IE_INFO_DRAW_BOW = 48, + ACT_IE_INFO_49 = 49, + ACT_IE_INFO_50 = 50, + ACT_IE_INFO_51 = 51, + ACT_IE_INFO_SWING = 52, + ACT_IE_INFO_BALANCE = 53, + ACT_IE_INFO_JOSTLE = 54, + ACT_IE_INFO_55 = 55, + ACT_IE_INFO_SLEEP = 56, + ACT_IE_INFO_DROP_2 = 57, + ACT_IE_INFO_LAUNCH = 58, + ACT_IE_INFO_READ = 59, + ACT_IE_INFO_WHIP = 60, + ACT_IE_INFO_PULL = 61, + ACT_IE_INFO_DRINK = 62, + ACT_IE_INFO_63 = 63, + ACT_IE_INFO_GET_IN = 64, + ACT_IE_INFO_FIRE = 65, + ACT_IE_INFO_ATTACK = 66, + ACT_IE_INFO_FATAL_BLOW = 67, + ACT_IE_INFO_JUMP_DOWN = 68, + ACT_IE_INFO_STRUM = 69, + ACT_IE_INFO_70 = 70, + ACT_IE_INFO_RELEASE = 71, + ACT_IE_INFO_GRAB_2 = 72, + ACT_IE_INFO_READY_STANCE = 73, + ACT_IE_INFO_REMOVE = 74, + ACT_IE_INFO_READY_SWORD = 75, + ACT_IE_INFO_THRUST_SWORD = 76, + ACT_IE_INFO_USE = 77, + ACT_IE_INFO_SCOOP = 78, + ACT_IE_INFO_79 = 79, + ACT_IE_INFO_80 = 80, + ACT_IE_INFO_LOOK = 81, + ACT_IE_INFO_DOWSE = 82, + ACT_IE_INFO_PILOT = 83, + ACT_IE_INFO_LOOK_DOWN = 84, + ACT_IE_INFO_DIVE = 85, + ACT_IE_INFO_SELECT = 86, + ACT_IE_INFO_GRAB_3 = 87, + ACT_IE_INFO_MOVE_1 = 88, + ACT_IE_INFO_ACCELERATE = 89, + ACT_IE_INFO_CHARGE = 90, + ACT_IE_INFO_LEAN = 91, + ACT_IE_INFO_PRESS = 92, + ACT_IE_SEPARATOR = 93, + ACT_IE_ETC_LOCK_ON = 94, + ACT_IE_ETC_DASH = 95, + ACT_IE_ETC_RAISE_SHIELD = 96, + ACT_IE_ETC_97 = 97, + ACT_IE_ETC_SHIELD_BASH = 98, + ACT_IE_ETC_99 = 99, + ACT_IE_ETC_ROLL = 100, + ACT_IE_ETC_DODGE = 101, + ACT_IE_ETC_102 = 102, + ACT_IE_ETC_VIEW_SURFACE = 103, + ACT_IE_ETC_PUT_AWAY = 104, + ACT_IE_ETC_105 = 105, + ACT_IE_ETC_106 = 106, + ACT_IE_ETC_CENTER = 107, + ACT_IE_ETC_BACK = 108, + ACT_IE_ETC_WORLD_MAP = 109, + ACT_IE_ETC_ZOOM_OUT = 110, + ACT_IE_ETC_ZOOM_IN = 111, + ACT_IE_ETC_SCROLL = 112, + ACT_IE_ETC_CURRENT_LOCATION = 113, + ACT_IE_ETC_114 = 114, + ACT_IE_ETC_115 = 115, + ACT_IE_ETC_BACK_2 = 116, + ACT_IE_ETC_ADD_BEACON = 117, + ACT_IE_ETC_REMOVE_BEACON = 118, + ACT_IE_ETC_ROTATE_MAP = 119, + ACT_IE_ETC_ROTATE_MAP_2 = 120, + ACT_IE_ETC_121 = 121, + ACT_IE_ETC_122 = 122, + ACT_IE_ETC_123 = 123, + ACT_IE_ETC_124 = 124, + ACT_IE_ETC_GET_OFF = 125, + ACT_IE_ETC_STORE = 126, + ACT_IE_ETC_RETURN = 127, + ACT_IE_ETC_MOVE = 128, + ACT_IE_ETC_VIEW_LOCK = 129, + ACT_IE_ETC_RESET_POSITION = 130, + ACT_IE_ETC_CANCEL = 131, + ACT_IE_ETC_STOP = 132, + ACT_IE_ETC_ITEMS = 133, + ACT_IE_ETC_SPIN = 134, + ACT_IE_ETC_DONE = 135, + ACT_IE_ETC_RESET_PANELS = 136, + ACT_IE_ETC_BACK_3 = 137, + ACT_IE_ETC_SLOW_DOWN = 138, + ACT_IE_ETC_DISPLAY = 139, + ACT_IE_ETC_SELECT_FLOOR = 140, + ACT_IE_ETC_SHOW_ISLAND_NAME = 141, + ACT_IE_ETC_HIDE_ISLAND_NAME = 142, + ACT_IE_ETC_READY_CANNON = 143, + ACT_IE_ETC_STOW_CANNON = 144, + ACT_IE_ETC_SAILCLOTH = 145, + ACT_IE_ETC_RETURN_2 = 146, - DO_0x74 = 0x74, - - DO_RETURN = 0x7F, - DO_STOP = 0x84, - DO_ITEMS = 0x85, - DO_DONE = 0x87, - DO_READY_CANNON = 0x8F, - DO_STOW_CANNON = 0x90, - DO_SAILCLOTH = 0x91, - DO_NONE = 0x98, + ACT_IE_NONE = 152, }; enum DoButton_e { @@ -49,7 +186,7 @@ public: DO_BUTTON_PLUS = 11, }; - static void set(DoButton_e button, Action_e value) { + static void set(DoButton_e button, Act_IE_e value) { if (sInstance != nullptr) { LytDoButtonRelated *b = sInstance; b->field_0x04[button] = value; @@ -57,7 +194,7 @@ public: } } - static void reset(DoButton_e button, Action_e value) { + static void reset(DoButton_e button, Act_IE_e value) { LytDoButtonRelated *b = sInstance; if (b != nullptr) { b->field_0x04[button] = value; @@ -65,11 +202,11 @@ public: } } - static Action_e get(DoButton_e button) { + static Act_IE_e get(DoButton_e button) { if (sInstance != nullptr) { return sInstance->field_0x04[button]; } else { - return DO_NONE; + return ACT_IE_NONE; } } @@ -82,23 +219,14 @@ public: } - static Action_e get0x08() { - if (sInstance != nullptr) { - return sInstance->field_0x04[1]; - } else { - return DO_NONE; - } - } + static Act_IE_e convertDoButton(s32); - static Action_e convertDoButton(s32); + static void fn_8010EC10(Act_IE_e, bool); + static void fn_8010ED50(Act_IE_e, bool); - static void fn_8010EC10(Action_e, bool); - static void fn_8010ED50(Action_e, bool); - private: - static LytDoButtonRelated *sInstance; - /* 0x04 */ Action_e field_0x04[12]; + /* 0x04 */ Act_IE_e field_0x04[12]; /* 0x34 */ bool field_0x34[12]; }; @@ -118,7 +246,6 @@ public: static LytBirdButtonRelated *sInstance; - private: d2d::LytBase_c mLyt; d2d::AnmGroup_c mAnmGroups[7]; diff --git a/include/m/m2d.h b/include/m/m2d.h index c996b43b..c39ceec4 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -6,6 +6,7 @@ #include "nw4r/lyt/lyt_arcResourceAccessor.h" #include "nw4r/lyt/lyt_drawInfo.h" #include "nw4r/lyt/lyt_layout.h" + #include "nw4r/ut.h" // IWYU pragma: export namespace m2d { @@ -183,9 +184,14 @@ public: mPriority = p; } - /* 0x0C */ u8 mPriority; + u8 getPriority() const { + return mPriority; + } void addToDrawList(); + +protected: + /* 0x0C */ u8 mPriority; }; class Simple_c : public Base_c { @@ -218,7 +224,6 @@ private: u32 field_0x94; }; - void getAllocator(); } // namespace m2d diff --git a/src/d/lyt/d_lyt_common_arrow.cpp b/src/d/lyt/d_lyt_common_arrow.cpp index 1aeb988b..1b9d859d 100644 --- a/src/d/lyt/d_lyt_common_arrow.cpp +++ b/src/d/lyt/d_lyt_common_arrow.cpp @@ -42,7 +42,7 @@ bool dLytCommonArrow_c::build() { void *data = LayoutArcManager::GetInstance()->getLoadedData("CommonArrow"); mResAcc.attach(data, ""); mLytBase.build("commonArrow_00.brlyt", &mResAcc); - mLytBase.mPriority = 0x86; + mLytBase.setPriority(0x86); for (int i = 0; i < 9; i++) { mAnmGroups[i].init(brlanMap[i].mFile, &mResAcc, mLytBase.getLayout(), brlanMap[i].mName); @@ -87,9 +87,9 @@ bool dLytCommonArrow_c::draw() { void dLytCommonArrow_c::setState(s32 state) { mType = state; if (state == 0) { - mLytBase.mPriority = 0x86; + mLytBase.setPriority(0x86); } else { - mLytBase.mPriority = 0x80; + mLytBase.setPriority(0x80); } } diff --git a/src/d/lyt/d_lyt_do_button.cpp b/src/d/lyt/d_lyt_do_button.cpp index 052d71e3..c71d47d6 100644 --- a/src/d/lyt/d_lyt_do_button.cpp +++ b/src/d/lyt/d_lyt_do_button.cpp @@ -1,5 +1,9 @@ #include "d/lyt/d_lyt_do_button.h" +#include "common.h" +#include "sized_string.h" +#include "toBeSorted/small_sound_mgr.h" + struct DoButtonClass { DoButtonClass(); virtual ~DoButtonClass(); @@ -51,6 +55,8 @@ STATE_DEFINE(dLytDobutton_c, Out); #define DO_BUTTON_ANIM_MOVE_OUT 10 #define DO_BUTTON_ANIM_LOOP_BG 11 +#define DO_BUTTON_NUM_ANIM 12 + static const d2d::LytBrlanMapping brlanMap[] = { { "basicInfo_00_in.brlan", "G_inOut_00"}, { "basicInfo_00_basicInfo.brlan", "G_basicInfo_00"}, @@ -66,6 +72,24 @@ static const d2d::LytBrlanMapping brlanMap[] = { { "basicInfo_00_loopBg.brlan", "G_loopBg_00"}, }; +static const char *sPaneNames[] = { + "N_infoAll_00", "N_infoAll_01", "N_bg_00", "W_bgP_00", "W_bgP_01", "N_infoText_00", "N_aBtn_00", + "N_aBtn_01", "N_bBtn_00", "N_cBtn_00", "N_cBtn_01", "N_nunchaku_01", "N_nunchaku_02", "N_nunchaku_03", + "N_upSwing_00", "N_downSwing_00", "N_swing_00", "N_rotate_00", "N_nunRimo_00", "N_nunDrag_00", "N_aBtnDown_00", + "N_aBtnDown_01", "N_draw_00", "N_play_00", "N_swing_01", "N_swing_03", "N_upset_00", "N_stab_00", + "N_pullOut_01", "N_bBtn_01", "N_twist_00", "N_zBtn_00", "N_zBtn_01", "N_crossBtn_00", "N_plusAll_00", + "N_upSwing_01", "N_aBtnDown_02", +}; + +#define DO_BUTTON_NUM_PANES 37 + +static const char *sTextBoxNames[] = { + "T_infoText_00", + "T_infoTextS_00", +}; + +#define DO_BUTTON_NUM_TEXT_BOXES 2 + void dLytDobutton_c::initializeState_InvisibleWait() {} void dLytDobutton_c::executeState_InvisibleWait() { if (field_0x488 == field_0x474 && mNextDoActionToShow == mDoActionToShow) { @@ -172,6 +196,230 @@ void dLytDobutton_c::executeState_Out() { } void dLytDobutton_c::finalizeState_Out() {} -bool dLytDobutton_c::init(m2d::ResAccIf_c *resAcc) { - return brlanMap[0].mFile[0] != '\0' && sDoButtonClass.field_0x04; +bool dLytDobutton_c::build(m2d::ResAccIf_c *resAcc) { + mLyt.setResAcc(resAcc); + mLyt.build("basicInfo_00.brlyt", nullptr); + mLyt.setPriority(0x8A); + + for (int i = 0; i < DO_BUTTON_NUM_ANIM; i++) { + mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); + mAnmGroups[i].bind(false); + mAnmGroups[i].setAnimEnable(false); + } + + for (int i = 0; i < DO_BUTTON_NUM_PANES; i++) { + mpPanes[i] = mLyt.findPane(sPaneNames[i]); + } + + for (int i = 0; i < DO_BUTTON_NUM_TEXT_BOXES; i++) { + mpTextBoxes[i] = mLyt.getTextBox(sTextBoxNames[i]); + } + + mDoActionToShow = 0x5E; + field_0x474 = 0x29; + field_0x478 = 0x29; + mNextDoActionToShow = 0x5E; + field_0x488 = 0x29; + field_0x490 = 0; + field_0x47C = 0x5E; + field_0x480 = 0x29; + field_0x491 = 0; + field_0x492 = 0; + + mAnmGroups[DO_BUTTON_ANIM_LOOP_NUN].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_LOOP_BG].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(false); + mLyt.calc(); + mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(false); + + mStateMgr.changeState(StateID_InvisibleWait); + field_0x48C = 0; + return true; +} + +bool dLytDobutton_c::remove() { + for (int i = 0; i < DO_BUTTON_NUM_ANIM; i++) { + mAnmGroups[i].remove(); + } + return true; +} + +bool dLytDobutton_c::draw() { + mLyt.addToDrawList(); + return true; +} + +static const s32 sActDoIds[] = { + 1, // ACT_DO_CLIMB_UP + 2, // ACT_DO_JUMP + 3, // ACT_DO_DROP_DOWN + 4, // ACT_DO_LET_GO + 5, // ACT_DO_OPEN + 6, // ACT_DO_PUT_DOWN + 7, // ACT_DO_THROW + 8, // ACT_DO_BURROW + 9, // ACT_DO_ROLL + 10, // ACT_DO_9 + 11, // ACT_DO_MOVE + 12, // ACT_DO_GRAB + 13, // ACT_DO_SHOOT + 14, // ACT_DO_13 + 15, // ACT_DO_14 + 16, // ACT_DO_15 + 17, // ACT_DO_TALK + 18, // ACT_DO_EXAMINE + 19, // ACT_DO_DRAW + 20, // ACT_DO_19 + 21, // ACT_DO_BLOW + 22, // ACT_DO_21 + 23, // ACT_DO_22 + 24, // ACT_DO_SWIM + 25, // ACT_DO_LEAP + 26, // ACT_DO_DASH + 27, // ACT_DO_GET_OUT + 28, // ACT_DO_27 + 29, // ACT_DO_PICK_UP + 30, // ACT_DO_SIT + 31, // ACT_DO_STAND + 32, // ACT_DO_DIG + 33, // ACT_DO_32 + 34, // ACT_DO_33 + 35, // ACT_DO_BREAK_FREE + 36, // ACT_DO_35 + 37, // ACT_DO_36 + 38, // ACT_DO_PLANT + 39, // ACT_DO_CATCH + 40, // ACT_DO_SPEED_UP + 41, // ACT_DO_SAILCLOTH + 42, // ACT_DO_PUT_AWAY + 43, // ACT_DO_EMERGE + 44, // ACT_DO_INSERT + 45, // ACT_DO_44 + 46, // ACT_DO_TURN + 47, // ACT_DO_PUSH_IN + 48, // ACT_DO_47 + 49, // ACT_DO_DRAW_BOW + 50, // ACT_DO_49 + 51, // ACT_DO_50 + 52, // ACT_DO_51 + 53, // ACT_DO_SWING + 54, // ACT_DO_BALANCE + 55, // ACT_DO_JOSTLE + 56, // ACT_DO_55 + 57, // ACT_DO_SLEEP + 58, // ACT_DO_DROP + 59, // ACT_DO_LAUNCH + 60, // ACT_DO_READ + 61, // ACT_DO_WHIP + 62, // ACT_DO_PULL + 63, // ACT_DO_DRINK + 64, // ACT_DO_63 + 65, // ACT_DO_GET_IN + 66, // ACT_DO_FIRE + 67, // ACT_DO_ATTACK + 68, // ACT_DO_FATAL_BLOW + 69, // ACT_DO_JUMP_DOWN + 70, // ACT_DO_STRUM + 71, // ACT_DO_70 + 72, // ACT_DO_RELEASE + 73, // ACT_DO_GRAB_2 + 74, // ACT_DO_READY_STANCE + 75, // ACT_DO_REMOVE + 76, // ACT_DO_READY_SWORD + 77, // ACT_DO_THRUST_SWORD + 78, // ACT_DO_USE + 79, // ACT_DO_SCOOP + 80, // ACT_DO_79 + 81, // ACT_DO_80 + 82, // ACT_DO_LOOK + 83, // ACT_DO_DOWSE + 84, // ACT_DO_PILOT + 85, // ACT_DO_LOOK_DOWN + 86, // ACT_DO_DIVE + 87, // ACT_DO_SELECT + 88, // ACT_DO_GRAB_3 + 89, // ACT_DO_MOVE_2 + 90, // ACT_DO_ACCELERATE + 91, // ACT_DO_CHARGE + 92, // ACT_DO_LEAN + 93, // ACT_DO_PRESS +}; + +void dLytDobutton_c::realize() { + // TODO: what? + s32 i1 = field_0x478; + s32 i2 = field_0x474; + if ((i1 == 11 && i2 == 26) || (i1 == 11 && i2 == 27) || (i1 == 11 && i2 == 28) || (i1 == 11 && i2 == 29) || + (i1 == 8 && i2 == 30) || (i1 == 8 && i2 == 31) || (i1 == 36 && i2 == 32) || (i1 == 11 && i2 == 33) || + (i1 == 11 && i2 == 34) || (i1 == 11 && i2 == 35)) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_NUN].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setForwardOnce(); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setForwardOnce(); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setAnimEnable(true); + } else if ((i1 == 26 && i2 == 11) || (i1 == 27 && i2 == 11) || (i1 == 28 && i2 == 11) || (i1 == 29 && i2 == 11) || + (i1 == 30 && i2 == 8) || (i1 == 31 && i2 == /* this one is changed 8 -> 11 */ 11) || + (i1 == 32 && i2 == 36) || (i1 == 33 && i2 == 11) || (i1 == 34 && i2 == 11) || (i1 == 35 && i2 == 11)) { + // Same conditions as above, but inverted (with one exception. Is that exception a bug?) + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setBackwardsOnce(); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setBackwardsOnce(); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setAnimEnable(true); + i2 = field_0x478; + } else if (i2 >= 26 && i2 < 36) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_NUN].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setForwardOnce(); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setToEnd2(); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setForwardOnce(); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setToEnd2(); + } else { + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setBackwardsOnce(); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setToEnd2(); + if (field_0x474 == 11 || field_0x474 == 8) { + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setBackwardsOnce(); + } else { + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setForwardOnce(); + } + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setToEnd2(); + } + + mAnmGroups[DO_BUTTON_ANIM].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM].setFrame(i2); + if (mDoActionToShow != ACT_DO_NONE) { + SizedString<16> buf; + buf.sprintf("ACT_DO_%03d", sActDoIds[mDoActionToShow]); + mpTextBoxes[0]->setMessageWithGlobalTextProcessor2(buf, nullptr); + mpTextBoxes[1]->setMessageWithGlobalTextProcessor2(buf, nullptr); + fn_8010E3D0(true); + } else { + wchar_t buf1[2]; + buf1[0] = buf1[1] = 0; + mpTextBoxes[0]->setTextWithGlobalTextProcessor(buf1, nullptr); + mpTextBoxes[1]->setTextWithGlobalTextProcessor(buf1, nullptr); + fn_8010E3D0(false); + } + + if (mDoActionToShow == ACT_DO_CATCH) { + SmallSoundManager::GetInstance()->playSound(SE_S_CALL_BIRD_CATCH); + } +} + +s32 dLytDobutton_c::getActionInternal() const { + return mDoActionToShow; } diff --git a/src/d/lyt/d_lyt_do_button_related.cpp b/src/d/lyt/d_lyt_do_button_related.cpp index 457407ce..502a3d13 100644 --- a/src/d/lyt/d_lyt_do_button_related.cpp +++ b/src/d/lyt/d_lyt_do_button_related.cpp @@ -7,7 +7,7 @@ LytDoButtonRelated::LytDoButtonRelated() { bool LytDoButtonRelated::build(d2d::ResAccIf_c *resAcc) { for (int i = 0; i < 12; i++) { - field_0x04[i] = DO_NONE; + field_0x04[i] = ACT_IE_NONE; field_0x34[i] = 0; } diff --git a/src/d/lyt/d_lyt_pause_disp_00.cpp b/src/d/lyt/d_lyt_pause_disp_00.cpp index 9f88dca6..43c176cd 100644 --- a/src/d/lyt/d_lyt_pause_disp_00.cpp +++ b/src/d/lyt/d_lyt_pause_disp_00.cpp @@ -20,7 +20,7 @@ dLytPauseDisp00_c::dLytPauseDisp00_c() : mStateMgr(*this, sStateID::null) {} void dLytPauseDisp00_c::init() { mLytBase.build("pause_00.brlyt", nullptr); - mLytBase.mPriority = 0x86; + mLytBase.setPriority(0x86); for (int i = 0; i < 0x7E; i++) { field_0x00D0[i].init(S_MAPPINGS[i].mFile, nullptr, mLytBase.getLayout(), S_MAPPINGS[i].mName); diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index f4f5c0db..0f466304 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -996,9 +996,9 @@ void dLytMeterMain_c::fn_800D5290() { meter->setFlags(METER_BTN_PLUS); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_PLUS, LytDoButtonRelated::DO_0x74); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_PLUS, LytDoButtonRelated::ACT_IE_ETC_BACK_2); meter->clearFlags(METER_BTN_MINUS | METER_BTN_1 | METER_BTN_2); - if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) == LytDoButtonRelated::DO_NONE) { + if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) == LytDoButtonRelated::ACT_IE_NONE) { meter->clearFlags(METER_BTN_C); } } @@ -1134,10 +1134,10 @@ void dLytMeterMain_c::checkPaneVisibility() { dLytDobutton_c::setActionTextStuff(0x29, 0x5E, true); } if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_A) != 0x12) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE); } } @@ -1156,16 +1156,16 @@ void dLytMeterMain_c::checkPaneVisibility() { } if ((!StoryflagManager::sInstance->getCounterOrFlag(58) && - ((LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + ((LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && mItemSelect.getField_0x5794() != 2 && (!EventManager::isInEvent() || !EventManager::isCurrentEvent("ItemGetGorgeous"))))) || (dStageMgr_c::GetInstance()->isAreaTypeHouse() && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && !MinigameManager::isInMinigameState(MinigameManager::HOUSE_CLEANING) && !mItemSelect.fn_800F02F0()) || - (isSilentRealm() && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + (isSilentRealm() && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && !mItemSelect.fn_800F02F0()) || ((dAcPy_c::GetLink()->checkActionFlagsCont(0x400000) || fn_800D5420() || @@ -1175,7 +1175,7 @@ void dLytMeterMain_c::checkPaneVisibility() { MinigameManager::isInMinigameState(MinigameManager::BAMBOO_CUTTING))) || (MinigameManager::isInMinigameState(MinigameManager::TRIAL_TIME_ATTACK) && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE) || + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE) || (dLytMeter_c::getField_0x13B66() || (fn_800D56B0() && !mItemSelect.fn_800F02F0() && !fn_800D53D0()) || fn_800D5650() || fn_800D5680())) { mPanesVisible[METER_ANIM_ITEM_SELECT] = false; @@ -1379,7 +1379,7 @@ void dLytMeterMain_c::checkPaneVisibility() { if (dAcPy_c::GetLink()->getRidingActorType() != dAcPy_c::RIDING_LOFTWING || !field_0x13780 || - (dLytDobutton_c::getFn0x8010E5D0() != 0x5E || fn_800D56B0() || dLytMeter_c::getField_0x13B66() || + (dLytDobutton_c::getAction() != dLytDobutton_c::ACT_DO_INVALID || fn_800D56B0() || dLytMeter_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { mBirdGaugeVisible = false; } @@ -1653,19 +1653,19 @@ bool dLytMeterMain_c::execute() { } meter->resetFlags(); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_NONE); - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::DO_NONE, true); - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::DO_NONE, true); + LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); + LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::ACT_IE_NONE); - LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_NUN_STK, LytDoButtonRelated::DO_NONE); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_NUN_STK, LytDoButtonRelated::ACT_IE_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::ACT_IE_NONE); if (mpTimer != nullptr) { mpTimer->execute(); @@ -1769,7 +1769,7 @@ bool dLytMeter_c::build() { } if (mpDoButton != nullptr) { - mpDoButton->init(&mResAcc); + mpDoButton->build(&mResAcc); } if (mpDoButtonRelated != nullptr) { mpDoButtonRelated->build(&mResAcc); diff --git a/src/d/lyt/meter/d_lyt_meter_a_btn.cpp b/src/d/lyt/meter/d_lyt_meter_a_btn.cpp index 9e0c1ceb..be4861ef 100644 --- a/src/d/lyt/meter/d_lyt_meter_a_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_a_btn.cpp @@ -81,7 +81,7 @@ void dLytMeterABtn_c::executeState_Wait() { } if (field_0x1C0) { - if (field_0x1BC != LytDoButtonRelated::DO_NONE) { + if (field_0x1BC != LytDoButtonRelated::ACT_IE_NONE) { mAnm[A_BTN_ANIM_INPUT].setBackwardsOnce(); mAnm[A_BTN_ANIM_INPUT].setToStart(); mAnm[A_BTN_ANIM_INPUT].setAnimEnable(true); @@ -90,7 +90,7 @@ void dLytMeterABtn_c::executeState_Wait() { } field_0x1B8 = field_0x1BC; } else { - if (field_0x1BC != LytDoButtonRelated::DO_NONE) { + if (field_0x1BC != LytDoButtonRelated::ACT_IE_NONE) { setMessage(field_0x1BC); } field_0x1B8 = field_0x1BC; @@ -110,7 +110,7 @@ void dLytMeterABtn_c::finalizeState_On() {} void dLytMeterABtn_c::initializeState_Active() {} void dLytMeterABtn_c::executeState_Active() { if (field_0x1BC != field_0x1B8 || !field_0x1C0) { - if (field_0x1BC == LytDoButtonRelated::DO_NONE || !field_0x1C0) { + if (field_0x1BC == LytDoButtonRelated::ACT_IE_NONE || !field_0x1C0) { mAnm[A_BTN_ANIM_INPUT].setForwardOnce(); mAnm[A_BTN_ANIM_INPUT].setFrame(0.0f); mAnm[A_BTN_ANIM_INPUT].setAnimEnable(true); @@ -122,7 +122,7 @@ void dLytMeterABtn_c::executeState_Active() { setMessage(field_0x1BC); } field_0x1B8 = field_0x1BC; - } else if (field_0x1B8 == LytDoButtonRelated::DO_NONE) { + } else if (field_0x1B8 == LytDoButtonRelated::ACT_IE_NONE) { mAnm[A_BTN_ANIM_INPUT].setForwardOnce(); mAnm[A_BTN_ANIM_INPUT].setFrame(0.0f); mAnm[A_BTN_ANIM_INPUT].setAnimEnable(true); @@ -170,9 +170,9 @@ bool dLytMeterABtn_c::build(d2d::ResAccIf_c *resAcc) { mpSizeBox[i] = mLyt.getSizeBoxInWindow(sWindows[i]); } - field_0x1C4 = LytDoButtonRelated::DO_DASH; - field_0x1B8 = LytDoButtonRelated::DO_DASH; - field_0x1BC = LytDoButtonRelated::DO_DASH; + field_0x1C4 = LytDoButtonRelated::ACT_IE_ETC_DASH; + field_0x1B8 = LytDoButtonRelated::ACT_IE_ETC_DASH; + field_0x1BC = LytDoButtonRelated::ACT_IE_ETC_DASH; field_0x1C8 = 0; field_0x1CA = 0; field_0x1C9 = 0; @@ -211,17 +211,17 @@ bool dLytMeterABtn_c::execute() { mAnm[A_BTN_ANIM_INPUT].setToEnd2(); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); return true; } if (dLytMeter_c::GetInstance()->getMeterField_0x13750() == 0) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); - if (field_0x1BC != LytDoButtonRelated::DO_NONE) { - field_0x1BC = LytDoButtonRelated::DO_NONE; - field_0x1B8 = LytDoButtonRelated::DO_NONE; + if (field_0x1BC != LytDoButtonRelated::ACT_IE_NONE) { + field_0x1BC = LytDoButtonRelated::ACT_IE_NONE; + field_0x1B8 = LytDoButtonRelated::ACT_IE_NONE; } setMessage(field_0x1BC); } @@ -230,10 +230,10 @@ bool dLytMeterABtn_c::execute() { if (EventManager::isInEvent() && !dLytMeter_c::GetInstance()->fn_800D5670() && dLytMeter_c::GetMain()->getField_0x1377E() == 0 && !checkIsInSkykeepPuzzle() && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_A) == LytDoButtonRelated::DO_NONE) { + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_A) == LytDoButtonRelated::ACT_IE_NONE) { field_0x1C9 = 0; - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); } else { field_0x1C9 = 1; } @@ -256,7 +256,7 @@ bool dLytMeterABtn_c::execute() { case 0x23: case 0x27: case 0x28: { - LytDoButtonRelated::Action_e action = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getField0x47C()); + LytDoButtonRelated::Act_IE_e action = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getField0x47C()); if (action >= 0) { state = true; LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, action); @@ -305,21 +305,21 @@ void dLytMeterABtn_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); - } else if (id == 0x5D) { + } else if (id == LytDoButtonRelated::ACT_IE_SEPARATOR) { wchar_t b2[2]; b2[0] = b2[1] = 0; for (int i = 0; i < 2; i++) { mpTextBoxes[i]->setTextWithGlobalTextProcessor(b2); } } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } - if (id != 0x5D) { + if (id != LytDoButtonRelated::ACT_IE_SEPARATOR) { for (int i = 0; i < 2; i++) { mpTextBoxes[i]->SetVisible(true); mpTextBoxes[i]->setMessageWithGlobalTextProcessor2(buf, nullptr); diff --git a/src/d/lyt/meter/d_lyt_meter_action_table.inc b/src/d/lyt/meter/d_lyt_meter_action_table.inc index 6ca2e66f..8f8f38cb 100644 --- a/src/d/lyt/meter/d_lyt_meter_action_table.inc +++ b/src/d/lyt/meter/d_lyt_meter_action_table.inc @@ -1,10 +1,151 @@ +// 001-Action.msbt static const s32 sActIds[] = { - 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x10, 0x11, 0x12, 0x13, - 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, - 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, - 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, - 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, -1, 0x1, - 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF, 0x10, 0x11, 0x12, 0x13, 0x14, - 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x0, 0x0, 0x0, 0x0, 0x0 + 1, // ACT_IE_INFO_CLIMB_UP + 2, // ACT_IE_INFO_JUMP + 3, // ACT_IE_INFO_DROP_DOWN + 4, // ACT_IE_INFO_LET_GO + 5, // ACT_IE_INFO_OPEN + 6, // ACT_IE_INFO_DROP + 7, // ACT_IE_INFO_THROW + 8, // ACT_IE_INFO_BURROW + 9, // ACT_IE_INFO_ROLL + 10, // ACT_IE_INFO_9 + 11, // ACT_IE_INFO_MOVE + 12, // ACT_IE_INFO_GRAB + 13, // ACT_IE_INFO_SHOOT + 14, // ACT_IE_INFO_13 + 15, // ACT_IE_INFO_14 + 16, // ACT_IE_INFO_15 + 17, // ACT_IE_INFO_TALK + 18, // ACT_IE_INFO_EXAMINE + 19, // ACT_IE_INFO_DRAW + 20, // ACT_IE_INFO_19 + 21, // ACT_IE_INFO_BLOW + 22, // ACT_IE_INFO_21 + 23, // ACT_IE_INFO_22 + 24, // ACT_IE_INFO_SWIM + 25, // ACT_IE_INFO_LEAP + 26, // ACT_IE_INFO_DASH + 27, // ACT_IE_INFO_GET_OUT + 28, // ACT_IE_INFO_27 + 29, // ACT_IE_INFO_PICK_UP + 30, // ACT_IE_INFO_SIT + 31, // ACT_IE_INFO_STAND + 32, // ACT_IE_INFO_DIG + 33, // ACT_IE_INFO_32 + 34, // ACT_IE_INFO_33 + 35, // ACT_IE_INFO_BREAK_FREE + 36, // ACT_IE_INFO_35 + 37, // ACT_IE_INFO_36 + 38, // ACT_IE_INFO_PLANT + 39, // ACT_IE_INFO_CATCH + 40, // ACT_IE_INFO_SPEED_UP + 41, // ACT_IE_INFO_SAILCLOTH + 42, // ACT_IE_INFO_PUT_AWAY + 43, // ACT_IE_INFO_EMERGE + 44, // ACT_IE_INFO_INSERT + 45, // ACT_IE_INFO_44 + 46, // ACT_IE_INFO_TURN + 47, // ACT_IE_INFO_ALIGN + 48, // ACT_IE_INFO_47 + 49, // ACT_IE_INFO_DRAW_BOW + 50, // ACT_IE_INFO_49 + 51, // ACT_IE_INFO_50 + 52, // ACT_IE_INFO_51 + 53, // ACT_IE_INFO_SWING + 54, // ACT_IE_INFO_BALANCE + 55, // ACT_IE_INFO_JOSTLE + 56, // ACT_IE_INFO_55 + 57, // ACT_IE_INFO_SLEEP + 58, // ACT_IE_INFO_DROP_2 + 59, // ACT_IE_INFO_LAUNCH + 60, // ACT_IE_INFO_READ + 61, // ACT_IE_INFO_WHIP + 62, // ACT_IE_INFO_PULL + 63, // ACT_IE_INFO_DRINK + 64, // ACT_IE_INFO_63 + 65, // ACT_IE_INFO_GET_IN + 66, // ACT_IE_INFO_FIRE + 67, // ACT_IE_INFO_ATTACK + 68, // ACT_IE_INFO_FATAL_BLOW + 69, // ACT_IE_INFO_JUMP_DOWN + 70, // ACT_IE_INFO_STRUM + 71, // ACT_IE_INFO_70 + 72, // ACT_IE_INFO_RELEASE + 73, // ACT_IE_INFO_GRAB_2 + 74, // ACT_IE_INFO_READY_STANCE + 75, // ACT_IE_INFO_REMOVE + 76, // ACT_IE_INFO_READY_SWORD + 77, // ACT_IE_INFO_THRUST_SWORD + 78, // ACT_IE_INFO_USE + 79, // ACT_IE_INFO_SCOOP + 80, // ACT_IE_INFO_79 + 81, // ACT_IE_INFO_80 + 82, // ACT_IE_INFO_LOOK + 83, // ACT_IE_INFO_DOWSE + 84, // ACT_IE_INFO_PILOT + 85, // ACT_IE_INFO_LOOK_DOWN + 86, // ACT_IE_INFO_DIVE + 87, // ACT_IE_INFO_SELECT + 88, // ACT_IE_INFO_GRAB_3 + 89, // ACT_IE_INFO_MOVE_1 + 90, // ACT_IE_INFO_ACCELERATE + 91, // ACT_IE_INFO_CHARGE + 92, // ACT_IE_INFO_LEAN + 93, // ACT_IE_INFO_PRESS + -1, // ACT_IE_SEPARATOR + 1, // ACT_IE_ETC_LOCK_ON + 2, // ACT_IE_ETC_DASH + 3, // ACT_IE_ETC_RAISE_SHIELD + 4, // ACT_IE_ETC_97 + 5, // ACT_IE_ETC_SHIELD_BASH + 6, // ACT_IE_ETC_99 + 7, // ACT_IE_ETC_ROLL + 8, // ACT_IE_ETC_DODGE + 9, // ACT_IE_ETC_102 + 10, // ACT_IE_ETC_VIEW_SURFACE + 11, // ACT_IE_ETC_PUT_AWAY + 12, // ACT_IE_ETC_105 + 13, // ACT_IE_ETC_106 + 14, // ACT_IE_ETC_CENTER + 15, // ACT_IE_ETC_BACK + 16, // ACT_IE_ETC_WORLD_MAP + 17, // ACT_IE_ETC_ZOOM_OUT + 18, // ACT_IE_ETC_ZOOM_IN + 19, // ACT_IE_ETC_SCROLL + 20, // ACT_IE_ETC_CURRENT_LOCATION + 21, // ACT_IE_ETC_114 + 22, // ACT_IE_ETC_115 + 23, // ACT_IE_ETC_BACK_2 + 24, // ACT_IE_ETC_ADD_BEACON + 25, // ACT_IE_ETC_REMOVE_BEACON + 26, // ACT_IE_ETC_ROTATE_MAP + 27, // ACT_IE_ETC_ROTATE_MAP_2 + 28, // ACT_IE_ETC_121 + 29, // ACT_IE_ETC_122 + 30, // ACT_IE_ETC_123 + 31, // ACT_IE_ETC_124 + 32, // ACT_IE_ETC_GET_OFF + 33, // ACT_IE_ETC_STORE + 34, // ACT_IE_ETC_RETURN + 35, // ACT_IE_ETC_MOVE + 36, // ACT_IE_ETC_VIEW_LOCK + 37, // ACT_IE_ETC_RESET_POSITION + 38, // ACT_IE_ETC_CANCEL + 39, // ACT_IE_ETC_STOP + 40, // ACT_IE_ETC_ITEMS + 41, // ACT_IE_ETC_SPIN + 42, // ACT_IE_ETC_DONE + 43, // ACT_IE_ETC_RESET_PANELS + 44, // ACT_IE_ETC_BACK_3 + 45, // ACT_IE_ETC_SLOW_DOWN + 46, // ACT_IE_ETC_DISPLAY + 47, // ACT_IE_ETC_SELECT_FLOOR + 48, // ACT_IE_ETC_SHOW_ISLAND_NAME + 49, // ACT_IE_ETC_HIDE_ISLAND_NAME + 50, // ACT_IE_ETC_READY_CANNON + 51, // ACT_IE_ETC_STOW_CANNON + 52, // ACT_IE_ETC_SAILCLOTH + 53, // ACT_IE_ETC_RETURN_2 + 0, 0, 0, 0, 0, }; diff --git a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp index 427cda47..912014eb 100644 --- a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp @@ -33,7 +33,7 @@ void dLytMeterCrossBtnParts_c::executeState_Wait() { if (field_0x7C) { if (field_0x68) { bool bDoUpdate = true; - if (field_0x64 != LytDoButtonRelated::DO_NONE || field_0x70 != field_0x74) { + if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE || field_0x70 != field_0x74) { if (timer <= 0) { mStateMgr.changeState(StateID_On); setMessage(field_0x64); @@ -47,7 +47,7 @@ void dLytMeterCrossBtnParts_c::executeState_Wait() { field_0x70 = field_0x74; } } else { - if (field_0x64 != LytDoButtonRelated::DO_NONE || field_0x70 != field_0x74) { + if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE || field_0x70 != field_0x74) { setMessage(field_0x64); } field_0x60 = field_0x64; @@ -77,7 +77,7 @@ void dLytMeterCrossBtnParts_c::finalizeState_On() {} void dLytMeterCrossBtnParts_c::initializeState_Active() {} void dLytMeterCrossBtnParts_c::executeState_Active() { if (field_0x64 != field_0x60 || !field_0x68 || field_0x70 != field_0x74) { - if ((field_0x64 == LytDoButtonRelated::DO_NONE && field_0x74 == 6) || !field_0x68) { + if ((field_0x64 == LytDoButtonRelated::ACT_IE_NONE && field_0x74 == 6) || !field_0x68) { if (field_0x60 != field_0x6C) { field_0x64 = field_0x6C; } @@ -87,7 +87,7 @@ void dLytMeterCrossBtnParts_c::executeState_Active() { } field_0x60 = field_0x64; field_0x70 = field_0x74; - } else if (field_0x60 == LytDoButtonRelated::DO_NONE && field_0x74 == 6) { + } else if (field_0x60 == LytDoButtonRelated::ACT_IE_NONE && field_0x74 == 6) { mStateMgr.changeState(StateID_Off); } } @@ -107,15 +107,15 @@ void dLytMeterCrossBtnParts_c::executeState_Off() { void dLytMeterCrossBtnParts_c::finalizeState_Off() {} void dLytMeterCrossBtnParts_c::init() { - field_0x6C = LytDoButtonRelated::DO_NONE; - field_0x60 = LytDoButtonRelated::DO_NONE; - field_0x64 = LytDoButtonRelated::DO_NONE; + field_0x6C = LytDoButtonRelated::ACT_IE_NONE; + field_0x60 = LytDoButtonRelated::ACT_IE_NONE; + field_0x64 = LytDoButtonRelated::ACT_IE_NONE; field_0x7C = false; field_0x70 = 6; field_0x68 = 1; mOnDelay = 15; mpOwnerPane = 0; - setMessage(LytDoButtonRelated::DO_NONE); + setMessage(LytDoButtonRelated::ACT_IE_NONE); mStateMgr.changeState(StateID_Wait); } @@ -142,18 +142,18 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { if (dLytMeter_c::GetInstance()->getMeterField_0x13750() == 0) { if (mIndex == 0) { - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::DO_NONE, true); + LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 1) { - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::DO_NONE, true); + LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 2) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); } else if (mIndex == 3) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::ACT_IE_NONE); } - if (field_0x64 != LytDoButtonRelated::DO_NONE) { - field_0x64 = LytDoButtonRelated::DO_NONE; - field_0x60 = LytDoButtonRelated::DO_NONE; + if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE) { + field_0x64 = LytDoButtonRelated::ACT_IE_NONE; + field_0x60 = LytDoButtonRelated::ACT_IE_NONE; } setMessage(field_0x64); } @@ -169,13 +169,13 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { field_0x7C = 0; if (mIndex == 0) { - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::DO_NONE, true); + LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 1) { - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::DO_NONE, true); + LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 2) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); } else if (mIndex == 3) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::ACT_IE_NONE); } } else { field_0x7C = 1; @@ -258,11 +258,11 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { mpLyt->getLayout()->Animate(0); mpLyt->calc(); mpAnm[1]->setAnimEnable(false); - } else if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + } else if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } diff --git a/src/d/lyt/meter/d_lyt_meter_dowsing.cpp b/src/d/lyt/meter/d_lyt_meter_dowsing.cpp index f7850755..7b5adc59 100644 --- a/src/d/lyt/meter/d_lyt_meter_dowsing.cpp +++ b/src/d/lyt/meter/d_lyt_meter_dowsing.cpp @@ -830,9 +830,9 @@ bool dLytMeterDowsing_c::build(d2d::ResAccIf_c *resAcc) { field_0x54F8 = -1; mDemoFrame = 0; field_0x5500 = 0; - field_0x54F0 = LytDoButtonRelated::DO_NONE; - field_0x54E4 = LytDoButtonRelated::DO_NONE; - field_0x54E8 = LytDoButtonRelated::DO_NONE; + field_0x54F0 = LytDoButtonRelated::ACT_IE_NONE; + field_0x54E4 = LytDoButtonRelated::ACT_IE_NONE; + field_0x54E8 = LytDoButtonRelated::ACT_IE_NONE; field_0x54D8 = 15; field_0x5505 = 0; field_0x54EC = 1; @@ -901,7 +901,7 @@ bool dLytMeterDowsing_c::remove() { bool dLytMeterDowsing_c::execute() { if (dLytControlGame_c::getInstance()->isStateNormal()) { if (StoryflagManager::sInstance->getCounterOrFlag(566) && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) != LytDoButtonRelated::DO_NONE) { + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) != LytDoButtonRelated::ACT_IE_NONE) { if (dLytMeter_c::GetMain()->fn_800D5380(0)) { field_0x5508 = 0; StoryflagManager::sInstance->unsetFlag(566); @@ -971,7 +971,7 @@ bool dLytMeterDowsing_c::execute() { bool state = false; s32 action = dLytDobutton_c::getFn0x8010E5E0(); if (action == 8 || action == 10 || action == 30) { - LytDoButtonRelated::Action_e action = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getFn0x8010E5D0()); + LytDoButtonRelated::Act_IE_e action = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getAction()); if (action >= 0) { state = true; LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_C, action); @@ -1230,11 +1230,11 @@ void dLytMeterDowsing_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } @@ -1269,7 +1269,7 @@ s32 dLytMeterDowsing_c::fn_800FE9C0(s32 unkId) const { bool dLytMeterDowsing_c::shouldCall() const { if (dLytControlGame_c::getInstance()->isStateNormal() && ((StoryflagManager::sInstance->getCounterOrFlag(566) && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) != LytDoButtonRelated::DO_NONE) || + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) != LytDoButtonRelated::ACT_IE_NONE) || (StoryflagManager::sInstance->getCounterOrFlag(818) && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_C) == 0x52))) { return true; diff --git a/src/d/lyt/meter/d_lyt_meter_item_select.cpp b/src/d/lyt/meter/d_lyt_meter_item_select.cpp index 7055a566..38abda5b 100644 --- a/src/d/lyt/meter/d_lyt_meter_item_select.cpp +++ b/src/d/lyt/meter/d_lyt_meter_item_select.cpp @@ -666,7 +666,7 @@ void dLytMeterItemSelect_c::initializeState_Wait() { } void dLytMeterItemSelect_c::executeState_Wait() { if (field_0x57B3 == 1 && (field_0x5794 == I_INVALID || LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == - LytDoButtonRelated::DO_STOP)) { + LytDoButtonRelated::ACT_IE_ETC_STOP)) { mStateMgr.changeState(StateID_SetNone); } else if (field_0x57B3 == 0 && field_0x5794 == I_INVALID && (field_0x579A == I_SAILCLOTH || field_0x579A == I_BOAT_CANNON || field_0x579A == I_HARP)) { @@ -687,10 +687,10 @@ void dLytMeterItemSelect_c::executeState_Wait() { } else if (!dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_B)) { mStateMgr.changeState(StateID_ToUnuse); } else if (!dLytMeter_c::GetMain()->fn_800D5650() && !dLytMeter_c::GetMain()->fn_800D5680() && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::DO_ITEMS && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::DO_RETURN && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::DO_DONE && - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::DO_STOP && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::ACT_IE_ETC_ITEMS && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::ACT_IE_ETC_RETURN && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::ACT_IE_ETC_DONE && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) != LytDoButtonRelated::ACT_IE_ETC_STOP && (field_0x5794 != I_BOAT_CANNON && field_0x5794 != I_HARP && field_0x5794 != I_INVALID && field_0x5794 != I_SAILCLOTH)) { mStateMgr.changeState(StateID_ResetIn); @@ -1122,10 +1122,10 @@ void dLytMeterItemSelect_c::executeState_Reset() { fn_800F0310(); } else if (field_0x5794 == I_SAILCLOTH || field_0x5794 == I_BOAT_CANNON || field_0x5794 == I_HARP) { mStateMgr.changeState(StateID_SetSpecialItemIn); - } else if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_ITEMS || - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_RETURN || - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_DONE || - LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_STOP || + } else if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_ETC_ITEMS || + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_ETC_RETURN || + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_ETC_DONE || + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_ETC_STOP || field_0x5794 == I_INVALID || !dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_B) || field_0x5754 == 1) { mStateMgr.changeState(StateID_ResetOut); @@ -1789,10 +1789,10 @@ bool dLytMeterItemSelect_c::build(d2d::ResAccIf_c *resAcc) { field_0x57BB = 0; field_0x57BC = 0; field_0x5774 = 0; - mLastDoButtonRelatedAction = LytDoButtonRelated::DO_NONE; + mLastDoButtonRelatedAction = LytDoButtonRelated::ACT_IE_NONE; field_0x5770 = 5; - setBtnText(LytDoButtonRelated::DO_NONE); + setBtnText(LytDoButtonRelated::ACT_IE_NONE); mStateMgr.changeState(StateID_InitWait); @@ -2203,12 +2203,12 @@ bool dLytMeterItemSelect_c::execute() { } if (field_0x5794 == I_SAILCLOTH) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_SAILCLOTH); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_ETC_SAILCLOTH); } else if (field_0x5794 == I_BOAT_CANNON) { if (field_0x57B3 != 0) { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_STOW_CANNON); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_ETC_STOW_CANNON); } else { - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_READY_CANNON); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_ETC_READY_CANNON); } } @@ -2220,8 +2220,8 @@ bool dLytMeterItemSelect_c::execute() { setBtnText(mLastDoButtonRelatedAction); } } else { - if (mLastDoButtonRelatedAction != LytDoButtonRelated::DO_NONE) { - mLastDoButtonRelatedAction = LytDoButtonRelated::DO_NONE; + if (mLastDoButtonRelatedAction != LytDoButtonRelated::ACT_IE_NONE) { + mLastDoButtonRelatedAction = LytDoButtonRelated::ACT_IE_NONE; setBtnText(mLastDoButtonRelatedAction); } @@ -2230,7 +2230,7 @@ bool dLytMeterItemSelect_c::execute() { } } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_NONE); } field_0x57C1 = isWheelBlockedByCurrentAction(); @@ -2580,26 +2580,26 @@ void dLytMeterItemSelect_c::fn_800F0310() { #include "d/lyt/meter/d_lyt_meter_action_table.inc" -void dLytMeterItemSelect_c::setBtnText(s32 unkId) { - SizedString<16> id; - if (unkId < LytDoButtonRelated::DO_NONE) { +void dLytMeterItemSelect_c::setBtnText(s32 id) { + SizedString<16> buf; + if (id < LytDoButtonRelated::ACT_IE_NONE) { mpTextBoxes[8]->SetVisible(true); mpTextBoxes[9]->SetVisible(true); mpWindows[0]->SetVisible(true); mpTextBoxes[4]->SetVisible(true); mpTextBoxes[5]->SetVisible(true); mpWindows[3]->SetVisible(true); - if (unkId < 0x5D) { - id.sprintf("ACT_INFO_%03d", sActIds[unkId]); + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { + buf.sprintf("ACT_INFO_%03d", sActIds[id]); } else { - unkId -= 0x5E; - id.sprintf("ACT_ETC_%03d", sActIds[unkId]); + s32 tempId = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; + buf.sprintf("ACT_ETC_%03d", sActIds[tempId]); } - mpTextBoxes[8]->setMessageWithGlobalTextProcessor2(id, nullptr); - mpTextBoxes[9]->setMessageWithGlobalTextProcessor2(id, nullptr); + mpTextBoxes[8]->setMessageWithGlobalTextProcessor2(buf, nullptr); + mpTextBoxes[9]->setMessageWithGlobalTextProcessor2(buf, nullptr); mpWindows[0]->UpdateSize(mpSizeBoxes[0], 32.0f); - mpTextBoxes[4]->setMessageWithGlobalTextProcessor2(id, nullptr); - mpTextBoxes[5]->setMessageWithGlobalTextProcessor2(id, nullptr); + mpTextBoxes[4]->setMessageWithGlobalTextProcessor2(buf, nullptr); + mpTextBoxes[5]->setMessageWithGlobalTextProcessor2(buf, nullptr); mpWindows[3]->UpdateSize(mpSizeBoxes[3], 32.0f); } else { const wchar_t *empty = L""; diff --git a/src/d/lyt/meter/d_lyt_meter_nun_stk.cpp b/src/d/lyt/meter/d_lyt_meter_nun_stk.cpp index 7b9468d2..a44d6584 100644 --- a/src/d/lyt/meter/d_lyt_meter_nun_stk.cpp +++ b/src/d/lyt/meter/d_lyt_meter_nun_stk.cpp @@ -27,7 +27,7 @@ void dLytMeterNunStk_c::executeState_Wait() { if (field_0x184) { if (field_0x178) { bool bDoUpdate = true; - if (field_0x174 != LytDoButtonRelated::DO_NONE) { + if (field_0x174 != LytDoButtonRelated::ACT_IE_NONE) { if (timer <= 0) { mAnm[NUN_STK_ANIM_INPUT].setBackwardsOnce(); mAnm[NUN_STK_ANIM_INPUT].setToStart(); @@ -43,7 +43,7 @@ void dLytMeterNunStk_c::executeState_Wait() { field_0x170 = field_0x174; } } else { - if (field_0x174 != LytDoButtonRelated::DO_NONE) { + if (field_0x174 != LytDoButtonRelated::ACT_IE_NONE) { setMessage(field_0x174); } field_0x170 = field_0x174; @@ -68,7 +68,7 @@ void dLytMeterNunStk_c::finalizeState_On() {} void dLytMeterNunStk_c::initializeState_Active() {} void dLytMeterNunStk_c::executeState_Active() { if (field_0x174 != field_0x170 || !field_0x178) { - if (field_0x174 == LytDoButtonRelated::DO_NONE || !field_0x178) { + if (field_0x174 == LytDoButtonRelated::ACT_IE_NONE || !field_0x178) { mAnm[NUN_STK_ANIM_INPUT].setForwardOnce(); mAnm[NUN_STK_ANIM_INPUT].setFrame(0.0f); mAnm[NUN_STK_ANIM_INPUT].setAnimEnable(true); @@ -80,7 +80,7 @@ void dLytMeterNunStk_c::executeState_Active() { setMessage(field_0x174); } field_0x170 = field_0x174; - } else if (field_0x170 == LytDoButtonRelated::DO_NONE) { + } else if (field_0x170 == LytDoButtonRelated::ACT_IE_NONE) { mAnm[NUN_STK_ANIM_INPUT].setForwardOnce(); mAnm[NUN_STK_ANIM_INPUT].setFrame(0.0f); mAnm[NUN_STK_ANIM_INPUT].setAnimEnable(true); @@ -127,9 +127,9 @@ bool dLytMeterNunStk_c::build(d2d::ResAccIf_c *resAcc) { mpSizeBox[i] = mLyt.getSizeBoxInWindow(sWindows[i]); } - mDisplayedAction = LytDoButtonRelated::DO_NONE; - field_0x170 = LytDoButtonRelated::DO_NONE; - field_0x174 = LytDoButtonRelated::DO_NONE; + mDisplayedAction = LytDoButtonRelated::ACT_IE_NONE; + field_0x170 = LytDoButtonRelated::ACT_IE_NONE; + field_0x174 = LytDoButtonRelated::ACT_IE_NONE; field_0x184 = true; field_0x178 = true; @@ -173,7 +173,7 @@ bool dLytMeterNunStk_c::execute() { mAnm[NUN_STK_ANIM_INPUT].setAnimEnable(false); mStateMgr.changeState(StateID_Wait); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_STK, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_STK, LytDoButtonRelated::ACT_IE_NONE); field_0x174 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_NUN_STK); setMessage(field_0x174); return true; @@ -202,11 +202,11 @@ void dLytMeterNunStk_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } diff --git a/src/d/lyt/meter/d_lyt_meter_nunchaku_bg.cpp b/src/d/lyt/meter/d_lyt_meter_nunchaku_bg.cpp index 582cba17..dc6275f7 100644 --- a/src/d/lyt/meter/d_lyt_meter_nunchaku_bg.cpp +++ b/src/d/lyt/meter/d_lyt_meter_nunchaku_bg.cpp @@ -30,7 +30,7 @@ void dLytMeterNunchakuBg_c::executeState_Wait() { if (field_0x1C4) { if (field_0x1B8) { bool bDoUpdate = true; - if (field_0x1B4 != LytDoButtonRelated::DO_NONE) { + if (field_0x1B4 != LytDoButtonRelated::ACT_IE_NONE) { if (timer <= 0) { mAnm[NUN_BG_ANIM_INPUT].setBackwardsOnce(); mAnm[NUN_BG_ANIM_INPUT].setToStart(); @@ -46,7 +46,7 @@ void dLytMeterNunchakuBg_c::executeState_Wait() { field_0x1B0 = field_0x1B4; } } else { - if (field_0x1B4 != LytDoButtonRelated::DO_NONE) { + if (field_0x1B4 != LytDoButtonRelated::ACT_IE_NONE) { setMessage(field_0x1B4); } field_0x1B0 = field_0x1B4; @@ -71,7 +71,7 @@ void dLytMeterNunchakuBg_c::finalizeState_On() {} void dLytMeterNunchakuBg_c::initializeState_Active() {} void dLytMeterNunchakuBg_c::executeState_Active() { if (field_0x1B4 != field_0x1B0 || !field_0x1B8) { - if (field_0x1B4 == LytDoButtonRelated::DO_NONE || !field_0x1B8) { + if (field_0x1B4 == LytDoButtonRelated::ACT_IE_NONE || !field_0x1B8) { mAnm[NUN_BG_ANIM_INPUT].setForwardOnce(); mAnm[NUN_BG_ANIM_INPUT].setFrame(0.0f); mAnm[NUN_BG_ANIM_INPUT].setAnimEnable(true); @@ -83,7 +83,7 @@ void dLytMeterNunchakuBg_c::executeState_Active() { setMessage(field_0x1B4); } field_0x1B0 = field_0x1B4; - } else if (field_0x1B0 == LytDoButtonRelated::DO_NONE) { + } else if (field_0x1B0 == LytDoButtonRelated::ACT_IE_NONE) { mAnm[NUN_BG_ANIM_INPUT].setForwardOnce(); mAnm[NUN_BG_ANIM_INPUT].setFrame(0.0f); mAnm[NUN_BG_ANIM_INPUT].setAnimEnable(true); @@ -180,7 +180,7 @@ bool dLytMeterNunchakuBg_c::execute() { mAnm[NUN_BG_ANIM_INPUT].setAnimEnable(false); mStateMgr.changeState(StateID_Wait); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::ACT_IE_NONE); field_0x1B4 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_NUN_STK); setMessage(field_0x1B4); return true; @@ -188,14 +188,14 @@ bool dLytMeterNunchakuBg_c::execute() { if (EventManager::isInEvent()) { field_0x1C4 = false; - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::ACT_IE_NONE); } else { field_0x1C4 = true; } s32 d = dLytDobutton_c::getFn0x8010E5E0(); if (d == 6 || d == 9) { - LytDoButtonRelated::Action_e a = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getFn0x8010E5D0()); + LytDoButtonRelated::Act_IE_e a = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getAction()); if (a >= 0) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, a); } @@ -245,11 +245,11 @@ void dLytMeterNunchakuBg_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } diff --git a/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp b/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp index 4c2cfb9e..ba9c4b7d 100644 --- a/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp @@ -121,10 +121,10 @@ bool dLytMeterPlusBtn_c::build(d2d::ResAccIf_c *resAcc) { mpWindow[i]->UpdateSize(mpSizeBox[i], 32.0f); } - field_0x1B0 = LytDoButtonRelated::DO_NONE; - field_0x1B4 = LytDoButtonRelated::DO_NONE; + field_0x1B0 = LytDoButtonRelated::ACT_IE_NONE; + field_0x1B4 = LytDoButtonRelated::ACT_IE_NONE; - setMessage(LytDoButtonRelated::DO_NONE); + setMessage(LytDoButtonRelated::ACT_IE_NONE); field_0x1C0 = 0; field_0x1C1 = StoryflagManager::sInstance->getCounterOrFlag(212); @@ -218,7 +218,7 @@ bool dLytMeterPlusBtn_c::execute() { mStateMgr.executeState(); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_PLUS, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_PLUS, LytDoButtonRelated::ACT_IE_NONE); if (mAnm[PLUS_BTN_ANIM_LOOP].isEnabled()) { mAnm[PLUS_BTN_ANIM_LOOP].play(); @@ -313,11 +313,11 @@ void dLytMeterPlusBtn_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } diff --git a/src/d/lyt/meter/d_lyt_meter_remocon_bg.cpp b/src/d/lyt/meter/d_lyt_meter_remocon_bg.cpp index 0986a7bc..b2818006 100644 --- a/src/d/lyt/meter/d_lyt_meter_remocon_bg.cpp +++ b/src/d/lyt/meter/d_lyt_meter_remocon_bg.cpp @@ -50,13 +50,13 @@ bool dLytMeterRemoconBg_c::remove() { bool dLytMeterRemoconBg_c::execute() { if (EventManager::isInEvent() || dLytMeter_c::getItemSelect0x75A2() != 0) { field_0xEC = 0; - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_REMOCON_BG, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_REMOCON_BG, LytDoButtonRelated::ACT_IE_NONE); } else { field_0xEC = 1; } s32 d = dLytDobutton_c::getFn0x8010E5E0(); if (d == 1 || d == 2 || d == 3 || d == 4 || d == 12 || d == 13 || d == 14 || d == 6) { - LytDoButtonRelated::Action_e a = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getFn0x8010E5D0()); + LytDoButtonRelated::Act_IE_e a = LytDoButtonRelated::convertDoButton(dLytDobutton_c::getAction()); if (a >= 0) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_REMOCON_BG, a); } @@ -65,6 +65,6 @@ bool dLytMeterRemoconBg_c::execute() { field_0xE0 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_REMOCON_BG); field_0xE4 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_REMOCON_BG); mStateMgr.executeState(); - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_REMOCON_BG, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_REMOCON_BG, LytDoButtonRelated::ACT_IE_NONE); return true; } diff --git a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp index 31dca491..3058e83f 100644 --- a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp @@ -35,7 +35,7 @@ void dLytMeterZBtn_c::executeState_Wait() { if (field_0x1C4) { if (field_0x1B8) { bool bDoUpdate = true; - if (field_0x1B4 != LytDoButtonRelated::DO_NONE) { + if (field_0x1B4 != LytDoButtonRelated::ACT_IE_NONE) { if (timer <= 0) { mAnm[Z_BTN_ANIM_INPUT].setBackwardsOnce(); mAnm[Z_BTN_ANIM_INPUT].setToStart(); @@ -51,7 +51,7 @@ void dLytMeterZBtn_c::executeState_Wait() { field_0x1B0 = field_0x1B4; } } else { - if (field_0x1B4 != LytDoButtonRelated::DO_NONE) { + if (field_0x1B4 != LytDoButtonRelated::ACT_IE_NONE) { setMessage(field_0x1B4); } field_0x1B0 = field_0x1B4; @@ -76,7 +76,7 @@ void dLytMeterZBtn_c::finalizeState_On() {} void dLytMeterZBtn_c::initializeState_Active() {} void dLytMeterZBtn_c::executeState_Active() { if (field_0x1B4 != field_0x1B0 || !field_0x1B8) { - if (field_0x1B4 == LytDoButtonRelated::DO_NONE || !field_0x1B8) { + if (field_0x1B4 == LytDoButtonRelated::ACT_IE_NONE || !field_0x1B8) { mAnm[Z_BTN_ANIM_INPUT].setForwardOnce(); mAnm[Z_BTN_ANIM_INPUT].setFrame(0.0f); mAnm[Z_BTN_ANIM_INPUT].setAnimEnable(true); @@ -88,7 +88,7 @@ void dLytMeterZBtn_c::executeState_Active() { setMessage(field_0x1B4); } field_0x1B0 = field_0x1B4; - } else if (field_0x1B0 == LytDoButtonRelated::DO_NONE) { + } else if (field_0x1B0 == LytDoButtonRelated::ACT_IE_NONE) { mAnm[Z_BTN_ANIM_INPUT].setForwardOnce(); mAnm[Z_BTN_ANIM_INPUT].setFrame(0.0f); mAnm[Z_BTN_ANIM_INPUT].setAnimEnable(true); @@ -182,14 +182,14 @@ bool dLytMeterZBtn_c::execute() { mAnm[Z_BTN_ANIM_INPUT].setAnimEnable(true); mStateMgr.changeState(StateID_Off); } - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE); return true; } field_0x1C4 = true; if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || AttentionManager::GetInstance()->checkLink2()) && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z) == 0x67) { field_0x1C4 = false; - LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::ACT_IE_NONE); } field_0x1B4 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z); field_0x1B8 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_Z) && @@ -249,11 +249,11 @@ void dLytMeterZBtn_c::setMessage(s32 id) { buf[i] = 0; } - if (id < LytDoButtonRelated::DO_NONE) { - if (id < 0x5D) { + if (id < LytDoButtonRelated::ACT_IE_NONE) { + if (id < LytDoButtonRelated::ACT_IE_SEPARATOR) { sprintf(buf, "ACT_INFO_%03d", sActIds[id]); } else { - s32 id2 = id - 0x5E; + s32 id2 = id - LytDoButtonRelated::ACT_IE_SEPARATOR - 1; sprintf(buf, "ACT_ETC_%03d", sActIds[id2]); } diff --git a/src/m/m2d.cpp b/src/m/m2d.cpp index ed5a306f..5de7dd37 100644 --- a/src/m/m2d.cpp +++ b/src/m/m2d.cpp @@ -46,7 +46,7 @@ void defaultSet() { void draw(u8 priority) { for (Base_c *base = static_cast(nw4r::ut::List_GetFirst(&l_list)); base != nullptr; base = static_cast(nw4r::ut::List_GetNext(&l_list, base))) { - if (base->mPriority >= priority) { + if (base->getPriority() >= priority) { break; } base->draw(); @@ -56,7 +56,7 @@ void draw(u8 priority) { void drawBefore(u8 priority) { for (Base_c *base = static_cast(nw4r::ut::List_GetFirst(&l_list)); base != nullptr; base = static_cast(nw4r::ut::List_GetNext(&l_list, base))) { - if (base->mPriority > priority) { + if (base->getPriority() > priority) { base->draw(); } } From df17fa201a9ff8fcc46c3de9fc5fccfef3975f97 Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 16 May 2025 01:21:45 +0200 Subject: [PATCH 2/4] dLytDoButton_c OK --- config/SOUE01/splits.txt | 1 + config/SOUE01/symbols.txt | 4 +- configure.py | 2 +- include/d/a/d_a_player.h | 2 + include/d/lyt/d2d.h | 4 + include/d/lyt/d_lyt_do_button.h | 69 +++- include/d/lyt/d_lyt_unknowns.h | 1 + include/m/m2d.h | 4 + src/d/lyt/d_lyt_do_button.cpp | 428 ++++++++++++++++++-- src/d/lyt/meter/d_lyt_meter.cpp | 16 +- src/d/lyt/meter/d_lyt_meter_item_select.cpp | 11 +- 11 files changed, 497 insertions(+), 45 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 92b31f9d..960e6c5c 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -693,6 +693,7 @@ d/lyt/d_lyt_do_button.cpp: .data start:0x8051A5A8 end:0x8051AC00 .sdata start:0x80572520 end:0x80572530 .sbss start:0x80575468 end:0x80575470 + .sdata2 start:0x80579D70 end:0x80579D98 .bss start:0x805ACE10 end:0x805ACF78 d/lyt/d_lyt_do_button_related.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 130810cc..4caef926 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2656,7 +2656,7 @@ fn_8005E090 = .text:0x8005E090; // type:function size:0x64 ActorLink__initSwordModels = .text:0x8005E100; // type:function size:0x1F0 ActorLink__updateSword = .text:0x8005E2F0; // type:function size:0xA8 getCurrentShieldPouchSlot = .text:0x8005E3A0; // type:function size:0x50 -checkBambooCuttingMinigameState = .text:0x8005E3F0; // type:function size:0x8 +isInBambooCuttingMinigame__7dAcPy_cFv = .text:0x8005E3F0; // type:function size:0x8 getCurrentlyEquippedShieldId = .text:0x8005E400; // type:function size:0x4C getShieldSubtype = .text:0x8005E450; // type:function size:0x3C ActorLink__initShieldModels = .text:0x8005E490; // type:function size:0x2C0 @@ -6531,7 +6531,7 @@ remove__14dLytDobutton_cFv = .text:0x8010D670; // type:function size:0x50 execute__14dLytDobutton_cFv = .text:0x8010D6C0; // type:function size:0x80C draw__14dLytDobutton_cFv = .text:0x8010DED0; // type:function size:0x28 realize__14dLytDobutton_cFv = .text:0x8010DF00; // type:function size:0x4CC -fn_8010E3D0 = .text:0x8010E3D0; // type:function size:0x1F0 +fn_8010E3D0__14dLytDobutton_cFb = .text:0x8010E3D0; // type:function size:0x1F0 setActionTextStuffInternal__14dLytDobutton_cFllb = .text:0x8010E5C0; // type:function size:0x10 getActionInternal__14dLytDobutton_cCFv = .text:0x8010E5D0; // type:function size:0x8 fn_8010E5E0__14dLytDobutton_cCFv = .text:0x8010E5E0; // type:function size:0x1C diff --git a/configure.py b/configure.py index a52f71aa..0fe1b801 100644 --- a/configure.py +++ b/configure.py @@ -490,7 +490,7 @@ config.libs = [ Object(Matching, "d/lyt/meter/d_lyt_meter_timer.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_heart.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_shield_gauge.cpp"), - Object(NonMatching, "d/lyt/d_lyt_do_button.cpp"), + Object(Matching, "d/lyt/d_lyt_do_button.cpp"), Object(NonMatching, "d/lyt/d_lyt_do_button_related.cpp"), Object(Matching, "d/lyt/d_lyt_common_a_btn.cpp"), Object(Matching, "d/lyt/d_lyt_common_icon_material.cpp"), diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index ed043bff..522b09fd 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -340,6 +340,8 @@ public: static s32 getCurrentBugNetType(); static s32 getCurrentlyEquippedShieldType(); + static bool isInBambooCuttingMinigame(); + static bool isItemRestrictedByBokoBase(ITEM_ID item); static u32 getCurrentHealthCapacity(); diff --git a/include/d/lyt/d2d.h b/include/d/lyt/d2d.h index c4e3e533..fc19bfb9 100644 --- a/include/d/lyt/d2d.h +++ b/include/d/lyt/d2d.h @@ -230,6 +230,10 @@ struct AnmGroupBase_c { mpFrameCtrl->setRate(rate); } + inline f32 getRate() const { + return mpFrameCtrl->getRate(); + } + inline bool isEnabled() const { return (mFlags & ANMGROUP_FLAG_ENABLE) != 0; } diff --git a/include/d/lyt/d_lyt_do_button.h b/include/d/lyt/d_lyt_do_button.h index efe6d25e..5893f817 100644 --- a/include/d/lyt/d_lyt_do_button.h +++ b/include/d/lyt/d_lyt_do_button.h @@ -9,6 +9,58 @@ class dLytDobutton_c { public: + // TODO: figure out that these mean. The two pane arrays in d_lyt_do_button.cpp might help + enum Icon_e { + ICON_0 = 0, + ICON_1 = 1, + ICON_2 = 2, + ICON_3 = 3, + ICON_4 = 4, + ICON_5 = 5, + ICON_6 = 6, + ICON_7 = 7, + ICON_8 = 8, + ICON_9 = 9, + ICON_10 = 10, + ICON_11 = 11, + ICON_12 = 12, + ICON_13 = 13, + ICON_14 = 14, + ICON_15 = 15, + ICON_16 = 16, + ICON_17 = 17, + ICON_18 = 18, + ICON_19 = 19, + ICON_20 = 20, + ICON_21 = 21, + ICON_22 = 22, + ICON_23 = 23, + ICON_24 = 24, + ICON_25 = 25, + ICON_26 = 26, + ICON_27 = 27, + ICON_28 = 28, + ICON_29 = 29, + ICON_30 = 30, + ICON_31 = 31, + ICON_32 = 32, + ICON_33 = 33, + ICON_34 = 34, + ICON_35 = 35, + ICON_36 = 36, + ICON_37 = 37, + ICON_38 = 38, + ICON_39 = 39, + ICON_40 = 40, + + ICON_NONE = 41, + }; + + // 001-Action.msbt - Enum for ACT_DO + // This is actually just the first part of ACT_INFO, but + // LytDoButtonRelated has a full conversion table + // from Act_IE_e -> Act_Do_e + enum Act_Do_e { ACT_DO_CLIMB_UP = 0, ACT_DO_JUMP = 1, @@ -104,6 +156,7 @@ public: ACT_DO_LEAN = 91, ACT_DO_PRESS = 92, + // why two of them? ACT_DO_NONE = 93, ACT_DO_INVALID = 94, }; @@ -136,7 +189,7 @@ public: if (sInstance != nullptr) { return sInstance->field_0x480; } else { - return 0x29; + return ICON_NONE; } } @@ -144,7 +197,8 @@ public: if (sInstance != nullptr) { return sInstance->mNextDoActionToShow; } else { - return 0x29; + // @bug (?) should this be ACT_DO_INVALID? + return ICON_NONE; } } @@ -152,7 +206,7 @@ public: if (sInstance != nullptr) { return sInstance->fn_8010E5E0(); } else { - return 0x29; + return ICON_NONE; } } @@ -177,6 +231,11 @@ private: void fn_8010E3D0(bool); void realize(); + void set_0x47C_0x480(s32 v1, s32 v2) { + field_0x47C = v1; + field_0x480 = v2; + } + static dLytDobutton_c *sInstance; STATE_FUNC_DECLARE(dLytDobutton_c, InvisibleWait); @@ -187,7 +246,7 @@ private: STATE_MGR_DEFINE_UTIL_CHANGESTATE(dLytDobutton_c); - UI_STATE_MGR_DECLARE(dLytDobutton_c); + /* 0x000 */ UI_STATE_MGR_DECLARE(dLytDobutton_c); /* 0x040 */ d2d::dLytSub mLyt; /* 0x0D4 */ d2d::AnmGroup_c mAnmGroups[12]; /* 0x3D4 */ nw4r::lyt::Pane *mpPanes[37]; @@ -202,7 +261,7 @@ private: /* 0x48C */ s32 field_0x48C; /* 0x490 */ u8 field_0x490; /* 0x491 */ u8 field_0x491; - /* 0x492 */ u8 field_0x492; + /* 0x492 */ bool mSavedIsInEvent; }; #endif diff --git a/include/d/lyt/d_lyt_unknowns.h b/include/d/lyt/d_lyt_unknowns.h index 36022564..0d885967 100644 --- a/include/d/lyt/d_lyt_unknowns.h +++ b/include/d/lyt/d_lyt_unknowns.h @@ -17,6 +17,7 @@ public: return sInstance; } + // 001-Action.msbt - Unified enum for ACT_INFO and ACT_ETC enum Act_IE_e { ACT_IE_INFO_CLIMB_UP = 0, ACT_IE_INFO_JUMP = 1, diff --git a/include/m/m2d.h b/include/m/m2d.h index c39ceec4..aad5f08d 100644 --- a/include/m/m2d.h +++ b/include/m/m2d.h @@ -61,6 +61,10 @@ public: return mCurrFrame; } + inline f32 getRate() const { + return mRate; + } + inline void setCurrFrame(f32 arg) { mCurrFrame = arg; } diff --git a/src/d/lyt/d_lyt_do_button.cpp b/src/d/lyt/d_lyt_do_button.cpp index c71d47d6..26122bb4 100644 --- a/src/d/lyt/d_lyt_do_button.cpp +++ b/src/d/lyt/d_lyt_do_button.cpp @@ -1,7 +1,13 @@ #include "d/lyt/d_lyt_do_button.h" #include "common.h" +#include "d/a/d_a_player.h" +#include "d/lyt/meter/d_lyt_meter.h" +#include "nw4r/lyt/lyt_pane.h" +#include "nw4r/lyt/lyt_types.h" +#include "nw4r/math/math_types.h" #include "sized_string.h" +#include "toBeSorted/event_manager.h" #include "toBeSorted/small_sound_mgr.h" struct DoButtonClass { @@ -36,6 +42,8 @@ DoButtonClass::DoButtonClass() { } DoButtonClass::~DoButtonClass() {} +dLytDobutton_c *dLytDobutton_c::sInstance; + STATE_DEFINE(dLytDobutton_c, InvisibleWait); STATE_DEFINE(dLytDobutton_c, InvisibleTimeCnt); STATE_DEFINE(dLytDobutton_c, In); @@ -43,7 +51,7 @@ STATE_DEFINE(dLytDobutton_c, Wait); STATE_DEFINE(dLytDobutton_c, Out); #define DO_BUTTON_ANIM_IN 0 -#define DO_BUTTON_ANIM 1 +#define DO_BUTTON_ANIM_BASIC_INFO 1 #define DO_BUTTON_ANIM_LOOP_BTN 2 #define DO_BUTTON_ANIM_LOOP_BTN_Z 3 #define DO_BUTTON_ANIM_LOOP_NUN 4 @@ -55,7 +63,7 @@ STATE_DEFINE(dLytDobutton_c, Out); #define DO_BUTTON_ANIM_MOVE_OUT 10 #define DO_BUTTON_ANIM_LOOP_BG 11 -#define DO_BUTTON_NUM_ANIM 12 +#define DO_BUTTON_NUM_ANIMS 12 static const d2d::LytBrlanMapping brlanMap[] = { { "basicInfo_00_in.brlan", "G_inOut_00"}, @@ -81,6 +89,45 @@ static const char *sPaneNames[] = { "N_upSwing_01", "N_aBtnDown_02", }; +#define DO_BUTTON_PANE_INFOALL_00 0 +#define DO_BUTTON_PANE_INFOALL_01 1 +#define DO_BUTTON_PANE_BG_00 2 +#define DO_BUTTON_PANE_W_BGP_00 3 +#define DO_BUTTON_PANE_W_BGP_01 4 +#define DO_BUTTON_PANE_INFOTEXT_00 5 +#define DO_BUTTON_PANE_A_BTN_00 6 +#define DO_BUTTON_PANE_A_BTN_01 7 +#define DO_BUTTON_PANE_B_BTN_00 8 +#define DO_BUTTON_PANE_C_BTN_00 9 +#define DO_BUTTON_PANE_C_BTN_01 10 +#define DO_BUTTON_PANE_NUNCHAKU_01 11 +#define DO_BUTTON_PANE_NUNCHAKU_02 12 +#define DO_BUTTON_PANE_NUNCHAKU_03 13 +#define DO_BUTTON_PANE_UP_SWING_00 14 +#define DO_BUTTON_PANE_DOWN_SWING_00 15 +#define DO_BUTTON_PANE_SWING_00 16 +#define DO_BUTTON_PANE_ROTATE_00 17 +#define DO_BUTTON_PANE_NUN_RIMO_00 18 +#define DO_BUTTON_PANE_NUN_DRAG_00 19 +#define DO_BUTTON_PANE_A_BTN_DOWN_00 20 +#define DO_BUTTON_PANE_A_BTN_DOWN_01 21 +#define DO_BUTTON_PANE_DRAW_00 22 +#define DO_BUTTON_PANE_PLAY_00 23 +#define DO_BUTTON_PANE_SWING_01 24 +#define DO_BUTTON_PANE_SWING_03 25 +#define DO_BUTTON_PANE_UPSET_00 26 +#define DO_BUTTON_PANE_STAB_00 27 +#define DO_BUTTON_PANE_PULL_OUT_01 28 +#define DO_BUTTON_PANE_B_BTN_01 29 +#define DO_BUTTON_PANE_TWIST_00 30 +#define DO_BUTTON_PANE_ZBTN_00 31 +#define DO_BUTTON_PANE_ZBTN_01 32 +#define DO_BUTTON_PANE_CROSS_BTN_00 33 +#define DO_BUTTON_PANE_PLUS_ALL_00 34 +#define DO_BUTTON_PANE_UP_SWING_01 35 +#define DO_BUTTON_PANE_A_BTN_DOWN_02 36 + +#define DO_BUTTON_PANE_NONE 37 #define DO_BUTTON_NUM_PANES 37 static const char *sTextBoxNames[] = { @@ -99,11 +146,11 @@ void dLytDobutton_c::executeState_InvisibleWait() { field_0x478 = field_0x474; field_0x474 = field_0x488; mDoActionToShow = mNextDoActionToShow; - if (field_0x488 == 0x29) { + if (field_0x488 == ICON_NONE) { return; } - if (mNextDoActionToShow == 0x5E) { + if (mNextDoActionToShow == ACT_DO_INVALID) { return; } mStateMgr.changeState(StateID_InvisibleTimeCnt); @@ -114,14 +161,12 @@ void dLytDobutton_c::initializeState_InvisibleTimeCnt() { field_0x48C = 0; } -extern "C" void fn_8010DF00(dLytDobutton_c *); - void dLytDobutton_c::executeState_InvisibleTimeCnt() { if (field_0x488 != field_0x474 || mNextDoActionToShow != mDoActionToShow) { field_0x478 = field_0x474; field_0x474 = field_0x488; mDoActionToShow = mNextDoActionToShow; - if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) { + if (field_0x488 == ICON_NONE || mNextDoActionToShow == ACT_DO_INVALID) { mStateMgr.changeState(StateID_InvisibleWait); } else { field_0x48C = 0; @@ -130,7 +175,7 @@ void dLytDobutton_c::executeState_InvisibleTimeCnt() { if (field_0x48C < sDoButtonClass.field_0x15) { field_0x48C++; } else { - fn_8010DF00(this); + realize(); mStateMgr.changeState(StateID_In); } } @@ -147,7 +192,7 @@ void dLytDobutton_c::initializeState_In() { mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f); } void dLytDobutton_c::executeState_In() { - if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) { + if (field_0x488 == ICON_NONE || mNextDoActionToShow == ACT_DO_INVALID) { mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f); mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(true); mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setToEnd(); @@ -168,11 +213,11 @@ void dLytDobutton_c::executeState_Wait() { field_0x478 = field_0x474; field_0x474 = field_0x488; mDoActionToShow = mNextDoActionToShow; - if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) { + if (field_0x488 == ICON_NONE || mNextDoActionToShow == ACT_DO_INVALID) { mStateMgr.changeState(StateID_Out); field_0x48C = 0; } else { - fn_8010DF00(this); + realize(); } } } @@ -191,7 +236,7 @@ void dLytDobutton_c::executeState_Out() { if (mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].isEndReached()) { mLyt.calc(); mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(false); - mStateMgr.changeState(StateID_InvisibleTimeCnt); + mStateMgr.changeState(StateID_InvisibleWait); } } void dLytDobutton_c::finalizeState_Out() {} @@ -201,7 +246,7 @@ bool dLytDobutton_c::build(m2d::ResAccIf_c *resAcc) { mLyt.build("basicInfo_00.brlyt", nullptr); mLyt.setPriority(0x8A); - for (int i = 0; i < DO_BUTTON_NUM_ANIM; i++) { + for (int i = 0; i < DO_BUTTON_NUM_ANIMS; i++) { mAnmGroups[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName); mAnmGroups[i].bind(false); mAnmGroups[i].setAnimEnable(false); @@ -215,16 +260,16 @@ bool dLytDobutton_c::build(m2d::ResAccIf_c *resAcc) { mpTextBoxes[i] = mLyt.getTextBox(sTextBoxNames[i]); } - mDoActionToShow = 0x5E; - field_0x474 = 0x29; - field_0x478 = 0x29; - mNextDoActionToShow = 0x5E; - field_0x488 = 0x29; + mDoActionToShow = ACT_DO_INVALID; + field_0x474 = ICON_NONE; + field_0x478 = ICON_NONE; + mNextDoActionToShow = ACT_DO_INVALID; + field_0x488 = ICON_NONE; field_0x490 = 0; - field_0x47C = 0x5E; - field_0x480 = 0x29; + field_0x47C = ACT_DO_INVALID; + field_0x480 = ICON_NONE; field_0x491 = 0; - field_0x492 = 0; + mSavedIsInEvent = false; mAnmGroups[DO_BUTTON_ANIM_LOOP_NUN].setAnimEnable(true); mAnmGroups[DO_BUTTON_ANIM_LOOP_BG].setAnimEnable(true); @@ -240,12 +285,189 @@ bool dLytDobutton_c::build(m2d::ResAccIf_c *resAcc) { } bool dLytDobutton_c::remove() { - for (int i = 0; i < DO_BUTTON_NUM_ANIM; i++) { + for (int i = 0; i < DO_BUTTON_NUM_ANIMS; i++) { mAnmGroups[i].remove(); } return true; } +bool dLytDobutton_c::execute() { + bool isInEvent = EventManager::isInEvent(); + bool b1 = true; + if (dAcPy_c::isInBambooCuttingMinigame()) { + setActionTextStuff(ICON_12, ACT_DO_70, false); + } + if (field_0x490 == 0) { + if (isInEvent != mSavedIsInEvent) { + if (isInEvent && field_0x488 == field_0x480 && mNextDoActionToShow == field_0x47C) { + setActionTextStuff(ICON_NONE, ACT_DO_INVALID, false); + b1 = false; + } + mSavedIsInEvent = isInEvent; + } else if (isInEvent && field_0x490 == 0 && field_0x488 == field_0x480 && mNextDoActionToShow == field_0x47C) { + setActionTextStuff(ICON_NONE, ACT_DO_INVALID, false); + b1 = false; + } + } + + if (b1) { + set_0x47C_0x480(mNextDoActionToShow, field_0x488); + } + + if ((isInEvent && !field_0x490) || dLytMeter_c::getItemSelect0x75A2() != 0 || + dLytMeter_c::getMinusBtnFn800F7600()) { + setActionTextStuffInternal(41, ACT_DO_INVALID, false); + } + + for (int i = 0; i < DO_BUTTON_NUM_ANIMS; i++) { + if (i != DO_BUTTON_ANIM_BASIC_INFO && i != DO_BUTTON_ANIM_LOOP_MOVE_INFO && i != DO_BUTTON_ANIM_MOVE_ALPHA) { + if (mAnmGroups[i].isEnabled()) { + mAnmGroups[i].play(); + } + } + } + + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].isEnabled() || mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].isEnabled()) { + bool b2 = false; + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].isStop2()) { + if (((field_0x478 == 26 && field_0x474 == 11) || (field_0x478 == 27 && field_0x474 == 11) || + (field_0x478 == 28 && field_0x474 == 11) || (field_0x478 == 29 && field_0x474 == 11) || + (field_0x478 == 30 && field_0x474 == 8) || (field_0x478 == 31 && field_0x474 == 11) || + (field_0x478 == 32 && field_0x474 == 36) || (field_0x478 == 33 && field_0x474 == 11) || + (field_0x478 == 34 && field_0x474 == 11) || (field_0x478 == 35 && field_0x474 == 11)) && + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].getFrame() == 0.0f) { + mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].setFrame(field_0x474); + } + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].setAnimEnable(false); + } else { + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].play(); + b2 = true; + } + if (mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].isStop2()) { + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setAnimEnable(false); + } else { + mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].play(); + b2 = true; + } + + if (b2) { + mLyt.calc(); + } + fn_8010E3D0(mDoActionToShow != ACT_DO_NONE); + } + + mStateMgr.executeState(); + + if (((field_0x474 == 1 && mDoActionToShow == ACT_DO_27) || + (field_0x474 == 1 && mDoActionToShow == ACT_DO_BREAK_FREE)) && + field_0x491) { + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setRate(3.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setAnimEnable(true); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setAnimEnable(false); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setAnimEnable(false); + } + } else if ((field_0x474 == 6 && field_0x491) || (field_0x478 == 6 && *mStateMgr.getStateID() == StateID_Out)) { + // Same code as above, copypasted + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setRate(3.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setAnimEnable(true); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setAnimEnable(false); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setAnimEnable(false); + } + } else { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_RECOVER].setAnimEnable(false); + } + + if (field_0x474 == 4 || field_0x474 == 28 || field_0x474 == 29) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setAnimEnable(false); + } + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setAnimEnable(true); + } + } else if (field_0x474 == 12 && mDoActionToShow == ACT_DO_70) { + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setAnimEnable(true); + } + + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].getRate() != 2.0f) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setRate(2.0f); + } + + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setAnimEnable(false); + } + } else { + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setFrame(0.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setAnimEnable(true); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].getRate() != 1.0f) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_REMO_CON].setRate(1.0f); + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setRate(1.0f); + mAnmGroups[DO_BUTTON_ANIM_LOOP_ROTATE].setAnimEnable(false); + } + } + } + + mLyt.calc(); + + if (field_0x474 >= 26 && field_0x474 < 36) { + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].isEnabled()) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].isEnabled()) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].getFrame() == 0.0f) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].setAnimEnable(false); + } + } + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].isEnabled()) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].getFrame() == 0.0f) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].setAnimEnable(false); + } + } + } + } else { + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN].setAnimEnable(true); + } + + if (!mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_LOOP_BTN_Z].setAnimEnable(true); + } + } + + if (mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].isEnabled()) { + mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].setAnimEnable(false); + } + + setActionTextStuffInternal(41, ACT_DO_INVALID, false); + return true; +} + bool dLytDobutton_c::draw() { mLyt.addToDrawList(); return true; @@ -345,6 +567,7 @@ static const s32 sActDoIds[] = { 91, // ACT_DO_CHARGE 92, // ACT_DO_LEAN 93, // ACT_DO_PRESS + -1, }; void dLytDobutton_c::realize() { @@ -399,8 +622,8 @@ void dLytDobutton_c::realize() { mAnmGroups[DO_BUTTON_ANIM_MOVE_ALPHA].setToEnd2(); } - mAnmGroups[DO_BUTTON_ANIM].setAnimEnable(true); - mAnmGroups[DO_BUTTON_ANIM].setFrame(i2); + mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].setAnimEnable(true); + mAnmGroups[DO_BUTTON_ANIM_BASIC_INFO].setFrame(i2); if (mDoActionToShow != ACT_DO_NONE) { SizedString<16> buf; buf.sprintf("ACT_DO_%03d", sActDoIds[mDoActionToShow]); @@ -420,6 +643,163 @@ void dLytDobutton_c::realize() { } } +static const s32 sPaneIdxes1[] = { + DO_BUTTON_PANE_A_BTN_00, // ICON_0 + DO_BUTTON_PANE_SWING_00, // ICON_1 + DO_BUTTON_PANE_UP_SWING_00, // ICON_2 + DO_BUTTON_PANE_DOWN_SWING_00, // ICON_3 + DO_BUTTON_PANE_ROTATE_00, // ICON_4 + DO_BUTTON_PANE_NONE, // ICON_5 + DO_BUTTON_PANE_NUN_RIMO_00, // ICON_6 + DO_BUTTON_PANE_A_BTN_00, // ICON_7 + DO_BUTTON_PANE_C_BTN_00, // ICON_8 + DO_BUTTON_PANE_NUN_DRAG_00, // ICON_9 + DO_BUTTON_PANE_C_BTN_01, // ICON_10 + DO_BUTTON_PANE_A_BTN_DOWN_00, // ICON_11 + DO_BUTTON_PANE_SWING_01, // ICON_12 + DO_BUTTON_PANE_DRAW_00, // ICON_13 + DO_BUTTON_PANE_PLAY_00, // ICON_14 + DO_BUTTON_PANE_NONE, // ICON_15 + DO_BUTTON_PANE_NUNCHAKU_01, // ICON_16 + DO_BUTTON_PANE_UPSET_00, // ICON_17 + DO_BUTTON_PANE_STAB_00, // ICON_18 + DO_BUTTON_PANE_NONE, // ICON_19 + DO_BUTTON_PANE_PULL_OUT_01, // ICON_20 + DO_BUTTON_PANE_A_BTN_01, // ICON_21 + DO_BUTTON_PANE_SWING_03, // ICON_22 + DO_BUTTON_PANE_B_BTN_00, // ICON_23 + DO_BUTTON_PANE_B_BTN_01, // ICON_24 + DO_BUTTON_PANE_TWIST_00, // ICON_25 + DO_BUTTON_PANE_A_BTN_DOWN_00, // ICON_26 + DO_BUTTON_PANE_A_BTN_DOWN_00, // ICON_27 + DO_BUTTON_PANE_A_BTN_DOWN_01, // ICON_28 + DO_BUTTON_PANE_A_BTN_DOWN_01, // ICON_29 + DO_BUTTON_PANE_C_BTN_00, // ICON_30 + DO_BUTTON_PANE_ZBTN_00, // ICON_31 + DO_BUTTON_PANE_ZBTN_01, // ICON_32 + DO_BUTTON_PANE_A_BTN_DOWN_01, // ICON_33 + DO_BUTTON_PANE_A_BTN_DOWN_00, // ICON_34 + DO_BUTTON_PANE_A_BTN_DOWN_00, // ICON_35 + DO_BUTTON_PANE_ZBTN_00, // ICON_36 + DO_BUTTON_PANE_CROSS_BTN_00, // ICON_37 + DO_BUTTON_PANE_UP_SWING_01, // ICON_38 + DO_BUTTON_PANE_A_BTN_DOWN_02, // ICON_39 + DO_BUTTON_PANE_A_BTN_DOWN_02, // ICON_40 + +}; + +static const s32 sPaneIdxes2[] = { + DO_BUTTON_PANE_NONE, // ICON_0 + DO_BUTTON_PANE_NONE, // ICON_1 + DO_BUTTON_PANE_NONE, // ICON_2 + DO_BUTTON_PANE_NONE, // ICON_3 + DO_BUTTON_PANE_NONE, // ICON_4 + DO_BUTTON_PANE_NONE, // ICON_5 + DO_BUTTON_PANE_NONE, // ICON_6 + DO_BUTTON_PANE_NONE, // ICON_7 + DO_BUTTON_PANE_NONE, // ICON_8 + DO_BUTTON_PANE_NONE, // ICON_9 + DO_BUTTON_PANE_NONE, // ICON_10 + DO_BUTTON_PANE_NONE, // ICON_11 + DO_BUTTON_PANE_NONE, // ICON_12 + DO_BUTTON_PANE_NONE, // ICON_13 + DO_BUTTON_PANE_NONE, // ICON_14 + DO_BUTTON_PANE_NONE, // ICON_15 + DO_BUTTON_PANE_NONE, // ICON_16 + DO_BUTTON_PANE_NONE, // ICON_17 + DO_BUTTON_PANE_NONE, // ICON_18 + DO_BUTTON_PANE_NONE, // ICON_19 + DO_BUTTON_PANE_NONE, // ICON_20 + DO_BUTTON_PANE_NONE, // ICON_21 + DO_BUTTON_PANE_NONE, // ICON_22 + DO_BUTTON_PANE_NONE, // ICON_23 + DO_BUTTON_PANE_NONE, // ICON_24 + DO_BUTTON_PANE_NONE, // ICON_25 + DO_BUTTON_PANE_NUNCHAKU_02, // ICON_26 + DO_BUTTON_PANE_NUNCHAKU_03, // ICON_27 + DO_BUTTON_PANE_ROTATE_00, // ICON_28 + DO_BUTTON_PANE_ROTATE_00, // ICON_29 + DO_BUTTON_PANE_NUN_DRAG_00, // ICON_30 + DO_BUTTON_PANE_A_BTN_00, // ICON_31 + DO_BUTTON_PANE_UP_SWING_00, // ICON_32 + DO_BUTTON_PANE_PLAY_00, // ICON_33 + DO_BUTTON_PANE_PULL_OUT_01, // ICON_34 + DO_BUTTON_PANE_STAB_00, // ICON_35 + DO_BUTTON_PANE_NONE, // ICON_36 + DO_BUTTON_PANE_NONE, // ICON_37 + DO_BUTTON_PANE_NONE, // ICON_38 + DO_BUTTON_PANE_STAB_00, // ICON_39 + DO_BUTTON_PANE_PULL_OUT_01, // ICON_40 + +}; + +void dLytDobutton_c::fn_8010E3D0(bool b) { + s32 i1 = field_0x474; + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].isEnabled()) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].isPlayingForwardsOnce()) { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].getFrame() < + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].getAnimDuration() * 0.5f) { + i1 = field_0x478; + } + } else { + if (mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].getFrame() > + mAnmGroups[DO_BUTTON_ANIM_LOOP_MOVE_INFO].getAnimDuration() * 0.5f) { + i1 = field_0x478; + } + } + } + + s32 idx1 = sPaneIdxes1[i1]; + f32 w1 = mpPanes[idx1]->GetSize().width; + f32 x1 = mpPanes[idx1]->GetTranslate().x; + f32 left = x1 - w1 / 2.0f; + f32 right = x1 + w1 / 2.0f; + f32 xBase = mpPanes[5]->GetTranslate().x; + + s32 idx2 = sPaneIdxes2[i1]; + if (idx2 != 37) { + f32 x2 = mpPanes[idx2]->GetTranslate().x; + f32 w2 = mpPanes[idx2]->GetSize().width; + f32 left2 = x2 - w2 / 2.0f; + f32 right2 = x2 + w2 / 2.0f; + if (left > left2) { + left = left2; + } + if (right < right2) { + right = right2; + } + w1 = right - left; + } + + nw4r::lyt::Size sz3 = mpPanes[3]->GetSize(); + nw4r::lyt::Size sz4 = mpPanes[4]->GetSize(); + if (b) { + f32 tmp = (xBase - left); + w1 = mpTextBoxes[0]->GetLineWidth(nullptr) + tmp; + } + f32 w = w1 + sDoButtonClass.field_0x10; + sz3.width = w; + sz4.width = w; + mpPanes[3]->SetSize(sz3); + mpPanes[4]->SetSize(sz4); + nw4r::math::VEC3 v = mpPanes[1]->GetTranslate(); + v.x = -left - w1 / 2.0f; + mpPanes[1]->SetTranslate(v); +} + +void dLytDobutton_c::setActionTextStuffInternal(s32 a1, s32 a2, bool b) { + field_0x488 = a1; + mNextDoActionToShow = a2; + field_0x490 = b; +} + s32 dLytDobutton_c::getActionInternal() const { return mDoActionToShow; } + +s32 dLytDobutton_c::fn_8010E5E0() const { + if (mDoActionToShow != ACT_DO_INVALID) { + return field_0x474; + } + return ICON_NONE; +} diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 0f466304..f6580305 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -1130,10 +1130,10 @@ void dLytMeterMain_c::checkPaneVisibility() { const char *name = EventManager::getCurrentEventName(); if (strequals(name, "SwordDraw") || strequals(name, "SwordDrawDoorNew")) { field_0x1377E = true; - if (dLytDobutton_c::getNextActionToShow() != 0x12) { - dLytDobutton_c::setActionTextStuff(0x29, 0x5E, true); + if (dLytDobutton_c::getNextActionToShow() != dLytDobutton_c::ACT_DO_DRAW) { + dLytDobutton_c::setActionTextStuff(dLytDobutton_c::ICON_NONE, dLytDobutton_c::ACT_DO_INVALID, true); } - if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_A) != 0x12) { + if (LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_A) != LytDoButtonRelated::ACT_IE_INFO_DRAW) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); } LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::ACT_IE_NONE); @@ -1164,9 +1164,9 @@ void dLytMeterMain_c::checkPaneVisibility() { LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && !MinigameManager::isInMinigameState(MinigameManager::HOUSE_CLEANING) && !mItemSelect.fn_800F02F0()) - || - (isSilentRealm() && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && - !mItemSelect.fn_800F02F0()) + || (isSilentRealm() && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::ACT_IE_NONE && + !mItemSelect.fn_800F02F0()) || ((dAcPy_c::GetLink()->checkActionFlagsCont(0x400000) || fn_800D5420() || dAcPy_c::GetLink()->checkActionFlags(dAcPy_c::FLG0_CRAWLING) || fn_800D5380(0) || @@ -1379,8 +1379,8 @@ void dLytMeterMain_c::checkPaneVisibility() { if (dAcPy_c::GetLink()->getRidingActorType() != dAcPy_c::RIDING_LOFTWING || !field_0x13780 || - (dLytDobutton_c::getAction() != dLytDobutton_c::ACT_DO_INVALID || fn_800D56B0() || dLytMeter_c::getField_0x13B66() || - fn_800D5420() || fn_800D5650() || fn_800D5680())) { + (dLytDobutton_c::getAction() != dLytDobutton_c::ACT_DO_INVALID || fn_800D56B0() || + dLytMeter_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { mBirdGaugeVisible = false; } diff --git a/src/d/lyt/meter/d_lyt_meter_item_select.cpp b/src/d/lyt/meter/d_lyt_meter_item_select.cpp index 38abda5b..4b97558e 100644 --- a/src/d/lyt/meter/d_lyt_meter_item_select.cpp +++ b/src/d/lyt/meter/d_lyt_meter_item_select.cpp @@ -1410,7 +1410,9 @@ void dLytMeterItemSelect_c::executeState_DemoMove() { nw4r::math::MTX34 mtx = mpPanes[i + ITEM_SELECT_PANE_ICON_OFFSET]->GetGlobalMtx(); mVec3_c pos(mtx._03, mtx._13, 0.0f); - dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_740_, pos, nullptr, nullptr, nullptr, nullptr); + dJEffManager_c::spawnUIEffect( + PARTICLE_RESOURCE_ID_MAPPING_740_, pos, nullptr, nullptr, nullptr, nullptr + ); if (mIsBocoburinLocked[i]) { mIsBocoburinLocked[i] = false; @@ -1983,7 +1985,7 @@ bool dLytMeterItemSelect_c::execute() { } } - if (dLytDobutton_c::getField0x47C() == 0x28) { + if (dLytDobutton_c::getField0x47C() == dLytDobutton_c::ACT_DO_SAILCLOTH) { if (field_0x5774 == 0) { SmallSoundManager::GetInstance()->playSound(SE_S_PARACHUTE_CALL); } @@ -2069,7 +2071,7 @@ bool dLytMeterItemSelect_c::execute() { mStateMgr.executeState(); fn_800EF8C0(false); - if (dLytDobutton_c::getField0x47C() == 0x28) { + if (dLytDobutton_c::getField0x47C() == dLytDobutton_c::ACT_DO_SAILCLOTH) { if (field_0x57C3 != 0) { field_0x57BB = 1; } @@ -2481,8 +2483,7 @@ bool dLytMeterItemSelect_c::fn_800F0030() const { if (!StoryflagManager::sInstance->getCounterOrFlag(58) && !(EventManager::isInEvent() && EventManager::isCurrentEvent("ItemGetGorgeous")) || (mpOwnerPane == nullptr || !mpOwnerPane->IsVisible() || dLytMeter_c::GetMain()->fn_800D5650() || - dLytMeter_c::GetMain()->fn_800D5680() || - !dLytMeter_c::GetMain()->getItemSelectNotHiddenByAreaCaption())) { + dLytMeter_c::GetMain()->fn_800D5680() || !dLytMeter_c::GetMain()->getItemSelectNotHiddenByAreaCaption())) { // If we don't have a B-Wheel and we're not currently in the ItemGetGorgeous event, // or (random other conditions), return false return false; From 96264ddedc8c7a2b8dce966a1e9ddd7a4251ee8d Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 16 May 2025 11:18:43 +0200 Subject: [PATCH 3/4] d_lyt_do_button_related OK --- config/SOUE01/splits.txt | 1 + config/SOUE01/symbols.txt | 32 +-- configure.py | 2 +- include/d/lyt/d_lyt_do_button.h | 22 +-- include/d/lyt/d_lyt_target_bird.h | 28 +++ include/d/lyt/d_lyt_unknowns.h | 35 +--- include/d/lyt/meter/d_lyt_meter.h | 21 +- include/d/lyt/meter/d_lyt_meter_cross_btn.h | 36 +++- include/toBeSorted/misc_actor.h | 6 + src/d/lyt/d_lyt_do_button.cpp | 6 +- src/d/lyt/d_lyt_do_button_related.cpp | 197 +++++++++++++++++++ src/d/lyt/meter/d_lyt_meter.cpp | 30 +-- src/d/lyt/meter/d_lyt_meter_a_btn.cpp | 3 +- src/d/lyt/meter/d_lyt_meter_action_table.inc | 3 +- src/d/lyt/meter/d_lyt_meter_cross_btn.cpp | 139 +++++++------ src/d/lyt/meter/d_lyt_meter_item_select.cpp | 5 +- 16 files changed, 412 insertions(+), 154 deletions(-) create mode 100644 include/d/lyt/d_lyt_target_bird.h create mode 100644 include/toBeSorted/misc_actor.h diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 960e6c5c..9676583a 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -702,6 +702,7 @@ d/lyt/d_lyt_do_button_related.cpp: .rodata start:0x804E7080 end:0x804E72E0 .data start:0x8051AC00 end:0x8051AC18 .sbss start:0x80575470 end:0x80575480 + .bss start:0x805ACF78 end:0x805ACF88 d/lyt/d_lyt_common_a_btn.cpp: .text start:0x8010EF90 end:0x8010F818 align:16 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 4caef926..1f2e55f1 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -6065,7 +6065,7 @@ executeState_Off__24dLytMeterCrossBtnParts_cFv = .text:0x800F9170; // type:funct finalizeState_Off__24dLytMeterCrossBtnParts_cFv = .text:0x800F91E0; // type:function size:0x4 init__24dLytMeterCrossBtnParts_cFv = .text:0x800F91F0; // type:function size:0x80 execute__24dLytMeterCrossBtnParts_cFb = .text:0x800F9270; // type:function size:0x4C8 -setMessage__24dLytMeterCrossBtnParts_cFQ218LytDoButtonRelated8Act_IE_e = .text:0x800F9740; // type:function size:0x508 +setMessage__24dLytMeterCrossBtnParts_cFl = .text:0x800F9740; // type:function size:0x508 initializeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C50; // type:function size:0x4 executeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C60; // type:function size:0x4 finalizeState_Wait__19dLytMeterCrossBtn_cFv = .text:0x800F9C70; // type:function size:0x4 @@ -6532,21 +6532,21 @@ execute__14dLytDobutton_cFv = .text:0x8010D6C0; // type:function size:0x80C draw__14dLytDobutton_cFv = .text:0x8010DED0; // type:function size:0x28 realize__14dLytDobutton_cFv = .text:0x8010DF00; // type:function size:0x4CC fn_8010E3D0__14dLytDobutton_cFb = .text:0x8010E3D0; // type:function size:0x1F0 -setActionTextStuffInternal__14dLytDobutton_cFllb = .text:0x8010E5C0; // type:function size:0x10 +setActionTextStuffInternal__14dLytDobutton_cFlQ214dLytDobutton_c8Act_Do_eb = .text:0x8010E5C0; // type:function size:0x10 getActionInternal__14dLytDobutton_cCFv = .text:0x8010E5D0; // type:function size:0x8 fn_8010E5E0__14dLytDobutton_cCFv = .text:0x8010E5E0; // type:function size:0x1C __sinit_\d_lyt_do_button_cpp = .text:0x8010E600; // type:function size:0x410 scope:local __dt__29sFStateID_c<14dLytDobutton_c>Fv = .text:0x8010EA10; // type:function size:0x58 isSameName__29sFStateID_c<14dLytDobutton_c>CFPCc = .text:0x8010EA70; // type:function size:0x88 -fn_8010EB00 = .text:0x8010EB00; // type:function size:0x24 -fn_8010EB30 = .text:0x8010EB30; // type:function size:0x40 +__ct__23LytDoButtonRelatedClassFv = .text:0x8010EB00; // type:function size:0x24 +__dt__23LytDoButtonRelatedClassFv = .text:0x8010EB30; // type:function size:0x40 __ct__18LytDoButtonRelatedFv = .text:0x8010EB70; // type:function size:0x14 build__18LytDoButtonRelatedFPQ23d2d10ResAccIf_c = .text:0x8010EB90; // type:function size:0x70 remove__18LytDoButtonRelatedFv = .text:0x8010EC00; // type:function size:0x8 -fn_8010EC10__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010EC10; // type:function size:0x134 -fn_8010ED50__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010ED50; // type:function size:0x110 -convertDoButton__18LytDoButtonRelatedFl = .text:0x8010EE60; // type:function size:0xE8 -fn_8010EF50 = .text:0x8010EF50; // type:function size:0x3C +setCrossTop__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010EC10; // type:function size:0x134 +setCrossDown__18LytDoButtonRelatedFQ218LytDoButtonRelated8Act_IE_eb = .text:0x8010ED50; // type:function size:0x110 +convertDoButton__18LytDoButtonRelatedFQ214dLytDobutton_c8Act_Do_e = .text:0x8010EE60; // type:function size:0xE8 +__sinit_\d_lyt_do_button_related_cpp = .text:0x8010EF50; // type:function size:0x3C scope:local build__16dLytCommonABtn_cFPQ23d2d10ResAccIf_c = .text:0x8010EF90; // type:function size:0xAC remove__16dLytCommonABtn_cFv = .text:0x8010F040; // type:function size:0x50 execute__16dLytCommonABtn_cFv = .text:0x8010F090; // type:function size:0x58 @@ -6734,10 +6734,10 @@ getPane__20dLytCommonIconItem_cFv = .text:0x80113A50; // type:function size:0x58 __sinit_\d_lyt_common_icon_item_cpp = .text:0x80113AB0; // type:function size:0x338 scope:local __dt__35sFStateID_c<20dLytCommonIconItem_c>Fv = .text:0x80113DF0; // type:function size:0x58 isSameName__35sFStateID_c<20dLytCommonIconItem_c>CFPCc = .text:0x80113E50; // type:function size:0x88 -build__20LytBirdButtonRelatedFPQ23d2d10ResAccIf_c = .text:0x80113EE0; // type:function size:0x224 -remove__20LytBirdButtonRelatedFv = .text:0x80114110; // type:function size:0x58 -execute__20LytBirdButtonRelatedFv = .text:0x80114170; // type:function size:0x10C -draw__20LytBirdButtonRelatedFv = .text:0x80114280; // type:function size:0x44 +build__16dLytTargetBird_cFPQ23d2d10ResAccIf_c = .text:0x80113EE0; // type:function size:0x224 +remove__16dLytTargetBird_cFv = .text:0x80114110; // type:function size:0x58 +execute__16dLytTargetBird_cFv = .text:0x80114170; // type:function size:0x10C +draw__16dLytTargetBird_cFv = .text:0x80114280; // type:function size:0x44 fn_801142D0 = .text:0x801142D0; // type:function size:0x168 fn_80114440 = .text:0x80114440; // type:function size:0x248 fn_80114690 = .text:0x80114690; // type:function size:0x25C @@ -10442,7 +10442,7 @@ dAcOClef__getTadtoneGroupIndex2 = .text:0x80194E80; // type:function size:0x8 dAcOClef__IsSceneflagValid = .text:0x80194E90; // type:function size:0x2C dAcOClef__isTempflagSet = .text:0x80194EC0; // type:function size:0x58 dAcOClef__getSceneflag = .text:0x80194F20; // type:function size:0xC -checkIsInSkykeepPuzzle = .text:0x80194F30; // type:function size:0x8 +checkIsInSkykeepPuzzle__Fv = .text:0x80194F30; // type:function size:0x8 isInSkyKeepPuzzleRoom = .text:0x80194F40; // type:function size:0xA4 isInAnySkyKeepRoom = .text:0x80194FF0; // type:function size:0x38 maybeResetSkykeepPuzzle = .text:0x80195030; // type:function size:0xB4 @@ -31961,8 +31961,8 @@ lbl_8051AA40 = .data:0x8051AA40; // type:object size:0x14 lbl_8051AA54 = .data:0x8051AA54; // type:object size:0xC data:string __vt__13DoButtonClass = .data:0x8051AA60; // type:object size:0x16C __vt__29sFStateID_c<14dLytDobutton_c> = .data:0x8051ABCC; // type:object size:0x34 -lbl_8051AC00 = .data:0x8051AC00; // type:object size:0xC -lbl_8051AC0C = .data:0x8051AC0C; // type:object size:0xC +__vt__23LytDoButtonRelatedClass = .data:0x8051AC00; // type:object size:0xC +__vt__18LytDoButtonRelated = .data:0x8051AC0C; // type:object size:0xC lbl_8051AC18 = .data:0x8051AC18; // type:object size:0x11 data:string lbl_8051AC2C = .data:0x8051AC2C; // type:object size:0xB data:string lbl_8051AC38 = .data:0x8051AC38; // type:object size:0x13 data:string @@ -40103,7 +40103,7 @@ sFinished__16dLytMeterTimer_c = .sbss:0x80575462; // type:object size:0x1 data:b sInstance__14dLytDobutton_c = .sbss:0x80575468; // type:object size:0x8 data:4byte lbl_80575470 = .sbss:0x80575470; // type:object size:0x8 sInstance__18LytDoButtonRelated = .sbss:0x80575478; // type:object size:0x8 data:4byte -sInstance__20LytBirdButtonRelated = .sbss:0x80575480; // type:object size:0x8 data:4byte +sInstance__16dLytTargetBird_c = .sbss:0x80575480; // type:object size:0x8 data:4byte sInstance__15dLytMsgWindow_c = .sbss:0x80575488; // type:object size:0x4 data:4byte lbl_8057548C = .sbss:0x8057548C; // type:object size:0x4 data:4byte CURRENT_ACTOR_EVENT_FLOW_MANAGER = .sbss:0x80575490; // type:object size:0x8 data:4byte diff --git a/configure.py b/configure.py index 0fe1b801..8edfd9c7 100644 --- a/configure.py +++ b/configure.py @@ -491,7 +491,7 @@ config.libs = [ Object(Matching, "d/lyt/meter/d_lyt_meter_heart.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_shield_gauge.cpp"), Object(Matching, "d/lyt/d_lyt_do_button.cpp"), - Object(NonMatching, "d/lyt/d_lyt_do_button_related.cpp"), + Object(Matching, "d/lyt/d_lyt_do_button_related.cpp"), Object(Matching, "d/lyt/d_lyt_common_a_btn.cpp"), Object(Matching, "d/lyt/d_lyt_common_icon_material.cpp"), Object(Matching, "d/lyt/d_lyt_common_icon_item.cpp"), diff --git a/include/d/lyt/d_lyt_do_button.h b/include/d/lyt/d_lyt_do_button.h index 5893f817..41e95b8f 100644 --- a/include/d/lyt/d_lyt_do_button.h +++ b/include/d/lyt/d_lyt_do_button.h @@ -177,7 +177,7 @@ public: return sInstance; } - static s32 getField0x47C() { + static Act_Do_e getField0x47C() { if (sInstance != nullptr) { return sInstance->field_0x47C; } else { @@ -193,12 +193,12 @@ public: } } - static s32 getNextActionToShow() { + static Act_Do_e getNextActionToShow() { if (sInstance != nullptr) { return sInstance->mNextDoActionToShow; } else { // @bug (?) should this be ACT_DO_INVALID? - return ICON_NONE; + return (Act_Do_e)ICON_NONE; } } @@ -210,7 +210,7 @@ public: } } - static s32 getAction() { + static Act_Do_e getAction() { if (sInstance != nullptr) { return sInstance->getActionInternal(); } else { @@ -218,20 +218,20 @@ public: } } - static void setActionTextStuff(s32 p1, s32 p2, bool p3) { + static void setActionTextStuff(s32 p1, Act_Do_e p2, bool p3) { if (sInstance != nullptr) { sInstance->setActionTextStuffInternal(p1, p2, p3); } } private: - void setActionTextStuffInternal(s32, s32, bool); - s32 getActionInternal() const; + void setActionTextStuffInternal(s32, Act_Do_e, bool); + Act_Do_e getActionInternal() const; s32 fn_8010E5E0() const; void fn_8010E3D0(bool); void realize(); - void set_0x47C_0x480(s32 v1, s32 v2) { + void set_0x47C_0x480(Act_Do_e v1, s32 v2) { field_0x47C = v1; field_0x480 = v2; } @@ -251,12 +251,12 @@ private: /* 0x0D4 */ d2d::AnmGroup_c mAnmGroups[12]; /* 0x3D4 */ nw4r::lyt::Pane *mpPanes[37]; /* 0x468 */ dTextBox_c *mpTextBoxes[2]; - /* 0x470 */ s32 mDoActionToShow; + /* 0x470 */ Act_Do_e mDoActionToShow; /* 0x474 */ s32 field_0x474; /* 0x478 */ s32 field_0x478; - /* 0x47C */ s32 field_0x47C; + /* 0x47C */ Act_Do_e field_0x47C; /* 0x480 */ s32 field_0x480; - /* 0x484 */ s32 mNextDoActionToShow; + /* 0x484 */ Act_Do_e mNextDoActionToShow; /* 0x488 */ s32 field_0x488; /* 0x48C */ s32 field_0x48C; /* 0x490 */ u8 field_0x490; diff --git a/include/d/lyt/d_lyt_target_bird.h b/include/d/lyt/d_lyt_target_bird.h new file mode 100644 index 00000000..de327ff4 --- /dev/null +++ b/include/d/lyt/d_lyt_target_bird.h @@ -0,0 +1,28 @@ +#ifndef D_LYT_TARGET_BIRD_H +#define D_LYT_TARGET_BIRD_H + +#include "d/lyt/d2d.h" + +// size 0x27C +class dLytTargetBird_c { +public: + dLytTargetBird_c() { + sInstance = this; + } + ~dLytTargetBird_c() { + sInstance = nullptr; + } + bool build(d2d::ResAccIf_c *resAcc); + bool remove(); + bool execute(); + bool draw(); + + static dLytTargetBird_c *sInstance; + +private: + d2d::LytBase_c mLyt; + d2d::AnmGroup_c mAnmGroups[7]; + /* 0x250 */ u8 field_0x250[0x27C - 0x250]; +}; + +#endif diff --git a/include/d/lyt/d_lyt_unknowns.h b/include/d/lyt/d_lyt_unknowns.h index 0d885967..b82e6d4a 100644 --- a/include/d/lyt/d_lyt_unknowns.h +++ b/include/d/lyt/d_lyt_unknowns.h @@ -3,6 +3,7 @@ #include "common.h" #include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_do_button.h" class LytDoButtonRelated { public: @@ -167,6 +168,12 @@ public: ACT_IE_ETC_SAILCLOTH = 145, ACT_IE_ETC_RETURN_2 = 146, + ACT_IE_147 = 147, + ACT_IE_148 = 148, + ACT_IE_149 = 149, + ACT_IE_150 = 150, + ACT_IE_151 = 151, + ACT_IE_NONE = 152, }; @@ -220,10 +227,10 @@ public: } - static Act_IE_e convertDoButton(s32); + static Act_IE_e convertDoButton(dLytDobutton_c::Act_Do_e); - static void fn_8010EC10(Act_IE_e, bool); - static void fn_8010ED50(Act_IE_e, bool); + static void setCrossTop(Act_IE_e, bool); + static void setCrossDown(Act_IE_e, bool); private: static LytDoButtonRelated *sInstance; @@ -231,26 +238,4 @@ private: /* 0x34 */ bool field_0x34[12]; }; -// size 0x27C -class LytBirdButtonRelated { -public: - LytBirdButtonRelated() { - sInstance = this; - } - ~LytBirdButtonRelated() { - sInstance = nullptr; - } - bool build(d2d::ResAccIf_c *resAcc); - bool remove(); - bool execute(); - bool draw(); - - static LytBirdButtonRelated *sInstance; - -private: - d2d::LytBase_c mLyt; - d2d::AnmGroup_c mAnmGroups[7]; - /* 0x250 */ u8 field_0x250[0x27C - 0x250]; -}; - #endif diff --git a/include/d/lyt/meter/d_lyt_meter.h b/include/d/lyt/meter/d_lyt_meter.h index 5f71f75e..6fa03ddd 100644 --- a/include/d/lyt/meter/d_lyt_meter.h +++ b/include/d/lyt/meter/d_lyt_meter.h @@ -25,6 +25,7 @@ #include "d/lyt/meter/d_lyt_meter_item_select.h" #include "d/lyt/meter/d_lyt_meter_parts.h" #include "d/lyt/d_lyt_unknowns.h" +#include "d/lyt/d_lyt_target_bird.h" #include "m/m_vec.h" // clang-format on @@ -291,11 +292,23 @@ public: mFlags = 0xFFFFFFFF; } - static s32 getCrossBtn0x7BF8() { + static dLytMeterCrossBtn_c::CrossIcon_e getCrossIconDown() { if (sInstance != nullptr) { - return sInstance->mMain.mCrossBtn.getField_0x620(); + return sInstance->mMain.mCrossBtn.getIconDown(); } else { - return 6; + return dLytMeterCrossBtn_c::CROSS_ICON_NONE; + } + } + + static void setCrossIconDown(dLytMeterCrossBtn_c::CrossIcon_e icon) { + if (sInstance != nullptr) { + sInstance->mMain.mCrossBtn.setIconDown(icon); + } + } + + static void setCrossIconTop(dLytMeterCrossBtn_c::CrossIcon_e icon) { + if (sInstance != nullptr) { + sInstance->mMain.mCrossBtn.setIconTop(icon); } } @@ -443,7 +456,7 @@ private: /* 0x00378 */ dLytMeterMain_c mMain; /* 0x13B3C */ dLytDobutton_c *mpDoButton; /* 0x13B40 */ LytDoButtonRelated *mpDoButtonRelated; - /* 0x13B44 */ LytBirdButtonRelated *mpBirdRelated; + /* 0x13B44 */ dLytTargetBird_c *mpTargetBird; /* 0x13B48 */ bool mVisible; /* 0x13B49 */ u8 _0x13B49[0x13B50 - 0x13B49]; /* 0x13B50 */ s32 mFlags; diff --git a/include/d/lyt/meter/d_lyt_meter_cross_btn.h b/include/d/lyt/meter/d_lyt_meter_cross_btn.h index a9c48dde..56f91edd 100644 --- a/include/d/lyt/meter/d_lyt_meter_cross_btn.h +++ b/include/d/lyt/meter/d_lyt_meter_cross_btn.h @@ -41,18 +41,30 @@ private: /* 0x54 */ dTextBox_c *mpSizeBox; /* 0x58 */ nw4r::lyt::Pane *mpOwnerPane; /* 0x5C */ s32 mIndex; - /* 0x60 */ s32 field_0x60; - /* 0x64 */ s32 field_0x64; + /* 0x60 */ s32 mSavedMessage; + /* 0x64 */ s32 mMessage; /* 0x68 */ s32 field_0x68; /* 0x6C */ s32 field_0x6C; - /* 0x70 */ s32 field_0x70; - /* 0x74 */ s32 field_0x74; + /* 0x70 */ s32 mSavedIcon; + /* 0x74 */ s32 mCurrentIcon; /* 0x78 */ s32 mOnDelay; /* 0x7C */ u8 field_0x7C; }; class dLytMeterCrossBtn_c : public d2d::dSubPane { public: + enum CrossIcon_e { + CROSS_ICON_TOP_1 = 1, + CROSS_ICON_TOP_3 = 3, + CROSS_ICON_TOP_4 = 4, + + CROSS_ICON_DOWN_0 = 0, + CROSS_ICON_DOWN_2 = 2, + CROSS_ICON_DOWN_5 = 5, + + CROSS_ICON_NONE = 6, + }; + dLytMeterCrossBtn_c() : mStateMgr(*this, sStateID::null) {} virtual bool build(d2d::ResAccIf_c *resAcc) override; virtual bool remove() override; @@ -69,8 +81,16 @@ public: virtual ~dLytMeterCrossBtn_c() {} - s32 getField_0x620() const { - return field_0x620; + CrossIcon_e getIconDown() const { + return mIconDown; + } + + void setIconDown(CrossIcon_e icon) { + mIconDown = icon; + } + + void setIconTop(CrossIcon_e icon) { + mIconTop = icon; } void setOwnerPane(nw4r::lyt::Pane *pane); @@ -93,8 +113,8 @@ private: /* 0x400 */ dWindow_c *mpWindows[4]; /* 0x410 */ dTextBox_c *mpSizeBoxes[4]; /* 0x420 */ dLytMeterCrossBtnParts_c mParts[4]; - /* 0x620 */ s32 field_0x620; - /* 0x624 */ s32 field_0x624; + /* 0x620 */ CrossIcon_e mIconDown; + /* 0x624 */ CrossIcon_e mIconTop; /* 0x628 */ u16 mSavedFiFlow; /* 0x62C */ s32 mCallCount0; /* 0x630 */ s32 mCallCount1; diff --git a/include/toBeSorted/misc_actor.h b/include/toBeSorted/misc_actor.h new file mode 100644 index 00000000..95f4af98 --- /dev/null +++ b/include/toBeSorted/misc_actor.h @@ -0,0 +1,6 @@ +#ifndef MISC_ACTOR_H +#define MISC_ACTOR_H + +bool checkIsInSkykeepPuzzle(); + +#endif diff --git a/src/d/lyt/d_lyt_do_button.cpp b/src/d/lyt/d_lyt_do_button.cpp index 26122bb4..9aec9bcf 100644 --- a/src/d/lyt/d_lyt_do_button.cpp +++ b/src/d/lyt/d_lyt_do_button.cpp @@ -787,13 +787,13 @@ void dLytDobutton_c::fn_8010E3D0(bool b) { mpPanes[1]->SetTranslate(v); } -void dLytDobutton_c::setActionTextStuffInternal(s32 a1, s32 a2, bool b) { +void dLytDobutton_c::setActionTextStuffInternal(s32 a1, Act_Do_e a2, bool b) { field_0x488 = a1; - mNextDoActionToShow = a2; + mNextDoActionToShow = (Act_Do_e)a2; field_0x490 = b; } -s32 dLytDobutton_c::getActionInternal() const { +dLytDobutton_c::Act_Do_e dLytDobutton_c::getActionInternal() const { return mDoActionToShow; } diff --git a/src/d/lyt/d_lyt_do_button_related.cpp b/src/d/lyt/d_lyt_do_button_related.cpp index 502a3d13..5583ed9d 100644 --- a/src/d/lyt/d_lyt_do_button_related.cpp +++ b/src/d/lyt/d_lyt_do_button_related.cpp @@ -1,5 +1,31 @@ +#include "common.h" #include "d/lyt/d2d.h" +#include "d/lyt/d_lyt_do_button.h" #include "d/lyt/d_lyt_unknowns.h" +#include "d/lyt/meter/d_lyt_meter.h" +#include "toBeSorted/misc_actor.h" + +class LytDoButtonRelatedClass { +public: + LytDoButtonRelatedClass(); + virtual ~LytDoButtonRelatedClass(); + +private: + /* 0x04 */ u8 field_0x04; + /* 0x05 */ u8 field_0x05; + /* 0x06 */ u8 field_0x06; +}; + +static LytDoButtonRelatedClass sDoButtonRelatedClass; + +LytDoButtonRelatedClass::LytDoButtonRelatedClass() { + field_0x04 = 0; + field_0x05 = 0; + field_0x06 = LytDoButtonRelated::ACT_IE_NONE; +} +LytDoButtonRelatedClass::~LytDoButtonRelatedClass() {} + +LytDoButtonRelated *LytDoButtonRelated::sInstance; LytDoButtonRelated::LytDoButtonRelated() { sInstance = this; @@ -17,3 +43,174 @@ bool LytDoButtonRelated::build(d2d::ResAccIf_c *resAcc) { bool LytDoButtonRelated::remove() { return true; } + +static const dLytDobutton_c::Act_Do_e sActIEtoDoConversionTable[LytDoButtonRelated::ACT_IE_NONE] = { + dLytDobutton_c::ACT_DO_CLIMB_UP, // ACT_IE_INFO_CLIMB_UP + dLytDobutton_c::ACT_DO_JUMP, // ACT_IE_INFO_JUMP + dLytDobutton_c::ACT_DO_DROP_DOWN, // ACT_IE_INFO_DROP_DOWN + dLytDobutton_c::ACT_DO_LET_GO, // ACT_IE_INFO_LET_GO + dLytDobutton_c::ACT_DO_OPEN, // ACT_IE_INFO_OPEN + dLytDobutton_c::ACT_DO_PUT_DOWN, // ACT_IE_INFO_DROP + dLytDobutton_c::ACT_DO_THROW, // ACT_IE_INFO_THROW + dLytDobutton_c::ACT_DO_BURROW, // ACT_IE_INFO_BURROW + dLytDobutton_c::ACT_DO_ROLL, // ACT_IE_INFO_ROLL + dLytDobutton_c::ACT_DO_9, // ACT_IE_INFO_9 + dLytDobutton_c::ACT_DO_MOVE, // ACT_IE_INFO_MOVE + dLytDobutton_c::ACT_DO_GRAB, // ACT_IE_INFO_GRAB + dLytDobutton_c::ACT_DO_SHOOT, // ACT_IE_INFO_SHOOT + dLytDobutton_c::ACT_DO_13, // ACT_IE_INFO_13 + dLytDobutton_c::ACT_DO_14, // ACT_IE_INFO_14 + dLytDobutton_c::ACT_DO_15, // ACT_IE_INFO_15 + dLytDobutton_c::ACT_DO_TALK, // ACT_IE_INFO_TALK + dLytDobutton_c::ACT_DO_EXAMINE, // ACT_IE_INFO_EXAMINE + dLytDobutton_c::ACT_DO_DRAW, // ACT_IE_INFO_DRAW + dLytDobutton_c::ACT_DO_19, // ACT_IE_INFO_19 + dLytDobutton_c::ACT_DO_BLOW, // ACT_IE_INFO_BLOW + dLytDobutton_c::ACT_DO_21, // ACT_IE_INFO_21 + dLytDobutton_c::ACT_DO_22, // ACT_IE_INFO_22 + dLytDobutton_c::ACT_DO_SWIM, // ACT_IE_INFO_SWIM + dLytDobutton_c::ACT_DO_LEAP, // ACT_IE_INFO_LEAP + dLytDobutton_c::ACT_DO_DASH, // ACT_IE_INFO_DASH + dLytDobutton_c::ACT_DO_GET_OUT, // ACT_IE_INFO_GET_OUT + dLytDobutton_c::ACT_DO_27, // ACT_IE_INFO_27 + dLytDobutton_c::ACT_DO_PICK_UP, // ACT_IE_INFO_PICK_UP + dLytDobutton_c::ACT_DO_SIT, // ACT_IE_INFO_SIT + dLytDobutton_c::ACT_DO_STAND, // ACT_IE_INFO_STAND + dLytDobutton_c::ACT_DO_DIG, // ACT_IE_INFO_DIG + dLytDobutton_c::ACT_DO_32, // ACT_IE_INFO_32 + dLytDobutton_c::ACT_DO_33, // ACT_IE_INFO_33 + dLytDobutton_c::ACT_DO_BREAK_FREE, // ACT_IE_INFO_BREAK_FREE + dLytDobutton_c::ACT_DO_35, // ACT_IE_INFO_35 + dLytDobutton_c::ACT_DO_36, // ACT_IE_INFO_36 + dLytDobutton_c::ACT_DO_PLANT, // ACT_IE_INFO_PLANT + dLytDobutton_c::ACT_DO_CATCH, // ACT_IE_INFO_CATCH + dLytDobutton_c::ACT_DO_SPEED_UP, // ACT_IE_INFO_SPEED_UP + dLytDobutton_c::ACT_DO_SAILCLOTH, // ACT_IE_INFO_SAILCLOTH + dLytDobutton_c::ACT_DO_PUT_AWAY, // ACT_IE_INFO_PUT_AWAY + dLytDobutton_c::ACT_DO_EMERGE, // ACT_IE_INFO_EMERGE + dLytDobutton_c::ACT_DO_INSERT, // ACT_IE_INFO_INSERT + dLytDobutton_c::ACT_DO_44, // ACT_IE_INFO_44 + dLytDobutton_c::ACT_DO_TURN, // ACT_IE_INFO_TURN + dLytDobutton_c::ACT_DO_PUSH_IN, // ACT_IE_INFO_ALIGN + dLytDobutton_c::ACT_DO_47, // ACT_IE_INFO_47 + dLytDobutton_c::ACT_DO_DRAW_BOW, // ACT_IE_INFO_DRAW_BOW + dLytDobutton_c::ACT_DO_49, // ACT_IE_INFO_49 + dLytDobutton_c::ACT_DO_50, // ACT_IE_INFO_50 + dLytDobutton_c::ACT_DO_51, // ACT_IE_INFO_51 + dLytDobutton_c::ACT_DO_SWING, // ACT_IE_INFO_SWING + dLytDobutton_c::ACT_DO_BALANCE, // ACT_IE_INFO_BALANCE + dLytDobutton_c::ACT_DO_JOSTLE, // ACT_IE_INFO_JOSTLE + dLytDobutton_c::ACT_DO_55, // ACT_IE_INFO_55 + dLytDobutton_c::ACT_DO_SLEEP, // ACT_IE_INFO_SLEEP + dLytDobutton_c::ACT_DO_DROP, // ACT_IE_INFO_DROP_2 + dLytDobutton_c::ACT_DO_LAUNCH, // ACT_IE_INFO_LAUNCH + dLytDobutton_c::ACT_DO_READ, // ACT_IE_INFO_READ + dLytDobutton_c::ACT_DO_WHIP, // ACT_IE_INFO_WHIP + dLytDobutton_c::ACT_DO_PULL, // ACT_IE_INFO_PULL + dLytDobutton_c::ACT_DO_DRINK, // ACT_IE_INFO_DRINK + dLytDobutton_c::ACT_DO_63, // ACT_IE_INFO_63 + dLytDobutton_c::ACT_DO_GET_IN, // ACT_IE_INFO_GET_IN + dLytDobutton_c::ACT_DO_FIRE, // ACT_IE_INFO_FIRE + dLytDobutton_c::ACT_DO_ATTACK, // ACT_IE_INFO_ATTACK + dLytDobutton_c::ACT_DO_FATAL_BLOW, // ACT_IE_INFO_FATAL_BLOW + dLytDobutton_c::ACT_DO_JUMP_DOWN, // ACT_IE_INFO_JUMP_DOWN + dLytDobutton_c::ACT_DO_STRUM, // ACT_IE_INFO_STRUM + dLytDobutton_c::ACT_DO_70, // ACT_IE_INFO_70 + dLytDobutton_c::ACT_DO_RELEASE, // ACT_IE_INFO_RELEASE + dLytDobutton_c::ACT_DO_GRAB_2, // ACT_IE_INFO_GRAB_2 + dLytDobutton_c::ACT_DO_READY_STANCE, // ACT_IE_INFO_READY_STANCE + dLytDobutton_c::ACT_DO_REMOVE, // ACT_IE_INFO_REMOVE + dLytDobutton_c::ACT_DO_READY_SWORD, // ACT_IE_INFO_READY_SWORD + dLytDobutton_c::ACT_DO_THRUST_SWORD, // ACT_IE_INFO_THRUST_SWORD + dLytDobutton_c::ACT_DO_USE, // ACT_IE_INFO_USE + dLytDobutton_c::ACT_DO_SCOOP, // ACT_IE_INFO_SCOOP + dLytDobutton_c::ACT_DO_79, // ACT_IE_INFO_79 + dLytDobutton_c::ACT_DO_80, // ACT_IE_INFO_80 + dLytDobutton_c::ACT_DO_LOOK, // ACT_IE_INFO_LOOK + dLytDobutton_c::ACT_DO_DOWSE, // ACT_IE_INFO_DOWSE + dLytDobutton_c::ACT_DO_PILOT, // ACT_IE_INFO_PILOT + dLytDobutton_c::ACT_DO_LOOK_DOWN, // ACT_IE_INFO_LOOK_DOWN + dLytDobutton_c::ACT_DO_DIVE, // ACT_IE_INFO_DIVE + dLytDobutton_c::ACT_DO_SELECT, // ACT_IE_INFO_SELECT + dLytDobutton_c::ACT_DO_GRAB_3, // ACT_IE_INFO_GRAB_3 + dLytDobutton_c::ACT_DO_MOVE_2, // ACT_IE_INFO_MOVE_1 + dLytDobutton_c::ACT_DO_ACCELERATE, // ACT_IE_INFO_ACCELERATE + dLytDobutton_c::ACT_DO_CHARGE, // ACT_IE_INFO_CHARGE + dLytDobutton_c::ACT_DO_LEAN, // ACT_IE_INFO_LEAN + dLytDobutton_c::ACT_DO_PRESS, // ACT_IE_INFO_PRESS +}; + +void LytDoButtonRelated::setCrossTop(Act_IE_e act, bool bHas) { + LytDoButtonRelated *p = sInstance; + if (p != nullptr) { + if (act == ACT_IE_147) { + p->field_0x04[DO_BUTTON_CROSS_T] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_T] = bHas; + if (!checkIsInSkykeepPuzzle()) { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_TOP_1); + } else { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } else if (act == ACT_IE_149) { + p->field_0x04[DO_BUTTON_CROSS_T] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_T] = bHas; + if (!checkIsInSkykeepPuzzle()) { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_TOP_3); + } else { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } else if (act == ACT_IE_151) { + p->field_0x04[DO_BUTTON_CROSS_T] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_T] = bHas; + if (!checkIsInSkykeepPuzzle()) { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_TOP_4); + } else { + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } else { + p->field_0x04[DO_BUTTON_CROSS_T] = act; + p->field_0x34[DO_BUTTON_CROSS_T] = bHas; + dLytMeter_c::setCrossIconTop(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } +} + +void LytDoButtonRelated::setCrossDown(Act_IE_e act, bool bHas) { + LytDoButtonRelated *p = sInstance; + if (p != nullptr) { + if (act == ACT_IE_148) { + p->field_0x04[DO_BUTTON_CROSS_D] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_D] = bHas; + if (!checkIsInSkykeepPuzzle()) { + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_DOWN_0); + } else { + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } else if (act == ACT_IE_150) { + p->field_0x04[DO_BUTTON_CROSS_D] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_D] = bHas; + if (!checkIsInSkykeepPuzzle()) { + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_DOWN_2); + } else { + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } else if (act == ACT_IE_ETC_CENTER) { + p->field_0x04[DO_BUTTON_CROSS_D] = ACT_IE_NONE; + p->field_0x34[DO_BUTTON_CROSS_D] = bHas; + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_DOWN_5); + } else { + p->field_0x04[DO_BUTTON_CROSS_D] = act; + p->field_0x34[DO_BUTTON_CROSS_D] = bHas; + dLytMeter_c::setCrossIconDown(dLytMeterCrossBtn_c::CROSS_ICON_NONE); + } + } +} + +LytDoButtonRelated::Act_IE_e LytDoButtonRelated::convertDoButton(dLytDobutton_c::Act_Do_e act) { + for (s32 i = 0; i < ACT_IE_NONE; i++) { + if (sActIEtoDoConversionTable[i] == act) { + return static_cast(i); + } + } + return (Act_IE_e)-1; +} diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index f6580305..35842b0f 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -39,6 +39,7 @@ #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/minigame_mgr.h" +#include "toBeSorted/misc_actor.h" #include "toBeSorted/small_sound_mgr.h" // clang-format on @@ -1019,7 +1020,6 @@ bool dLytMeterMain_c::fn_800D5380(u8 arg) { return false; } -extern "C" bool checkIsInSkykeepPuzzle(); bool dLytMeterMain_c::fn_800D53D0() { if (checkIsInSkykeepPuzzle() && !field_0x13774) { return true; @@ -1656,8 +1656,8 @@ bool dLytMeterMain_c::execute() { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::ACT_IE_NONE); LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::ACT_IE_NONE); - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); + LytDoButtonRelated::setCrossTop(LytDoButtonRelated::ACT_IE_NONE, true); + LytDoButtonRelated::setCrossDown(LytDoButtonRelated::ACT_IE_NONE, true); LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::ACT_IE_NONE); @@ -1761,11 +1761,11 @@ bool dLytMeter_c::build() { if (dScTitle_c::sInstance != nullptr) { mpDoButton = nullptr; mpDoButtonRelated = nullptr; - mpBirdRelated = nullptr; + mpTargetBird = nullptr; } else { mpDoButton = new dLytDobutton_c(); mpDoButtonRelated = new LytDoButtonRelated(); - mpBirdRelated = new LytBirdButtonRelated(); + mpTargetBird = new dLytTargetBird_c(); } if (mpDoButton != nullptr) { @@ -1774,8 +1774,8 @@ bool dLytMeter_c::build() { if (mpDoButtonRelated != nullptr) { mpDoButtonRelated->build(&mResAcc); } - if (mpBirdRelated != nullptr) { - mpBirdRelated->build(&mResAcc); + if (mpTargetBird != nullptr) { + mpTargetBird->build(&mResAcc); } fn_800D97E0(0xb); @@ -1810,10 +1810,10 @@ bool dLytMeter_c::remove() { delete mpEventSkip; mpEventSkip = nullptr; } - if (mpBirdRelated != nullptr) { - mpBirdRelated->remove(); - delete mpBirdRelated; - mpBirdRelated = nullptr; + if (mpTargetBird != nullptr) { + mpTargetBird->remove(); + delete mpTargetBird; + mpTargetBird = nullptr; } dLytAreaCaption_c::remove(); mResAcc.detach(); @@ -1833,8 +1833,8 @@ bool dLytMeter_c::execute() { mpDoButton->execute(); } - if (mpBirdRelated != nullptr) { - mpBirdRelated->execute(); + if (mpTargetBird != nullptr) { + mpTargetBird->execute(); } if (field_0x13B61 || (!EventManager::isInEvent() && field_0x13B62)) { @@ -1871,8 +1871,8 @@ bool dLytMeter_c::draw() { if (mpDoButton != nullptr) { mpDoButton->draw(); } - if (mpBirdRelated != nullptr) { - mpBirdRelated->draw(); + if (mpTargetBird != nullptr) { + mpTargetBird->draw(); } } } diff --git a/src/d/lyt/meter/d_lyt_meter_a_btn.cpp b/src/d/lyt/meter/d_lyt_meter_a_btn.cpp index be4861ef..4eaf009b 100644 --- a/src/d/lyt/meter/d_lyt_meter_a_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_a_btn.cpp @@ -7,6 +7,7 @@ #include "d/lyt/d_window.h" #include "d/lyt/meter/d_lyt_meter.h" #include "toBeSorted/event_manager.h" +#include "toBeSorted/misc_actor.h" STATE_DEFINE(dLytMeterABtn_c, InvisibleWait); STATE_DEFINE(dLytMeterABtn_c, In); @@ -199,8 +200,6 @@ bool dLytMeterABtn_c::remove() { return true; } -extern "C" bool checkIsInSkykeepPuzzle(); - bool dLytMeterABtn_c::execute() { if (mpOwnerPane == nullptr) { return true; diff --git a/src/d/lyt/meter/d_lyt_meter_action_table.inc b/src/d/lyt/meter/d_lyt_meter_action_table.inc index 8f8f38cb..13cdecdb 100644 --- a/src/d/lyt/meter/d_lyt_meter_action_table.inc +++ b/src/d/lyt/meter/d_lyt_meter_action_table.inc @@ -1,5 +1,5 @@ // 001-Action.msbt -static const s32 sActIds[] = { +static const s32 sActIds[LytDoButtonRelated::ACT_IE_NONE] = { 1, // ACT_IE_INFO_CLIMB_UP 2, // ACT_IE_INFO_JUMP 3, // ACT_IE_INFO_DROP_DOWN @@ -147,5 +147,4 @@ static const s32 sActIds[] = { 51, // ACT_IE_ETC_STOW_CANNON 52, // ACT_IE_ETC_SAILCLOTH 53, // ACT_IE_ETC_RETURN_2 - 0, 0, 0, 0, 0, }; diff --git a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp index 912014eb..a16a09a7 100644 --- a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp @@ -9,6 +9,7 @@ #include "d/lyt/meter/d_lyt_meter.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/fi_context.h" +#include "toBeSorted/misc_actor.h" #include "toBeSorted/small_sound_mgr.h" STATE_DEFINE(dLytMeterCrossBtnParts_c, Wait); @@ -21,6 +22,13 @@ STATE_DEFINE(dLytMeterCrossBtn_c, ToUse); STATE_DEFINE(dLytMeterCrossBtn_c, ToUnuse); STATE_DEFINE(dLytMeterCrossBtn_c, Unuse); +#define CROSS_BTN_PART_TOP 0 +#define CROSS_BTN_PART_DOWN 1 +#define CROSS_BTN_PART_LEFT 2 +#define CROSS_BTN_PART_RIGHT 3 + +#define CROSS_BTN_NUM_PARTS 4 + void dLytMeterCrossBtnParts_c::initializeState_Wait() { mOnDelay = 15; } @@ -33,25 +41,25 @@ void dLytMeterCrossBtnParts_c::executeState_Wait() { if (field_0x7C) { if (field_0x68) { bool bDoUpdate = true; - if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE || field_0x70 != field_0x74) { + if (mMessage != LytDoButtonRelated::ACT_IE_NONE || mSavedIcon != mCurrentIcon) { if (timer <= 0) { mStateMgr.changeState(StateID_On); - setMessage(field_0x64); + setMessage(mMessage); } else { bDoUpdate = false; mOnDelay -= 1; } } if (bDoUpdate) { - field_0x60 = field_0x64; - field_0x70 = field_0x74; + mSavedMessage = mMessage; + mSavedIcon = mCurrentIcon; } } else { - if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE || field_0x70 != field_0x74) { - setMessage(field_0x64); + if (mMessage != LytDoButtonRelated::ACT_IE_NONE || mSavedIcon != mCurrentIcon) { + setMessage(mMessage); } - field_0x60 = field_0x64; - field_0x70 = field_0x74; + mSavedMessage = mMessage; + mSavedIcon = mCurrentIcon; } } @@ -76,18 +84,20 @@ void dLytMeterCrossBtnParts_c::finalizeState_On() {} void dLytMeterCrossBtnParts_c::initializeState_Active() {} void dLytMeterCrossBtnParts_c::executeState_Active() { - if (field_0x64 != field_0x60 || !field_0x68 || field_0x70 != field_0x74) { - if ((field_0x64 == LytDoButtonRelated::ACT_IE_NONE && field_0x74 == 6) || !field_0x68) { - if (field_0x60 != field_0x6C) { - field_0x64 = field_0x6C; + if (mMessage != mSavedMessage || !field_0x68 || mSavedIcon != mCurrentIcon) { + if ((mMessage == LytDoButtonRelated::ACT_IE_NONE && mCurrentIcon == dLytMeterCrossBtn_c::CROSS_ICON_NONE) || + !field_0x68) { + if (mSavedMessage != field_0x6C) { + mMessage = field_0x6C; } mStateMgr.changeState(StateID_Off); } else { - setMessage(field_0x64); + setMessage(mMessage); } - field_0x60 = field_0x64; - field_0x70 = field_0x74; - } else if (field_0x60 == LytDoButtonRelated::ACT_IE_NONE && field_0x74 == 6) { + mSavedMessage = mMessage; + mSavedIcon = mCurrentIcon; + } else if (mSavedMessage == LytDoButtonRelated::ACT_IE_NONE && + mCurrentIcon == dLytMeterCrossBtn_c::CROSS_ICON_NONE) { mStateMgr.changeState(StateID_Off); } } @@ -108,10 +118,10 @@ void dLytMeterCrossBtnParts_c::finalizeState_Off() {} void dLytMeterCrossBtnParts_c::init() { field_0x6C = LytDoButtonRelated::ACT_IE_NONE; - field_0x60 = LytDoButtonRelated::ACT_IE_NONE; - field_0x64 = LytDoButtonRelated::ACT_IE_NONE; + mSavedMessage = LytDoButtonRelated::ACT_IE_NONE; + mMessage = LytDoButtonRelated::ACT_IE_NONE; field_0x7C = false; - field_0x70 = 6; + mSavedIcon = dLytMeterCrossBtn_c::CROSS_ICON_NONE; field_0x68 = 1; mOnDelay = 15; mpOwnerPane = 0; @@ -119,7 +129,6 @@ void dLytMeterCrossBtnParts_c::init() { mStateMgr.changeState(StateID_Wait); } -extern "C" bool checkIsInSkykeepPuzzle(); void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { if (mpOwnerPane == nullptr) { return; @@ -129,7 +138,7 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { if (!(*mStateMgr.getStateID() == StateID_On)) { return; } - field_0x70 = 6; + mSavedIcon = dLytMeterCrossBtn_c::CROSS_ICON_NONE; mpAnm[0]->setForwardOnce(); mpAnm[0]->setToEnd2(); mpAnm[0]->setAnimEnable(true); @@ -141,21 +150,21 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { } if (dLytMeter_c::GetInstance()->getMeterField_0x13750() == 0) { - if (mIndex == 0) { - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); - } else if (mIndex == 1) { - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); - } else if (mIndex == 2) { + if (mIndex == CROSS_BTN_PART_TOP) { + LytDoButtonRelated::setCrossTop(LytDoButtonRelated::ACT_IE_NONE, true); + } else if (mIndex == CROSS_BTN_PART_DOWN) { + LytDoButtonRelated::setCrossDown(LytDoButtonRelated::ACT_IE_NONE, true); + } else if (mIndex == CROSS_BTN_PART_LEFT) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); - } else if (mIndex == 3) { + } else if (mIndex == CROSS_BTN_PART_RIGHT) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::ACT_IE_NONE); } - if (field_0x64 != LytDoButtonRelated::ACT_IE_NONE) { - field_0x64 = LytDoButtonRelated::ACT_IE_NONE; - field_0x60 = LytDoButtonRelated::ACT_IE_NONE; + if (mMessage != LytDoButtonRelated::ACT_IE_NONE) { + mMessage = LytDoButtonRelated::ACT_IE_NONE; + mSavedMessage = LytDoButtonRelated::ACT_IE_NONE; } - setMessage(field_0x64); + setMessage(mMessage); } if (!bIsVisible && *mStateMgr.getStateID() == StateID_Off) { @@ -165,13 +174,13 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { if ((EventManager::isInEvent() && dMessage_c::getInstance()->getField_0x32C() == 12 && !checkIsInSkykeepPuzzle() && !dLytMeter_c::GetInstance()->fn_800D5670()) || - ((dLytMeter_c::getItemSelect0x75A2() && (mIndex != 1 || field_0x74 != 0)) || !bIsVisible)) { + ((dLytMeter_c::getItemSelect0x75A2() && (mIndex != 1 || mCurrentIcon != 0)) || !bIsVisible)) { field_0x7C = 0; if (mIndex == 0) { - LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::ACT_IE_NONE, true); + LytDoButtonRelated::setCrossTop(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 1) { - LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::ACT_IE_NONE, true); + LytDoButtonRelated::setCrossDown(LytDoButtonRelated::ACT_IE_NONE, true); } else if (mIndex == 2) { LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::ACT_IE_NONE); } else if (mIndex == 3) { @@ -182,16 +191,16 @@ void dLytMeterCrossBtnParts_c::execute(bool bIsVisible) { } if (mIndex == 0) { - field_0x64 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_T); + mMessage = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_T); field_0x68 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_CROSS_T); } else if (mIndex == 1) { - field_0x64 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_D); + mMessage = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_D); field_0x68 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_CROSS_D); } else if (mIndex == 2) { - field_0x64 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_L); + mMessage = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_L); field_0x68 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_CROSS_L); } else if (mIndex == 3) { - field_0x64 = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_R); + mMessage = LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_CROSS_R); field_0x68 = LytDoButtonRelated::getHas(LytDoButtonRelated::DO_BUTTON_CROSS_R); } @@ -213,7 +222,7 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { } // If only there was an easier way to write this - if (field_0x74 == 0 || field_0x74 == 1) { + if (mCurrentIcon == 0 || mCurrentIcon == 1) { mpWindow->SetVisible(false); mpAnm[1]->setFrame(0.0f); mpAnm[1]->setAnimEnable(true); @@ -222,7 +231,7 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { mpLyt->getLayout()->Animate(0); mpLyt->calc(); mpAnm[1]->setAnimEnable(false); - } else if (field_0x74 == 2) { + } else if (mCurrentIcon == 2) { mpWindow->SetVisible(false); mpAnm[1]->setFrame(2.0f); mpAnm[1]->setAnimEnable(true); @@ -231,7 +240,7 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { mpLyt->getLayout()->Animate(0); mpLyt->calc(); mpAnm[1]->setAnimEnable(false); - } else if (field_0x74 == 3) { + } else if (mCurrentIcon == 3) { mpWindow->SetVisible(false); mpAnm[1]->setFrame(3.0f); mpAnm[1]->setAnimEnable(true); @@ -240,7 +249,7 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { mpLyt->getLayout()->Animate(0); mpLyt->calc(); mpAnm[1]->setAnimEnable(false); - } else if (field_0x74 == 4) { + } else if (mCurrentIcon == 4) { mpWindow->SetVisible(false); mpAnm[1]->setFrame(4.0f); mpAnm[1]->setAnimEnable(true); @@ -249,7 +258,7 @@ void dLytMeterCrossBtnParts_c::setMessage(s32 id) { mpLyt->getLayout()->Animate(0); mpLyt->calc(); mpAnm[1]->setAnimEnable(false); - } else if (field_0x74 == 5) { + } else if (mCurrentIcon == 5) { mpWindow->SetVisible(false); mpAnm[1]->setFrame(5.0f); mpAnm[1]->setAnimEnable(true); @@ -385,21 +394,21 @@ bool dLytMeterCrossBtn_c::build(d2d::ResAccIf_c *resAcc) { mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]); } - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mpWindows[i] = mLyt.getWindow(sWindows[i]); mpSizeBoxes[i] = mLyt.getSizeBoxInWindow(sWindows[i]); } - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mParts[i].mIndex = i; mParts[i].mpLyt = &mLyt; mParts[i].mpAnm[0] = &mAnm[i + CROSS_BTN_ANIM_INPUT_OFFSET]; mParts[i].mpAnm[1] = &mAnm[i + CROSS_BTN_ANIM_PATTERN_OFFSET]; mParts[i].mpTextBoxes[0] = mpTextboxes[i]; - mParts[i].mpTextBoxes[1] = mpTextboxes[i + 4]; + mParts[i].mpTextBoxes[1] = mpTextboxes[i + CROSS_BTN_NUM_PARTS]; mParts[i].mpWindow = mpWindows[i]; mParts[i].mpSizeBox = mpSizeBoxes[i]; - mParts[i].field_0x74 = 6; + mParts[i].mCurrentIcon = dLytMeterCrossBtn_c::CROSS_ICON_NONE; mParts[i].init(); } @@ -410,8 +419,8 @@ bool dLytMeterCrossBtn_c::build(d2d::ResAccIf_c *resAcc) { mSavedFiFlow = 0xFFFF; mCallCount0 = 0; mCallCount1 = 0; - field_0x620 = 6; - field_0x624 = 6; + mIconDown = CROSS_ICON_NONE; + mIconTop = CROSS_ICON_NONE; field_0x637 = 0; field_0x638 = 0; @@ -422,7 +431,7 @@ bool dLytMeterCrossBtn_c::build(d2d::ResAccIf_c *resAcc) { mpOwnerPane = nullptr; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mAnm[i + CROSS_BTN_ANIM_INPUT_OFFSET].setToEnd(); mAnm[i + CROSS_BTN_ANIM_INPUT_OFFSET].setAnimEnable(true); } @@ -436,7 +445,7 @@ bool dLytMeterCrossBtn_c::build(d2d::ResAccIf_c *resAcc) { mLyt.calc(); - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mAnm[i + CROSS_BTN_ANIM_INPUT_OFFSET].setAnimEnable(false); } @@ -465,11 +474,11 @@ bool dLytMeterCrossBtn_c::execute() { mCallCount0 = 0; } - mParts[0].field_0x74 = field_0x624; - mParts[1].field_0x74 = field_0x620; + mParts[CROSS_BTN_PART_TOP].mCurrentIcon = mIconTop; + mParts[CROSS_BTN_PART_DOWN].mCurrentIcon = mIconDown; if (mpOwnerPane != nullptr) { - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mParts[i].execute(mpOwnerPane->IsVisible()); } } @@ -481,7 +490,7 @@ bool dLytMeterCrossBtn_c::execute() { } if (field_0x637 != 0) { - if (field_0x620 == 0) { + if (mIconDown == 0) { f32 frame = dAcPy_c::GetLink2()->getAnmMatClrFrame(); if (frame == 0.0f) { mAnm[CROSS_BTN_ANIM_CALL_0].setToEnd(); @@ -492,7 +501,8 @@ bool dLytMeterCrossBtn_c::execute() { if (mAnm[CROSS_BTN_ANIM_CALL_0].isEnabled()) { mAnm[CROSS_BTN_ANIM_CALL_0].play(); - if (mParts[1].isActive() && mCallCount0 < 3 && mAnm[CROSS_BTN_ANIM_CALL_0].getFrame() == 1.0f) { + if (mParts[CROSS_BTN_PART_DOWN].isActive() && mCallCount0 < 3 && + mAnm[CROSS_BTN_ANIM_CALL_0].getFrame() == 1.0f) { SmallSoundManager::GetInstance()->playSound(SE_S_SG_CALL); mCallCount0++; } @@ -505,14 +515,15 @@ bool dLytMeterCrossBtn_c::execute() { } if (field_0x639 != 0) { - if (field_0x624 == 3) { + if (mIconTop == 3) { if (field_0x63A == 0) { mAnm[CROSS_BTN_ANIM_CALL_1].setToEnd(); mAnm[CROSS_BTN_ANIM_CALL_1].setAnimEnable(true); } if (mAnm[CROSS_BTN_ANIM_CALL_1].isEnabled()) { mAnm[CROSS_BTN_ANIM_CALL_1].play(); - if (mParts[0].isActive() && mCallCount1 < 3 && mAnm[CROSS_BTN_ANIM_CALL_1].getFrame() == 1.0f) { + if (mParts[CROSS_BTN_PART_TOP].isActive() && mCallCount1 < 3 && + mAnm[CROSS_BTN_ANIM_CALL_1].getFrame() == 1.0f) { SmallSoundManager::GetInstance()->playSound(SE_S_CATAPULT_READY); mCallCount1++; } @@ -525,7 +536,7 @@ bool dLytMeterCrossBtn_c::execute() { } if (field_0x63B != 0) { - if (field_0x620 == 2) { + if (mIconDown == 2) { if (field_0x63C == 0) { mAnm[CROSS_BTN_ANIM_CALL_2].setToEnd(); mAnm[CROSS_BTN_ANIM_CALL_2].setRate(2.0f); @@ -533,7 +544,7 @@ bool dLytMeterCrossBtn_c::execute() { } if (mAnm[CROSS_BTN_ANIM_CALL_2].isEnabled()) { mAnm[CROSS_BTN_ANIM_CALL_2].play(); - if (mParts[1].isActive() && mAnm[CROSS_BTN_ANIM_CALL_2].getFrame() == 1.0f) { + if (mParts[CROSS_BTN_PART_DOWN].isActive() && mAnm[CROSS_BTN_ANIM_CALL_2].getFrame() == 1.0f) { SmallSoundManager::GetInstance()->playSound(SE_S_BIRD_CALL); } } @@ -548,8 +559,8 @@ bool dLytMeterCrossBtn_c::execute() { mAnm[CROSS_BTN_ANIM_LOOP].play(); } - field_0x620 = 6; - field_0x624 = 6; + mIconDown = CROSS_ICON_NONE; + mIconTop = CROSS_ICON_NONE; // Might be arrays field_0x638 = field_0x637; field_0x637 = 0; @@ -563,13 +574,13 @@ bool dLytMeterCrossBtn_c::execute() { void dLytMeterCrossBtn_c::setOwnerPane(nw4r::lyt::Pane *pane) { mpOwnerPane = pane; - for (int i = 0; i < 4; i++) { + for (int i = 0; i < CROSS_BTN_NUM_PARTS; i++) { mParts[i].mpOwnerPane = pane; } } bool dLytMeterCrossBtn_c::fn_800FA730() const { - if (field_0x620 == 2) { + if (mIconDown == 2) { return true; } diff --git a/src/d/lyt/meter/d_lyt_meter_item_select.cpp b/src/d/lyt/meter/d_lyt_meter_item_select.cpp index 4b97558e..7d0b0d93 100644 --- a/src/d/lyt/meter/d_lyt_meter_item_select.cpp +++ b/src/d/lyt/meter/d_lyt_meter_item_select.cpp @@ -21,6 +21,7 @@ #include "toBeSorted/d_emitter.h" #include "toBeSorted/event_manager.h" #include "toBeSorted/minigame_mgr.h" +#include "toBeSorted/misc_actor.h" #include "toBeSorted/small_sound_mgr.h" STATE_DEFINE(dLytMeterItemSelectIcon_c, Wait); @@ -790,7 +791,7 @@ void dLytMeterItemSelect_c::finalizeState_SelectIn() { void dLytMeterItemSelect_c::initializeState_Select() {} void dLytMeterItemSelect_c::executeState_Select() { - if (dLytMeter_c::getCrossBtn0x7BF8() == 0 && dPad::checkButtonDpadDownPressed()) { + if (dLytMeter_c::getCrossIconDown() == 0 && dPad::checkButtonDpadDownPressed()) { if (field_0x5794 != I_INVALID) { field_0x5780 = 0.0f; mStateMgr.changeState(StateID_SetIn); @@ -2713,8 +2714,6 @@ s32 dLytMeterItemSelect_c::getBaseItemLytIndexforInternalId(s32 idx) const { return LYT_CMN_ItemInvalid; } -extern "C" bool checkIsInSkykeepPuzzle(); - bool dLytMeterItemSelect_c::isWheelBlockedByCurrentAction() { if (dAcPy_c::LINK->getRidingActorType() == dAcPy_c::RIDING_LOFTWING || dAcPy_c::LINK->checkActionFlags(dAcPy_c::FLG0_SWING_ROPE) || dAcPy_c::LINK->checkCurrentAction(0x9C) || From 8c30e45c13f18899ca0b06b8594332af72e64202 Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 16 May 2025 18:02:42 +0200 Subject: [PATCH 4/4] More enum while I'm at it --- include/d/lyt/meter/d_lyt_meter.h | 26 ++++++- include/d/lyt/msg_window/d_lyt_msg_window.h | 28 +++++++ .../msg_window/d_lyt_msg_window_select_btn.h | 2 +- src/d/d_tag_processor.cpp | 46 +++++++----- src/d/lyt/d_textbox.cpp | 3 +- src/d/lyt/meter/d_lyt_meter.cpp | 14 ++-- src/d/lyt/msg_window/d_lyt_msg_window.cpp | 74 ++++++++++--------- 7 files changed, 128 insertions(+), 65 deletions(-) diff --git a/include/d/lyt/meter/d_lyt_meter.h b/include/d/lyt/meter/d_lyt_meter.h index 6fa03ddd..c7618481 100644 --- a/include/d/lyt/meter/d_lyt_meter.h +++ b/include/d/lyt/meter/d_lyt_meter.h @@ -60,7 +60,6 @@ enum MeterFlag_e { METER_BTN_Z = 0x800, METER_BTN_0x1000 = 0x1000, - METER_BTN_CROSS = METER_BTN_CROSS_UP | METER_BTN_CROSS_DOWN | METER_BTN_CROSS_LEFT | METER_BTN_CROSS_RIGHT, }; @@ -68,6 +67,11 @@ class dLytMeterMain_c { friend class dLytMeter_c; public: + enum BasicPosition_e { + POSITION_NORMAL = 0, + POSITION_MAP = 1, + }; + dLytMeterMain_c(); virtual ~dLytMeterMain_c() {} @@ -169,8 +173,8 @@ private: /* 0x136DC */ mVec3_c mRupyPositions[7]; /* 0x13730 */ mVec3_c mShieldPos; /* 0x1373C */ mVec3_c mRupyPos; - /* 0x13748 */ s32 field_0x13748; - /* 0x1374C */ s32 field_0x1374C; + /* 0x13748 */ s32 mBasicPosition; + /* 0x1374C */ s32 mSavedBasicPosition; /* 0x13750 */ s32 field_0x13750; /* 0x13754 */ s32 field_0x13754; /* 0x13758 */ s32 mShieldPosIndex; @@ -264,6 +268,14 @@ public: return mMain.field_0x13770; } + bool getMeterField_0x13773() const { + return mMain.field_0x13773; + } + + void setMeterField_0x13773(bool value) { + mMain.field_0x13773 = value; + } + bool getMeterField_0x13774() const { return mMain.field_0x13774; } @@ -450,6 +462,14 @@ public: } } + dLytMeterMain_c::BasicPosition_e getBasicPosition() const { + return (dLytMeterMain_c::BasicPosition_e)mMain.mBasicPosition; + } + + void setBasicPosition(dLytMeterMain_c::BasicPosition_e pos) { + mMain.mBasicPosition = pos; + } + private: /* 0x00004 */ d2d::ResAccIf_c mResAcc; /* 0x00374 */ dLytMeterEventSkip_c *mpEventSkip; diff --git a/include/d/lyt/msg_window/d_lyt_msg_window.h b/include/d/lyt/msg_window/d_lyt_msg_window.h index c454767b..a11113e6 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window.h @@ -25,6 +25,34 @@ struct dLytMsgWindowCharData; class dLytMsgWindow_c { public: + enum MsgWindow_e { + MSG_WINDOW_0 = 0, + MSG_WINDOW_1 = 1, + + MSG_WINDOW_SWORD_FI = 2, + MSG_WINDOW_SWORD_GHIRAHIM = 3, + MSG_WINDOW_SWORD_LASTBOSS = 4, + MSG_WINDOW_GET = 5, + MSG_WINDOW_WOOD = 6, + MSG_WINDOW_STONE = 7, + + MSG_WINDOW_8 = 8, + + MSG_WINDOW_LINK = 9, + + MSG_WINDOW_10 = 10, + + MSG_WINDOW_22 = 22, + + MSG_WINDOW_DEMO = 30, + MSG_WINDOW_31 = 31, + + MSG_WINDOW_34 = 34, + + // Maybe none + MSG_WINDOW_36 = 36, + }; + dLytMsgWindow_c() : mStateMgr(*this) {} virtual ~dLytMsgWindow_c() {} diff --git a/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h b/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h index 43a0b409..3cdfd756 100644 --- a/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h +++ b/include/d/lyt/msg_window/d_lyt_msg_window_select_btn.h @@ -124,7 +124,7 @@ public: return *mStateMgr.getStateID() == StateID_Wait; } -private: +protected: s32 fn_8011FE50(); STATE_FUNC_DECLARE(dLytMsgWindowSelectBtn_c, Wait); diff --git a/src/d/d_tag_processor.cpp b/src/d/d_tag_processor.cpp index 0ef8892a..7da58f43 100644 --- a/src/d/d_tag_processor.cpp +++ b/src/d/d_tag_processor.cpp @@ -5,6 +5,7 @@ #include "d/d_message.h" #include "d/d_textunk.h" #include "d/d_textwindow_unk.h" +#include "d/lyt/msg_window/d_lyt_msg_window.h" #include "nw4r/lyt/lyt_types.h" #include "nw4r/ut/ut_CharWriter.h" #include "nw4r/ut/ut_Color.h" @@ -206,7 +207,7 @@ dTagProcessor_c::dTagProcessor_c() { field_0xEE3 = 0; field_0xEE4 = 0; field_0x004 = nullptr; - mMsgWindowSubtype = 0x24; + mMsgWindowSubtype = dLytMsgWindow_c::MSG_WINDOW_36; field_0x90D = 4; field_0xEF0 = 0; field_0xEF1 = 0; @@ -497,7 +498,9 @@ beginning: if (lineNum / getMaxNumLines(mMsgWindowSubtype) == unkArg) { nw4r::lyt::Size fontSize = field_0x004->GetFontSize(); posX = fn_800B8560(lineNum); - if ((mMsgWindowSubtype < 6 || mMsgWindowSubtype >= 10) && mMsgWindowSubtype != 30) { + if ((mMsgWindowSubtype < dLytMsgWindow_c::MSG_WINDOW_WOOD || + mMsgWindowSubtype >= dLytMsgWindow_c::MSG_WINDOW_10) && + mMsgWindowSubtype != dLytMsgWindow_c::MSG_WINDOW_DEMO) { posX = 0.0f; } @@ -513,7 +516,7 @@ beginning: if (textBox != nullptr) { currScale *= textBox->getMyScale(); } - if (mMsgWindowSubtype == 30) { + if (mMsgWindowSubtype == dLytMsgWindow_c::MSG_WINDOW_DEMO) { tmp3 = -2.0f; } else { tmp3 = 3.0f; @@ -804,12 +807,14 @@ nw4r::ut::Operation dTagProcessor_c::ProcessTags(nw4r::ut::Rect *rect, u16 ch, n } void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext *ctx, u8 cmdLen, wchar_t *ptr) { - if (mMsgWindowSubtype != 22 && mMsgWindowSubtype != 30 && field_0xEE0 != 0) { + if (mMsgWindowSubtype != dLytMsgWindow_c::MSG_WINDOW_22 && mMsgWindowSubtype != dLytMsgWindow_c::MSG_WINDOW_DEMO && + field_0xEE0 != 0) { int arg = ptr[0]; nw4r::lyt::Size textBoxSize = field_0x004->GetSize(); nw4r::lyt::Size fontSize = field_0x004->GetFontSize(); int i1 = getMaxNumLines(mMsgWindowSubtype); - if (arg % i1 == 0 && mMsgWindowSubtype != 31 && mMsgWindowSubtype != 8) { + if (arg % i1 == 0 && mMsgWindowSubtype != dLytMsgWindow_c::MSG_WINDOW_31 && + mMsgWindowSubtype != dLytMsgWindow_c::MSG_WINDOW_8) { int u = 0; int v = 0; for (int i = arg; i < arg + getMaxNumLines(mMsgWindowSubtype) && i < 0x32; i++) { @@ -854,7 +859,9 @@ void dTagProcessor_c::fn_800B4FF0(nw4r::ut::Rect *rect, nw4r::ut::PrintContext= 9) && mMsgWindowSubtype != 30) { + if ((mMsgWindowSubtype < dLytMsgWindow_c::MSG_WINDOW_WOOD || + mMsgWindowSubtype >= dLytMsgWindow_c::MSG_WINDOW_LINK) && + mMsgWindowSubtype != 30) { margin = 0.0f; } if (margin > 0.0f) { @@ -872,14 +879,14 @@ void dTagProcessor_c::setColor(nw4r::ut::Rect *rect, nw4r::ut::PrintContext= 2 && mMsgWindowSubtype < 5) { + } else if (cmd == 3 && mMsgWindowSubtype >= dLytMsgWindow_c::MSG_WINDOW_SWORD_FI && + mMsgWindowSubtype < dLytMsgWindow_c::MSG_WINDOW_SWORD_FI + 3) { c1.r = 0x50; c1.g = 0xE6; c1.b = 0xFA; @@ -1261,23 +1269,23 @@ void dTagProcessor_c::setStringArg(const wchar_t *arg, s32 index) { f32 dTagProcessor_c::fn_800B8040(s8 factor, u32 windowType) { // Fun little recursion here f32 f1 = UnkTextThing::getFn800B1F70(); - if (windowType == 6) { + if (windowType == dLytMsgWindow_c::MSG_WINDOW_WOOD) { f32 f2 = fn_800B8040(0, 0); f32 f3 = fn_800B8040(factor, 0); return f1 * ((f3 / f2) * 0.93f); - } else if (windowType == 7) { + } else if (windowType == dLytMsgWindow_c::MSG_WINDOW_STONE) { f32 f2 = fn_800B8040(0, 0); f32 f3 = fn_800B8040(factor, 0); return f1 * ((f3 / f2) * 0.9f); - } else if (windowType == 9) { + } else if (windowType == dLytMsgWindow_c::MSG_WINDOW_LINK) { f32 f2 = fn_800B8040(0, 0); f32 f3 = fn_800B8040(factor, 0); return f1 * ((f3 / f2) * 0.68f); - } else if (windowType == 30) { + } else if (windowType == dLytMsgWindow_c::MSG_WINDOW_DEMO) { f32 f2 = fn_800B8040(0, 0); f32 f3 = fn_800B8040(factor, 0); return f1 * ((f3 / f2) * 0.9f); - } else if (windowType == 34) { + } else if (windowType == dLytMsgWindow_c::MSG_WINDOW_34) { f32 f2 = fn_800B8040(0, 0); f32 f3 = fn_800B8040(factor, 0); return f1 * ((f3 / f2) * 0.86f); @@ -1296,11 +1304,11 @@ f32 dTagProcessor_c::fn_800B8040(s8 factor, u32 windowType) { } s32 dTagProcessor_c::getMaxNumLines(s32 arg) { - if (arg >= 6 && arg < 8) { + if (arg >= dLytMsgWindow_c::MSG_WINDOW_WOOD && arg < dLytMsgWindow_c::MSG_WINDOW_WOOD + 2) { return 4; - } else if (arg == 9) { + } else if (arg == dLytMsgWindow_c::MSG_WINDOW_LINK) { return 2; - } else if (arg == 30) { + } else if (arg == dLytMsgWindow_c::MSG_WINDOW_DEMO) { return 2; } return 4; diff --git a/src/d/lyt/d_textbox.cpp b/src/d/lyt/d_textbox.cpp index 6bf867fb..8d97b56d 100644 --- a/src/d/lyt/d_textbox.cpp +++ b/src/d/lyt/d_textbox.cpp @@ -5,6 +5,7 @@ #include "d/d_message.h" #include "d/d_tag_processor.h" #include "d/d_textunk.h" +#include "d/lyt/msg_window/d_lyt_msg_window.h" #include "libms/msgfile.h" #include "m/m_color.h" #include "nw4r/lyt/lyt_common.h" @@ -500,7 +501,7 @@ void dTextBox_c::init() { SetFontSize(sz); mMyTextScale = sz; mMyScale = 1.0f; - mWindowSubtype = 0x24; + mWindowSubtype = dLytMsgWindow_c::MSG_WINDOW_36; field_0x201 = true; } diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 35842b0f..00789d34 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -849,8 +849,8 @@ bool dLytMeterMain_c::build(d2d::ResAccIf_c *resAcc) { } s32 zero = 0; - field_0x1374C = 0; - field_0x13748 = 0; + mSavedBasicPosition = 0; + mBasicPosition = POSITION_NORMAL; field_0x13750 = 4; field_0x13770 = 3; field_0x13774 = 0; @@ -1005,7 +1005,7 @@ void dLytMeterMain_c::fn_800D5290() { } bool dLytMeterMain_c::fn_800D5350() { - if (field_0x13748 == 1 && dMessage_c::getInstance()->getField_0x328()) { + if (mBasicPosition == POSITION_MAP && dMessage_c::getInstance()->getField_0x328()) { return true; } return false; @@ -1519,7 +1519,7 @@ bool dLytMeterMain_c::execute() { meter->clearFlags(METER_BTN_PLUS); } - if (field_0x13750 != 0 && field_0x13748 == 1) { + if (field_0x13750 != 0 && mBasicPosition == POSITION_MAP) { fn_800D5290(); } @@ -1606,9 +1606,9 @@ bool dLytMeterMain_c::execute() { mNodes[METER_SHIELD].mpPane->SetTranslate(mShieldPos); } - if (field_0x13748 != field_0x1374C) { - field_0x1374C = field_0x13748; - mAnmGroups[METER_ANIM_POSITION].setFrame(field_0x13748); + if (mBasicPosition != mSavedBasicPosition) { + mSavedBasicPosition = mBasicPosition; + mAnmGroups[METER_ANIM_POSITION].setFrame(mBasicPosition); mAnmGroups[METER_ANIM_POSITION].setAnimEnable(true); } diff --git a/src/d/lyt/msg_window/d_lyt_msg_window.cpp b/src/d/lyt/msg_window/d_lyt_msg_window.cpp index 6317e712..3f935e28 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window.cpp @@ -14,6 +14,7 @@ // clang-format off // vtable order +#include "d/lyt/meter/d_lyt_meter.h" #include "d/lyt/msg_window/d_lyt_msg_window_common.h" #include "d/lyt/msg_window/d_lyt_msg_window_talk.h" #include "d/lyt/msg_window/d_lyt_msg_window_link.h" @@ -167,6 +168,9 @@ bool dLytMsgWindow_c::remove() { void dLytMsgWindow_c::initializeState_Invisible() {} void dLytMsgWindow_c::executeState_Invisible() { + if (!EventManager::isInEvent() && dLytMeter_c::GetInstance()->getMeterField_0x13773()) { + dLytMeter_c::GetInstance()->setMeterField_0x13773(false); + } if (dMessage_c::getInstance()->getField_0x329()) { mStateMgr.changeState(StateID_MapOpen); } else if (dMessage_c::getInstance()->getField_0x32A()) { @@ -179,7 +183,7 @@ void dLytMsgWindow_c::executeState_Invisible() { if (field_0x1220 == 0) { if (field_0x80D != 0) { - if (mpTagProcessor->getMsgWindowSubtype() == 0x16) { + if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_22) { mpAutoCaption = new dLytAutoCaption_c(); mpAutoCaption->build(&mResAcc1, &mResAcc2, mpTagProcessor); mpCurrentSubtype = mpAutoCaption; @@ -200,29 +204,29 @@ void dLytMsgWindow_c::executeState_Invisible() { createSubMsgManager(mpTagProcessor->getMsgWindowSubtype()); field_0x828 = nullptr; mSpecialFiMenuValue = FiContext::KEN8_Nevermind; - if (mpTagProcessor->getMsgWindowSubtype() == 6) { + if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_WOOD) { mpCurrentSubtype = mpWindowWood; dTextBox_c *box = mpCurrentSubtype->getTextBox(); mpMsgWindowUnk->fn_800B2130(mNameCopy, box, nullptr, true); mpMsgWindowUnk->textAdvancingRelated(true, true); setTextToDisplay(mpMsgWindowUnk->getProcessedText()); - } else if (mpTagProcessor->getMsgWindowSubtype() == 7) { + } else if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_STONE) { mpCurrentSubtype = mpWindowStone; dTextBox_c *box = mpCurrentSubtype->getTextBox(); mpMsgWindowUnk->fn_800B2130(mNameCopy, box, nullptr, true); mpMsgWindowUnk->textAdvancingRelated(true, true); setTextToDisplay(mpMsgWindowUnk->getProcessedText()); - } else if (mpTagProcessor->getMsgWindowSubtype() >= 2 && - mpTagProcessor->getMsgWindowSubtype() < 5) { + } else if (mpTagProcessor->getMsgWindowSubtype() >= MSG_WINDOW_SWORD_FI && + mpTagProcessor->getMsgWindowSubtype() < MSG_WINDOW_SWORD_FI + 3) { mpCurrentSubtype = mpWindowSword; field_0x828 = mpWindowSword->getCharData(); - } else if (mpTagProcessor->getMsgWindowSubtype() == 9) { + } else if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_LINK) { mpCurrentSubtype = mpWindowLink; field_0x828 = mpWindowLink->getCharData(); - } else if (mpTagProcessor->getMsgWindowSubtype() == 5) { + } else if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_GET) { mpCurrentSubtype = mpWindowGet; field_0x828 = mpWindowGet->getCharData(); - } else if (mpTagProcessor->getMsgWindowSubtype() == 30) { + } else if (mpTagProcessor->getMsgWindowSubtype() == MSG_WINDOW_DEMO) { mpCurrentSubtype = mpWindowDemo; field_0x828 = mpWindowDemo->getCharData(); dTextBox_c *box = mpCurrentSubtype->getTextBox(); @@ -298,9 +302,10 @@ void dLytMsgWindow_c::executeState_OutputText() { } } - if (mpTagProcessor->getMsgWindowSubtype() >= 2 && mpTagProcessor->getMsgWindowSubtype() < 5) { + if (mpTagProcessor->getMsgWindowSubtype() >= MSG_WINDOW_SWORD_FI && + mpTagProcessor->getMsgWindowSubtype() < MSG_WINDOW_SWORD_FI + 3) { fn_803998A0(lbl_80575DE0, mpMsgWindowUnk->getField_0x147A(), mpMsgWindowUnk->getField_0x147C()); - } else if (mpTagProcessor->getMsgWindowSubtype() <= 1 && oldValue != mpMsgWindowUnk->getField_0x147A()) { + } else if (mpTagProcessor->getMsgWindowSubtype() <= MSG_WINDOW_1 && oldValue != mpMsgWindowUnk->getField_0x147A()) { u16 a = mpMsgWindowUnk->getField_0x147C(); f32 b = (dTagProcessor_c::fn_800B8040(0, 0) * 100.0f); SmallSoundManager::GetInstance()->playButtonPressSoundWhenAdvancingTextBoxes(a / b); @@ -362,7 +367,8 @@ void dLytMsgWindow_c::executeState_WaitKeyChangePage0() { mStateMgr.changeState(StateID_WaitKeyChangePage1); } else { mpMsgWindowUnk->fn_800B2AA0(); - if (mpTagProcessor->getMsgWindowSubtype() >= 6 && mpTagProcessor->getMsgWindowSubtype() < 8) { + if (mpTagProcessor->getMsgWindowSubtype() >= MSG_WINDOW_WOOD && + mpTagProcessor->getMsgWindowSubtype() < MSG_WINDOW_WOOD + 2) { mpMsgWindowUnk->textAdvancingRelated(true, true); } setTextToDisplay(mpMsgWindowUnk->getProcessedText()); @@ -377,7 +383,8 @@ void dLytMsgWindow_c::executeState_WaitKeyChangePage1() { if (mpCurrentSubtype->startDecide(false)) { field_0x817 = 0; mpMsgWindowUnk->fn_800B2AA0(); - if (mpTagProcessor->getMsgWindowSubtype() >= 6 && mpTagProcessor->getMsgWindowSubtype() < 8) { + if (mpTagProcessor->getMsgWindowSubtype() >= MSG_WINDOW_WOOD && + mpTagProcessor->getMsgWindowSubtype() < MSG_WINDOW_WOOD + 2) { mpMsgWindowUnk->textAdvancingRelated(true, true); } setTextToDisplay(mpMsgWindowUnk->getProcessedText()); @@ -487,18 +494,15 @@ void dLytMsgWindow_c::initializeState_WaitKeySelectQuestion() { mSelectBtn.setField_0x990(tmp); mSelectBtn.setTagProcessor(mpTagProcessor); - wchar_t **buf = sBufs; - - buf[0] = mpTagProcessor->getBuf(0); - buf[1] = mpTagProcessor->getBuf(1); - buf[2] = mpTagProcessor->getBuf(2); - buf[3] = mpTagProcessor->getBuf(3); + for (s32 i = 0; i < 4; i++) { + sBufs[i] = mpTagProcessor->getBuf(i); + } mSelectBtn.fn_8011E5D0(field_0x824, true); - for (int i = 0; i < field_0x824; i++) { - for (int j = 0; j < 2; j++) { - mSelectBtn.getSelectTextBox(i, j)->setTextWithGlobalTextProcessor(buf[i]); + for (s32 i = 0, option = 0; i < field_0x824; option++, i++) { + for (s32 j = 0; j < 2; j++) { + mSelectBtn.getSelectTextBox(option, j)->setTextWithGlobalTextProcessor(sBufs[i]); } } } @@ -558,7 +562,13 @@ void dLytMsgWindow_c::executeState_WaitKeyMapClose() { void dLytMsgWindow_c::finalizeState_WaitKeyMapClose() {} void dLytMsgWindow_c::initializeState_MapClose() {} -void dLytMsgWindow_c::executeState_MapClose() {} +void dLytMsgWindow_c::executeState_MapClose() { + if (dLytMeter_c::GetInstance()->getBasicPosition() == dLytMeterMain_c::POSITION_NORMAL) { + dMessage_c::getInstance()->setField_0x32A(false); + dMessage_c::getInstance()->clearLightPillarRelatedArgs(); + mStateMgr.changeState(StateID_Invisible); + } +} void dLytMsgWindow_c::finalizeState_MapClose() {} void dLytMsgWindow_c::initializeState_Out() { @@ -745,46 +755,42 @@ void dLytMsgWindow_c::setCurrentFlowFilename(const char *name) { void dLytMsgWindow_c::createSubMsgManager(u8 type) { switch (type) { - case 6: + case MSG_WINDOW_WOOD: mpWindowWood = new dLytMsgWindowWood_c(); mpWindowWood->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 7: + case MSG_WINDOW_STONE: mpWindowStone = new dLytMsgWindowStone_c(); mpWindowStone->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 2: + case MSG_WINDOW_SWORD_FI: mpWindowSword = new dLytMsgWindowSword_c(); mpWindowSword->setSwordType(dLytTextSword::FI); mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 3: + case MSG_WINDOW_SWORD_GHIRAHIM: mpWindowSword = new dLytMsgWindowSword_c(); mpWindowSword->setSwordType(dLytTextSword::GHIRAHIM); mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 4: + case MSG_WINDOW_SWORD_LASTBOSS: mpWindowSword = new dLytMsgWindowSword_c(); mpWindowSword->setSwordType(dLytTextSword::LASTBOSS); mpWindowSword->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 9: - // TODO Link + case MSG_WINDOW_LINK: mpWindowLink = new dLytMsgWindowLink_c(); mpWindowLink->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 5: - // TODO Get + case MSG_WINDOW_GET: mpWindowGet = new dLytMsgWindowGet_c(); mpWindowGet->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; - case 30: - // TODO Demo + case MSG_WINDOW_DEMO: mpWindowDemo = new dLytMsgWindowDemo_c(); mpWindowDemo->build(&mResAcc1, &mResAcc2, mpTagProcessor); break; default: - // TODO talk mpWindowTalk = new dLytMsgWindowTalk_c(); mpWindowTalk->build(&mResAcc1, &mResAcc2, mpTagProcessor); break;