From f8f84a2ac80b989858730952deb005eda23077b2 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Fri, 7 Jun 2024 10:02:06 -0400 Subject: [PATCH] procTactPlay, player_tact 100% fixes #641 --- include/d/d_kankyo.h | 1 + include/d/d_stage.h | 6 +- include/m_Do/m_Do_audio.h | 5 +- src/d/actor/d_a_player_tact.inc | 107 +++++++++++++++++++++++++++++++- src/d/d_kankyo.cpp | 8 +-- 5 files changed, 118 insertions(+), 9 deletions(-) diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 389dd4deb..b14ea2400 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -449,5 +449,6 @@ void dKy_DayProc(); u8 dKy_get_schbit(); int dKy_rain_check(); void dKy_setLight_mine(dKy_tevstr_c* pTevStr); +BOOL dKy_daynighttact_stop_chk(); #endif /* D_KANKYO_D_KANKYO_H */ diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 91167bea9..1e33ea2d6 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -1065,9 +1065,9 @@ inline u8 dStage_FileList_dt_CheckAgbHover(dStage_FileList_dt_c* i_fili) { return i_fili->mParam & 4; } -// inline u8 dStage_FileList_dt_GetSongOk(dStage_FileList_dt_c* i_fili) { - // maybe 0x40000000? -// } +inline u32 dStage_FileList_dt_GetSongOk(dStage_FileList_dt_c* i_fili) { + return i_fili->mParam & 0x40000000; +} // inline u8 dStage_FileList_dt_GetToonsw(dStage_FileList_dt_c* i_fili) { diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index ac13a80cd..892a606f8 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -263,7 +263,10 @@ 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_melodyPlay(s32 param_1) { + return mDoAud_zelAudio_c::getTact().melodyPlay(param_1); +} + inline void mDoAud_tact_melodyStop() {} inline BOOL mDoAud_checkCbPracticePlay() { diff --git a/src/d/actor/d_a_player_tact.inc b/src/d/actor/d_a_player_tact.inc index baf8f228f..5c21f455e 100644 --- a/src/d/actor/d_a_player_tact.inc +++ b/src/d/actor/d_a_player_tact.inc @@ -18,6 +18,7 @@ #include "d/actor/d_a_ship.h" #include "d/actor/d_a_player_HIO.h" #include "JSystem/JKernel/JKRHeap.h" +#include "d/d_kankyo_wether.h" extern const Vec l_tact_top; @@ -559,7 +560,111 @@ BOOL daPy_lk_c::procTactPlay_init(s32 r27, int r30, int r31) { /* 8014EBA0-8014EFD4 .text procTactPlay__9daPy_lk_cFv */ BOOL daPy_lk_c::procTactPlay() { - /* Nonmatching */ + if (dComIfGp_checkPlayerStatus0(0, daPyStts1_UNK10000_e)) { + setShipRidePos(1); + shape_angle.y -= 0x4000; + } + + mDoAud_tact_ambientPlay(); + + if (m3624 != 0) { + if (checkEndMessage(m3624)) { + resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); + dComIfGp_event_reset(); + dCam_getBody()->EndEventCamera(fopAcM_GetID(this)); + endDemoMode(); + } + return TRUE; + } else if (m34DA > 0) { + m34DA--; + if (m34DA == 0) { + mDoAud_tact_melodyPlay(m3570); + } + } + + + if (m34D0 != 0) { + if (m34D8 != 0) { + g_dComIfG_gameInfo.play.field_0x4947 = 0; + dComIfGp_evmng_cutEnd(mStaffIdx); + return TRUE; + } + + msg_class* msg_p = fopMsgM_SearchByID(m3628); + if (msg_p == NULL || msg_p->mStatus == fopMsgStts_BOX_CLOSED_e) { + fopAc_ac_c* r5 = NULL; + g_dComIfG_gameInfo.play.field_0x4947 = 0; + + if (msg_p != NULL) { + msg_p->mStatus = fopMsgStts_MSG_DESTROYED_e; + m3628 = fpcM_ERROR_PROCESS_ID_e; + } + + if (mTactZevPartnerPID != fpcM_ERROR_PROCESS_ID_e && m34CC == m3570) { + r5 = fopAcM_SearchByID(mTactZevPartnerPID); + } + + if (m3574 == 0) { + dComIfGp_evmng_cutEnd(mStaffIdx); + return TRUE; + } + + if (r5 != NULL) { + if (m3494 == 0) { + resetActAnimeUpper(UPPER_MOVE2_e, -1.0f); + dComIfGp_event_reset(); + dCam_getBody()->EndEventCamera(fopAcM_GetID(this)); + endDemoMode(); + return TRUE; + } else { + return procTactPlayEnd_init(-1); + } + } + + if (m3570 == 0) { + if (dKyw_gbwind_use_check()) { + return procTactPlayEnd_init(m3570); + } + m3624 = 0x14A5; + } else if (m3570 == 1) { + daShip_c* ship = dComIfGp_getShipActor(); + if (ship != NULL && ship->getTactWarpID() != fpcM_ERROR_PROCESS_ID_e) { + return procTactPlayEnd_init(m3570); + } + m3624 = 0x14A6; + } else if (m3570 == 2) { + if (checkNpcStatus() && !dComIfGp_checkPlayerStatus0(0, daPyStts1_UNK10000_e)) { + return procTactPlayEnd_init(m3570); + } + m3624 = 0x14A8; + } else if (m3570 == 5) { + if (dKy_daynighttact_stop_chk()) { + m3624 = 0x14A7; + } else { + dStage_FileList_dt_c* fili_p = dComIfGp_roomControl_getStatusRoomDt(current.roomNo)->getFileListInfo(); + if (dStage_FileList_dt_GetSongOk(fili_p)) { + m3624 = 0x14AA; + } else { + return procTactPlayEnd_init(m3570); + } + } + } else { + m3624 = 0x14A9; + } + } + } else if (mFrameCtrlUnder[UNDER_MOVE0_e].getRate() < 0.01f) { + mDoAud_seStart(JA_SE_TAKT_MATCHED, 0); + fopMsgM_messageSendOn(); + m34D0 = 1; + + mDoAud_tact_reset(); + setSingleMoveAnime(ANM_WAITTAKT, daPy_HIO_tact_c0::m.field_0x0, 0.0f, -1, 10.0f); + setTextureAnime(6, 0); + onModeFlg(ModeFlg_00000100); + offModeFlg(ModeFlg_00000400); + } + + return TRUE; } /* 8014EFD4-8014F210 .text procTactPlayEnd_init__9daPy_lk_cFi */ diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index a9e4fc0a9..4d71c31a8 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -3526,12 +3526,12 @@ u8 dKy_pship_existense_chk() { } /* 80197708-80197760 .text dKy_daynighttact_stop_chk__Fv */ -bool dKy_daynighttact_stop_chk() { - bool rt = false; +BOOL dKy_daynighttact_stop_chk() { + BOOL rt = FALSE; if (dKy_checkEventNightStop()) { - rt = true; + rt = TRUE; } else if (g_env_light.mbDayNightTactStop) { - rt = true; + rt = TRUE; } return rt;