From 2fe316f55ccca6accf8a6a6b1d9466c4c724a44c Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 25 Sep 2025 13:31:59 +0200 Subject: [PATCH] Implement the last function --- config/SOUE01/symbols.txt | 4 +-- include/d/lyt/d_lyt_deposit.h | 14 ++++++++ include/d/lyt/d_lyt_map.h | 18 +++++----- include/d/lyt/d_lyt_shop.h | 14 ++++++++ include/toBeSorted/event_manager.h | 4 +-- include/toBeSorted/event_manager_util.h | 46 +++++++++++++++++++++++++ src/d/d_cs_game.cpp | 33 ++++++++++-------- src/d/lyt/meter/d_lyt_meter.cpp | 2 +- 8 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 include/d/lyt/d_lyt_deposit.h create mode 100644 include/d/lyt/d_lyt_shop.h create mode 100644 include/toBeSorted/event_manager_util.h diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 3dd6468c..19ee717e 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -42186,10 +42186,10 @@ lbl_80575998 = .sbss:0x80575998; // type:object size:0x8 data:4byte BOSS_CAPTION_PTR = .sbss:0x805759A0; // type:object size:0x8 data:4byte sInstance__17dLytDemoDowsing_c = .sbss:0x805759A8; // type:object size:0x8 data:4byte lbl_805759B0 = .sbss:0x805759B0; // type:object size:0x2 data:2byte -LYT_SHOP = .sbss:0x805759B4; // type:object size:0x4 data:4byte +sInstance__10dLytShop_c = .sbss:0x805759B4; // type:object size:0x4 data:4byte lbl_805759B8 = .sbss:0x805759B8; // type:object size:0x8 lbl_805759C0 = .sbss:0x805759C0; // type:object size:0x8 -lbl_805759C8 = .sbss:0x805759C8; // type:object size:0x8 data:4byte +sInstance__13dLytDeposit_c = .sbss:0x805759C8; // type:object size:0x8 data:4byte lbl_805759D0 = .sbss:0x805759D0; // type:object size:0x8 data:4byte LYT_END_ROLL_PTR = .sbss:0x805759D8; // type:object size:0x8 data:4byte GLOBAL_FI_POINTER = .sbss:0x805759E0; // type:object size:0x4 data:4byte diff --git a/include/d/lyt/d_lyt_deposit.h b/include/d/lyt/d_lyt_deposit.h new file mode 100644 index 00000000..aa8804c9 --- /dev/null +++ b/include/d/lyt/d_lyt_deposit.h @@ -0,0 +1,14 @@ +#ifndef D_LYT_DEPOSIT_H +#define D_LYT_DEPOSIT_H + +class dLytDeposit_c { +public: + static dLytDeposit_c *GetInstance() { + return sInstance; + } + +private: + static dLytDeposit_c *sInstance; +}; + +#endif diff --git a/include/d/lyt/d_lyt_map.h b/include/d/lyt/d_lyt_map.h index 7a040021..283a01e8 100644 --- a/include/d/lyt/d_lyt_map.h +++ b/include/d/lyt/d_lyt_map.h @@ -268,6 +268,7 @@ private: class dLytMapMain_c : public m2d::Base_c { friend class dLytMap_c; + public: dLytMapMain_c(); virtual ~dLytMapMain_c(); @@ -342,7 +343,7 @@ private: /* 0x8904 */ mVec3_c field_0x8904; /* 0x8910 */ mVec3_c field_0x8910; /* 0x891C */ mVec3_c field_0x891C; - + /* 0x8928 */ u8 _0x8928[0x8930 - 0x8928]; /* 0x8930 */ mVec3_c field_0x8930; @@ -350,7 +351,7 @@ private: /* 0x8948 */ u8 idkfixmelater[0x4BC0]; /* 0x8C94 */ s32 field_0x8C94; - + // ... /* 0x8CC4 */ mVec3_c field_0x8CC4; @@ -411,16 +412,13 @@ public: void build(); - static bool isValid(s32 val) { - if (val >= 2 && val < 7) { - return true; - } - return false; + bool isSomeMapFieldEq2Or4Or5Or6() const { + return mMapMain.field_0x8C94 == 2 || mMapMain.field_0x8C94 == 4 || mMapMain.field_0x8C94 == 5 || + mMapMain.field_0x8C94 == 6; } - bool unkMeterCheck() const { - s32 val = mMapMain.field_0x8C94; - return isValid(val) && ((1 << (val - 2)) & 0x1D); + bool isSomeMapFieldEq10() const { + return mMapMain.field_0x8C94 == 10; } void lightPillarRelated(s32 p1, s32 p2, s32 p3) { diff --git a/include/d/lyt/d_lyt_shop.h b/include/d/lyt/d_lyt_shop.h new file mode 100644 index 00000000..74b38903 --- /dev/null +++ b/include/d/lyt/d_lyt_shop.h @@ -0,0 +1,14 @@ +#ifndef D_LYT_SHOP_H +#define D_LYT_SHOP_H + +class dLytShop_c { +public: + static dLytShop_c *GetInstance() { + return sInstance; + } + +private: + static dLytShop_c *sInstance; +}; + +#endif diff --git a/include/toBeSorted/event_manager.h b/include/toBeSorted/event_manager.h index 130d54ab..c9a89c2c 100644 --- a/include/toBeSorted/event_manager.h +++ b/include/toBeSorted/event_manager.h @@ -1,14 +1,13 @@ - #ifndef EVENT_MANAGER_H #define EVENT_MANAGER_H #include "common.h" -#include "d/a/obj/d_a_obj_base.h" #include "f/f_base.h" #include "sized_string.h" #include "toBeSorted/event.h" class dAcBase_c; +class dAcObjBase_c; class EventManager { public: @@ -53,7 +52,6 @@ public: static bool FUN_800a0ba0(); private: - /* 0x000 */ u8 _000[0x084 - 0x000]; /* 0x084 */ Event mCurrentEvent; /* 0x0C4 */ u8 _0C4[0x184 - 0x0C4]; diff --git a/include/toBeSorted/event_manager_util.h b/include/toBeSorted/event_manager_util.h new file mode 100644 index 00000000..9d38951f --- /dev/null +++ b/include/toBeSorted/event_manager_util.h @@ -0,0 +1,46 @@ +#ifndef EVENT_MANAGER_UTIL_H +#define EVENT_MANAGER_UTIL_H + +#include "d/d_base.h" +#include "d/d_message.h" +#include "d/lyt/d_lyt_deposit.h" +#include "d/lyt/d_lyt_map.h" +#include "d/lyt/d_lyt_shop.h" +#include "toBeSorted/event_manager.h" +#include "toBeSorted/misc_actor.h" + +// Pulling these functions out into a separate file to avoid circular dependencies + +inline bool EventManagerNotDrawControl0x80() { + return EventManager::isInEvent() && (dBase_c::s_DrawControlFlags & 0x80) == 0; +} + +inline bool EventManagerNotSkyKeepPuzzle() { + return EventManager::isInEvent() && !checkIsInSkykeepPuzzle(); +} + +inline bool EventManagerNotInShop() { + return EventManager::isInEvent() && dLytShop_c::GetInstance() == nullptr; +} + +inline bool EventManagerNotInDeposit() { + return EventManager::isInEvent() && dLytDeposit_c::GetInstance() == nullptr; +} + +inline bool EventManagerIsInMap() { + return EventManager::isInEvent() && dLytMap_c::GetInstance() != nullptr; +} + +inline bool EventManagerIsMapOpen() { + return EventManagerIsInMap() && dLytMap_c::GetInstance()->isOpenMaybe(); +} + +inline bool EventManagerIsMapOpenAndMessage() { + return EventManagerIsMapOpen() && !dMessage_c::getInstance()->getField_0x328(); +} + +inline bool EventManagerIsMapOpenAnd0x9008Eq10() { + return EventManagerIsMapOpen() && dLytMap_c::GetInstance()->isSomeMapFieldEq10(); +} + +#endif diff --git a/src/d/d_cs_game.cpp b/src/d/d_cs_game.cpp index 1fa8322f..f16dfd7e 100644 --- a/src/d/d_cs_game.cpp +++ b/src/d/d_cs_game.cpp @@ -16,6 +16,7 @@ #include "s/s_StateInterfaces.hpp" #include "toBeSorted/arc_managers/layout_arc_manager.h" #include "toBeSorted/d_emitter.h" +#include "toBeSorted/event_manager_util.h" SPECIAL_BASE_PROFILE(C_GAME, dCsGame_c, fProfile::C_GAME, 0x2BF, 0x06F9); @@ -254,8 +255,10 @@ bool dCsGame_c::shouldDraw() const { } bool dCsGame_c::isForcedHidden() const { - // TODO - lots of EventManager inlines - return false; + return ( + EventManagerNotDrawControl0x80() && EventManagerNotSkyKeepPuzzle() && EventManagerNotInShop() && + EventManagerNotInDeposit() && !EventManagerIsMapOpenAndMessage() && !EventManagerIsMapOpenAnd0x9008Eq10() + ); } void dCsGame_c::setNextCursorType(CursorType_e cs) { @@ -501,6 +504,18 @@ void dCsGame_c::lytItemCursor_c::changeState(const sFStateID_c mStateMgr.changeState(newState); } +void dCsGame_c::lytItemCursor_c::bowStartDrawOrCharge(f32 f1, f32 f2) { + mBow.startDrawOrCharge(f1, f2); +} + +void dCsGame_c::lytItemCursor_c::bowAimStart() { + mBow.aimStart(); +} + +void dCsGame_c::lytItemCursor_c::bowReady() { + mBow.ready(); +} + void dCsGame_c::lytItemCursor_c::pachinkoSetCharging(bool charging, f32 progress) { mPachinko.setCharging(charging, progress); } @@ -525,18 +540,6 @@ void dCsGame_c::lytItemCursor_c::clawshotsSetLocked(bool locked) { mCrawShot.setLocked(locked); } -void dCsGame_c::lytItemCursor_c::bowStartDrawOrCharge(f32 f1, f32 f2) { - mBow.startDrawOrCharge(f1, f2); -} - -void dCsGame_c::lytItemCursor_c::bowAimStart() { - mBow.aimStart(); -} - -void dCsGame_c::lytItemCursor_c::bowReady() { - mBow.ready(); -} - void dCsGame_c::lytItemCursor_c::loadResAcc() { mLyt.setResAcc(mpResAcc); } @@ -646,7 +649,7 @@ void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::executeState_NotFind() { if (field_0xC0 < 0.9999f) { mAnm[MAIN_ANIM_DOWSE_IN_OUT].setAnimEnable(true); mAnm[MAIN_ANIM_DOWSE_IN_OUT].setForward(); - mStateMgr.changeState(StateID_Find); + mStateMgr.changeState(StateID_ToFind); } } void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::finalizeState_NotFind() {} diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 76e91e78..12dc2514 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -996,7 +996,7 @@ bool dLytMeterMain_c::remove() { void dLytMeterMain_c::fn_800D5290() { dLytMeter_c *meter = dLytMeter_c::GetInstance(); - if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->unkMeterCheck()) { + if (dLytMap_c::GetInstance() != nullptr && !dLytMap_c::GetInstance()->isSomeMapFieldEq2Or4Or5Or6()) { meter->setFlags(METER_BTN_PLUS); }