From b85c72d3f5584f9e4935ca7d6695f08ea464650c Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 2 Jul 2024 01:21:48 -0700 Subject: [PATCH] d_s_menu work --- include/d/d_s_menu.h | 27 +++++-- src/d/d_s_menu.cpp | 179 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 180 insertions(+), 26 deletions(-) diff --git a/include/d/d_s_menu.h b/include/d/d_s_menu.h index 0cd6accda..10cb4e2cc 100644 --- a/include/d/d_s_menu.h +++ b/include/d/d_s_menu.h @@ -15,20 +15,33 @@ public: class menu_of_scene_class : public scene_class { public: - struct info2_s { - u8 field_0x0[0x24 - 0x00]; - u8* field_0x24; + struct room_inf { + char name[0x20]; + u8 field_0x20; + char stageName[0x08]; + s8 roomNo; + u8 startCode; + s8 layerNo; }; - struct info1_s { - u8 field_0x0; - info2_s* field_0x4; + struct stage_inf { + char name[0x20]; + u8 field_0x20; + u8 roomNum; + u8 field_0x22; + u8 field_0x23; + room_inf* roomPtr; + }; + + struct menu_inf { + u8 num; + stage_inf* stage; }; /* 0x1C4 */ request_of_phase_process_class mPhs; /* 0x1CC */ mDoDvdThd_toMainRam_c* command; /* 0x1D0 */ mDoDvdThd_toMainRam_c* fontCommand; - /* 0x1D4 */ info1_s* info; + /* 0x1D4 */ menu_inf* info; /* 0x1D8 */ ResFONT* field_0x1d8; /* 0x1DC */ myFontClass* field_0x1dc; /* 0x1E0 */ u8 field_0x1e0; diff --git a/src/d/d_s_menu.cpp b/src/d/d_s_menu.cpp index 2a0bc0577..a1bca113c 100644 --- a/src/d/d_s_menu.cpp +++ b/src/d/d_s_menu.cpp @@ -13,6 +13,8 @@ #include "d/d_com_lib_game.h" #include "d/d_procname.h" #include "f_ap/f_ap_game.h" +#include "f_op/f_op_scene_mng.h" +#include "m_Do/m_Do_controller_pad.h" #include "m_Do/m_Do_dvd_thread.h" #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_main.h" @@ -32,11 +34,11 @@ static BOOL dScnMenu_Draw(menu_of_scene_class* i_this) { if (i_this->field_0x1e0) { JUTReport(400, 50,"<%d>", i_this->field_0x1e0 - 1); } - menu_of_scene_class::info1_s* r30 = i_this->info; + menu_of_scene_class::menu_inf* r30 = i_this->info; int r29 = 70; u8 r3; int r4 = l_cursolID - l_startID; - r3 = r30->field_0x0; + r3 = r30->num; int r31 = r3 < 20 ? r3 : 20; if (r4 < 5) { l_startID += r4 - 5; @@ -53,12 +55,12 @@ static BOOL dScnMenu_Draw(menu_of_scene_class* i_this) { l_startID = r5; } } - int i, r26; - r26 = l_startID; - for (i = 0; i < r31; r26++, r29 += 16, i++) { - s8 r6 = l_cursolID == r26 ? 79 : 32; - menu_of_scene_class::info2_s* r8 = r30->field_0x4 + r26; - JUTReport(20, r29, "%c %2d %s <%s>", r6, r26, r8, r8->field_0x24 + l_groupPoint[r26] * 0x2c); + int i, id; + id = l_startID; + for (i = 0; i < r31; id++, r29 += 16, i++) { + s8 r6 = l_cursolID == id ? 79 : 32; + menu_of_scene_class::stage_inf* stage = &r30->stage[id]; + JUTReport(20, r29, "%c %2d %s <%s>", r6, id, stage->name, stage->roomPtr[l_groupPoint[id]].name); } JUTReport(280,400,"X:進む Y:戻る"); char* local_3c[] = {"通常", "高速経過", "朝(あさ)に固定", "昼(ひる)に固定", "夕方(ゆうがた)に固定", "夜(よる)に固定", "時に固定"}; @@ -70,7 +72,7 @@ static BOOL dScnMenu_Draw(menu_of_scene_class* i_this) { } JUTReport(40, 420, "十字右:進む 十字左:戻る"); JUTReport(200, 400, "曜日:%s", local_58[l_weekpat]); -#if VERSION == VERSION_PAL +#if VERSION != VERSION_JPN static const char* language[] = {"ENGLISH", "GERMAN", "FRENCH", "SPANISH", "ITALIAN"}; JUTReport(40, 440, "%s", language[g_dComIfG_gameInfo.play.mGameLanguage]); #endif @@ -84,8 +86,148 @@ static BOOL dScnMenu_Draw(menu_of_scene_class* i_this) { } /* 8022ED50-8022F318 .text dScnMenu_Execute__FP19menu_of_scene_class */ -static void dScnMenu_Execute(menu_of_scene_class*) { +static BOOL dScnMenu_Execute(menu_of_scene_class* i_this) { /* Nonmatching */ + menu_of_scene_class::menu_inf* info = i_this->info; + if (CPad_CHECK_HOLD_UP(0) || CPad_CHECK_HOLD_DOWN(0)) { + BOOL trig = TRUE; + if (CPad_CHECK_TRIG_UP(0) || CPad_CHECK_TRIG_DOWN(0)) { + i_this->field_0x1e1 = 20; + } else { + if (!cLib_calcTimer(&i_this->field_0x1e1)) + i_this->field_0x1e1 = 4; + else + trig = FALSE; + } + + if (trig) { + if (CPad_CHECK_HOLD_UP(0)) { + if (--l_cursolID < 0) + l_cursolID = info->num - 1; + } else { + if (++l_cursolID >= info->num) + l_cursolID = 0; + } + } + } + + if (CPad_CHECK_HOLD_B(0) || CPad_CHECK_HOLD_A(0)) { + BOOL trig = TRUE; + if (CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_A(0)) { + i_this->field_0x1e2 = 20; + } else { + if (!cLib_calcTimer(&i_this->field_0x1e2)) + i_this->field_0x1e2 = 4; + else + trig = FALSE; + } + + if (trig) { + if (CPad_CHECK_HOLD_B(0)) { + if (--l_groupPoint[l_cursolID] < 0) + l_groupPoint[l_cursolID] = info->stage[l_cursolID].roomNum - 1; + } else { + if (++l_groupPoint[l_cursolID] >= info->stage[l_cursolID].roomNum) + l_groupPoint[l_cursolID] = 0; + } + } + } + + if (CPad_CHECK_TRIG_R(0)) { + if (++i_this->field_0x1e0 == 0) + i_this->field_0x1e0++; + } else if (CPad_CHECK_TRIG_L(0)) { + if (--i_this->field_0x1e0 == 0) + i_this->field_0x1e0--; + } + + if (CPad_CHECK_TRIG_START(0)) { + menu_of_scene_class::room_inf* room = &info->stage[l_cursolID].roomPtr[l_groupPoint[l_cursolID]]; + dComIfGp_offEnableNextStage(); + s16 startCode = (i_this->field_0x1e0 != 0) ? i_this->field_0x1e0 - 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); + mDoAud_bgmStop(0x1E); + } else { + fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, 0, 5); + dComIfGs_setRestartRoomParam(0); + mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), dComIfGp_getNextStageLayer()); + } + } + + if (CPad_CHECK_TRIG_Y(0)) { + if (--l_timepat < 0) + l_timepat = 0x1d; + } else if (CPad_CHECK_TRIG_X(0)) { + if (++l_timepat > 0x1d) + l_timepat = 0; + } + + if (CPad_CHECK_TRIG_LEFT(0)) { + if (--l_weekpat < 0) + l_weekpat = 6; + } else if (CPad_CHECK_TRIG_RIGHT(0)) { + if (++l_weekpat >= 7) + l_weekpat = 0; + } + dComIfGs_setDate(l_weekpat); + +#if VERSION != VERSION_JPN + static const u8 language[] = { 0, 1, 2, 3, 4, }; + if (CPad_CHECK_TRIG_Z(3)) { + if (++l_languageType > 4) + l_languageType = 0; + g_dComIfG_gameInfo.play.mGameLanguage = language[l_languageType]; + } +#endif + + if (CPad_CHECK_TRIG_A(2)) { + l_demo23 ^= 1; + if (l_demo23) + dComIfGs_onEventBit(0x2d01); + else + dComIfGs_offEventBit(0x2d01); + } + + g_env_light.mTimeAdv = 0.0f; + if (l_timepat >= 6) { + dComIfGs_setTime((l_timepat - 6) * 15.0f); + g_env_light.mTimeAdv = 1000.0f; + } else { + switch (l_timepat) { + case 0: + dComIfGs_setTime(120.0f); + g_env_light.mTimeAdv = 0.02f; + break; + case 1: + dComIfGs_setTime(120.0f); + g_env_light.mTimeAdv = 0.25f; + break; + case 2: + dComIfGs_setTime(75.0f); + g_env_light.mCurTime = 75.0f; + g_env_light.mTimeAdv = 1000.0f; + break; + case 3: + dComIfGs_setTime(195.0f); + g_env_light.mCurTime = 195.0f; + g_env_light.mTimeAdv = 1001.0f; + break; + case 4: + dComIfGs_setTime(255.0f); + g_env_light.mCurTime = 255.0f; + g_env_light.mTimeAdv = 1002.0f; + break; + case 5: + dComIfGs_setTime(315.0f); + g_env_light.mCurTime = 315.0f; + g_env_light.mTimeAdv = 1003.0f; + break; + } + } + + return TRUE; } /* 8022F318-8022F320 .text dScnMenu_IsDelete__FP19menu_of_scene_class */ @@ -121,18 +263,18 @@ s32 phase_2(menu_of_scene_class* i_this) { if (!i_this->command->sync() || !i_this->fontCommand->sync()) { return cPhs_INIT_e; } - i_this->info = (menu_of_scene_class::info1_s*)i_this->command->getMemAddress(); + i_this->info = (menu_of_scene_class::menu_inf*)i_this->command->getMemAddress(); JUT_ASSERT(779, i_this->info != NULL); delete i_this->command; - menu_of_scene_class::info1_s* info = i_this->info; - info->field_0x4 = (menu_of_scene_class::info2_s*)(u32(info->field_0x4) + u32(info)); - for (int i = 0; i < info->field_0x0; i++) { - info->field_0x4[i].field_0x24 = (u8*)info + u32(info->field_0x4[i].field_0x24); + menu_of_scene_class::menu_inf* info = i_this->info; + info->stage = (menu_of_scene_class::stage_inf*)(u32(info->stage) + u32(info)); + for (int i = 0; i < info->num; i++) { + info->stage[i].roomPtr = (menu_of_scene_class::room_inf*)((u8*)info + u32(info->stage[i].roomPtr)); } if (!l_groupPoint) { - l_groupPoint = new s8[info->field_0x0]; + l_groupPoint = new s8[info->num]; JUT_ASSERT(792, l_groupPoint != NULL); - for (int i = 0; i < info->field_0x0; i++) { + for (int i = 0; i < info->num; i++) { l_groupPoint[i] = 0; } } @@ -157,7 +299,7 @@ static s32 dScnMenu_Create(scene_class* i_scn) { (cPhs__Handler)phase_2, }; menu_of_scene_class* i_this = (menu_of_scene_class *)i_scn; -#if VERSION == VERSION_PAL +#if VERSION != VERSION_JPN l_languageType = g_dComIfG_gameInfo.play.mGameLanguage; #endif return dComLbG_PhaseHandler(&i_this->mPhs, l_method, i_this); @@ -168,7 +310,6 @@ myFontClass::~myFontClass() {} /* 8022F7A8-8022F7CC .text drawChar_scale__11myFontClassFffffib */ f32 myFontClass::drawChar_scale(f32 param_1, f32 param_2, f32 param_3, f32 param_4, int param_5, bool param_6) { - /* Nonmatching */ JUTResFont::drawChar_scale(param_1, param_2, 12.0f, param_4, param_5, param_6); }