From 48ae3aead6f6c57210bbe9e5524760a86b226efa Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 19 Sep 2025 22:25:10 +0200 Subject: [PATCH] Almost done --- config/SOUE01/symbols.txt | 32 +++++------ include/d/d_cs_game.h | 21 ++++++-- src/d/d_cs_game.cpp | 109 ++++++++++++++++++++++++++++++++------ src/d/d_pad.cpp | 6 +-- src/d/lyt/d_lyt_pause.cpp | 8 +-- 5 files changed, 132 insertions(+), 44 deletions(-) diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index f5f27e9d..3dd6468c 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -11309,21 +11309,21 @@ doDelete__9dCsGame_cFv = .text:0x801BF210; // type:function size:0x84 execute__9dCsGame_cFv = .text:0x801BF2A0; // type:function size:0x25C setPosition__17dCsGameLytBase1_cFRC7mVec2_c = .text:0x801BF500; // type:function size:0x14 draw__9dCsGame_cFv = .text:0x801BF520; // type:function size:0xBC -fn_801BF5E0__9dCsGame_cCFv = .text:0x801BF5E0; // type:function size:0x44 +shouldDraw__9dCsGame_cCFv = .text:0x801BF5E0; // type:function size:0x44 isForcedHidden__9dCsGame_cCFv = .text:0x801BF630; // type:function size:0x288 setNextCursorType__9dCsGame_cFQ29dCsGame_c12CursorType_e = .text:0x801BF8C0; // type:function size:0x10 -setCursorTypeNoneMaybe__9dCsGame_cFv = .text:0x801BF8D0; // type:function size:0x8 -setCursorTypePointer__9dCsGame_cFv = .text:0x801BF8E0; // type:function size:0x18 -fn_801BF900 = .text:0x801BF900; // type:function size:0x8 -fn_801BF910 = .text:0x801BF910; // type:function size:0x58 +noneSet__9dCsGame_cFv = .text:0x801BF8D0; // type:function size:0x8 +pointerDefSet__9dCsGame_cFv = .text:0x801BF8E0; // type:function size:0x18 +pointerCatSet__9dCsGame_cFv = .text:0x801BF900; // type:function size:0x8 +pachinkoSetCharging__9dCsGame_cFbf = .text:0x801BF910; // type:function size:0x58 bowStartDrawOrCharge__9dCsGame_cFff = .text:0x801BF970; // type:function size:0x58 bowAimStart__9dCsGame_cFv = .text:0x801BF9D0; // type:function size:0x38 bowReady__9dCsGame_cFv = .text:0x801BFA10; // type:function size:0x38 -fn_801BFA50 = .text:0x801BFA50; // type:function size:0x68 -fn_801BFAC0 = .text:0x801BFAC0; // type:function size:0x8 -fn_801BFAD0 = .text:0x801BFAD0; // type:function size:0x54 -fn_801BFB30 = .text:0x801BFB30; // type:function size:0x3C -fn_801BFB70 = .text:0x801BFB70; // type:function size:0x48 +dowsingSetParams__9dCsGame_cFRC4mAngff = .text:0x801BFA50; // type:function size:0x68 +dowsingSetUnkWord__9dCsGame_cFi = .text:0x801BFAC0; // type:function size:0x8 +vacuumSetNotLocked__9dCsGame_cFf = .text:0x801BFAD0; // type:function size:0x54 +vacuumSetLocked__9dCsGame_cFv = .text:0x801BFB30; // type:function size:0x3C +clawshotsSetLocked__9dCsGame_cFb = .text:0x801BFB70; // type:function size:0x48 setCursorTypePlayerCam__9dCsGame_cFv = .text:0x801BFBC0; // type:function size:0x8 getCursorPos__22dCursorInterfaceGame_cFv = .text:0x801BFBD0; // type:function size:0x178 init__17dCsGameLytBase2_cFv = .text:0x801BFD50; // type:function size:0x50 @@ -11364,12 +11364,12 @@ changeState__96sStateMgr_c &newState); + void pachinkoSetCharging(bool charging, f32 progress); + void dowsingSetParams(const mAng &rot, f32 v1, f32 v2); + void dowsingSetUnkWord(UNKWORD v); + void vacuumSetUnkFloat(f32 v); + void vacuumSetLocked(bool locked); + void clawshotsSetLocked(bool locked); void bowStartDrawOrCharge(f32 f1, f32 f2); void bowAimStart(); void bowReady(); @@ -398,9 +404,16 @@ public: }; void setNextCursorType(CursorType_e); - void setCursorTypeNoneMaybe(); - void setCursorTypePointer(); + void noneSet(); + void pointerDefSet(); + void pointerCatSet(); + void pachinkoSetCharging(bool charging, f32 progress); + void dowsingSetParams(const mAng &rot, f32 v1, f32 v2); + void dowsingSetUnkWord(UNKWORD v); + void vacuumSetNotLocked(f32 v); + void vacuumSetLocked(); + void clawshotsSetLocked(bool locked); void bowStartDrawOrCharge(f32 f1, f32 f2); void bowAimStart(); void bowReady(); diff --git a/src/d/d_cs_game.cpp b/src/d/d_cs_game.cpp index 6282cbb6..1fa8322f 100644 --- a/src/d/d_cs_game.cpp +++ b/src/d/d_cs_game.cpp @@ -6,6 +6,7 @@ #include "d/d_cursor_hit_check.h" #include "d/d_gfx.h" #include "d/d_pad.h" +#include "d/d_pad_nav.h" #include "d/lyt/d2d.h" #include "d/lyt/d_lyt_map.h" #include "d/snd/d_snd_small_effect_mgr.h" @@ -20,7 +21,7 @@ SPECIAL_BASE_PROFILE(C_GAME, dCsGame_c, fProfile::C_GAME, 0x2BF, 0x06F9); struct dCsGame_HIO_c { dCsGame_HIO_c(); - virtual ~dCsGame_HIO_c() {} + virtual ~dCsGame_HIO_c(); /* 0x04 */ f32 field_0x04; /* 0x08 */ f32 field_0x08; @@ -45,8 +46,6 @@ struct dCsGame_HIO_c { static const f32 sFloat2; }; -static dCsGame_HIO_c sHio; - dCsGame_HIO_c::dCsGame_HIO_c() { field_0x04 = 0.0f; field_0x08 = 0.0f; @@ -68,6 +67,9 @@ dCsGame_HIO_c::dCsGame_HIO_c() { field_0x40 = 5; } +dCsGame_HIO_c::~dCsGame_HIO_c() {} + +static dCsGame_HIO_c sHio; dCsGame_c *dCsGame_c::sInstance; STATE_DEFINE(dCsGame_c::lytItemCursor_c, Invisible); @@ -247,15 +249,39 @@ int dCsGame_c::draw() { return SUCCEEDED; } -bool dCsGame_c::fn_801BF5E0() const { +bool dCsGame_c::shouldDraw() const { return isCursorActive() & !isForcedHidden(); } +bool dCsGame_c::isForcedHidden() const { + // TODO - lots of EventManager inlines + return false; +} + void dCsGame_c::setNextCursorType(CursorType_e cs) { mNextCursorActive = true; mNextCursorType = cs; } +void dCsGame_c::noneSet() { + setNextCursorType(CS_NONE); +} + +void dCsGame_c::pointerDefSet() { + if (dPadNav::isPointerVisible()) { + setNextCursorType(CS_POINTER_DEF); + } +} + +void dCsGame_c::pointerCatSet() { + setNextCursorType(CS_POINTER_CAT); +} + +void dCsGame_c::pachinkoSetCharging(bool charging, f32 progress) { + setNextCursorType(CS_PACHINKO); + mCursor.pachinkoSetCharging(charging, progress); +} + void dCsGame_c::bowStartDrawOrCharge(f32 f1, f32 f2) { setNextCursorType(CS_BOW); mCursor.bowStartDrawOrCharge(f1, f2); @@ -271,6 +297,31 @@ void dCsGame_c::bowReady() { mCursor.bowReady(); } +void dCsGame_c::dowsingSetParams(const mAng &rot, f32 v1, f32 v2) { + setNextCursorType(CS_DOWSING); + mCursor.dowsingSetParams(rot, v1, v2); +} + +void dCsGame_c::dowsingSetUnkWord(UNKWORD v) { + mCursor.dowsingSetUnkWord(v); +} + +void dCsGame_c::vacuumSetNotLocked(f32 v) { + setNextCursorType(CS_VACUUM); + mCursor.vacuumSetUnkFloat(v); + mCursor.vacuumSetLocked(false); +} + +void dCsGame_c::vacuumSetLocked() { + setNextCursorType(CS_VACUUM); + mCursor.vacuumSetLocked(true); +} + +void dCsGame_c::clawshotsSetLocked(bool locked) { + setNextCursorType(CS_HOOKSHOT); + mCursor.clawshotsSetLocked(locked); +} + void dCsGame_c::setCursorTypePlayerCam() { setNextCursorType(CS_PLAYERCAM); } @@ -450,6 +501,30 @@ void dCsGame_c::lytItemCursor_c::changeState(const sFStateID_c mStateMgr.changeState(newState); } +void dCsGame_c::lytItemCursor_c::pachinkoSetCharging(bool charging, f32 progress) { + mPachinko.setCharging(charging, progress); +} + +void dCsGame_c::lytItemCursor_c::dowsingSetParams(const mAng &rot, f32 v1, f32 v2) { + mDowsing.setParams(rot, v1, v2); +} + +void dCsGame_c::lytItemCursor_c::dowsingSetUnkWord(UNKWORD v) { + mDowsing.setUnkWord(v); +} + +void dCsGame_c::lytItemCursor_c::vacuumSetUnkFloat(f32 v) { + mVacuum.setUnkFloat(v); +} + +void dCsGame_c::lytItemCursor_c::vacuumSetLocked(bool locked) { + mVacuum.setLocked(locked); +} + +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); } @@ -551,7 +626,7 @@ bool dCsGame_c::lytItemCursor_c::execute() { mAnmGroups[MAIN_ANIM_LOOP].setAnimEnable(true); mStateMgr.executeState(); - if (dCsGame_c::GetInstance()->fn_801BF5E0() && mDrawCursorTrailThisFrame) { + if (dCsGame_c::GetInstance()->shouldDraw() && mDrawCursorTrailThisFrame) { f32 sqDist = mPositionThisFrame.squareDistance(mPositionLastFrame); if (sqDist > sHio.field_0x34 * sHio.field_0x34 || (mEffects.hasEmitters() && sqDist > sHio.field_0x38 * sHio.field_0x38)) { @@ -652,7 +727,7 @@ void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::enter() { mAnm[MAIN_ANIM_DOWSE_LOOP_1].setAnimEnable(true); } -void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::setParams(const mAng& rot, f32 v1, f32 v2) { +void dCsGame_c::lytItemCursor_c::lytDowsingCsr_c::setParams(const mAng &rot, f32 v1, f32 v2) { field_0xC0 = v1; if (field_0xC0 <= 0.999f) { mRotZ = rot; @@ -1282,6 +1357,17 @@ void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::executeState_ToNormal() { } void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::finalizeState_ToNormal() {} +void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::enter() { + mAnm[MAIN_ANIM_CURSOR].setFrame(4.0f); + mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(false); + mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(true); + mAnm[MAIN_ANIM_VACUUM_LOCK].setFrame(0.0f); + mpLyt->animate(); + mpLyt->calc(); + mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(false); + mStateMgr.changeState(StateID_Normal); +} + void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::setUnkFloat(f32 f) { if (f < 0.0f) { f = 0.0f; @@ -1295,17 +1381,6 @@ void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::setLocked(bool locked) { mLocked = locked; } -void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::enter() { - mAnm[MAIN_ANIM_CURSOR].setFrame(4.0f); - mAnm[MAIN_ANIM_LOCK_LOOP].setAnimEnable(false); - mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(true); - mAnm[MAIN_ANIM_VACUUM_LOCK].setFrame(0.0f); - mpLyt->animate(); - mpLyt->calc(); - mAnm[MAIN_ANIM_VACUUM_LOCK].setAnimEnable(false); - mStateMgr.changeState(StateID_Normal); -} - void dCsGame_c::lytItemCursor_c::lytVacuumCsr_c::init() { mLocked = false; enter(); diff --git a/src/d/d_pad.cpp b/src/d/d_pad.cpp index efc067d1..75a64e4f 100644 --- a/src/d/d_pad.cpp +++ b/src/d/d_pad.cpp @@ -7,8 +7,8 @@ #include "d/d_cs_game.h" #include "d/d_gfx.h" #include "d/d_hbm.h" -#include "d/d_pad_nav.h" #include "d/d_pad_manager.h" +#include "d/d_pad_nav.h" #include "d/d_reset.h" #include "d/d_sc_game.h" #include "d/lyt/d_lyt_control_game.h" @@ -222,8 +222,8 @@ void beginPad_BR() { KPADEnableMplsAccRevise(0); KPADSetMplsAccReviseParam(0, 0.03f, 0.4f); - if ((dCsGame_c::GetInstance() && dCsGame_c::GetInstance()->fn_801BF5E0() && !ex.field_0x22D0) || - (dAcPy_c::GetLink() && + if ((dCsGame_c::GetInstance() != nullptr && dCsGame_c::GetInstance()->shouldDraw() && !ex.field_0x22D0) || + (dAcPy_c::GetLink() != nullptr && dAcPy_c::GetLink()->checkActionFlagsCont(0x400 | 0x100 | 0x80 | 0x40 | 0x10 | 0x4 | 0x2 | 0x1) && !dAcPy_c::GetLink()->vt_0x1C0() && !dLytMeter_c::GetMain()->getField_0x1377F()) || ex.field_0x22CF) { diff --git a/src/d/lyt/d_lyt_pause.cpp b/src/d/lyt/d_lyt_pause.cpp index 959469ff..39cd859a 100644 --- a/src/d/lyt/d_lyt_pause.cpp +++ b/src/d/lyt/d_lyt_pause.cpp @@ -600,7 +600,7 @@ void dLytPauseMgr_c::executeState_In() { mStateMgr.changeState(StateID_GetDemo); } else { mStateMgr.changeState(StateID_Wait); - dCsGame_c::GetInstance()->setCursorTypePointer(); + dCsGame_c::GetInstance()->pointerDefSet(); } } } @@ -629,7 +629,7 @@ void dLytPauseMgr_c::executeState_Wait() { dPad::ex_c::getInstance()->centerCursor(mPad::getCurrentCoreID(), true); } - dCsGame_c::GetInstance()->setCursorTypePointer(); + dCsGame_c::GetInstance()->pointerDefSet(); if (dPad::getDownTrig1() || (dLytControlGame_c::getInstance()->getCurrentPauseDisp() != dLytPauseMgr_c::DISP_00_INVENTORY && @@ -685,7 +685,7 @@ void dLytPauseMgr_c::executeState_Wait() { if (checkRing()) { if (mTimer >= 10) { mTimer = 0; - dCsGame_c::GetInstance()->setCursorTypeNoneMaybe(); + dCsGame_c::GetInstance()->noneSet(); mStateMgr.changeState(StateID_Ring); } else { mTimer++; @@ -715,7 +715,7 @@ void dLytPauseMgr_c::initializeState_Change() { } void dLytPauseMgr_c::executeState_Change() { if (!sInstance->getField_0x083E()) { - dCsGame_c::GetInstance()->setCursorTypePointer(); + dCsGame_c::GetInstance()->pointerDefSet(); } if (mMain.isChangingState() == true) {