From eec24f6c27cb3c8c6034b53cc4c10a434cbafeda Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 6 Jun 2024 18:48:25 -0400 Subject: [PATCH] procTactWait --- include/JAZelAudio/JAIZelInst.h | 7 +- include/d/actor/d_a_player.h | 5 +- include/d/actor/d_a_player_main.h | 5 +- include/d/d_com_inf_game.h | 2 +- include/m_Do/m_Do_audio.h | 20 ++- src/JAZelAudio/JAIZelInst.cpp | 2 +- src/d/actor/d_a_player_tact.inc | 203 +++++++++++++++++++++++++++++- src/d/d_metronome.cpp | 2 +- 8 files changed, 228 insertions(+), 18 deletions(-) diff --git a/include/JAZelAudio/JAIZelInst.h b/include/JAZelAudio/JAIZelInst.h index bff8c433..f69fe389 100644 --- a/include/JAZelAudio/JAIZelInst.h +++ b/include/JAZelAudio/JAIZelInst.h @@ -15,7 +15,7 @@ public: void setBeat(s32); void setVolume(f32); void metronomePlay(s32, s32); - void judge(s32, s32); + s32 judge(s32, s32); void ambientPlay(); void armSoundPlay(s32); f32 getMelodyPattern(s32, s32, s32*); @@ -24,9 +24,8 @@ public: void melodyPlay(s32); void melodyStop(); - // one of these inlines returns field_0x30, not sure which - void getBeat() {} - void getBeatFrames() {} + u8 getBeat() { return mMelodyNum; } + f32 getBeatFrames() { return field_0x30; } public: /* 0x00 */ int field_0x0; diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 0e4ec97c..816f208a 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -148,7 +148,7 @@ public: daPyRFlg0_UNK80000 = 0x00080000, daPyRFlg0_POISON_CURSE = 0x00100000, daPyRFlg0_GRAB_PUT_START = 0x00400000, - daPyRFlg0_TACT_USE = 0x01000000, + daPyRFlg0_TACT_INPUT = 0x01000000, daPyRFlg0_FAIRY_USE = 0x02000000, daPyRFlg0_UNK8000000 = 0x08000000, daPyRFlg0_UNK10000000 = 0x10000000, @@ -445,7 +445,7 @@ public: void onPoisonCurse() { onResetFlg0(daPyRFlg0_POISON_CURSE); } bool getGrabPutStart() const { return checkResetFlg0(daPyRFlg0_GRAB_PUT_START); } bool checkFairyUse() const { return checkResetFlg0(daPyRFlg0_FAIRY_USE); } - bool checkTactUse() const { return checkResetFlg0(daPyRFlg0_TACT_USE); } + bool checkTactInput() const { return checkResetFlg0(daPyRFlg0_TACT_INPUT); } bool checkArrowShoot() const { return checkResetFlg0(daPyRFlg0_ARROW_SHOOT); } bool checkGrabWear() const { return field_0x2b0 < 0.0f; } @@ -465,7 +465,6 @@ public: void checkSwordMiniGame() const {} void checkSoupPowerUp() const {} void checkSubjectAccept() const {} - void checkTactInput() const {} void checkUseArrowEffect() const {} void getRopeJumpLand() const {} void checkRopeForceEnd() const {} diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index d3bae075..710f148e 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -95,6 +95,9 @@ public: } void onAlphaOutFlg() { mAlphaOutFlg = TRUE; } + JPABaseEmitter* getEmitter() { return mpEmitter; } + + void deleteCallBack() {} /* 0x4 */ BOOL mAlphaOutFlg; /* 0x8 */ JPABaseEmitter* mpEmitter; @@ -2098,7 +2101,7 @@ public: /* 0x3618 */ u32 mModeFlg; /* 0x361C */ u32 mMtrlSndId; /* 0x3620 */ u32 m3620; - /* 0x3624 */ int m3624; + /* 0x3624 */ u32 m3624; /* 0x3628 */ int m3628; /* 0x362C */ uint mTactZevPartnerPID; /* 0x3630 */ u32 m3630; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 532af9f4..826455cd 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2456,7 +2456,7 @@ inline bool dComIfGp_2dShowCheck() { return g_dComIfG_gameInfo.play.show2dCheck(); } -inline u8 dComIfGp_setMelodyNum() { +inline u8 dComIfGp_getMelodyNum() { return g_dComIfG_gameInfo.play.getMelodyNum(); } diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 79b04ead..ac13a80c 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -48,6 +48,7 @@ void mDoAud_setSceneName(const char*, s32, s32); void mDoAud_Execute(); BOOL mDoAud_isUsedHeapForStreamBuffer(); int mDoAud_load1stDynamicWave(); +int mDoAud_getTactDirection(int stick, int ret); extern JKRSolidHeap* g_mDoAud_audioHeap; @@ -214,7 +215,7 @@ inline void mDoAud_tact_reset() { mDoAud_zelAudio_c::getTact().reset(); } -inline void mDoAud_tact_getBeat() { +inline u8 mDoAud_tact_getBeat() { return mDoAud_zelAudio_c::getTact().getBeat(); } @@ -222,7 +223,7 @@ inline void mDoAud_tact_setBeat(s32 beat) { mDoAud_zelAudio_c::getTact().setBeat(beat); } -inline void mDoAud_tact_getBeatFrames() { +inline f32 mDoAud_tact_getBeatFrames() { return mDoAud_zelAudio_c::getTact().getBeatFrames(); } @@ -250,11 +251,20 @@ inline void mDoAud_tact_stopArmSwing() { mDoAud_zelAudio_c::getTact().stopArmSwing(); } -inline void mDoAud_tact_armSoundPlay(s32) {} -inline void mDoAud_tact_judge(s32, s32) {} +inline s32 mDoAud_tact_judge(s32 param_1, s32 param_2) { + return mDoAud_zelAudio_c::getTact().judge(param_1, param_2); +} + +inline void mDoAud_tact_armSoundPlay(s32 param_1) { + return mDoAud_zelAudio_c::getTact().armSoundPlay(param_1); +} + +inline void mDoAud_tact_metronomePlay(s32 param_1, s32 param_2) { + return mDoAud_zelAudio_c::getTact().metronomePlay(param_1, param_2); +} + inline void mDoAud_tact_melodyPlay(s32) {} inline void mDoAud_tact_melodyStop() {} -inline void mDoAud_tact_metronomePlay(s32, s32) {} inline BOOL mDoAud_checkCbPracticePlay() { return mDoAud_zelAudio_c::getInterface()->checkCbPracticePlay(); diff --git a/src/JAZelAudio/JAIZelInst.cpp b/src/JAZelAudio/JAIZelInst.cpp index b4f30ce6..c51ced80 100644 --- a/src/JAZelAudio/JAIZelInst.cpp +++ b/src/JAZelAudio/JAIZelInst.cpp @@ -64,7 +64,7 @@ void JAIZelInst::metronomePlay(s32, s32) { } /* 802AE864-802AEB5C .text judge__10JAIZelInstFll */ -void JAIZelInst::judge(s32, s32) { +s32 JAIZelInst::judge(s32, s32) { /* Nonmatching */ } diff --git a/src/d/actor/d_a_player_tact.inc b/src/d/actor/d_a_player_tact.inc index 1844d34f..baf8f228 100644 --- a/src/d/actor/d_a_player_tact.inc +++ b/src/d/actor/d_a_player_tact.inc @@ -99,7 +99,7 @@ BOOL daPy_lk_c::checkEndTactMusic() const { /* 8014D9A4-8014D9D0 .text getTactMetronomeRate__9daPy_lk_cFv */ f32 daPy_lk_c::getTactMetronomeRate() { if (mCurProc == daPyProc_TACT_WAIT_e) { - return m35A0 / mDoAud_zelAudio_c::getTact().field_0x30; + return m35A0 / mDoAud_tact_getBeatFrames(); } else { return -1.0f; } @@ -303,7 +303,206 @@ BOOL daPy_lk_c::procTactWait_init(int r30) { /* 8014E100-8014E9A4 .text procTactWait__9daPy_lk_cFv */ BOOL daPy_lk_c::procTactWait() { - /* Nonmatching */ + setShipRidePosUseItem(); + mDoAud_tact_ambientPlay(); + if (m3570 == -4) { + dComIfGp_evmng_cutEnd(mStaffIdx); + return TRUE; + } + + if (m34D2 > 0) { + m34D2--; + if (m3570 == -5) { + m35A0 += 1.0f; + } + if (m34D2 == 0) { + if (m3570 == -5 || m3570 == 6 || m3570 == 7) { + dComIfGp_evmng_cutEnd(mStaffIdx); + g_dComIfG_gameInfo.play.field_0x4947 = 0; + } else if (m3570 == -1 || m3570 == -3 || m3570 >= 0) { + procTactPlay_init(m3574, m3570 == -1, m3570 >= 0); + } + } + return TRUE; + } + + if (m3570 == 5 || m3570 == 1 || m3570 == 6 || m3570 == 7) { + if (m35AC >= 0.0f) { + m35AC -= 1.0f; + } + if (m3570 == 5) { + dComIfGp_setAStatus(7); + } + } else if (m3570 != -5) { + dComIfGp_setAStatus(7); + } + + if (m34D2 == 0 || ((mPressedButtons & 2) != 0 && dComIfGp_getAStatus() == 7) || m35AC <= 0.0f) { + if (m34D2 != 0) { + resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); + resetActAnimeUpper(UPPER_MOVE1_e, -1.0f); + mDoAud_seStart(JA_SE_TAKT_USE_CANCEL, 0); + } + + g_dComIfG_gameInfo.play.field_0x4947 = 0; + + if ((mPressedButtons & 2) != 0 && m3570 == 5) { + m35AC = -1000.0f; + } + + if (m3570 == -1) { + dComIfGp_event_reset(); + dCam_getBody()->EndEventCamera(fopAcM_GetID(this)); + endDemoMode(); + } else { + dComIfGp_evmng_cutEnd(mStaffIdx); + } + mDoAud_tact_reset(); + return TRUE; + } + + int r31, r30; + if (m3570 != -5) { + r31 = mDoAud_getTactDirection(1, m34D4); + r30 = mDoAud_getTactDirection(0, m34D6); + mDoAud_tact_setVolume(m35B0 * cM_scos(m34DC)); + } else { + r31 = m34D4; + r30 = m34D6; + } + + m35A0 += 1.0f; + + if (r31 != m34D4) { + if (m35A4 <= 0.0f || r31 != 0) { + setActAnimeUpper(getTactPlayRightArmAnm(r31), UPPER_MOVE1_e, daPy_HIO_tact_c0::m.field_0x8, 0.0f, -1, daPy_HIO_tact_c0::m.field_0xC); + + if (r31 == 0 || r31 == 2 || r31 == 4) { + mFrameCtrlUpper[UPPER_MOVE1_e].setRate(daPy_HIO_tact_c0::m.field_0x0); + mFrameCtrlUpper[UPPER_MOVE1_e].setFrame(mFrameCtrlUnder[UNDER_MOVE0_e].getFrame()); + } + + if (m34D4 == 4 || m34D4 == 2 || r31 == 4 || r31 == 2) { + mDoAud_tact_reset(); + mDoAud_tact_setBeat(r31); + m35A0 = 0.0f; + m34DA = 0; + m_old_fdata->initOldFrameMorf(5.0f, 0, 0x2A); + m3624 = 0; + m34D0 = -1; + } + m34D4 = r31; + mAnmRatioUpper[UPPER_MOVE1_e].setRatio(0.0f); + + if (m34D4 != 0) { + m35A4 = 2.0f; + } + } else { + m35A4 -= 1.0f; + } + } else if (m34D4 != 0) { + m35A4 = 2.0f; + } + + if (r30 != m34D6) { + if (m35A8 <= 0.0f || r30 != 0) { + f32 f31; + if (m34D4 == 4) { + f31 = daPy_HIO_tact_c0::m.field_0x14; + } else if (m34D4 == 2) { + f31 = daPy_HIO_tact_c0::m.field_0x18; + } else { + f31 = daPy_HIO_tact_c0::m.field_0x10; + } + setActAnimeUpper(getTactPlayLeftArmAnm(r30), UPPER_MOVE2_e, f31, 0.0f, -1, daPy_HIO_tact_c0::m.field_0xC); + m34D6 = r30; + mAnmRatioUpper[UPPER_MOVE2_e].setRatio(0.0f); + mDoAud_tact_armSoundPlay(r30); + if (m34D6 != 0) { + m35A8 = 2.0f; + } + } else { + m35A8 -= 1.0f; + } + } else if (m34D6 != 0) { + m35A8 = 2.0f; + } + + if (m35A0 >= mDoAud_tact_getBeatFrames()) { + mDoAud_tact_metronomePlay(m34DA, m34D6); + mpEquipItemBrk->setFrame(mpEquipItemBrk->getFrameMax() - 0.001f); + m34D0 = 3; + m35A0 -= mDoAud_tact_getBeatFrames(); + m3624++; + if (m3624 == 2) { + m3624 = 0; + } + } else { + mpEquipItemBrk->setFrame(0.0f); + } + + if (m34D0 > 0) { + m34D0--; + } + + if (m34D0 == 0) { + m3574 = mDoAud_tact_judge(m34DA, m34D6); + m34DA++; + + if (m34DA >= mDoAud_tact_getBeat()) { + m34DA = 0; + } + + onResetFlg0(daPyRFlg0_TACT_INPUT); + m34D0 = -1; + + if ((m3570 >= 0 && m3570 == m3574) || + ( + (m3570 == -1 || m3570 == -3) && + (m3574 >= 0 && m3574 != 6 && m3574 != 7 && dComIfGs_isTact(m3574)) + ) + ) { + m34D2 = 30; + mDoAud_seStart(JA_SE_WTAKT_MATCH_SIGNAL, 0); + m35A0 = 0.0f; + } else { + m3574 = -1; + if (m3570 == -5) { + m34D8++; + if (m34D8 == 6) { + m34D2 = 15; + } + } else if (m3570 == -2) { + m34D8++; + if (m34D8 == 5) { + m34D2 = 30; + m35A0 = 0.0f; + } + } + } + } + + f32 f0; + if (m34D4 == 4) { + f0 = daPy_HIO_tact_c0::m.field_0x14; + } else if (m34D4 == 2) { + f0 = daPy_HIO_tact_c0::m.field_0x18; + } else { + f0 = daPy_HIO_tact_c0::m.field_0x10; + } + mFrameCtrlUpper[UPPER_MOVE2_e].setRate(f0); + + if (m34D2 == -1) { + f32 f0 = (m35A0 + m3624 * mDoAud_tact_getBeatFrames()) / (2.0f * mDoAud_tact_getBeatFrames()); + mFrameCtrlUnder[UPPER_MOVE0_e].setFrame(f0 * mFrameCtrlUnder[UPPER_MOVE0_e].getEnd()); + mFrameCtrlUpper[UPPER_MOVE1_e].setFrame(f0 * mFrameCtrlUpper[UPPER_MOVE1_e].getEnd()); + getNowAnmPackUnder(UNDER_MOVE0_e)->setFrame(mFrameCtrlUnder[UNDER_MOVE0_e].getFrame()); + if (getNowAnmPackUpper(UPPER_MOVE1_e)) { + getNowAnmPackUpper(UPPER_MOVE1_e)->setFrame(mFrameCtrlUpper[UPPER_MOVE1_e].getFrame()); + } + } + + return TRUE; } /* 8014E9A4-8014EBA0 .text procTactPlay_init__9daPy_lk_cFlii */ diff --git a/src/d/d_metronome.cpp b/src/d/d_metronome.cpp index 6322b213..6046b284 100644 --- a/src/d/d_metronome.cpp +++ b/src/d/d_metronome.cpp @@ -317,7 +317,7 @@ void dMetronome_c::melodyGuideShow(s32 note, s16 no) { /* 80222854-80222C4C .text melodyShow__12dMetronome_cFv */ void dMetronome_c::melodyShow() { cXyz tactTop, sparklePos; - if (daPy_getPlayerActorClass()->checkTactUse()) { + if (daPy_getPlayerActorClass()->checkTactInput()) { cXyz pos; pos.x = 0.0f; pos.y = 0.0f;