From 596d5820e6d788cbf72a0a27346e9e7203f169cb Mon Sep 17 00:00:00 2001 From: robojumper Date: Sat, 19 Apr 2025 19:03:46 +0200 Subject: [PATCH] dLytMeter_c::fn_800D57B0 OK --- config/SOUE01/symbols.txt | 22 +- include/d/a/d_a_bird.h | 6 + include/d/a/d_a_player.h | 8 +- include/d/d_stage_mgr.h | 1 + include/d/flag/sceneflag_manager.h | 2 +- include/d/lyt/d_lyt_bird_gauge.h | 16 + include/d/lyt/d_lyt_boss_gauge.h | 9 +- include/d/lyt/d_lyt_do_button.h | 17 +- include/d/lyt/d_lyt_sky_gauge.h | 6 + include/d/lyt/d_lyt_unknowns.h | 4 +- include/d/lyt/meter/d_lyt_meter.h | 14 +- include/d/lyt/meter/d_lyt_meter_drink.h | 8 + include/d/lyt/meter/d_lyt_meter_item_select.h | 4 + include/d/lyt/meter/d_lyt_meter_key.h | 12 + include/d/lyt/meter/d_lyt_meter_minus_btn.h | 3 +- include/d/lyt/meter/d_lyt_meter_plus_btn.h | 4 + include/d/lyt/meter/d_lyt_meter_rupy.h | 4 + .../d/lyt/meter/d_lyt_meter_shield_gauge.h | 4 + include/d/lyt/meter/d_lyt_meter_timer.h | 4 +- .../d/lyt/msg_window/d_lyt_simple_window.h | 19 + include/toBeSorted/minigame_mgr.h | 1 + src/d/flag/sceneflag_manager.inc | 2 +- src/d/lyt/meter/d_lyt_meter.cpp | 414 ++++++++++++++++++ 23 files changed, 562 insertions(+), 22 deletions(-) create mode 100644 include/d/lyt/msg_window/d_lyt_simple_window.h diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index a0eac5fd..ae9d961c 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -3632,7 +3632,7 @@ create__15MinigameManagerFv = .text:0x800A5160; // type:function size:0x50 destroy__15MinigameManagerFv = .text:0x800A51B0; // type:function size:0x44 fn_800A5200 = .text:0x800A5200; // type:function size:0x40 execute__15MinigameManagerFv = .text:0x800A5240; // type:function size:0x30 -isSpecialMinigameState1 = .text:0x800A5270; // type:function size:0x2C +isInAnyMinigame__15MinigameManagerFv = .text:0x800A5270; // type:function size:0x2C isInMinigameState__15MinigameManagerFQ215MinigameManager8Minigame = .text:0x800A52A0; // type:function size:0x28 setNextStoredSpecialMinigameState = .text:0x800A52D0; // type:function size:0x54 endSpecialMinigameState = .text:0x800A5330; // type:function size:0x50 @@ -4743,14 +4743,14 @@ __dt__15dLytBossGauge_cFv = .text:0x800D5180; // type:function size:0x108 fn_800D5290__11dLytMeter_cFv = .text:0x800D5290; // type:function size:0xB4 fn_800D5350 = .text:0x800D5350; // type:function size:0x30 fn_800D5380__11dLytMeter_cFUc = .text:0x800D5380; // type:function size:0x44 -fn_800D53D0 = .text:0x800D53D0; // type:function size:0x50 -fn_800D5420 = .text:0x800D5420; // type:function size:0x114 +fn_800D53D0__11dLytMeter_cFv = .text:0x800D53D0; // type:function size:0x50 +fn_800D5420__11dLytMeter_cFv = .text:0x800D5420; // type:function size:0x114 isSilentRealm__11dLytMeter_cFv = .text:0x800D5540; // type:function size:0x4C -fn_800D5590 = .text:0x800D5590; // type:function size:0x98 +fn_800D5590__11dLytMeter_cFv = .text:0x800D5590; // type:function size:0x98 fn_800D5630 = .text:0x800D5630; // type:function size:0x18 fn_800D5650__11dLytMeter_cFv = .text:0x800D5650; // type:function size:0x24 fn_800D5680__11dLytMeter_cFv = .text:0x800D5680; // type:function size:0x28 -fn_800D56B0 = .text:0x800D56B0; // type:function size:0xFC +fn_800D56B0__11dLytMeter_cFv = .text:0x800D56B0; // type:function size:0xFC fn_800D57B0__11dLytMeter_cFv = .text:0x800D57B0; // type:function size:0x1A58 execute__11dLytMeter_cFv = .text:0x800D7210; // type:function size:0x92C fn_800D7B40__15dLytMsgWindow_cFv = .text:0x800D7B40; // type:function size:0xC @@ -6532,7 +6532,7 @@ 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 fn_8010E3D0 = .text:0x8010E3D0; // type:function size:0x1F0 -LytDoButton__setActionTextStuff = .text:0x8010E5C0; // type:function size:0x10 +setActionTextStuffInternal__14dLytDobutton_cFllb = .text:0x8010E5C0; // type:function size:0x10 fn_8010E5D0__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 @@ -7404,7 +7404,7 @@ fn_8012AE70 = .text:0x8012AE70; // type:function size:0x8 LytSimpleWindow__displayText = .text:0x8012AE80; // type:function size:0x11C fn_8012AFA0 = .text:0x8012AFA0; // type:function size:0x4C fn_8012AFF0 = .text:0x8012AFF0; // type:function size:0x10 -fn_8012B000 = .text:0x8012B000; // type:function size:0x50 +fn_8012B000__18dLytSimpleWindow_cFv = .text:0x8012B000; // type:function size:0x50 fn_8012B050 = .text:0x8012B050; // type:function size:0xD4 fn_8012B130 = .text:0x8012B130; // type:function size:0xF4 fn_8012B230 = .text:0x8012B230; // type:function size:0xA4 @@ -8727,7 +8727,7 @@ build__15dLytBossGauge_cFv = .text:0x801585D0; // type:function size:0x188 execute__15dLytBossGauge_cFv = .text:0x80158760; // type:function size:0x100 draw__15dLytBossGauge_cFv = .text:0x80158860; // type:function size:0x68 remove__15dLytBossGauge_cFv = .text:0x801588D0; // type:function size:0x5C -fn_80158930 = .text:0x80158930; // type:function size:0x10 +setMode__15dLytBossGauge_cFl = .text:0x80158930; // type:function size:0x10 fn_80158940 = .text:0x80158940; // type:function size:0x108 __sinit_\d_lyt_boss_gauge_cpp = .text:0x80158A50; // type:function size:0x338 scope:local __dt__30sFStateID_c<15dLytBossGauge_c>Fv = .text:0x80158D90; // type:function size:0x58 @@ -10573,7 +10573,7 @@ StageManager__isAreaTypeNormal = .text:0x80199880; // type:function size:0x28 isAreaTypeDungeon__11dStageMgr_cCFv = .text:0x801998B0; // type:function size:0x2C StageManager__isAreaTypeBoss = .text:0x801998E0; // type:function size:0x2C StageManager__isAreaTypeSkyloft = .text:0x80199910; // type:function size:0x2C -StageManager__isAreaTypeHouse = .text:0x80199940; // type:function size:0x2C +isAreaTypeHouse__11dStageMgr_cCFv = .text:0x80199940; // type:function size:0x2C isAreaTypeSky__11dStageMgr_cCFv = .text:0x80199970; // type:function size:0x2C isAreaTypeOverworldOrSkyloft__11dStageMgr_cCFv = .text:0x801999A0; // type:function size:0x3C isAreaTypeDungeonOrBoss__11dStageMgr_cCFv = .text:0x801999E0; // type:function size:0x3C @@ -12452,7 +12452,7 @@ fn_802079B0 = .text:0x802079B0; // type:function size:0x728 ActorLink__firstPersonRelate = .text:0x802080E0; // type:function size:0x118 FileManager__isSelectedSlotNotDowsable = .text:0x80208200; // type:function size:0x58 fn_80208260 = .text:0x80208260; // type:function size:0x20 -canDowseProbably = .text:0x80208280; // type:function size:0xD4 +canDowseProbably__7dAcPy_cCFv = .text:0x80208280; // type:function size:0xD4 fn_80208360 = .text:0x80208360; // type:function size:0x2F0 fn_80208650 = .text:0x80208650; // type:function size:0x290 startDowsing = .text:0x802088E0; // type:function size:0x78 @@ -40107,7 +40107,7 @@ sInstance__20LytBirdButtonRelated = .sbss:0x80575480; // type:object size:0x8 da 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 -LYT_SIMPLE_WINDOW = .sbss:0x80575498; // type:object size:0x8 data:4byte +sInstance__18dLytSimpleWindow_c = .sbss:0x80575498; // type:object size:0x8 data:4byte lbl_805754A0 = .sbss:0x805754A0; // type:object size:0x8 data:4byte sMapFaderColor = .sbss:0x805754A8; // type:object size:0x4 data:byte lbl_805754AC = .sbss:0x805754AC; // type:object size:0x1 data:byte diff --git a/include/d/a/d_a_bird.h b/include/d/a/d_a_bird.h index af91133f..42db16b8 100644 --- a/include/d/a/d_a_bird.h +++ b/include/d/a/d_a_bird.h @@ -26,8 +26,14 @@ public: STATE_FUNC_DECLARE(dBird_c, MiniGameEnd); STATE_FUNC_DECLARE(dBird_c, MiniGameLevelUpDemo); + s16 getNumDashes() const { + return mNumDashes; + } + private: /* 0x??? */ STATE_MGR_DECLARE(dBird_c); + u8 _0x36C[0xF8E - 0x36C]; + /* 0xF8E */ s16 mNumDashes; }; #endif diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 7adcc2dd..32297c77 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -193,7 +193,7 @@ public: /* vt 0x254 */ virtual void isAttackingUnderground(); /* vt 0x258 */ virtual void vt_0x258(); /* vt 0x25C */ virtual void vt_0x25C(); - /* vt 0x260 */ virtual void vt_0x260(); + /* vt 0x260 */ virtual f32 vt_0x260() const; /* vt 0x264 */ virtual void getGroosenatorIfIn(); /* vt 0x268 */ virtual void setActorRef11(); /* vt 0x26C */ virtual void doesGameOver(); @@ -290,6 +290,10 @@ public: return mCurrentAction == action; } + bool isSittingOrUnk0xAE() const { + return mCurrentAction == 0xAD || mCurrentAction == 0xAE; + } + inline bool checkSwordAndMoreStates(u32 mask) const { return (mSwordAndMoreStates & mask) != 0; } @@ -338,6 +342,8 @@ public: static bool isItemRestrictedByBokoBase(ITEM_ID item); static u32 getCurrentHealthCapacity(); + + bool canDowseProbably() const; }; #endif diff --git a/include/d/d_stage_mgr.h b/include/d/d_stage_mgr.h index d4a3a805..f2f91e41 100644 --- a/include/d/d_stage_mgr.h +++ b/include/d/d_stage_mgr.h @@ -49,6 +49,7 @@ public: public: bool isAreaTypeDungeon() const; bool isAreaTypeSky() const; + bool isAreaTypeHouse() const; bool isAreaTypeDungeonOrBoss() const; bool isAreaTypeOverworldOrSkyloft() const; s32 getSTIFunk1() const; diff --git a/include/d/flag/sceneflag_manager.h b/include/d/flag/sceneflag_manager.h index b65c21df..dbb36b92 100644 --- a/include/d/flag/sceneflag_manager.h +++ b/include/d/flag/sceneflag_manager.h @@ -51,7 +51,7 @@ public: return checkUncommittedTempOrSceneflag(flag); } u16 checkFlag(u16 roomId, u16 flag); - bool checkSceneflagGlobal(u16 sceneIdx, u16 flag); + u16 checkSceneflagGlobal(u16 sceneIdx, u16 flag); u16 checkTempOrSceneflag(u16 flag); u16 checkUncommittedFlag(u16 roomId, u16 flag); void setZoneflag(u16 roomId, u16 flag); diff --git a/include/d/lyt/d_lyt_bird_gauge.h b/include/d/lyt/d_lyt_bird_gauge.h index e05fc963..68532922 100644 --- a/include/d/lyt/d_lyt_bird_gauge.h +++ b/include/d/lyt/d_lyt_bird_gauge.h @@ -71,6 +71,22 @@ public: void hide(); + void setNumDashes(s32 num) { + mGameStateDashes = num; + } + + void setField_0x690(bool val) { + field_0x690 = val; + } + + bool getField_0x692() const { + return field_0x692; + } + + bool getField_0x693() const { + return field_0x693; + } + private: static dLytBirdGauge_c *sInstance; diff --git a/include/d/lyt/d_lyt_boss_gauge.h b/include/d/lyt/d_lyt_boss_gauge.h index ab959bf7..f62eea3b 100644 --- a/include/d/lyt/d_lyt_boss_gauge.h +++ b/include/d/lyt/d_lyt_boss_gauge.h @@ -3,7 +3,6 @@ #include "d/lyt/d2d.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" class dLytBossGauge_c { public: @@ -15,6 +14,12 @@ public: bool execute(); bool draw(); + void setMode(s32 mode); + + void setField_0x545(bool value) { + field_0x545 = value; + } + private: STATE_FUNC_DECLARE(dLytBossGauge_c, None); STATE_FUNC_DECLARE(dLytBossGauge_c, In); @@ -25,6 +30,8 @@ private: /* 0x040 */ d2d::ResAccIf_c mResAcc; /* 0x3B0 */ d2d::dLytSub mLyt; /* 0x444 */ d2d::AnmGroup_c mAnmGroups[4]; + /* 0x544 */ u8 field_0x544; + /* 0x545 */ bool field_0x545; }; #endif diff --git a/include/d/lyt/d_lyt_do_button.h b/include/d/lyt/d_lyt_do_button.h index bb55159f..7970f6d5 100644 --- a/include/d/lyt/d_lyt_do_button.h +++ b/include/d/lyt/d_lyt_do_button.h @@ -39,6 +39,14 @@ public: } } + static s32 getNextActionToShow() { + if (sInstance != nullptr) { + return sInstance->mNextDoActionToShow; + } else { + return 0x29; + } + } + static s32 getFn0x8010E5E0() { if (sInstance != nullptr) { return sInstance->fn_8010E5E0(); @@ -54,8 +62,15 @@ public: return 0x5E; } } - + + 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 fn_8010E5E0() const; diff --git a/include/d/lyt/d_lyt_sky_gauge.h b/include/d/lyt/d_lyt_sky_gauge.h index fb9b6b63..af606b77 100644 --- a/include/d/lyt/d_lyt_sky_gauge.h +++ b/include/d/lyt/d_lyt_sky_gauge.h @@ -68,6 +68,12 @@ public: void setHeight(f32 height); static dLytSkyGauge_c *sInstance; + void setWantsIn() { + mWantsIn = true; + } + void setWantsOut() { + mWantsOut = true; + } private: STATE_FUNC_DECLARE(dLytSkyGauge_c, None); diff --git a/include/d/lyt/d_lyt_unknowns.h b/include/d/lyt/d_lyt_unknowns.h index a6f22db2..29b8233b 100644 --- a/include/d/lyt/d_lyt_unknowns.h +++ b/include/d/lyt/d_lyt_unknowns.h @@ -47,8 +47,8 @@ public: }; static void set(DoButton_e button, Action_e value) { - LytDoButtonRelated *b = sInstance; - if (b != nullptr) { + if (sInstance != nullptr) { + LytDoButtonRelated *b = sInstance; b->field_0x04[button] = value; b->field_0x34[button] = true; } diff --git a/include/d/lyt/meter/d_lyt_meter.h b/include/d/lyt/meter/d_lyt_meter.h index 4c2e158e..b88378de 100644 --- a/include/d/lyt/meter/d_lyt_meter.h +++ b/include/d/lyt/meter/d_lyt_meter.h @@ -72,14 +72,18 @@ public: bool fn_800D5380(u8); bool fn_800D5290(); + bool fn_800D5590(); bool fn_800D5650(); bool fn_800D5680(); bool fn_800D56B0(); - bool fn_800D57B0(); + void fn_800D57B0(); bool execute(); bool isSilentRealm(); + bool fn_800D53D0(); + bool fn_800D5420(); + void setUiMode(u16 value) const; u8 getUiMode(); @@ -334,6 +338,14 @@ public: } } + static u8 getField_0x13B66() { + if (sInstance != nullptr) { + return sInstance->field_0x13B66; + } else { + return 0; + } + } + static u8 getDowsing0x550A() { if (sInstance != nullptr) { return sInstance->mMeter.mDowsing.getField_0x550A(); diff --git a/include/d/lyt/meter/d_lyt_meter_drink.h b/include/d/lyt/meter/d_lyt_meter_drink.h index b6c4d8b7..7ba0fe9f 100644 --- a/include/d/lyt/meter/d_lyt_meter_drink.h +++ b/include/d/lyt/meter/d_lyt_meter_drink.h @@ -72,6 +72,14 @@ public: bool draw(); bool execute(); + void setShouldBeVisible(bool v) { + field_0x6F4 = v; + } + + void setField_0x6E0(const mVec3_c &v) { + field_0x6E0 = v; + } + private: bool fn_800E5C40(int); int getPartForDrinkType(dLytMeterDrinkParts_c::DrinkType_e ty) const; diff --git a/include/d/lyt/meter/d_lyt_meter_item_select.h b/include/d/lyt/meter/d_lyt_meter_item_select.h index 42100c1c..b076302a 100644 --- a/include/d/lyt/meter/d_lyt_meter_item_select.h +++ b/include/d/lyt/meter/d_lyt_meter_item_select.h @@ -203,6 +203,10 @@ public: return field_0x57A2; } + u8 getField_0x5794() const { + return field_0x5794; + } + private: void setBtnItem(s32 internalItem); void realizeSelectedWheelItem(); diff --git a/include/d/lyt/meter/d_lyt_meter_key.h b/include/d/lyt/meter/d_lyt_meter_key.h index fef29a9f..43885d4e 100644 --- a/include/d/lyt/meter/d_lyt_meter_key.h +++ b/include/d/lyt/meter/d_lyt_meter_key.h @@ -19,6 +19,10 @@ public: void setPosition(s32 position); + void setShouldBeVisible(bool v) { + mShouldBeVisible = v; + } + private: STATE_FUNC_DECLARE(dLytMeterKakeraKey_c, Wait); STATE_FUNC_DECLARE(dLytMeterKakeraKey_c, On); @@ -61,6 +65,10 @@ public: void setPosition(s32 position); + void setShouldBeVisible(bool v) { + mShouldBeVisible = v; + } + private: STATE_FUNC_DECLARE(dLytMeterBossKey_c, Wait); STATE_FUNC_DECLARE(dLytMeterBossKey_c, On); @@ -100,6 +108,10 @@ public: void setPosition(s32 position); + void setShouldBeVisible(bool v) { + mShouldBeVisible = v; + } + private: STATE_FUNC_DECLARE(dLytMeterSmallKey_c, Wait); STATE_FUNC_DECLARE(dLytMeterSmallKey_c, On); diff --git a/include/d/lyt/meter/d_lyt_meter_minus_btn.h b/include/d/lyt/meter/d_lyt_meter_minus_btn.h index 653305d8..5bc90743 100644 --- a/include/d/lyt/meter/d_lyt_meter_minus_btn.h +++ b/include/d/lyt/meter/d_lyt_meter_minus_btn.h @@ -129,10 +129,11 @@ public: void setField_0x4E80(s32 value) { field_0x4E80 = value; } + + bool fn_800F75E0() const; private: bool shouldCall() const; - bool fn_800F75E0() const; void fn_800F7300(); bool fn_800F7600() const; bool fn_800F7760() const; diff --git a/include/d/lyt/meter/d_lyt_meter_plus_btn.h b/include/d/lyt/meter/d_lyt_meter_plus_btn.h index 9e934f0c..ccbe9781 100644 --- a/include/d/lyt/meter/d_lyt_meter_plus_btn.h +++ b/include/d/lyt/meter/d_lyt_meter_plus_btn.h @@ -31,6 +31,10 @@ public: mpOwnerPane = pane; } + bool getField_0x1C0() const { + return field_0x1C0; + } + private: void setMessage(s32 id); bool isMapOpen() const; diff --git a/include/d/lyt/meter/d_lyt_meter_rupy.h b/include/d/lyt/meter/d_lyt_meter_rupy.h index f2d3c06c..cacdbc88 100644 --- a/include/d/lyt/meter/d_lyt_meter_rupy.h +++ b/include/d/lyt/meter/d_lyt_meter_rupy.h @@ -109,6 +109,10 @@ public: field_0x8AC = val; } + void setSize(u8 size) { + mSize = size; + } + private: bool updateDisplayedAmount(bool suppressSound); bool hasChangeInRupees() const; diff --git a/include/d/lyt/meter/d_lyt_meter_shield_gauge.h b/include/d/lyt/meter/d_lyt_meter_shield_gauge.h index 12a4d730..fb8ee441 100644 --- a/include/d/lyt/meter/d_lyt_meter_shield_gauge.h +++ b/include/d/lyt/meter/d_lyt_meter_shield_gauge.h @@ -39,6 +39,10 @@ public: field_0x318 = v; } + u8 getField_0x31D() const { + return field_0x31D; + } + private: s32 getLytFrameForShield(s32) const; void setLevel(f32 level); diff --git a/include/d/lyt/meter/d_lyt_meter_timer.h b/include/d/lyt/meter/d_lyt_meter_timer.h index 1d6c1d61..85f7c42f 100644 --- a/include/d/lyt/meter/d_lyt_meter_timer.h +++ b/include/d/lyt/meter/d_lyt_meter_timer.h @@ -245,10 +245,10 @@ public: bool build(); bool remove(); bool execute(); - -private: bool startIn2(); bool startOut2(); + +private: void startIn(); void gotoChangeSiren(); void gotoSiren(); diff --git a/include/d/lyt/msg_window/d_lyt_simple_window.h b/include/d/lyt/msg_window/d_lyt_simple_window.h new file mode 100644 index 00000000..2356fd83 --- /dev/null +++ b/include/d/lyt/msg_window/d_lyt_simple_window.h @@ -0,0 +1,19 @@ +#ifndef D_LYT_SIMPLE_WINDOW_H +#define D_LYT_SIMPLE_WINDOW_H + +class dLytSimpleWindow_c { +public: + dLytSimpleWindow_c() {} + virtual ~dLytSimpleWindow_c() {} + + static dLytSimpleWindow_c *getInstance() { + return sInstance; + } + + bool fn_8012B000(); + +private: + static dLytSimpleWindow_c *sInstance; +}; + +#endif diff --git a/include/toBeSorted/minigame_mgr.h b/include/toBeSorted/minigame_mgr.h index e83c7364..a74ddbeb 100644 --- a/include/toBeSorted/minigame_mgr.h +++ b/include/toBeSorted/minigame_mgr.h @@ -19,6 +19,7 @@ public: HARP_PLAYING, }; static bool isInMinigameState(Minigame game); + static bool isInAnyMinigame(); static void create(); static void destroy(); diff --git a/src/d/flag/sceneflag_manager.inc b/src/d/flag/sceneflag_manager.inc index 8eb180f4..ccec3d82 100644 --- a/src/d/flag/sceneflag_manager.inc +++ b/src/d/flag/sceneflag_manager.inc @@ -138,7 +138,7 @@ u16 SceneflagManager::checkFlag(u16 roomId, u16 flag) { return checkTempOrSceneflag(flag); } } -bool SceneflagManager::checkSceneflagGlobal(u16 sceneIdx, u16 flag) { +u16 SceneflagManager::checkSceneflagGlobal(u16 sceneIdx, u16 flag) { u16 *pData = FileManager::GetInstance()->getSceneFlagsConst(); return mFlagHelper.checkFlag(getSceneflagSlotGlobal(sceneIdx, flag), flag % 16, pData, 0x800); } diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 9610abca..9a26f7c5 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -1,23 +1,33 @@ // clang-format off #include "c/c_lib.h" #include "common.h" +#include "d/a/d_a_bird.h" +#include "d/a/d_a_item.h" #include "d/a/d_a_player.h" #include "d/d_message.h" #include "d/d_sc_game.h" #include "d/d_sc_title.h" #include "d/d_stage_mgr.h" #include "d/flag/storyflag_manager.h" +#include "d/flag/dungeonflag_manager.h" +#include "d/flag/sceneflag_manager.h" #include "d/lyt/d_lyt_area_caption.h" #include "d/lyt/d_lyt_control_game.h" +#include "d/lyt/d_lyt_do_button.h" #include "d/lyt/d_lyt_meter_configuration.h" #include "d/lyt/d_lyt_unknowns.h" #include "d/lyt/d_window.h" #include "d/lyt/meter/d_lyt_meter.h" #include "d/lyt/msg_window/d_lyt_msg_window.h" +#include "d/lyt/msg_window/d_lyt_simple_window.h" +#include "f/f_manager.h" +#include "f/f_profile_name.h" #include "m/m_vec.h" #include "nw4r/lyt/lyt_group.h" +#include "sized_string.h" #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/event_manager.h" +#include "toBeSorted/minigame_mgr.h" #include "toBeSorted/small_sound_mgr.h" // clang-format on @@ -949,6 +959,410 @@ bool dLytMeter_c::remove() { return true; } +void dLytMeter_c::fn_800D57B0() { + u8 old0x13776 = field_0x13776; + u8 old0x13777 = field_0x13777; + u8 old0x13778 = field_0x13778; + u8 old0x13779 = field_0x13779; + u8 old0x1377A = field_0x1377A; + u8 old0x1377B = field_0x1377B; + u8 old0x1377C = field_0x1377C; + u8 old0x1377D = field_0x1377D; + + dBird_c *bird = nullptr; + if (dAcPy_c::GetLink()->getRidingActorType() == dAcPy_c::RIDING_LOFTWING) { + bird = static_cast(fManager_c::searchBaseByProfName(fProfile::BIRD, nullptr)); + } + + field_0x13776 = 1; + field_0x13777 = 1; + field_0x13778 = 1; + field_0x13779 = 1; + field_0x1377A = 1; + field_0x1377B = 1; + field_0x1377C = 1; + field_0x1377D = 1; + field_0x1377E = 0; + + if (EventManager::getCurrentEventName() != nullptr) { + const char *name = EventManager::getCurrentEventName(); + if (strequals(name, "SwordDraw") || strequals(name, "SwordDrawDoorNew")) { + field_0x1377E = 1; + if (dLytDobutton_c::getNextActionToShow() != 0x12) { + 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_C, LytDoButtonRelated::DO_NONE); + LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE); + } + } + + for (int i = 0; i < METER_NUM_PANES; i++) { + field_0x13782[i] = 1; + } + + if (dAcPy_c::GetLink2()->canDowseProbably() && !fn_800D5650() && !fn_800D5680()) { + if (!field_0x1377F) { + field_0x1377F = true; + } + } else { + if (field_0x1377F) { + field_0x1377F = false; + } + } + + if ((!StoryflagManager::sInstance->getCounterOrFlag(58) && + ((LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + mItemSelect.getField_0x5794() != 2 && + (!EventManager::isInEvent() || !EventManager::isCurrentEvent("ItemGetGorgeous"))))) + + || (dStageMgr_c::GetInstance()->isAreaTypeHouse() && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + !MinigameManager::isInMinigameState(MinigameManager::HOUSE_CLEANING) && !mItemSelect.fn_800F02F0()) + + || + (isSilentRealm() && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE && + !mItemSelect.fn_800F02F0()) + + || ((dAcPy_c::GetLink()->checkActionFlagsCont(0x400000) || fn_800D5420() || + dAcPy_c::GetLink()->checkActionFlags(dAcPy_c::FLG0_CRAWLING) || fn_800D5380(0) || + MinigameManager::isInMinigameState(MinigameManager::FUN_FUN_ISLAND) || + MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER) || + MinigameManager::isInMinigameState(MinigameManager::BAMBOO_CUTTING))) + + || (MinigameManager::isInMinigameState(MinigameManager::TRIAL_TIME_ATTACK) && + LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_B) == LytDoButtonRelated::DO_NONE) || + (dLytMeterContainer_c::getField_0x13B66() || (fn_800D56B0() && !mItemSelect.fn_800F02F0() && !fn_800D53D0()) || + fn_800D5650() || fn_800D5680())) { + field_0x13782[0] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0() && !mMinusBtn.fn_800F75E0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680())) { + field_0x13782[1] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() > 1 && !mPlusBtn.getField_0x1C0() && !mPlusBtn.isCalling())) { + field_0x13782[2] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() > 1 && !mCrossBtn.fn_800FA730())) { + field_0x13782[3] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0 && !mp1Button->shouldCall())) { + field_0x13782[4] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0 && !mp2Button->shouldCall())) { + field_0x13782[5] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() > 1)) { + field_0x13782[6] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0)) { + field_0x13782[7] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0() && !mDowsing.fn_800FE490()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0 && !fn_800D5380(true) && !mDowsing.shouldCall() && !mDowsing.fn_800FE490())) { + field_0x13782[8] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0 && !fn_800D5380(true) && !mZBtn.isCalling())) { + field_0x13782[9] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0)) { + field_0x13782[10] = 0; + } + + if ((fn_800D56B0() && !fn_800D53D0()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680()) + + || (getUiMode() != 0)) { + field_0x13782[11] = 0; + } + + if ((!isNotSilentRealmOrLoftwing() || (mShield.getGaugePercentMaybe() == 0.0f && mShield.getField_0x31D()) || + dAcPy_c::GetLink()->getCurrentAction() == 0x8C || fn_800D5380(false) || field_0x13770 != 3 || + MinigameManager::isInMinigameState(MinigameManager::FUN_FUN_ISLAND) || + MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER) || + MinigameManager::isInMinigameState(MinigameManager::BAMBOO_CUTTING) || + MinigameManager::isInMinigameState(MinigameManager::TRIAL_TIME_ATTACK) || + MinigameManager::isInMinigameState(MinigameManager::PUMPKIN_ARCHERY) || + MinigameManager::isInMinigameState(MinigameManager::SPIRAL_CHARGE_TUTORIAL) || + MinigameManager::isInMinigameState(MinigameManager::ROLLERCOASTER) || fn_800D56B0() || field_0x1377E) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || + (dLytSimpleWindow_c::getInstance() != nullptr && dLytSimpleWindow_c::getInstance()->fn_8012B000()) || + fn_800D5650() || fn_800D5680())) { + field_0x13782[12] = 0; + } + + if ((isSilentRealm() || fn_800D5380(false) || field_0x13770 != 3 || + dAcPy_c::GetLink()->getCurrentAction() == 0x8C || + + MinigameManager::isInMinigameState(MinigameManager::FUN_FUN_ISLAND) || + MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER) || + MinigameManager::isInMinigameState(MinigameManager::BAMBOO_CUTTING) || + MinigameManager::isInMinigameState(MinigameManager::TRIAL_TIME_ATTACK) || + MinigameManager::isInMinigameState(MinigameManager::PUMPKIN_ARCHERY) || + MinigameManager::isInMinigameState(MinigameManager::INSECT_CAPTURE) || + MinigameManager::isInMinigameState(MinigameManager::SPIRAL_CHARGE_TUTORIAL) || + MinigameManager::isInMinigameState(MinigameManager::ROLLERCOASTER)) + + || + (dMessage_c::getInstance()->getField_0x2FC() && mHeart.getField_0x78C() && !dAcPy_c::LINK->isSittingOrUnk0xAE()) + + || (fn_800D56B0() && + (dMessage_c::getInstance()->getField_0x2FC() == 0 || dMessage_c::getInstance()->getField_0x2FC() == -2)) || + field_0x1377E + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || + (dLytSimpleWindow_c::getInstance() != nullptr && dLytSimpleWindow_c::getInstance()->fn_8012B000()) || + fn_800D5650() || fn_800D5680())) { + field_0x13782[13] = 0; + } + + if (dMessage_c::getInstance()->getField_0x2FC() != 0) { + mRupy.setSize(0); + } else { + mRupy.setSize(1); + } + + if ((isSilentRealm() || field_0x13770 != 3 || dAcPy_c::GetLink()->getCurrentAction() == 0x8C || + + MinigameManager::isInMinigameState(MinigameManager::FUN_FUN_ISLAND) || + MinigameManager::isInMinigameState(MinigameManager::BAMBOO_CUTTING) || + MinigameManager::isInMinigameState(MinigameManager::TRIAL_TIME_ATTACK) || + MinigameManager::isInMinigameState(MinigameManager::PUMPKIN_ARCHERY) || + MinigameManager::isInMinigameState(MinigameManager::SPIRAL_CHARGE_TUTORIAL) || + MinigameManager::isInMinigameState(MinigameManager::ROLLERCOASTER)) + + || (fn_800D56B0() && mHeart.getField_0x78C() == 0) + + || (dScGame_c::currentSpawnInfo.stageName == "F406" && dScGame_c::currentSpawnInfo.layer == 13) + + || (field_0x1377E != 0) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || + (dLytSimpleWindow_c::getInstance() != nullptr && dLytSimpleWindow_c::getInstance()->fn_8012B000()) || + fn_800D5650() || fn_800D5680())) { + field_0x13782[14] = 0; + } + + if (!isSilentRealm() || (fn_800D56B0() && !fn_800D5590()) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || field_0x13750 == 0 || fn_800D5680())) { + field_0x13776 = 0; + } + + if (mpTimer != nullptr && field_0x13776 != old0x13776) { + if (field_0x13776) { + mpTimer->startIn2(); + } else { + mpTimer->startOut2(); + } + } + + if ((dAcPy_c::GetLink()->hasvt_0x1C0() || dAcPy_c::GetLink()->checkActionFlagsCont(0x10) || + (fn_800D56B0() && !field_0x13774) || mGanbariGauge.fn_80104760() || + + MinigameManager::isInMinigameState(MinigameManager::FUN_FUN_ISLAND) || + MinigameManager::isInMinigameState(MinigameManager::THRILL_DIGGER) || + MinigameManager::isInMinigameState(MinigameManager::PUMPKIN_ARCHERY) || + MinigameManager::isInMinigameState(MinigameManager::SPIRAL_CHARGE_TUTORIAL) || + MinigameManager::isInMinigameState(MinigameManager::ROLLERCOASTER)) + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x13782[15] = 0; + } + + if ((dAcPy_c::GetLink()->getRidingActorType() != dAcPy_c::RIDING_LOFTWING || fn_800D56B0()) || + (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x13778 = 0; + } else if (bird != nullptr && mpSkyGauge != nullptr) { + mpSkyGauge->setHeight(dAcPy_c::GetLink()->vt_0x260()); + } + + if (mpSkyGauge != nullptr && field_0x13778 != old0x13778) { + if (field_0x13778) { + mpSkyGauge->setWantsIn(); + } else { + mpSkyGauge->setWantsOut(); + } + } + + if (dAcPy_c::GetLink()->getRidingActorType() != dAcPy_c::RIDING_LOFTWING || !field_0x13780 || + + (dLytDobutton_c::getFn0x8010E5D0() != 0x5E || fn_800D56B0() || dLytMeterContainer_c::getField_0x13B66() || + fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x13777 = 0; + } + + if (mpBirdGauge != nullptr) { + if (bird != nullptr) { + mpBirdGauge->setNumDashes(bird->getNumDashes()); + } + if (field_0x13777 != old0x13777) { + if (field_0x13777) { + if (mpBirdGauge->getField_0x693()) { + mpBirdGauge->setField_0x690(1); + } else { + field_0x13777 = false; + } + } else { + if (mpBirdGauge->getField_0x692()) { + mpBirdGauge->hide(); + } else { + field_0x13777 = true; + } + } + } + } + + if (!field_0x13781 || fn_800D56B0() || + + (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x13779 = false; + } + + if (field_0x13779 != old0x13779) { + if (field_0x13779) { + if (mpBossGauge != nullptr) { + s32 mode = 0; + if (dScGame_c::currentSpawnInfo.layer == 3) { + mode = 1; + } else if (dScGame_c::currentSpawnInfo.layer == 4) { + mode = 2; + } + mpBossGauge->setMode(mode); + } + } else { + if (mpBossGauge != nullptr) { + mpBossGauge->setField_0x545(true); + } + } + } + + if (mpKakeraKey != nullptr) { + if (dAcItem_c::getKeyPieceCount() == 0 || dLytAreaCaption_c::get0xAAC() || fn_800D5380(false) || + SceneflagManager::sInstance->checkSceneflagGlobal(4, 0x21) || MinigameManager::isInAnyMinigame() + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D56B0() || field_0x1377E || fn_800D5420() || + fn_800D5650() || fn_800D5680())) { + field_0x1377A = false; + } + if (field_0x1377A != old0x1377A) { + if (field_0x1377A) { + mpKakeraKey->setShouldBeVisible(true); + } else { + mpKakeraKey->setShouldBeVisible(false); + } + } + } + + if (mpBossKey != nullptr) { + if (DungeonflagManager::sInstance->getCounterOrFlag(12, 8) == 0 + + || DungeonflagManager::sInstance->getCounterOrFlag(16, 8) != 0 || + dAcPy_c::GetLink()->getCurrentAction() == 0x8C || dLytAreaCaption_c::get0xAAC() || fn_800D5380(false) || + MinigameManager::isInAnyMinigame() || fn_800D56B0() || field_0x1377E + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x1377B = false; + } + + if (field_0x1377B != old0x1377B) { + if (field_0x1377B) { + mpBossKey->setShouldBeVisible(true); + } else { + mpBossKey->setShouldBeVisible(false); + } + } + } + + if (mpSmallKey != nullptr) { + if (dAcItem_c::getSmallKeyCount() == 0 || dLytAreaCaption_c::get0xAAC() || fn_800D5380(false) || + MinigameManager::isInAnyMinigame() || fn_800D56B0() || field_0x1377E + + || (dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || fn_800D5680())) { + field_0x1377C = false; + } + + if (field_0x1377C != old0x1377C) { + if (field_0x1377C) { + mpSmallKey->setShouldBeVisible(true); + } else { + mpSmallKey->setShouldBeVisible(false); + } + } + } + + if (mpDrink != nullptr) { + if (!field_0x137B2 || dLytAreaCaption_c::get0xAAC() || fn_800D5380(false) || + MinigameManager::isInAnyMinigame() || field_0x1377E + + || fn_800D56B0() || dLytMeterContainer_c::getField_0x13B66() || fn_800D5420() || fn_800D5650() || + fn_800D5680()) { + field_0x1377D = false; + } + + if (field_0x1377D != old0x1377D) { + if (field_0x1377D) { + mpDrink->setShouldBeVisible(true); + } else { + mpDrink->setShouldBeVisible(false); + } + } + + mVec3_c pos = mRupy.getLastVisibleDigitPosition(); + mpDrink->setField_0x6E0(pos); + } +} + bool dLytMeter_c::execute() { dLytMeterContainer_c *container = dLytMeterContainer_c::GetInstance(); if (field_0x13775 && !EventManager::isInEvent()) {