From 5522044a8a62a66a13c2b3df30e646b2d9e18c64 Mon Sep 17 00:00:00 2001 From: z64a Date: Thu, 30 May 2024 01:44:38 -0400 Subject: [PATCH] simplify game modes and remove language select --- include/common_structs.h | 2 +- include/filemenu.h | 26 +- include/functions.h | 8 - src/filemenu/filemenu_common.c | 211 +------------- src/filemenu/filemenu_info.c | 13 - src/filemenu/filemenu_main.c | 99 +------ src/filemenu/filemenu_selectlanguage.c | 373 ------------------------- src/filemenu/filemenu_yesno.c | 38 --- src/game_modes.c | 357 ++++++++++++----------- src/game_modes.h | 69 ++--- src/game_states.c | 188 ------------- src/main_loop.c | 8 +- src/model.c | 15 - src/pause/pause_main.c | 8 +- src/state_battle.c | 1 - src/state_file_select.c | 247 ---------------- src/state_title_screen.c | 2 +- src/state_world.c | 3 +- ver/jp/symbol_addrs.txt | 14 +- ver/pal/asm/bss3.s | 2 +- ver/us/splat.yaml | 1 - ver/us/symbol_addrs.txt | 14 +- 22 files changed, 246 insertions(+), 1453 deletions(-) delete mode 100644 src/filemenu/filemenu_selectlanguage.c delete mode 100644 src/game_states.c diff --git a/include/common_structs.h b/include/common_structs.h index 8b718dc59d..67116ca388 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -1425,7 +1425,7 @@ typedef struct GameStatus { /* 0x098 */ Vec3f playerPos; /* 0x0A4 */ f32 playerYaw; /* 0x0A8 */ s8 introPart; - /* 0x0A9 */ s8 unk_A9; // selected language? + /* 0x0A9 */ s8 unk_A9; /* 0x0AA */ s8 demoBattleFlags; /* 0x0AB */ u8 soundOutputMode; /* 0x0AC */ s8 startupState; // used for various startup states like logos, title screen, intro, and demo diff --git a/include/filemenu.h b/include/filemenu.h index 347f61cf79..1bbb9978c9 100644 --- a/include/filemenu.h +++ b/include/filemenu.h @@ -18,28 +18,20 @@ enum { FILE_MENU_CONFIRM = 1, // confirmation prompt is open FILE_MENU_MESSAGE = 2, // message is displayed, e.g. "File X has been deleted." FILE_MENU_INPUT_NAME = 3, // "Enter a file name!" screen - FILE_MENU_LANGUAGES = 4, }; enum { FM_MAIN_SELECT_FILE = 0, // choose which file to load FM_MAIN_SELECT_DELETE = 1, // choose which file to delete - #if !VERSION_PAL - FM_MAIN_SELECT_LANGUAGE = 2, - #endif - FM_MAIN_SELECT_COPY_FROM, - FM_MAIN_SELECT_COPY_TO, + FM_MAIN_SELECT_COPY_FROM = 2, + FM_MAIN_SELECT_COPY_TO = 3, FM_CONFIRM_DELETE = 0, - FM_CONFIRM_LANGUAGE = 1, - FM_CONFIRM_CREATE = 2, - FM_CONFIRM_COPY = 3, // unused - FM_CONFIRM_START = 4, + FM_CONFIRM_CREATE = 1, + FM_CONFIRM_COPY = 2, // unused + FM_CONFIRM_START = 3, FM_MESSAGE_DELETED = 0, - #if !VERSION_PAL - FM_MESSAGE_LANGUAGE = 1, - #endif - FM_MESSAGE_COPIED, - FM_MESSAGE_CREATED, + FM_MESSAGE_COPIED = 1, + FM_MESSAGE_CREATED = 2, FM_INPUT_CHARSET_A = 0, FM_INPUT_CHARSET_B = 1, }; @@ -105,10 +97,6 @@ WINDOW_UPDATE_FUNC(unused_main_menu_window_darkening); WINDOW_UPDATE_FUNC(filemenu_update_show_title); -#if VERSION_PAL -WINDOW_UPDATE_FUNC(filemenu_selectlanguage_80248018); -#endif - void filemenu_draw_file_name(u8*, s32, s32, s32, s32, s32, s32, s32); void filemenu_draw_contents_title(MenuPanel*, s32, s32, s32, s32, s32, s32); void filemenu_draw_contents_stereo(MenuPanel*, s32, s32, s32, s32, s32, s32); diff --git a/include/functions.h b/include/functions.h index 9777ce95d6..5d9b1235d3 100644 --- a/include/functions.h +++ b/include/functions.h @@ -37,7 +37,6 @@ void copy_matrix(Matrix4f src, Matrix4f dest); Shadow* get_shadow_by_index(s32 index); s32 get_time_freeze_mode(void); void render_player_model(void); -s16 get_game_mode(void); s32 is_picking_up_item(void); f32 integrate_gravity(void); @@ -731,12 +730,6 @@ void state_drawUI_pause(void); void state_init_unpause(void); void state_step_unpause(void); void state_drawUI_unpause(void); -void state_init_language_select(void); -void state_step_language_select(void); -void state_drawUI_language_select(void); -void state_init_exit_language_select(void); -void state_step_exit_language_select(void); -void state_drawUI_exit_language_select(void); void state_init_file_select(void); void state_step_file_select(void); void state_drawUI_file_select(void); @@ -1094,7 +1087,6 @@ void btl_save_world_cameras(void); void load_battle_section(void); void btl_update(void); void update_item_entities(void); -void iterate_models(void); void restore_map_collision_data(void); void mdl_load_all_textures(struct ModelNode* model, s32 romOffset, s32 size); void mdl_calculate_model_sizes(void); diff --git a/src/filemenu/filemenu_common.c b/src/filemenu/filemenu_common.c index d48b0ab01e..ecafcd6190 100644 --- a/src/filemenu/filemenu_common.c +++ b/src/filemenu/filemenu_common.c @@ -12,7 +12,6 @@ extern MenuPanel filemenu_main_menuBP; extern MenuPanel filemenu_yesno_menuBP; extern MenuPanel filemenu_info_menuBP; extern MenuPanel filemenu_createfile_menuBP; -extern MenuPanel filemenu_selectlanguage_menuBP; HudScript* filemenu_cursor_hudElemScripts[] = { &HES_AnimatedCursorHand }; MenuPanel* filemenu_menus[] = { @@ -20,9 +19,6 @@ MenuPanel* filemenu_menus[] = { &filemenu_yesno_menuBP, &filemenu_info_menuBP, &filemenu_createfile_menuBP, -#if VERSION_PAL - &filemenu_selectlanguage_menuBP, -#endif }; s32 filemenu_cursor_posX = SCREEN_WIDTH / 2; s32 filemenu_cursor_posY = -SCREEN_HEIGHT / 2; @@ -32,9 +28,6 @@ s32 filemenu_cursor_targetY = -SCREEN_HEIGHT / 2; s32 filemenu_cursorGoalAlpha = 0; s32 filemenu_cursorGoalAlpha2 = 0; s32 D_80249BB0 = TRUE; -#if !VERSION_PAL -s32 D_80249BB4 = 0; -#endif s32 D_80249BB8 = 0; s16 D_80249BBC[16] = { 315, 303, 283, 260, 235, 210, 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 }; s16 D_80249BDC[16] = { 315, 303, 283, 260, 235, 210, 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 }; @@ -53,50 +46,6 @@ s16 D_80249D14[16] = { 0, 2, 9, 21, 34, 48, 62, 77, 91, 105, 120, 134, 148, 161, s16 D_80249D34[10] = { 185, 160, 135, 110, 85, 60, 37, 17, 5, 0 }; s16 D_80249D48[10] = { 0, 5, 17, 37, 60, 85, 110, 135, 160, 185}; -#if VERSION_PAL -s16 D_filemenu_8024EB5C[] = { - 210, - 182, - 162, - 145, - 130, - 117, - 105, - 92, - 80, - 67, - 55, - 42, - 30, - 18, - 8, - 2, - 0, -}; - -s16 D_filemenu_8024EB80[] = { - -2, - -8, - -18, - -30, - -42, - -55, - -67, - -80, - -92, - -105, - -117, - -130, - -142, - -155, - -167, - -180, - -192, - -205, -}; -#endif - -s32 D_80249D4C = 0; // padding? Vp D_80249D60 = { .vp = { .vscale = { 640, 480, 511, 0}, @@ -212,9 +161,7 @@ void filemenu_set_cursor_alpha(s32 alpha) { void filemenu_set_cursor_goal_pos(s32 windowID, s32 posX, s32 posY) { Window* window = &gWindows[windowID]; - if (D_80249BB0 - || get_game_mode() == GAME_MODE_END_FILE_SELECT - || get_game_mode() == GAME_MODE_END_LANGUAGE_SELECT) { + if (D_80249BB0 || get_game_mode() == GAME_MODE_END_FILE_SELECT) { if (D_80249BB0) { s32 i; @@ -785,106 +732,6 @@ void filemenu_update_hidden_name_confirm( } } -#if VERSION_PAL -void filemenu_update_pal_80247f40( - s32 windowIndex, - s32* flags, - s32* posX, s32* posY, s32* posZ, - f32* scaleX, f32* scaleY, - f32* rotX, f32* rotY, f32* rotZ, - s32* darkening, - s32* opacity -) { - Window* window = &gWindows[windowIndex]; - s32 var_a1 = window->updateCounter; - s32 var_a3 = 0; - s32 var_v1; - - switch (windowIndex) { - case WIN_FILES_SLOT0_BODY: - var_a3 = 0; - break; - case WIN_FILES_SLOT1_BODY: - var_a3 = 1; - break; - case WIN_FILES_SLOT2_BODY: - var_a3 = 2; - break; - case WIN_FILES_SLOT3_BODY: - var_a3 = 3; - break; - } - var_v1 = gCurrentLanguage; - var_v1 -= var_a3; - var_v1 = abs(var_v1); - - var_a1 -= (var_v1 * 3); - if (var_a1 < 0) { - var_a1 = 0; - } - if (var_a1 == 0) { - window->flags &= ~WINDOW_FLAG_HIDDEN; - } - if (var_a1 < ARRAY_COUNT(D_filemenu_8024EB5C)) { - *posX -= D_filemenu_8024EB5C[var_a1]; - } else { - *posX -= D_filemenu_8024EB5C[ARRAY_COUNT(D_filemenu_8024EB5C) - 1]; - window->flags &= ~WINDOW_FLAG_INITIAL_ANIMATION; - } -} - -void filemenu_selectlanguage_80248018( - s32 windowIndex, - s32* flags, - s32* posX, s32* posY, s32* posZ, - f32* scaleX, f32* scaleY, - f32* rotX, f32* rotY, f32* rotZ, - s32* darkening, - s32* opacity -) { - Window* window = &gWindows[windowIndex]; - s32 var_a1 = window->updateCounter; - s32 var_a3 = 0; - s32 var_v1; - - switch (windowIndex) { - case WIN_FILES_SLOT0_BODY: - var_a3 = 0; - break; - case WIN_FILES_SLOT1_BODY: - var_a3 = 1; - break; - case WIN_FILES_SLOT2_BODY: - var_a3 = 2; - break; - case WIN_FILES_SLOT3_BODY: - var_a3 = 3; - break; - } - var_v1 = gCurrentLanguage; - var_v1 -= var_a3; - if (var_v1 < 0) { - var_v1 = -var_v1; - } - var_a1 -= (var_v1 * 3); - if (var_a1 < 0) { - var_a1 = 0; - } - if (var_a1 < ARRAY_COUNT(D_filemenu_8024EB80)) { - *posX -= D_filemenu_8024EB80[var_a1]; - } else { - *posX -= D_filemenu_8024EB80[ARRAY_COUNT(D_filemenu_8024EB80) - 1]; - window->flags &= ~WINDOW_FLAG_INITIAL_ANIMATION; - window->flags |= WINDOW_FLAG_HIDDEN; - } - - // TODO: ARRAY_COUNT? - if (var_a1 >= 0x10) { - filemenu_cursor_alpha = 0; - } -} -#endif - void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { s32 temp_a1; @@ -1047,53 +894,10 @@ void filemenu_init(s32 arg0) { } setup_pause_menu_tab(filemenu_common_windowBPs, ARRAY_COUNT(filemenu_common_windowBPs)); -#if VERSION_PAL - if (arg0 != 2) { - filemenu_currentMenu = FILE_MENU_MAIN; - menu = filemenu_menus[FILE_MENU_MAIN]; - menu->page = filemenu_currentMenu; - func_PAL_8002B574(); - - if (menu->page == 0) { - fio_load_globals(); - if (gSaveGlobals.lastFileSelected >= 4) { - gSaveGlobals.lastFileSelected = 0; - } - gGameStatusPtr->saveSlot = gSaveGlobals.lastFileSelected; - } - - filemenu_set_selected(menu, (gGameStatusPtr->saveSlot & 1) * 2, gGameStatusPtr->saveSlot >> 1); - - panelIt = filemenu_menus; - for (i = 0; i < ARRAY_COUNT(filemenu_menus) - 1; i++, panelIt++) { - if ((*panelIt)->fpInit != NULL) { - (*panelIt)->fpInit((*panelIt)); - } - } - update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); - } else { - filemenu_currentMenu = FILE_MENU_LANGUAGES; - filemenu_set_selected(filemenu_menus[FILE_MENU_LANGUAGES], 0, gCurrentLanguage); - - panelIt = filemenu_menus; - for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++, panelIt++) { - if (i == 4) { - if ((*panelIt)->fpInit != NULL) { - (*panelIt)->fpInit((*panelIt)); - } - } - } - update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); - } -#else filemenu_currentMenu = FILE_MENU_MAIN; menu = filemenu_menus[FILE_MENU_MAIN]; - if (arg0 == 0) { - menu->state = FM_MAIN_SELECT_FILE; - } else { - menu->state = FM_MAIN_SELECT_LANGUAGE; - } + menu->state = FM_MAIN_SELECT_FILE; if (menu->state == FM_MAIN_SELECT_FILE) { for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++) { @@ -1109,13 +913,11 @@ void filemenu_init(s32 arg0) { } } - if (menu->state == FM_MAIN_SELECT_FILE) { // always the case? - fio_load_globals(); - if (gSaveGlobals.lastFileSelected >= 4) { - gSaveGlobals.lastFileSelected = 0; - } - gGameStatusPtr->saveSlot = gSaveGlobals.lastFileSelected; + fio_load_globals(); + if (gSaveGlobals.lastFileSelected >= 4) { + gSaveGlobals.lastFileSelected = 0; } + gGameStatusPtr->saveSlot = gSaveGlobals.lastFileSelected; } filemenu_set_selected(menu, (gGameStatusPtr->saveSlot & 1) * 2, gGameStatusPtr->saveSlot >> 1); @@ -1127,7 +929,6 @@ void filemenu_init(s32 arg0) { } } update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); -#endif } void filemenu_cleanup(void) { diff --git a/src/filemenu/filemenu_info.c b/src/filemenu/filemenu_info.c index fcfeb9b708..7cb83977f4 100644 --- a/src/filemenu/filemenu_info.c +++ b/src/filemenu/filemenu_info.c @@ -125,9 +125,6 @@ void filemenu_info_draw_message_contents( filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_34), baseX + 65, baseY + 18, 255, 0, 0); #endif break; - case FM_MESSAGE_LANGUAGE: - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_28), baseX + 10, baseY + 4, 255, 0, 0); - break; case FM_MESSAGE_CREATED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 10, baseY + 4, 255, 0, 0); draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + CREATE_SUCCESS_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); @@ -164,20 +161,10 @@ void filemenu_info_handle_input(MenuPanel* menu) { set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 0, 2); break; - case FILE_MENU_LANGUAGES: - menu->state = FILE_MENU_MAIN; - set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); - filemenu_set_selected(menu, 1, 2); - break; -#if !VERSION_PAL case FILE_MENU_MESSAGE: menu->state = FILE_MENU_MESSAGE; filemenu_set_selected(menu, 1, 2); break; -#endif } set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_HIDE); } diff --git a/src/filemenu/filemenu_main.c b/src/filemenu/filemenu_main.c index f7ebae3847..0ecf4a7034 100644 --- a/src/filemenu/filemenu_main.c +++ b/src/filemenu/filemenu_main.c @@ -358,6 +358,7 @@ void filemenu_draw_contents_title( s32 yOffset; switch (menu->state) { + default: case FM_MAIN_SELECT_FILE: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_START; xOffset = 9; @@ -378,14 +379,6 @@ void filemenu_draw_contents_title( xOffset = COPY_OFFSET_X; yOffset = 4; break; -#if !VERSION_PAL - case FM_MAIN_SELECT_LANGUAGE: - default: - msgIdx = FILE_MESSAGE_SELECT_FILE_TO_SAVE; - xOffset = 10; - yOffset = 4; - break; -#endif } filemenu_draw_message(filemenu_get_menu_message(msgIdx), baseX + xOffset, baseY + yOffset, 255, 0, 0); @@ -432,21 +425,10 @@ void filemenu_draw_contents_option_left( s32 width, s32 height, s32 opacity, s32 darkening ) { -#if VERSION_PAL - s32 offset = D_filemenu_802508E8[gCurrentLanguage]; - if (menu->col == 0 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, (baseX + offset) - 10, baseY + 8); - } - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + offset + OFFSET_WIDTH, baseY + 2, 255, 0, 1); -#else - if (menu->state != FM_MAIN_SELECT_LANGUAGE) { - if (menu->col == 0 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, baseX, baseY + 8); - } - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + 8 + OFFSET_WIDTH, baseY + 2, 255, 0, 1); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, baseX, baseY + 8); } -#endif + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + 8 + OFFSET_WIDTH, baseY + 2, 255, 0, 1); } #if VERSION_PAL @@ -526,21 +508,10 @@ void filemenu_draw_contents_option_right( s32 width, s32 height, s32 opacity, s32 darkening ) { -#if VERSION_PAL - s32 offset = D_filemenu_802508F0[gCurrentLanguage]; - if (menu->col == 2 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_RIGHT, baseX + offset - 10, baseY + 8); - } - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_CANCEL), baseX + offset, baseY + 2, 255, 0, 1); -#else - if (menu->state != FM_MAIN_SELECT_LANGUAGE) { - if (menu->col == 2 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_RIGHT, baseX + 8, baseY + 8); - } - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_CANCEL), baseX + RIGHT_CANCEL_X, baseY + 2, 255, 0, 1); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_RIGHT, baseX + 8, baseY + 8); } -#endif + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_CANCEL), baseX + RIGHT_CANCEL_X, baseY + 2, 255, 0, 1); } void filemenu_draw_contents_file_info(s32 fileIdx, @@ -829,15 +800,9 @@ void filemenu_main_init(MenuPanel* menu) { setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs)); menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - if (menu->state == FM_MAIN_SELECT_LANGUAGE) { - gWindows[WIN_FILES_TITLE].pos.y = 1; - gWindows[WIN_FILES_TITLE].width = 211; - gWindows[WIN_FILES_TITLE].height = 25; - } else { - gWindows[WIN_FILES_TITLE].pos.y = 1; - gWindows[WIN_FILES_TITLE].width = 162; - gWindows[WIN_FILES_TITLE].height = 25; - } + gWindows[WIN_FILES_TITLE].pos.y = 1; + gWindows[WIN_FILES_TITLE].width = 162; + gWindows[WIN_FILES_TITLE].height = 25; halfWidth = gWindows[WIN_FILES_TITLE].width / 2; posXPtr = &gWindows[WIN_FILES_TITLE].pos.x; @@ -867,9 +832,6 @@ void filemenu_main_init(MenuPanel* menu) { } #endif -#if VERSION_PAL -INCLUDE_ASM(void, "filemenu/filemenu_main", filemenu_main_handle_input); -#else void filemenu_main_handle_input(MenuPanel* menu) { s32 originalSelected = menu->selected; s32 i; @@ -923,7 +885,6 @@ void filemenu_main_handle_input(MenuPanel* menu) { } break; case FM_MAIN_SELECT_DELETE: - case FM_MAIN_SELECT_LANGUAGE: case FM_MAIN_SELECT_COPY_FROM: case FM_MAIN_SELECT_COPY_TO: // force selection to column 0 when navigating up from bottom row @@ -1166,42 +1127,6 @@ void filemenu_main_handle_input(MenuPanel* menu) { } } break; - case FM_MAIN_SELECT_LANGUAGE: - if (menu->selected == 6) { - // selected "Cancel" button - sfx_play_sound(SOUND_MENU_NEXT); - set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); - } else if (menu->selected < 4) { - // selected a file - // (just a dummy placeholder implementation) - if (!gSaveSlotMetadata[menu->selected].hasData) { - sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = FILE_MENU_MESSAGE; - filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_LANGUAGE; - set_window_update(WIN_FILES_MAIN, (s32)unused_main_menu_window_darkening); - set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); - set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); - fio_save_game(menu->selected); - gSaveSlotMetadata[menu->selected].hasData = TRUE; - } else { - sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); - gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 127; - gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; - gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; - gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); - - gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -50; - gWindows[WIN_FILES_CONFIRM_PROMPT].width = 148; - gWindows[WIN_FILES_CONFIRM_PROMPT].height = 38; - gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); - - filemenu_currentMenu = FILE_MENU_CONFIRM; - filemenu_menus[FILE_MENU_CONFIRM]->state = FM_CONFIRM_LANGUAGE; - filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 1); - } - } - break; } } @@ -1213,9 +1138,6 @@ void filemenu_main_handle_input(MenuPanel* menu) { case FM_MAIN_SELECT_DELETE: filemenu_set_selected(menu, 1, 2); break; - case FM_MAIN_SELECT_LANGUAGE: - filemenu_set_selected(menu, 1, 2); - break; case FM_MAIN_SELECT_COPY_FROM: filemenu_set_selected(menu, 1, 2); break; @@ -1262,14 +1184,9 @@ void filemenu_main_handle_input(MenuPanel* menu) { filemenu_set_selected(menu, (filemenu_CopyFromFileIdx % 2) * 2, filemenu_CopyFromFileIdx / 2); sfx_play_sound(SOUND_MENU_BACK); break; - case FM_MAIN_SELECT_LANGUAGE: - sfx_play_sound(SOUND_MENU_BACK); - set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); - break; } } } -#endif void filemenu_main_update(MenuPanel* menu) { // set default styles for all file slot panels diff --git a/src/filemenu/filemenu_selectlanguage.c b/src/filemenu/filemenu_selectlanguage.c deleted file mode 100644 index 629b1d96c0..0000000000 --- a/src/filemenu/filemenu_selectlanguage.c +++ /dev/null @@ -1,373 +0,0 @@ -#include "common.h" -#include "filemenu.h" -#include "message_ids.h" -#include "hud_element.h" -#include "ld_addrs.h" -#include "game_modes.h" - -extern HudScript HES_Spirit1; - -HudScript* D_filemenu_8024F120[] = { &HES_Spirit1 }; - -u32 D_filemenu_8024F124 = 0x00000000; - -s32 D_filemenu_8024F128 = 0x00000000; - -u8 D_filemenu_8024F12C[] = { 0x00, 0x01, 0x02, 0x03 }; - -u32 D_filemenu_8024F130[] = { - MSG_PAL_Menu_0056, - MSG_PAL_Menu_0057, - MSG_PAL_Menu_0058, - MSG_PAL_Menu_0059, -}; - -Gfx D_filemenu_8024F140[] = { - gsDPPipeSync(), - gsDPSetCycleType(G_CYC_1CYCLE), - gsDPSetRenderMode(G_RM_CLD_SURF, G_RM_CLD_SURF2), - gsDPSetTextureFilter(G_TF_POINT), - gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), - gsDPSetTexturePersp(G_TP_NONE), - gsDPSetColorDither(G_CD_DISABLE), - gsDPSetAlphaDither(G_AD_DISABLE), - gsDPSetTextureLOD(G_TL_TILE), - gsDPSetTextureLUT(G_TT_NONE), - gsDPSetTextureDetail(G_TD_CLAMP), - gsDPSetTextureConvert(G_TC_FILT), - gsDPSetCombineKey(G_CK_NONE), - gsDPSetAlphaCompare(G_AC_NONE), - gsDPNoOp(), - gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 320, 240), - gsSPEndDisplayList(), -}; - -u32 D_filemenu_8024F1C8[] = { - 0x00000300, - 0x00000000, - 0x00000200, - 0x00000100, -}; - -void filemenu_draw_pal_8024d6a0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening); -void filemenu_draw_pal_8024DAA0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening); -void filemenu_update_pal_80247f40(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, - f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity); -void filemenu_draw_pal_8024DA50(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening); - -void filemenu_draw_pal_8024DA00(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening); -void filemenu_draw_pal_8024D9B0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening); -void filemenu_selectlanguage_handle_input(MenuPanel*); -void filemenu_selectlanguage_init(MenuPanel*); -void filemenu_selectlanguage_cleanup(MenuPanel*); -void filemenu_selectlanguage_update(MenuPanel*); - -MenuWindowBP D_filemenu_8024F1D8[] = { - { - .windowID = WIN_FILES_TITLE, - .unk_01 = 0, - .pos = { .x = 0, .y = 0 }, - .width = 0, - .height = 0, - .priority = WINDOW_PRIORITY_0, - .fpDrawContents = &filemenu_draw_pal_8024d6a0, - .tab = NULL, - .parentID = WIN_FILES_MAIN, - .fpUpdate = { .func=&filemenu_update_show_title }, - .extraFlags = 0, - .style = { .customStyle = &filemenu_windowStyles[3] } - }, - { - .windowID = WIN_FILES_SLOT2_BODY, - .unk_01 = 0, - .pos = { .x = 89, .y = 98 }, - .width = 110, - .height = 20, - .priority = WINDOW_PRIORITY_0, - .fpDrawContents = &filemenu_draw_pal_8024DA50, - .tab = NULL, - .parentID = WIN_FILES_MAIN, - .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, - .extraFlags = 0, - .style = { .customStyle = &filemenu_windowStyles[9] } - }, - { - .windowID = WIN_FILES_SLOT3_BODY, - .unk_01 = 0, - .pos = { .x = 89, .y = 124 }, - .width = 110, - .height = 20, - .priority = WINDOW_PRIORITY_0, - .fpDrawContents = &filemenu_draw_pal_8024DAA0, - .tab = NULL, - .parentID = WIN_FILES_MAIN, - .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, - .extraFlags = 0, - .style = { .customStyle = &filemenu_windowStyles[10] } - }, - { - .windowID = WIN_FILES_SLOT0_BODY, - .unk_01 = 0, - .pos = { .x = 89, .y = 46 }, - .width = 110, - .height = 20, - .priority = WINDOW_PRIORITY_0, - .fpDrawContents = &filemenu_draw_pal_8024D9B0, - .tab = NULL, - .parentID = WIN_FILES_MAIN, - .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, - .extraFlags = 0, - .style = { .customStyle = &filemenu_windowStyles[7] } - }, - { - .windowID = WIN_FILES_SLOT1_BODY, - .unk_01 = 0, - .pos = { .x = 89, .y = 72 }, - .width = 110, - .height = 20, - .priority = WINDOW_PRIORITY_0, - .fpDrawContents = &filemenu_draw_pal_8024DA00, - .tab = NULL, - .parentID = WIN_FILES_MAIN, - .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, - .extraFlags = 0, - .style = { .customStyle = &filemenu_windowStyles[8] } - }, -}; - -MenuPanel filemenu_selectlanguage_menuBP = { - .initialized = FALSE, - .col = 0, - .row = 0, - .selected = 0, - .state = 0, - .numCols =1, - .numRows = 4, - .numPages = 0, - .gridData = D_filemenu_8024F12C, - .fpInit = filemenu_selectlanguage_init, - .fpHandleInput = filemenu_selectlanguage_handle_input, - .fpUpdate = filemenu_selectlanguage_update, - .fpCleanup = filemenu_selectlanguage_cleanup -}; - -void filemenu_draw_pal_8024d6a0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - draw_msg(MSG_PAL_Menu_0055, baseX + (192 - get_msg_width(MSG_PAL_Menu_0055, 0)) / 2, baseY + 4, 255, 0, 0); -} - -void func_filemenu_8024D710(s32 language, MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - s32 var_a1; - - if (filemenu_currentMenu == FILE_MENU_LANGUAGES && menu->selected == language) { - filemenu_set_cursor_goal_pos(language + 60, baseX + 4, baseY + 10); - } - - var_a1 = D_filemenu_8024F130[language]; - draw_msg(var_a1, baseX + 36, baseY + 2, 255, 10, 0); - - gSPDisplayList(gMainGfxPos++, D_filemenu_8024F140); - - if (language != gCurrentLanguage) { - gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, 128); - gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - } else { - gDPSetCombineMode(gMainGfxPos++, G_CC_DECALRGBA, G_CC_DECALRGBA); - } - - gDPPipeSync(gMainGfxPos++); - gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, &D_802517E0[D_filemenu_8024F124][D_filemenu_8024F1C8[language]]); - - gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gMainGfxPos++); - gDPLoadBlock(gMainGfxPos++, G_TX_LOADTILE, 0, 0, 255, 512); - gDPPipeSync(gMainGfxPos++); - gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 4, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gMainGfxPos++, G_TX_RENDERTILE, 0, 0, (16 - 1) << 2, (16 - 1) << 2); - gSPTextureRectangle(gMainGfxPos++, (baseX + 15) << 2, (baseY + 2) << 2, (baseX + 31) << 2, (baseY + 18) << 2, 0, 0, 0, 0x400, 0x400); -} - -void filemenu_draw_pal_8024D9B0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - func_filemenu_8024D710(0, menu, baseX, baseY, width, height, opacity, darkening); -} - -void filemenu_draw_pal_8024DA00(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - func_filemenu_8024D710(1, menu, baseX, baseY, width, height, opacity, darkening); -} - -void filemenu_draw_pal_8024DA50(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - func_filemenu_8024D710(2, menu, baseX, baseY, width, height, opacity, darkening); -} - -void filemenu_draw_pal_8024DAA0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - func_filemenu_8024D710(3, menu, baseX, baseY, width, height, opacity, darkening); -} - -void filemenu_selectlanguage_init(MenuPanel* menu) { - s16 x; - s16* posXPtr; - s32 i; - - for (i = 0; i < ARRAY_COUNT(D_filemenu_8024F120); i++) { - D_802517D0[i] = hud_element_create(D_filemenu_8024F120[i]); - hud_element_set_flags(D_802517D0[i], HUD_ELEMENT_FLAG_80); - } - - for (i = 0; i < ARRAY_COUNT(D_filemenu_8024F1D8); i++) { - D_filemenu_8024F1D8[i].tab = menu; - } - - setup_pause_menu_tab(D_filemenu_8024F1D8, 5); - - menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - D_802517D4[0] = (s32) menu->row; - - gWindows[WIN_FILES_TITLE].pos.y = 1; - gWindows[WIN_FILES_TITLE].width = 192; - gWindows[WIN_FILES_TITLE].height = 25; - - posXPtr = &gWindows[WIN_FILES_TITLE].pos.x; - if (gWindows[WIN_FILES_TITLE].parent != WIN_NONE) { - x = (gWindows[gWindows[WIN_FILES_TITLE].parent].width / 2) - (gWindows[WIN_FILES_TITLE].width / 2); - } else { - x = 64; - } - *posXPtr = x; - - menu->initialized = 1; - D_filemenu_8024F124 = 0; - dma_copy(titlemenu_flags_ROM_START, titlemenu_flags_ROM_END, D_802517E0[0]); - dma_copy(titlemenu_flags_ROM_START + 0x800, titlemenu_flags_ROM_END, D_802517E0[1]); - D_filemenu_8024F128 = 2; -} - -void filemenu_selectlanguage_handle_input(MenuPanel* menu) { - s32 originalSelected = menu->selected; - s32 var_s1 = 0; - s32 var_a1; - - if (filemenu_heldButtons & BUTTON_STICK_LEFT) { - while (TRUE) { - menu->col--; - if (menu->col < 0) { - menu->col = 0; - break; - } - if (menu->selected != MENU_PANEL_SELECTED_GRID_DATA(menu)) { - break; - } - } - } - - if (filemenu_heldButtons & BUTTON_STICK_RIGHT) { - while (TRUE) { - menu->col++; - if (menu->col >= menu->numCols) { - menu->col = menu->numCols - 1; - break; - } - - if (menu->selected != MENU_PANEL_SELECTED_GRID_DATA(menu)) { - break; - } - } - } - - if (filemenu_heldButtons & BUTTON_STICK_UP) { - menu->row--; - if (menu->row < 0) { - menu->row = 0; - } - } - - if (filemenu_heldButtons & BUTTON_STICK_DOWN) { - menu->row++; - if (menu->row >= menu->numRows) { - menu->row = menu->numRows - 1; - } - } - - var_a1 = 0; - if (filemenu_pressedButtons & BUTTON_B) { - if (menu->row != D_802517D4[0]) { - menu->row = D_802517D4[0]; - sfx_play_sound(SOUND_MENU_BACK); - var_a1 = 1; - } else { - var_s1 = 1; - } - } - - menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - if (originalSelected != menu->selected) { - if (var_a1 == 0) { - sfx_play_sound(SOUND_FILE_MENU_MOVE_CURSOR); - } - switch (menu->selected) { /* irregular */ - case 0: - gCurrentLanguage = LANGUAGE_EN; - break; - case 1: - gCurrentLanguage = LANGUAGE_DE; - break; - case 2: - gCurrentLanguage = LANGUAGE_FR; - break; - case 3: - gCurrentLanguage = LANGUAGE_ES; - break; - } - } - - if ((filemenu_pressedButtons & (BUTTON_A | BUTTON_START)) || (var_s1 != 0)) { - set_window_update(WIN_FILES_SLOT0_BODY, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WIN_FILES_SLOT1_BODY, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WIN_FILES_SLOT2_BODY, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WIN_FILES_SLOT3_BODY, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WIN_FILES_TITLE, (s32) filemenu_update_hidden_title); - if (var_s1 == 0) { - sfx_play_sound(SOUND_PLANTS_BELL); - } else { - sfx_play_sound(SOUND_FILE_MENU_OUT); - } - set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); - } -} - -void filemenu_selectlanguage_update(MenuPanel* menu) { - gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[15]; - - switch (menu->selected) { - case 0: - gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[16]; - break; - case 1: - gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; - break; - case 2: - gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; - break; - case 3: - gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; - break; - } - - D_filemenu_8024F124 ^= 1; - - D_filemenu_8024F128 = D_filemenu_8024F128 + 1; - if (D_filemenu_8024F128 > 40) { - D_filemenu_8024F128 = 0; - } - - dma_copy(titlemenu_flags_ROM_START + (D_filemenu_8024F128 * 0x800), titlemenu_flags_ROM_END, D_802517E0[D_filemenu_8024F124]); -} - -void filemenu_selectlanguage_cleanup(MenuPanel* arg0) { - s32 i; - - for (i = 0; i < ARRAY_COUNT(D_802517D0); i++) { - hud_element_free(D_802517D0[i]); - } -} diff --git a/src/filemenu/filemenu_yesno.c b/src/filemenu/filemenu_yesno.c index 1511cacbfb..3afa1221f7 100644 --- a/src/filemenu/filemenu_yesno.c +++ b/src/filemenu/filemenu_yesno.c @@ -33,9 +33,6 @@ u8 filemenu_yesno_gridData[] = { 0, 1, 0, 1, 0, 1, -#if !VERSION_PAL - 0, 1 -#endif }; MenuWindowBP filemenu_yesno_windowBPs[] = { @@ -105,12 +102,6 @@ void filemenu_yesno_draw_options_contents( xOffset2 = 28; yOffset2 = 21; break; - case FM_CONFIRM_LANGUAGE: - xOffset1 = 28; - yOffset1 = 4; - xOffset2 = 28; - yOffset2 = 21; - break; case FM_CONFIRM_CREATE: xOffset1 = 28; yOffset1 = 4; @@ -123,14 +114,12 @@ void filemenu_yesno_draw_options_contents( xOffset2 = 28; yOffset2 = 21; break; -#if !VERSION_PAL case FM_CONFIRM_START: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; -#endif } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 255, MSG_PAL_WHITE, 0); @@ -148,9 +137,6 @@ void filemenu_yesno_draw_options_contents( } } -#if VERSION_PAL -INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_draw_prompt_contents); -#else void filemenu_yesno_draw_prompt_contents( MenuPanel* menu, s32 baseX, s32 baseY, @@ -174,10 +160,6 @@ void filemenu_yesno_draw_prompt_contents( filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_WILL_BE_DELETED), baseX + 49, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK_TO_COPY_TO_THIS_FILE), baseX + 10, baseY + 18, 0xFF, 0, 0); break; - case FM_CONFIRM_LANGUAGE: - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OVERRIDE_TO_NEW_DATA), baseX + 10, baseY + 4, 0xFF, 0, 0); - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_SAVE_OK), baseX + 10, baseY + 18, 0xFF, 0, 0); - break; case FM_CONFIRM_CREATE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_NAME_IS), baseX + 10, baseY + 6, 0xFF, 0, 0); @@ -207,7 +189,6 @@ void filemenu_yesno_draw_prompt_contents( break; } } -#endif void filemenu_yesno_init(MenuPanel* tab) { s32 i; @@ -220,9 +201,6 @@ void filemenu_yesno_init(MenuPanel* tab) { tab->initialized = TRUE; } -#if VERSION_PAL -INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_handle_input); -#else void filemenu_yesno_handle_input(MenuPanel* menu) { s32 oldSelected = menu->selected; s32 selected; @@ -295,19 +273,6 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { gSaveSlotMetadata[filemenu_CopyToFileIdx] = gSaveSlotMetadata[filemenu_CopyFromFileIdx]; fio_save_game(filemenu_CopyToFileIdx); break; - case FM_CONFIRM_LANGUAGE: - filemenu_currentMenu = FILE_MENU_MESSAGE; - filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_LANGUAGE; - gWindows[WIN_FILES_MESSAGE].width = 153; - gWindows[WIN_FILES_MESSAGE].height = 25; - gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); - gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); - set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); - set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - gSaveSlotSummary[filemenu_menus[FILE_MENU_MAIN]->selected] = gSaveSlotSummary[gGameStatusPtr->saveSlot]; - fio_save_game(filemenu_menus[FILE_MENU_MAIN]->selected); - gSaveSlotMetadata[filemenu_menus[FILE_MENU_MAIN]->selected].hasData = TRUE; - break; case FM_CONFIRM_CREATE: clear_player_data(); clear_saved_variables(); @@ -363,7 +328,6 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { case 1: // NO switch (menu->state) { case FM_CONFIRM_DELETE: - case FM_CONFIRM_LANGUAGE: case FM_CONFIRM_COPY: filemenu_currentMenu = FILE_MENU_MAIN; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); @@ -400,7 +364,6 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { switch (menu->state) { case FM_CONFIRM_DELETE: - case FM_CONFIRM_LANGUAGE: case FM_CONFIRM_COPY: filemenu_currentMenu = FILE_MENU_MAIN; set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); @@ -429,7 +392,6 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { } } } -#endif void filemenu_yesno_update(MenuPanel* menu) { } diff --git a/src/game_modes.c b/src/game_modes.c index 55cc5a8586..367cb5380c 100644 --- a/src/game_modes.c +++ b/src/game_modes.c @@ -1,195 +1,192 @@ #include "game_modes.h" -GameMode GameModeStartup = { - .flags = MODE_FLAG_NONE, - .init = state_init_startup, - .step = state_step_startup, - .render = state_drawUI_startup, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeLogos = { - .flags = MODE_FLAG_NONE, - .init = state_init_logos, - .step = state_step_logos, - .render = state_drawUI_logos, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeTitleScreen = { - .flags = MODE_FLAG_NONE, - .init = state_init_title_screen, - .step = state_step_title_screen, - .render = state_drawUI_title_screen, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeEnterDemoWorld = { - .flags = MODE_FLAG_NONE, - .init = state_init_enter_demo, - .step = state_step_enter_world, - .render = state_drawUI_enter_world, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeChangeMap = { - .flags = MODE_FLAG_NONE, - .init = state_init_change_map, - .step = state_step_change_map, - .render = state_drawUI_change_map, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeGameOver = { - .flags = MODE_FLAG_NONE, - .init = state_init_game_over, - .step = state_step_game_over, - .render = state_drawUI_game_over, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeEnterWorld = { - .flags = MODE_FLAG_NONE, - .init = state_init_enter_world, - .step = state_step_enter_world, - .render = state_drawUI_enter_world, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeWorld = { - .flags = MODE_FLAG_NONE, - .init = state_init_world, - .step = state_step_world, - .render = state_drawUI_world, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeBattle = { - .flags = MODE_FLAG_NONE, - .init = state_init_battle, - .step = state_step_battle, - .render = state_drawUI_battle, - .renderAux = NULL, - .unusedFunc = NULL, -}; - -GameMode GameModeEndBattle = { - .flags = MODE_FLAG_NONE, - .init = state_init_end_battle, - .step = state_step_end_battle, - .render = state_drawUI_end_battle, - .renderAux = NULL, - .unusedFunc = NULL, -}; +enum GameModeFlags { + MODE_FLAG_NONE = 0, + MODE_FLAG_INITIALIZED = (1 << 0), // Set when the mode is initialized + MODE_FLAG_NEEDS_STEP = (1 << 1), // Turned off after the first step is done + MODE_FLAG_HAS_FRONT_UI = (1 << 2), // renderFrontUI function has been assigned +}; + +typedef struct GameModeData { + /* 0x00 */ u16 flags; + /* 0x04 */ void (*init)(void); + /* 0x08 */ void (*step)(void); + /* 0x0C */ void (*renderBackUI)(void); + /* 0x10 */ void (*renderFrontUI)(void); ///< @see render_game_mode_frontUI +} GameModeData; // size = 0x14 + +const GameModeData GameModeTemplates[] = { + [GAME_MODE_STARTUP] { + .init = state_init_startup, + .step = state_step_startup, + .renderBackUI = state_drawUI_startup, + .renderFrontUI = NULL, + }, + [GAME_MODE_LOGOS] { + .init = state_init_logos, + .step = state_step_logos, + .renderBackUI = state_drawUI_logos, + .renderFrontUI = NULL, + }, + [GAME_MODE_TITLE_SCREEN] { + .init = state_init_title_screen, + .step = state_step_title_screen, + .renderBackUI = state_drawUI_title_screen, + .renderFrontUI = NULL, + }, + [GAME_MODE_ENTER_DEMO_WORLD] { + .init = state_init_enter_demo, + .step = state_step_enter_world, + .renderBackUI = state_drawUI_enter_world, + .renderFrontUI = NULL, + }, + [GAME_MODE_ENTER_WORLD] { + .init = state_init_enter_world, + .step = state_step_enter_world, + .renderBackUI = state_drawUI_enter_world, + .renderFrontUI = NULL, + }, + [GAME_MODE_WORLD] { + .init = state_init_world, + .step = state_step_world, + .renderBackUI = state_drawUI_world, + .renderFrontUI = NULL, + }, + [GAME_MODE_CHANGE_MAP] { + .init = state_init_change_map, + .step = state_step_change_map, + .renderBackUI = state_drawUI_change_map, + .renderFrontUI = NULL, + }, + [GAME_MODE_GAME_OVER] { + .init = state_init_game_over, + .step = state_step_game_over, + .renderBackUI = state_drawUI_game_over, + .renderFrontUI = NULL, + }, + [GAME_MODE_BATTLE] { + .init = state_init_battle, + .step = state_step_battle, + .renderBackUI = state_drawUI_battle, + .renderFrontUI = NULL, + }, + [GAME_MODE_END_BATTLE] { + .init = state_init_end_battle, + .step = state_step_end_battle, + .renderBackUI = state_drawUI_end_battle, + .renderFrontUI = NULL, + }, + [GAME_MODE_PAUSE] { + .init = state_init_pause, + .step = state_step_pause, + .renderBackUI = state_drawUI_pause, + .renderFrontUI = NULL, + }, + [GAME_MODE_UNPAUSE] { + .init = state_init_unpause, + .step = state_step_unpause, + .renderBackUI = state_drawUI_unpause, + .renderFrontUI = NULL, + }, + [GAME_MODE_FILE_SELECT] { + .init = state_init_file_select, + .step = state_step_file_select, + .renderBackUI = state_drawUI_file_select, + .renderFrontUI = NULL, + }, + [GAME_MODE_END_FILE_SELECT] { + .init = state_init_exit_file_select, + .step = state_step_exit_file_select, + .renderBackUI = state_drawUI_exit_file_select, + .renderFrontUI = NULL, + }, + [GAME_MODE_INTRO] { + .init = state_init_intro, + .step = state_step_intro, + .renderBackUI = state_drawUI_intro, + .renderFrontUI = NULL, + }, + [GAME_MODE_DEMO] { + .init = state_init_demo, + .step = state_step_demo, + .renderBackUI = state_drawUI_demo, + .renderFrontUI = NULL, + }, +}; + +BSS s32 CurGameModeID; +BSS GameModeData CurGameMode; + +void game_mode_nop(void) { +} -GameMode GameModePause = { - .flags = MODE_FLAG_NONE, - .init = state_init_pause, - .step = state_step_pause, - .render = state_drawUI_pause, - .renderAux = NULL, - .unusedFunc = NULL, -}; +s32 get_game_mode(void) { + return CurGameModeID; +} -GameMode GameModeUnpause = { - .flags = MODE_FLAG_NONE, - .init = state_init_unpause, - .step = state_step_unpause, - .render = state_drawUI_unpause, - .renderAux = NULL, - .unusedFunc = NULL, -}; +void set_game_mode(s32 modeID) { + GameModeData* template = &GameModeTemplates[modeID]; + CurGameModeID = modeID; + + CurGameMode.flags = MODE_FLAG_INITIALIZED | MODE_FLAG_NEEDS_STEP; + CurGameMode.init = template->init; + CurGameMode.step = template->step; + CurGameMode.renderBackUI = template->renderBackUI; + + if (CurGameMode.init == NULL) { + CurGameMode.init = game_mode_nop; + } + if (CurGameMode.step == NULL) { + CurGameMode.step = game_mode_nop; + } + if (CurGameMode.renderBackUI == NULL) { + CurGameMode.renderBackUI = game_mode_nop; + } + + CurGameMode.renderFrontUI = game_mode_nop; + CurGameMode.init(); +} -GameMode GameModeLanguageSelect = { - .flags = MODE_FLAG_NONE, - .init = state_init_language_select, - .step = state_step_language_select, - .render = state_drawUI_language_select, - .renderAux = NULL, - .unusedFunc = NULL, -}; +void init_game_mode(void) { + CurGameMode.flags = MODE_FLAG_NONE; +} -GameMode GameModeEndLanguageSelect = { - .flags = MODE_FLAG_NONE, - .init = state_init_exit_language_select, - .step = state_step_exit_language_select, - .render = state_drawUI_exit_language_select, - .renderAux = NULL, - .unusedFunc = NULL, -}; +void set_game_mode_render_frontUI(void (*fn)(void)) { + CurGameMode.renderFrontUI = fn; + CurGameMode.flags |= MODE_FLAG_HAS_FRONT_UI; -GameMode GameModeFileSelect = { - .flags = MODE_FLAG_NONE, - .init = state_init_file_select, - .step = state_step_file_select, - .render = state_drawUI_file_select, - .renderAux = NULL, - .unusedFunc = NULL, -}; + if (fn == NULL) { + CurGameMode.renderFrontUI = game_mode_nop; + } +} -GameMode GameModeEndFileSelect = { - .flags = MODE_FLAG_NONE, - .init = state_init_exit_file_select, - .step = state_step_exit_file_select, - .render = state_drawUI_exit_file_select, - .renderAux = NULL, - .unusedFunc = NULL, -}; +void step_game_mode(void) { + if (CurGameMode.flags == MODE_FLAG_NONE) { + return; + } -GameMode GameModeIntro = { - .flags = MODE_FLAG_NONE, - .init = state_init_intro, - .step = state_step_intro, - .render = state_drawUI_intro, - .renderAux = NULL, - .unusedFunc = NULL, -}; + CurGameMode.flags &= ~MODE_FLAG_NEEDS_STEP; + CurGameMode.step(); +} -GameMode GameModeDemo = { - .flags = MODE_FLAG_NONE, - .init = state_init_demo, - .step = state_step_demo, - .render = state_drawUI_demo, - .renderAux = NULL, - .unusedFunc = NULL, -}; +void render_game_mode_backUI(void) { + if (CurGameMode.flags == MODE_FLAG_NONE) { + return; + } -GameMode* GameModeMap[] = { - [GAME_MODE_STARTUP] (GameMode*) &GameModeStartup, - [GAME_MODE_LOGOS] (GameMode*) &GameModeLogos, - [GAME_MODE_TITLE_SCREEN] (GameMode*) &GameModeTitleScreen, - [GAME_MODE_ENTER_DEMO_WORLD] (GameMode*) &GameModeEnterDemoWorld, - [GAME_MODE_WORLD] (GameMode*) &GameModeWorld, - [GAME_MODE_CHANGE_MAP] (GameMode*) &GameModeChangeMap, - [GAME_MODE_GAME_OVER] (GameMode*) &GameModeGameOver, - [GAME_MODE_ENTER_WORLD] (GameMode*) &GameModeEnterWorld, - [GAME_MODE_BATTLE] (GameMode*) &GameModeBattle, - [GAME_MODE_END_BATTLE] (GameMode*) &GameModeEndBattle, - [GAME_MODE_PAUSE] (GameMode*) &GameModePause, - [GAME_MODE_UNPAUSE] (GameMode*) &GameModeUnpause, - [GAME_MODE_LANGUAGE_SELECT] (GameMode*) &GameModeLanguageSelect, - [GAME_MODE_END_LANGUAGE_SELECT] (GameMode*) &GameModeEndLanguageSelect, - [GAME_MODE_FILE_SELECT] (GameMode*) &GameModeFileSelect, - [GAME_MODE_END_FILE_SELECT] (GameMode*) &GameModeEndFileSelect, - [GAME_MODE_INTRO] (GameMode*) &GameModeIntro, - [GAME_MODE_DEMO] (GameMode*) &GameModeDemo, -}; + CurGameMode.renderBackUI(); +} -BSS s16 CurGameMode; +void render_game_mode_frontUI(void) { + if (CurGameMode.flags == MODE_FLAG_NONE) { + return; + } -void set_game_mode(s16 mode) { - CurGameMode = mode; - set_game_mode_slot(0, GameModeMap[mode]); -} + if (CurGameMode.flags & MODE_FLAG_NEEDS_STEP) { + return; + } -s16 get_game_mode(void) { - return CurGameMode; + if (CurGameMode.flags & MODE_FLAG_HAS_FRONT_UI) { + CurGameMode.renderFrontUI(); + } } diff --git a/src/game_modes.h b/src/game_modes.h index a2cfc95e0e..76f40474cb 100644 --- a/src/game_modes.h +++ b/src/game_modes.h @@ -3,53 +3,32 @@ #include "common.h" -// These flags are mostly unused. Not enough context to discern their original purpose. -enum GameModeFlags { - MODE_FLAG_NONE = 0, - MODE_FLAG_INITIALIZED = (1 << 0), // Set when the mod is initialized - MODE_FLAG_STEP_NOT_DONE = (1 << 1), // Turned off after the first step is done - MODE_FLAG_4 = (1 << 2), - MODE_FLAG_8 = (1 << 3), - MODE_FLAG_10 = (1 << 4), - MODE_FLAG_RENDER_AUX_SET = (1 << 5), // Set when the renderAux function is set +enum GameMode { + GAME_MODE_STARTUP, + GAME_MODE_LOGOS, + GAME_MODE_TITLE_SCREEN, + GAME_MODE_ENTER_DEMO_WORLD, + GAME_MODE_ENTER_WORLD, + GAME_MODE_WORLD, + GAME_MODE_CHANGE_MAP, + GAME_MODE_GAME_OVER, + GAME_MODE_BATTLE, + GAME_MODE_END_BATTLE, + GAME_MODE_PAUSE, + GAME_MODE_UNPAUSE, + GAME_MODE_FILE_SELECT, + GAME_MODE_END_FILE_SELECT, + GAME_MODE_INTRO, + GAME_MODE_DEMO, }; -enum GameModeIDs { - GAME_MODE_STARTUP = 0, - GAME_MODE_LOGOS = 1, - GAME_MODE_TITLE_SCREEN = 2, - GAME_MODE_ENTER_DEMO_WORLD = 3, - GAME_MODE_WORLD = 4, - GAME_MODE_CHANGE_MAP = 5, - GAME_MODE_GAME_OVER = 6, - GAME_MODE_ENTER_WORLD = 7, - GAME_MODE_BATTLE = 8, - GAME_MODE_END_BATTLE = 9, - GAME_MODE_PAUSE = 10, - GAME_MODE_UNPAUSE = 11, - GAME_MODE_LANGUAGE_SELECT = 12, - GAME_MODE_END_LANGUAGE_SELECT = 13, - GAME_MODE_FILE_SELECT = 14, - GAME_MODE_END_FILE_SELECT = 15, - GAME_MODE_INTRO = 16, - GAME_MODE_DEMO = 17, -}; - -typedef struct GameMode { - /* 0x00 */ u16 flags; - /* 0x04 */ void (*init)(void); - /* 0x08 */ void (*step)(void); - /* 0x0C */ UNK_FUN_PTR(unusedFunc); - /* 0x10 */ void (*render)(void); - /* 0x14 */ void (*renderAux)(void); ///< @see state_render_frontUI -} GameMode; // size = 0x18 +void set_game_mode(s32 mode); +s32 get_game_mode(void); +void set_game_mode_render_frontUI(void (*fn)(void)); -void set_game_mode(s16 mode); -void clear_game_modes(void); -GameMode* set_game_mode_slot(s32 i, GameMode* mode); -void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void)); -void step_current_game_mode(void); -void state_render_backUI(void); -void state_render_frontUI(void); +void init_game_mode(void); +void step_game_mode(void); +void render_game_mode_backUI(void); +void render_game_mode_frontUI(void); #endif diff --git a/src/game_states.c b/src/game_states.c deleted file mode 100644 index f4e127c8b4..0000000000 --- a/src/game_states.c +++ /dev/null @@ -1,188 +0,0 @@ -#include "common.h" -#include "game_modes.h" - -BSS GameMode gMainGameMode[2]; - -void mode_default_nop(void) { -} - -void clear_game_modes(void) { - GameMode* gameMode; - s32 i; - - for (gameMode = gMainGameMode, i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - gameMode->flags = MODE_FLAG_NONE; - } -} - - -// Function is unused. -GameMode* set_next_game_mode(GameMode* mode) { - GameMode* gameMode; - s32 i; - - for (gameMode = gMainGameMode, i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags == MODE_FLAG_NONE) { - break; - } - } - - ASSERT(i < ARRAY_COUNT(gMainGameMode)); - - gameMode->flags = MODE_FLAG_INITIALIZED | MODE_FLAG_STEP_NOT_DONE; - gameMode->init = mode->init; - gameMode->step = mode->step; - gameMode->render = mode->render; - gameMode->unusedFunc = NULL; - - if (gameMode->init == NULL) { - gameMode->init = mode_default_nop; - } - if (gameMode->step == NULL) { - gameMode->step = mode_default_nop; - } - if (gameMode->unusedFunc == NULL) { - gameMode->unusedFunc = mode_default_nop; - } - if (gameMode->render == NULL) { - gameMode->render = mode_default_nop; - } - - gameMode->renderAux = mode_default_nop; - gameMode->init(); - - return gameMode; -} - -GameMode* set_game_mode_slot(s32 i, GameMode* mode) { - GameMode* gameMode = &gMainGameMode[i]; - - ASSERT(i < ARRAY_COUNT(gMainGameMode)); - - gameMode->flags = MODE_FLAG_INITIALIZED | MODE_FLAG_STEP_NOT_DONE; - gameMode->init = mode->init; - gameMode->step = mode->step; - gameMode->render = mode->render; - gameMode->unusedFunc = NULL; - if (gameMode->init == NULL) gameMode->init = mode_default_nop; - if (gameMode->step == NULL) gameMode->step = mode_default_nop; - if (gameMode->unusedFunc == NULL) gameMode->unusedFunc = mode_default_nop; - if (gameMode->render == NULL) gameMode->render = mode_default_nop; - - gameMode->renderAux = mode_default_nop; - gameMode->init(); - - return gameMode; -} - -void game_mode_set_fpDrawAuxUI(s32 i, void (*fn)(void)) { - GameMode* gameMode = &gMainGameMode[i]; - - ASSERT(i < ARRAY_COUNT(gMainGameMode)); - - gameMode->renderAux = fn; - gameMode->flags |= MODE_FLAG_RENDER_AUX_SET; - - if (fn == NULL) { - gameMode->renderAux = mode_default_nop; - } -} - -// Unused -void set_game_mode_flag_4(s32 i) { - gMainGameMode[i].flags |= MODE_FLAG_4; -} - -// Unused -void set_game_mode_flag_8(s32 i) { - gMainGameMode[i].flags |= MODE_FLAG_8; -} - -// Unused -void clear_game_mode_unk_flags(s32 i) { - gMainGameMode[i].flags &= ~(MODE_FLAG_4 | MODE_FLAG_8 | MODE_FLAG_10); -} - -// Unused -void set_game_mode_flag_10(s32 i) { - gMainGameMode[i].flags &= ~(MODE_FLAG_4 | MODE_FLAG_8); - gMainGameMode[i].flags |= MODE_FLAG_10; -} - -void step_current_game_mode(void) { - GameMode* gameMode = gMainGameMode; - s32 i; - - for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags != MODE_FLAG_NONE) { - if (!(gameMode->flags & MODE_FLAG_4)) { - if (!(gameMode->flags & MODE_FLAG_8)) { - gameMode->flags &= ~MODE_FLAG_STEP_NOT_DONE; - gameMode->step(); - } - } - } - } -} - -// Unused -void state_do_unk(void) { - GameMode* gameMode = gMainGameMode; - s32 i; - - for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags != MODE_FLAG_NONE) { - if (!(gameMode->flags & MODE_FLAG_4)) { - if (!(gameMode->flags & MODE_FLAG_10)) { - gameMode->unusedFunc(); - } - } - } - } -} - -void state_render_backUI(void) { - GameMode* gameMode = gMainGameMode; - s32 i; - - for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags != MODE_FLAG_NONE) { - if (!(gameMode->flags & MODE_FLAG_4)) { - if (!(gameMode->flags & MODE_FLAG_10)) { - gameMode->render(); - } - } - } - } -} - -void state_render_frontUI(void) { - GameMode* gameMode = gMainGameMode; - s32 i; - - for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags != MODE_FLAG_NONE) { - if (!(gameMode->flags & MODE_FLAG_4)) { - if (!(gameMode->flags & MODE_FLAG_STEP_NOT_DONE)) { - if (gameMode->flags & MODE_FLAG_RENDER_AUX_SET) { - gameMode->renderAux(); - } - } - } - } - } - - // re-initialization needed - evidence of inlining? or just copy/pasting? - gameMode = &gMainGameMode[0]; - for (i = 0; i < ARRAY_COUNT(gMainGameMode); i++, gameMode++) { - if (gameMode->flags != MODE_FLAG_NONE) { - if (!(gameMode->flags & MODE_FLAG_4)) { - if (!(gameMode->flags & MODE_FLAG_STEP_NOT_DONE)) { - if (gameMode->flags & MODE_FLAG_10) { - gameMode->render(); - } - } - } - } - } -} diff --git a/src/main_loop.c b/src/main_loop.c index c325e7e889..03276a1347 100644 --- a/src/main_loop.c +++ b/src/main_loop.c @@ -96,7 +96,7 @@ void step_game_loop(void) { profiler_update(PROFILER_TIME_MESSAGES, 0); update_hud_elements(); profiler_update(PROFILER_TIME_HUD_ELEMENTS, 0); - step_current_game_mode(); + step_game_mode(); profiler_update(PROFILER_TIME_STEP_GAME_MODE, 0); update_entities(); profiler_update(PROFILER_TIME_ENTITIES, 0); @@ -213,7 +213,7 @@ void gfx_draw_frame(void) { render_workers_backUI(); render_hud_elements_backUI(); render_effects_UI(); - state_render_backUI(); + render_game_mode_backUI(); if (!(gOverrideFlags & GLOBAL_OVERRIDES_WINDOWS_OVER_CURTAINS)) { render_window_root(); @@ -251,7 +251,7 @@ void gfx_draw_frame(void) { render_window_root(); } - state_render_frontUI(); + render_game_mode_frontUI(); if (gOverrideFlags & GLOBAL_OVERRIDES_SOFT_RESET) { switch (SoftResetState) { @@ -322,7 +322,7 @@ void load_engine_data(void) { reset_background_settings(); clear_character_set(); clear_printers(); - clear_game_modes(); + init_game_mode(); clear_npcs(); hud_element_clear_cache(); clear_trigger_data(); diff --git a/src/model.c b/src/model.c index 777bf50286..f6ab4ea11a 100644 --- a/src/model.c +++ b/src/model.c @@ -2582,21 +2582,6 @@ void mdl_create_model(ModelBlueprint* bp, s32 unused) { (*gCurrentModelTreeNodeInfo)[TreeIterPos].modelIndex = modelIdx; } -// Mysterious no-op -void iterate_models(void) { - Model* last = NULL; - Model* mdl; - s32 i; - - for (i = 0; i < ARRAY_COUNT(*gCurrentModels); i++) { - mdl = (*gCurrentModels)[i]; - if (mdl != NULL) { - last = mdl; - } - } - mdl = last; -} - void mdl_update_transform_matrices(void) { Matrix4f tempModelMtx; Matrix4f tempGroupMtx; diff --git a/src/pause/pause_main.c b/src/pause/pause_main.c index b850502545..29709034da 100644 --- a/src/pause/pause_main.c +++ b/src/pause/pause_main.c @@ -196,9 +196,7 @@ void pause_set_cursor_opacity(s32 val) { void pause_set_cursor_pos_immediate(s32 windowID, s32 posX, s32 posY) { Window* window = &gWindows[windowID]; - if (D_8024EFB4 != 0 - || get_game_mode() == GAME_MODE_END_FILE_SELECT - || get_game_mode() == GAME_MODE_END_LANGUAGE_SELECT) { + if (D_8024EFB4 != 0 || get_game_mode() == GAME_MODE_END_FILE_SELECT) { if (D_8024EFB4 != 0) { s32 i; @@ -230,9 +228,7 @@ void pause_set_cursor_pos_immediate(s32 windowID, s32 posX, s32 posY) { void pause_set_cursor_pos(s32 windowID, s32 posX, s32 posY) { Window* window = &gWindows[windowID]; - if (D_8024EFB4 != 0 - || get_game_mode() == GAME_MODE_END_FILE_SELECT - || get_game_mode() == GAME_MODE_END_LANGUAGE_SELECT) { + if (D_8024EFB4 != 0 || get_game_mode() == GAME_MODE_END_FILE_SELECT) { if (D_8024EFB4 != 0) { s32 i; diff --git a/src/state_battle.c b/src/state_battle.c index d0c4d91402..66eaba38be 100644 --- a/src/state_battle.c +++ b/src/state_battle.c @@ -112,7 +112,6 @@ void state_step_battle(void) { update_npcs(); update_item_entities(); update_effects(); - iterate_models(); update_cameras(); } diff --git a/src/state_file_select.c b/src/state_file_select.c index 0b9b896e29..23e229975e 100644 --- a/src/state_file_select.c +++ b/src/state_file_select.c @@ -46,14 +46,6 @@ BSS s8 D_800A0930; BSS s8 D_800A0931; static s16 D_800A0932; -void state_init_language_select(void) { - D_800A0931 = 0; - D_800A0932 = 0; - disable_player_input(); - set_time_freeze_mode(TIME_FREEZE_FULL); - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); -} - void state_init_file_select(void) { D_800A0931 = 0; D_800A0932 = 0; @@ -90,93 +82,6 @@ void state_init_file_select(void) { gOverrideFlags |= GLOBAL_OVERRIDES_WINDOWS_OVER_CURTAINS; } -void state_step_language_select(void) { - switch (D_800A0931) { - case 0: - update_player(); - update_npcs(); - update_encounters(); - update_effects(); - - if (D_800A0932 < 255) { - D_800A0932 += 20; - - if (D_800A0932 > 255) { - D_800A0932 = 255; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - if (D_800A0932 == 255) { - D_800A0931 = 1; - } - } else { - D_800A0931 = 1; - } - break; - case 1: - D_800A0930 = 5; - D_800A0931 = 2; - gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - break; - case 2: - D_800A0930--; - if (D_800A0930 == 0) { - nuGfxSetCfb(fsFrameBuffers, 2); - if (nuGfxCfb[2] == nuGfxCfb_ptr) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - } else { - gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - set_windows_visible(WINDOW_GROUP_FILES); - D_800A0930 = 1; - D_800A0931 = 3; - } - } - break; - case 3: - if (D_800A0930 >= 0) { - D_800A0930--; - if (D_800A0930 == 0) { - D_800A0930 = -1; - sfx_stop_env_sounds(); - func_8003B1A8(); - gGameStatusPtr->isBattle = 2; - backup_map_collision_data(); - battle_heap_create(); - sfx_clear_env_sounds(0); - spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD); - clear_model_data(); - clear_sprite_shading_data(); - reset_background_settings(); - clear_entity_models(); - clear_animator_list(); - clear_worker_list(); - hud_element_set_aux_cache(&D_80200000, 0x20000); - hud_element_clear_cache(); - reset_status_bar(); - clear_item_entity_data(); - clear_script_list(); - clear_npcs(); - clear_entity_data(FALSE); - clear_trigger_data(); - nuPiReadRomOverlay(&D_8007798C); - filemenu_init(1); - gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - set_screen_overlay_params_front(OVERLAY_NONE, 255.0f); - } - if (D_800A0930 >= 0) { - break; - } - } - - filemenu_update(); - D_800A0932 -= 20; - if (D_800A0932 < 0) { - D_800A0932 = 0; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - break; - } -} - void state_step_file_select(void) { switch (D_800A0931) { case 0: @@ -205,24 +110,9 @@ void state_step_file_select(void) { } } -void state_drawUI_language_select(void) { -} - void state_drawUI_file_select(void) { } -void state_init_exit_language_select(void) { - if (D_800A0932 > 0) { - D_800A0931 = 0; - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - } else { - D_800A0931 = 1; - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - } - D_800A0930 = 1; - gOverrideFlags &= ~GLOBAL_OVERRIDES_40; -} - void state_init_exit_file_select(void) { D_800A0931 = 0; D_800A0932 = 0; @@ -238,140 +128,6 @@ void state_init_exit_file_select(void) { gOverrideFlags &= ~GLOBAL_OVERRIDES_40; } -void state_step_exit_language_select(void) { - switch (D_800A0931) { - case 0: - if (D_800A0932 != 0) { - D_800A0932 -= 20; - if (D_800A0932 < 0) { - D_800A0932 = 0; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - if (D_800A0932 == 0) { - D_800A0931 = 1; - } - } else { - D_800A0931 = 1; - } - break; - case 1: - if (D_800A0932 != 255) { - D_800A0932 += 20; - if (D_800A0932 > 255) { - D_800A0932 = 255; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - if (D_800A0932 == 255) { - D_800A0931 = 2; - } - } else { - D_800A0931 = 2; - } - break; - case 2: - if (D_800A0930 == 3) { - gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - } - - if (D_800A0930 >= 0) { - D_800A0930--; - if (D_800A0930 == 0) { - MapSettings* mapSettings; - MapConfig* mapConfig; - u32 mapShapeSize; - void* mapShape; - BackgroundHeader* bgHeader; - - D_800A0930 = -1; - nuGfxSetCfb(fsFrameBuffers, ARRAY_COUNT(fsFrameBuffers)); - filemenu_cleanup(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - mapSettings = get_current_map_settings(); - mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID]; - gGameStatusPtr->isBattle = FALSE; - func_8005AF84(); - func_8002ACDC(); - sfx_clear_env_sounds(1); - spr_init_sprites(gGameStatusPtr->playerSpriteSet); - init_model_data(); - init_sprite_shading_data(); - init_entity_models(); - reset_animator_list(); - init_worker_list(); - hud_element_set_aux_cache(0, 0); - init_hud_element_list(); - init_item_entity_list(); - init_script_list(); - init_npc_list(); - init_entity_data(); - init_trigger_list(); - mapShape = load_asset_by_name(wMapShapeName, &mapShapeSize); - decode_yay0(mapShape, &gMapShapeData); - general_heap_free(mapShape); - initialize_collision(); - restore_map_collision_data(); - - if (mapConfig->dmaStart != NULL) { - dma_copy(mapConfig->dmaStart, mapConfig->dmaEnd, mapConfig->dmaDest); - } - - load_map_bg(mapConfig->bgName); - - bgHeader = mapSettings->background; - if (bgHeader != NULL) { - set_background(bgHeader); - } else { - set_background_size(296, 200, 12, 20); - } - - mdl_calculate_model_sizes(); - npc_reload_all(); - status_bar_respond_to_changes(); - set_time_freeze_mode(TIME_FREEZE_PARTIAL); - } - set_windows_visible(WINDOW_GROUP_ALL); - D_800A0931 = 3; - update_player(); - update_npcs(); - update_encounters(); - update_effects(); - - D_800A0932 -= 20; - if (D_800A0932 < 0) { - D_800A0932 = 0; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - } - break; - case 3: - update_player(); - update_npcs(); - update_encounters(); - update_effects(); - - if (D_800A0932 == 0) { - D_800A0931 = 4; - } else { - D_800A0932 -= 20; - if (D_800A0932 < 0) { - D_800A0932 = 0; - } - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_800A0932); - } - break; - case 4: - set_time_freeze_mode(TIME_FREEZE_NORMAL); - update_player(); - update_npcs(); - update_encounters(); - update_effects(); - enable_player_input(); - set_game_mode(GAME_MODE_WORLD); - set_screen_overlay_params_front(OVERLAY_NONE, -1.0f); - break; - } -} - void state_step_exit_file_select(void) { s32 temp_s0 = func_80244BC4(); s32 flagSum; @@ -434,8 +190,5 @@ void state_step_exit_file_select(void) { } } -void state_drawUI_exit_language_select(void) { -} - void state_drawUI_exit_file_select(void) { } diff --git a/src/state_title_screen.c b/src/state_title_screen.c index e50b913360..10ab7a78be 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -188,7 +188,7 @@ void state_init_title_screen(void) { gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; clear_player_data(); gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - game_mode_set_fpDrawAuxUI(0, appendGfx_title_screen); + set_game_mode_render_frontUI(appendGfx_title_screen); load_map_bg("title_bg"); set_background(&gBackgroundImage); bgm_set_song(0, SONG_MAIN_THEME, 0, 500, 8); diff --git a/src/state_world.c b/src/state_world.c index 4ca707d4ef..e65e9a8a49 100644 --- a/src/state_world.c +++ b/src/state_world.c @@ -8,7 +8,7 @@ void state_world_draw_aux_ui(void); void state_init_world(void) { - game_mode_set_fpDrawAuxUI(0, state_world_draw_aux_ui); + set_game_mode_render_frontUI(state_world_draw_aux_ui); #ifdef DX_QUICK_LAUNCH_BATTLE if (gGameStatus.loadType == LOAD_FROM_FILE_SELECT) { @@ -28,7 +28,6 @@ void state_step_world(void) { profiler_update(PROFILE_TIME_WORLD_ITEM_ENTITIES, 0); update_effects(); profiler_update(PROFILE_TIME_WORLD_EFFECTS, 0); - iterate_models(); // no-op update_cameras(); profiler_update(PROFILE_TIME_WORLD_CAMERAS, 0); } diff --git a/ver/jp/symbol_addrs.txt b/ver/jp/symbol_addrs.txt index 3138d3855b..4c12d8a891 100644 --- a/ver/jp/symbol_addrs.txt +++ b/ver/jp/symbol_addrs.txt @@ -261,10 +261,10 @@ spr_render_init = 0x801115B0; update_entities = 0x801148E0; render_entities = 0x801150C4; clear_entity_data = 0x80115EC8; -clear_game_modes = 0x80117DA8; -step_current_game_mode = 0x80118088; -state_render_backUI = 0x80118168; -state_render_frontUI = 0x801181D4; +init_game_mode = 0x80117DA8; +step_game_mode = 0x80118088; +render_game_mode_backUI = 0x80118168; +render_game_mode_frontUI = 0x801181D4; clear_model_data = 0x8011AF54; mdl_update_transform_matrices = 0x8011B8A8; render_models = 0x8011BDA0; @@ -2139,10 +2139,10 @@ entity_raycast_down = 0x801177F8; // type:func rom:0xAC688 set_npc_shadow_scale = 0x80117B10; // type:func rom:0xAC9A0 set_peach_shadow_scale = 0x80117BE4; // type:func rom:0xACA74 is_block_on_ground = 0x80117D30; // type:func rom:0xACBC0 -mode_default_nop = 0x80117DA0; // type:func rom:0xACC30 +game_mode_nop = 0x80117DA0; // type:func rom:0xACC30 set_next_game_mode = 0x80117DCC; // type:func rom:0xACC5C set_game_mode_slot = 0x80117EB8; // type:func rom:0xACD48 -game_mode_set_fpDrawAuxUI = 0x80117F94; // type:func rom:0xACE24 +set_game_mode_render_frontUI = 0x80117F94; // type:func rom:0xACE24 set_game_mode_flag_4 = 0x80117FE4; // type:func rom:0xACE74 set_game_mode_flag_8 = 0x8011800C; // type:func rom:0xACE9C clear_game_mode_unk_flags = 0x80118034; // type:func rom:0xACEC4 @@ -2763,7 +2763,7 @@ D_80151664 = 0x801566A4; wEntityBlueprint = 0x801566A8; bEntityBlueprint = 0x80156728; D_801516FC = 0x8015673C; -gMainGameMode = 0x80156740; +CurGameMode = 0x80156740; gCurrentTextureHeader = 0x80156780; wModelList = 0x801567B0; bModelList = 0x80156BB0; diff --git a/ver/pal/asm/bss3.s b/ver/pal/asm/bss3.s index 6b17007686..62fe7a9508 100644 --- a/ver/pal/asm/bss3.s +++ b/ver/pal/asm/bss3.s @@ -170,7 +170,7 @@ dlabel bEntityBlueprint dlabel D_801516FC .space 4 -dlabel gMainGameMode +dlabel CurGameMode .space 0x00000040 dlabel gCurrentTextureHeader diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index e3e3d331d6..9a3e9eeb73 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -821,7 +821,6 @@ segments: vram_class: engine2 subsegments: - [auto, c, entity] - - [auto, c, game_states] - [auto, c, model] - [auto, c, animator] - [auto, c, entity_model] diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 3a99c57a29..ca439d977c 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -3944,19 +3944,19 @@ set_standard_shadow_scale = 0x8011285C; // type:func rom:0xA8F5C set_npc_shadow_scale = 0x80112900; // type:func rom:0xA9000 set_peach_shadow_scale = 0x801129D4; // type:func rom:0xA90D4 is_block_on_ground = 0x80112B20; // type:func rom:0xA9220 -mode_default_nop = 0x80112B90; // type:func rom:0xA9290 -clear_game_modes = 0x80112B98; // type:func rom:0xA9298 +game_mode_nop = 0x80112B90; // type:func rom:0xA9290 +init_game_mode = 0x80112B98; // type:func rom:0xA9298 set_next_game_mode = 0x80112BBC; // type:func rom:0xA92BC set_game_mode_slot = 0x80112CA8; // type:func rom:0xA93A8 -game_mode_set_fpDrawAuxUI = 0x80112D84; // type:func rom:0xA9484 +set_game_mode_render_frontUI = 0x80112D84; // type:func rom:0xA9484 set_game_mode_flag_3 = 0x80112DD4; // type:func rom:0xA94D4 set_game_mode_flag_4 = 0x80112DFC; // type:func rom:0xA94FC clear_game_mode_unk_flags = 0x80112E24; // type:func rom:0xA9524 set_game_mode_flag_5 = 0x80112E4C; // type:func rom:0xA954C -step_current_game_mode = 0x80112E78; // type:func rom:0xA9578 +step_game_mode = 0x80112E78; // type:func rom:0xA9578 state_do_unk = 0x80112EEC; // type:func rom:0xA95EC -state_render_backUI = 0x80112F58; // type:func rom:0xA9658 -state_render_frontUI = 0x80112FC4; // type:func rom:0xA96C4 +render_game_mode_backUI = 0x80112F58; // type:func rom:0xA9658 +render_game_mode_frontUI = 0x80112FC4; // type:func rom:0xA96C4 appendGfx_model = 0x80113090; // type:func rom:0xA9790 load_texture_impl = 0x80114B58; // type:func rom:0xAB258 load_texture_by_name = 0x80114D6C; // type:func rom:0xAB46C @@ -4816,7 +4816,7 @@ wEntityBlueprint = 0x80151668; // rom:0xE7D68 start_script = 0x802C33E0; // type:func rom:0xE7D90 bEntityBlueprint = 0x801516E8; // rom:0xE7DE8 D_801516FC = 0x801516FC; // rom:0xE7DFC -gMainGameMode = 0x80151700; // rom:0xE7E00 +CurGameMode = 0x80151700; // rom:0xE7E00 gCurrentTileDescriptor = 0x80151740; // rom:0xE7E40 wModelList = 0x80151770; // rom:0xE7E70 start_script_in_group = 0x802C35D0; // type:func rom:0xE7F80