From d4a36b32e4ffd2184336bea077e1a94e4abed174 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sat, 13 Jul 2024 09:47:17 -0700 Subject: [PATCH] some scene/overlap documentation and fixes --- include/d/d_procname.h | 2 ++ include/f_op/f_op_scene_req.h | 2 +- src/d/d_com_inf_game.cpp | 3 ++- src/d/d_s_logo.cpp | 2 +- src/d/d_s_menu.cpp | 4 ++-- src/d/d_s_name.cpp | 2 +- src/d/d_s_open.cpp | 2 +- src/d/d_s_play.cpp | 17 +++++++++++++++-- src/d/d_s_title.cpp | 2 +- src/d/d_stage.cpp | 2 +- src/f_ap/f_ap_game.cpp | 8 ++++---- src/f_op/f_op_scene_mng.cpp | 15 ++++++++------- src/f_op/f_op_scene_req.cpp | 14 +++++++------- 13 files changed, 46 insertions(+), 29 deletions(-) diff --git a/include/d/d_procname.h b/include/d/d_procname.h index aebd97c70..04c4f1d45 100644 --- a/include/d/d_procname.h +++ b/include/d/d_procname.h @@ -505,6 +505,8 @@ enum { PROC_PB = 0x01F4, PROC_GAMEOVER = 0x01F5, PROC_COUNT_e, + + PROC_INVALID_e = 0x7FFF, }; #endif /* D_PROCNAME_H */ diff --git a/include/f_op/f_op_scene_req.h b/include/f_op/f_op_scene_req.h index c72b795e8..655c948c1 100644 --- a/include/f_op/f_op_scene_req.h +++ b/include/f_op/f_op_scene_req.h @@ -13,7 +13,7 @@ void fopScnRq_ReRequest(void); class scene_request_class { public: node_create_request mCrtReq; - u32 mFadeRequest; // TODO: type is wrong + scene_request_class* mFadeRequest; request_of_phase_process_class mReqPhsProcCls; u8 field_0x70[4]; }; diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 10a514176..d093a02f7 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -15,6 +15,7 @@ #include "d/d_item_data.h" #include "d/d_magma.h" #include "d/d_particle.h" +#include "d/d_procname.h" #include "d/d_tree.h" #include "d/d_wood.h" #include "f_op/f_op_scene_mng.h" @@ -487,7 +488,7 @@ int dComIfG_changeOpeningScene(scene_class* i_scene, s16 i_procName) { dComIfGp_getNextStageLayer()); dComIfGs_setRestartRoomParam(0); - fopScnM_ChangeReq(i_scene, i_procName, 0, 30); + fopScnM_ChangeReq(i_scene, i_procName, PROC_OVERLAP0, 30); fopScnM_ReRequest(i_procName, 0); return 1; } diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index 64ad87c5f..4a3e5610e 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -482,7 +482,7 @@ static BOOL dScnLogo_Draw(dScnLogo_c* i_this) { /* 8022D1DC-8022D21C .text dScnLogo_Execute__FP10dScnLogo_c */ static BOOL dScnLogo_Execute(dScnLogo_c* i_this) { if (mDoRst::isReset()) - fopScnM_ChangeReq(i_this, PROC_LOGO_SCENE, 0, 5); + fopScnM_ChangeReq(i_this, PROC_LOGO_SCENE, PROC_OVERLAP0, 5); return TRUE; } diff --git a/src/d/d_s_menu.cpp b/src/d/d_s_menu.cpp index 6360d78ce..d07a6cf76 100644 --- a/src/d/d_s_menu.cpp +++ b/src/d/d_s_menu.cpp @@ -145,10 +145,10 @@ static BOOL dScnMenu_Execute(menu_of_scene_class* i_this) { s16 startCode = (i_this->startCode != 0) ? i_this->startCode - 1 : room->startCode; dComIfGp_setNextStage(room->stageName, startCode, room->roomNo, room->layerNo); if (strcmp(dComIfGp_getNextStageName(), "ENDING") == 0) { - fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, 0, 5); + fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, PROC_OVERLAP0, 5); mDoAud_bgmStop(0x1E); } else { - fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, 0, 5); + fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, PROC_OVERLAP0, 5); dComIfGs_setRestartRoomParam(0); mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), dComIfGp_getNextStageLayer()); } diff --git a/src/d/d_s_name.cpp b/src/d/d_s_name.cpp index a537bb82b..c51b8d245 100644 --- a/src/d/d_s_name.cpp +++ b/src/d/d_s_name.cpp @@ -911,7 +911,7 @@ void dScnName_c::changeGameScene() { dComIfGs_gameStart(); u32 procName = field_0x55f ? PROC_OPEN_SCENE : PROC_PLAY_SCENE; - if (fopScnM_ChangeReq(this, procName, 0, 5)) { + if (fopScnM_ChangeReq(this, procName, PROC_OVERLAP0, 5)) { g_dComIfG_gameInfo.save.getDan().mStageNo = -1; dComIfGs_setRestartRoomParam(0); mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), dComIfGp_getNextStageLayer()); diff --git a/src/d/d_s_open.cpp b/src/d/d_s_open.cpp index c561a07d6..260a08e6b 100644 --- a/src/d/d_s_open.cpp +++ b/src/d/d_s_open.cpp @@ -89,7 +89,7 @@ void dScnOpen_c::changeGameScene() { if (fpcM_GetName(this) == PROC_OPEN2_SCENE) { dComIfG_changeOpeningScene(this, PROC_OPENING2_SCENE); } else { - if (fopScnM_ChangeReq(this, PROC_PLAY_SCENE, 0, 5)) { + if (fopScnM_ChangeReq(this, PROC_PLAY_SCENE, PROC_OVERLAP0, 5)) { dComIfGs_setRestartRoomParam(0); mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), dComIfGp_getNextStageLayer()); } diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index de6d17fdd..e941cffc7 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -291,13 +291,26 @@ static int dScnPly_Draw(dScnPly_ply_c* i_this) { if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this) && fpcM_GetName(i_this) == PROC_PLAY_SCENE) { if (dComIfGp_isEnableNextStage()) { - static s16 l_wipeType[] = {0, 0, 16, 17, 18, 1, 2, 1, 3, 3, 4, 4}; + static s16 l_wipeType[] = { + PROC_OVERLAP0, + PROC_OVERLAP0, + PROC_OVERLAP2, + PROC_OVERLAP3, + PROC_OVERLAP4, + PROC_OVERLAP1, + PROC_OVERLAP6, + PROC_OVERLAP1, + PROC_OVERLAP7, + PROC_OVERLAP7, + PROC_OVERLAP8, + PROC_OVERLAP8, + }; JUT_ASSERT(VERSION_SELECT(997, 1001, 1001), dComIfGp_getNextStageWipe() < ARRAY_SIZE(l_wipeType)); if (strcmp(dComIfGp_getNextStageName(), "ENDING") == 0) { - fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, 0, 5); + fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, PROC_OVERLAP0, 5); mDoAud_bgmStop(30); } else { fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, l_wipeType[dComIfGp_getNextStageWipe()], 5); diff --git a/src/d/d_s_title.cpp b/src/d/d_s_title.cpp index 1e5af4785..321b27aab 100644 --- a/src/d/d_s_title.cpp +++ b/src/d/d_s_title.cpp @@ -72,7 +72,7 @@ static BOOL dScnTitle_Execute(title_of_scene_class* i_this) { if (fpcM_GetName(i_this) == PROC_ENDING_SCENE) { if (movie->mpCallBack1() == 0) { if (dComIfGs_getClearCount() == 0) { - fopScnM_ChangeReq(i_this, PROC_NAMEEX_SCENE, 0, 5); + fopScnM_ChangeReq(i_this, PROC_NAMEEX_SCENE, PROC_OVERLAP0, 5); } else { dComIfG_changeOpeningScene(i_this, PROC_OPENING_SCENE); } diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 2eb1ba7e6..ff9746be0 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -201,7 +201,7 @@ int createRoomScene(int param_0) { } *ptr = param_0; - return fopScnM_CreateReq(PROC_ROOM_SCENE, 0x7FFF, 0, (u32)ptr); + return fopScnM_CreateReq(PROC_ROOM_SCENE, PROC_INVALID_e, 0, (u32)ptr); } /* 80040E38-80040E6C .text checkRoomDisp__20dStage_roomControl_cCFi */ diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp index 70ee71ac8..cdedc6bce 100644 --- a/src/f_ap/f_ap_game.cpp +++ b/src/f_ap/f_ap_game.cpp @@ -9,9 +9,9 @@ #include "f_op/f_op_camera_mng.h" #include "f_op/f_op_draw_tag.h" #include "f_pc/f_pc_manager.h" -#include "SSystem/SComponent/c_counter.h" +#include "d/d_procname.h" #include "m_Do/m_Do_main.h" -#include "dolphin/types.h" +#include "SSystem/SComponent/c_counter.h" fapGm_HIO_c g_HIO; @@ -96,8 +96,8 @@ void fapGm_Create() { fopOvlpM_Init(); fopCamM_Init(); fopDwTg_CreateQueue(); - fopScnM_CreateReq(5, 0x7FFF, 0, 0); - + fopScnM_CreateReq(PROC_LOGO_SCENE, PROC_INVALID_e, 0, 0); + g_HIO.mChildID = mDoHIO_root.mDoHIO_createChild("ゲームシステム", &g_HIO); // "Game System" } diff --git a/src/f_op/f_op_scene_mng.cpp b/src/f_op/f_op_scene_mng.cpp index 638efe5a4..bbf91d188 100644 --- a/src/f_op/f_op_scene_mng.cpp +++ b/src/f_op/f_op_scene_mng.cpp @@ -7,6 +7,7 @@ #include "f_op/f_op_scene_iter.h" #include "f_op/f_op_scene_req.h" #include "f_pc/f_pc_searcher.h" +#include "d/d_procname.h" #include "JSystem/JUtility/JUTAssert.h" scene_class* fopScnM_SearchByID(fpc_ProcID id) { @@ -15,8 +16,8 @@ scene_class* fopScnM_SearchByID(fpc_ProcID id) { static uint l_scnRqID = -1; -int fopScnM_ChangeReq(scene_class* i_scene, s16 procName, s16 fadeTime, u16 param_4) { - uint sceneRequestID = fopScnRq_Request(2, i_scene, procName, 0, fadeTime, param_4); +int fopScnM_ChangeReq(scene_class* i_scene, s16 procName, s16 fadeProcName, u16 fadePeekTime) { + uint sceneRequestID = fopScnRq_Request(2, i_scene, procName, 0, fadeProcName, fadePeekTime); if (sceneRequestID == -1) { return 0; @@ -27,21 +28,21 @@ int fopScnM_ChangeReq(scene_class* i_scene, s16 procName, s16 fadeTime, u16 para } BOOL fopScnM_DeleteReq(scene_class* i_scene) { - uint sceneRequestID = fopScnRq_Request(1, i_scene, 0x7FFF, 0, 0x7FFF, 0); + uint sceneRequestID = fopScnRq_Request(1, i_scene, PROC_INVALID_e, 0, PROC_INVALID_e, 0); return sceneRequestID != -1; } -BOOL fopScnM_CreateReq(s16 param_1, s16 param_2, u16 param_3, u32 param_4) { - uint sceneRequestID = fopScnRq_Request(0, 0, param_1, (void*)param_4, param_2, param_3); +BOOL fopScnM_CreateReq(s16 procName, s16 fadeProcName, u16 fadePeekTime, u32 user) { + uint sceneRequestID = fopScnRq_Request(0, 0, procName, (void*)user, fadeProcName, fadePeekTime); return sceneRequestID != -1; } -u32 fopScnM_ReRequest(s16 param_1, u32 param_2) { +u32 fopScnM_ReRequest(s16 procName, u32 user) { if (l_scnRqID == -1) { return 0; } - return fopScnRq_ReRequest(l_scnRqID, param_1, (void*)param_2); + return fopScnRq_ReRequest(l_scnRqID, procName, (void*)user); } void fopScnM_Management() { diff --git a/src/f_op/f_op_scene_req.cpp b/src/f_op/f_op_scene_req.cpp index ebd83ec2f..19d84e344 100644 --- a/src/f_op/f_op_scene_req.cpp +++ b/src/f_op/f_op_scene_req.cpp @@ -81,7 +81,7 @@ static scene_request_class* fopScnRq_FadeRequest(s16 procName, u16 peekTime) { return (scene_request_class*)req; } -uint fopScnRq_Request(int param_1, scene_class* i_scene, s16 param_3, void* param_4, s16 param_5, u16 param_6) { +uint fopScnRq_Request(int reqType, scene_class* i_scene, s16 procName, void* user, s16 fadeProcName, u16 fadePeekTime) { static node_create_request_method_class submethod = { (process_method_func)fopScnRq_Execute, (process_method_func)fopScnRq_Cancel, @@ -112,25 +112,25 @@ uint fopScnRq_Request(int param_1, scene_class* i_scene, s16 param_3, void* para }; uint ret; - int tmp = 0; + scene_request_class* fade = NULL; cPhs__Handler* phase_handler_table; phase_handler_table = noFadeFase; scene_request_class* pScnReq = (scene_request_class*)fpcNdRq_Request( - sizeof(scene_request_class), param_1, (process_node_class*)i_scene, param_3, param_4, + sizeof(scene_request_class), reqType, (process_node_class*)i_scene, procName, user, &submethod); if (!pScnReq) { ret = -1; } else { - if (param_5 != 0x7fff) { + if (fadeProcName != 0x7fff) { phase_handler_table = fadeFase; - tmp = (int)fopScnRq_FadeRequest(param_5, param_6); - if (!tmp) { + fade = fopScnRq_FadeRequest(fadeProcName, fadePeekTime); + if (!fade) { fpcNdRq_Delete(&pScnReq->mCrtReq); return -1; } } - pScnReq->mFadeRequest = tmp; + pScnReq->mFadeRequest = fade; cPhs_Set(&pScnReq->mReqPhsProcCls, phase_handler_table); ret = pScnReq->mCrtReq.mRequestId; }