From df4860925bacb257a5933645df0fd38c095705c5 Mon Sep 17 00:00:00 2001 From: MegaMech <7255464+MegaMech@users.noreply.github.com> Date: Sat, 5 Oct 2024 21:17:28 +0000 Subject: [PATCH] Clang Format --- src/code_80091750.c | 178 ++++++++++++++++++++++---------------------- src/menus.c | 62 ++++++++------- src/menus.h | 21 ++---- 3 files changed, 133 insertions(+), 128 deletions(-) diff --git a/src/code_80091750.c b/src/code_80091750.c index f50cbb086..1355dfb97 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -4761,7 +4761,7 @@ void func_8009CE64(s32 arg0) { } else { D_8018E7AC[arg0] = 0; if (gDebugMenuSelection != DEBUG_MENU_OPTION_SELECTED) { - switch (gMenuFadeType) { /* switch 3 */ + switch (gMenuFadeType) { /* switch 3 */ case MENU_FADE_TYPE_MAIN: /* switch 3 */ if (gMenuSelection == LOGO_INTRO_MENU) { gMenuSelection = START_MENU; @@ -4877,12 +4877,12 @@ void func_8009CE64(s32 arg0) { } unref_8018EE0C = 0; } else { - switch (gDebugGotoScene) { /* switch 5; irregular */ + switch (gDebugGotoScene) { /* switch 5; irregular */ case DEBUG_GOTO_ENDING: /* switch 5 */ gGamestateNext = (s32) 5; break; case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 5 */ - case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 5 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 5 */ gGamestateNext = 9; gCreditsCourseId = 8; break; @@ -4925,7 +4925,7 @@ void func_8009CE64(s32 arg0) { gCupSelection = gCupSelectionByCourseId[gCurrentCourseId]; D_800DC540 = gCupSelection; gCourseIndexInCup = gPerCupIndexByCourseId[gCurrentCourseId]; - switch (gDebugGotoScene) { /* switch 6; irregular */ + switch (gDebugGotoScene) { /* switch 6; irregular */ case DEBUG_GOTO_ENDING: /* switch 6 */ break; case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 6 */ @@ -6328,7 +6328,8 @@ void func_800A09E0(struct_8018D9E0_entry* arg0) { s32 table_row, x = 0x20, y; gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH - 1, 194); for (table_row = 0; table_row < 9; table_row++) { - if ((gControllerPakScrollDirection != CONTROLLER_PAK_SCROLL_DIR_NONE) || ((table_row != 0) && (table_row != 8))) { + if ((gControllerPakScrollDirection != CONTROLLER_PAK_SCROLL_DIR_NONE) || + ((table_row != 0) && (table_row != 8))) { y = (table_row * 0xA) + arg0->row; gDisplayListHead = func_8009BA74(gDisplayListHead, D_0200157C, x, y); } @@ -6764,7 +6765,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { struct_8018EE10_entry* var_v1; gDisplayListHead = draw_box(gDisplayListHead, 0, 0, 0x00000140, 0x000000F0, 0, 0, 0, 0x00000064); - switch (gSubMenuSelection) { /* switch 1 */ + switch (gSubMenuSelection) { /* switch 1 */ case SUB_MENU_OPTION_RETURN_GAME_SELECT: /* switch 1 */ case SUB_MENU_OPTION_SOUND_MODE: /* switch 1 */ case SUB_MENU_OPTION_COPY_CONTROLLER_PAK: /* switch 1 */ @@ -6780,7 +6781,7 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { set_text_color(1); draw_text(0x000000E6, 0x55 + 0x23, gSoundModeNames[gSoundMode], 0, 1.0f, 1.0f); break; - case SUB_MENU_ERASE_QUIT: /* switch 1 */ + case SUB_MENU_ERASE_QUIT: /* switch 1 */ case SUB_MENU_ERASE_ERASE: /* switch 1 */ set_text_color(3); for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7878); stackPadding0++) { @@ -6802,9 +6803,9 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } break; case SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P: /* switch 1 */ set_text_color(2); var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_2P_MIN; for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E78D0) / 4; stackPadding0++) { // 12 / 4 = 3 @@ -6812,10 +6813,10 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { 0.9f, 0.9f); } break; - case SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P: /* switch 1 */ case SUB_MENU_COPY_PAK_ERROR_CANT_CREATE_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P: /* switch 1 */ set_text_color(2); var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_1P_MIN; for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7890) / 4; stackPadding0++) { // 16 / 4 = 4 @@ -6841,8 +6842,8 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { break; case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 1 */ case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 1 */ - case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 1 */ - case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 1 */ + case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 1 */ switch (gSubMenuSelection) { case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: @@ -6941,8 +6942,8 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { func_80093324(0x6E + (0x32 * var_s2), 0x000000D2, D_800E7930[var_s2], 0, 0.75f, 0.75f); } break; - case SUB_MENU_COPY_PAK_START: /* switch 1 */ - case SUB_MENU_COPY_PAK_COPYING: /* switch 1 */ + case SUB_MENU_COPY_PAK_START: /* switch 1 */ + case SUB_MENU_COPY_PAK_COPYING: /* switch 1 */ case SUB_MENU_COPY_PAK_COMPLETED: /* switch 1 */ var_s5 = (gSubMenuSelection - SUB_MENU_COPY_PAK_ACTION_MIN) / 2; set_text_color(2); @@ -6985,13 +6986,13 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } break; } - switch (gSubMenuSelection) { /* switch 2 */ - case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 2 */ - case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 2 */ - case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 2 */ - case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 2 */ - case SUB_MENU_COPY_PAK_PROMPT_QUIT: /* switch 2 */ - case SUB_MENU_COPY_PAK_PROMPT_COPY: /* switch 2 */ + switch (gSubMenuSelection) { /* switch 2 */ + case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: /* switch 2 */ + case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: /* switch 2 */ + case SUB_MENU_COPY_PAK_TO_GHOST1_2P: /* switch 2 */ + case SUB_MENU_COPY_PAK_TO_GHOST2_2P: /* switch 2 */ + case SUB_MENU_COPY_PAK_PROMPT_QUIT: /* switch 2 */ + case SUB_MENU_COPY_PAK_PROMPT_COPY: /* switch 2 */ spE0.column -= 5; spE0.row -= 6; break; @@ -7078,7 +7079,8 @@ void func_800A2EB8(struct_8018D9E0_entry* arg0) { draw_text((-(s32) (((f32) (get_string_width(D_800E76CC[gCCSelection]) + 8) * 0.6f) / 2) - arg0->column) + 0xF5, arg0->row + 0xE1, gCupNames[D_800DC540], 0, 0.6f, 0.6f); draw_text((temp_s0 - arg0->column) + 0xF5, arg0->row + 0xE1, - D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, 0.6f); + D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, + 0.6f); } void func_800A32B4(s32 arg0, s32 arg1, s32 characterId, s32 rank) { @@ -7194,7 +7196,8 @@ void func_800A34A8(struct_8018D9E0_entry* arg0) { draw_text((-(s32) (((get_string_width(D_800E76CC[gCCSelection]) + 8) * 0.6f) / 2) - arg0->column) + 0xE6, arg0->row + 0xE1, gCupNames[D_800DC540], 0, 0.6f, 0.6f); draw_text((temp_s0_3 - arg0->column) + 0xE6, arg0->row + 0xE1, - D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, 0.6f); + D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, + 0.6f); } } @@ -8056,7 +8059,10 @@ void func_800A66A8(struct_8018D9E0_entry* arg0, Unk_D_800E70A0* arg1) { z2 += z1; // clang-format off - if (x2); if (y2); if (z2); + if (x2) {; +}if (y2) {; +}if (z2) {; +} // clang-format on guScale(mtx, 1.2f, 1.2f, 1.2f); @@ -8479,19 +8485,19 @@ void func_800A7A4C(s32 arg0) { case 0xA: /* switch 8 */ func_800AA280(var_s1); break; - case 0x10: /* switch 8 */ - case 0x11: /* switch 8 */ - switch (gMainMenuSelection) { /* switch 5 */ + case 0x10: /* switch 8 */ + case 0x11: /* switch 8 */ + switch (gMainMenuSelection) { /* switch 5 */ case MAIN_MENU_OPTION: /* switch 5 */ - case MAIN_MENU_DATA: /* switch 5 */ - case MAIN_MENU_PLAYER_SELECT: /* switch 5 */ + case MAIN_MENU_DATA: /* switch 5 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 5 */ func_800A9B9C(var_s1); break; - case MAIN_MENU_MODE_SELECT: /* switch 5 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 5 */ - case MAIN_MENU_OK_SELECT: /* switch 5 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 5 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 5 */ + case MAIN_MENU_MODE_SELECT: /* switch 5 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 5 */ + case MAIN_MENU_OK_SELECT: /* switch 5 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 5 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 5 */ func_800A9C40(var_s1); break; } @@ -8500,21 +8506,21 @@ void func_800A7A4C(s32 arg0) { func_800AA280(var_s1); func_800A9A98(var_s1); break; - case 0xB: /* switch 8 */ - case 0xC: /* switch 8 */ - case 0xD: /* switch 8 */ - case 0xE: /* switch 8 */ - switch (gMainMenuSelection) { /* switch 6 */ + case 0xB: /* switch 8 */ + case 0xC: /* switch 8 */ + case 0xD: /* switch 8 */ + case 0xE: /* switch 8 */ + switch (gMainMenuSelection) { /* switch 6 */ case MAIN_MENU_OPTION: /* switch 6 */ - case MAIN_MENU_DATA: /* switch 6 */ - case MAIN_MENU_PLAYER_SELECT: /* switch 6 */ + case MAIN_MENU_DATA: /* switch 6 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 6 */ func_800A9B9C(var_s1); break; - case MAIN_MENU_MODE_SELECT: /* switch 6 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 6 */ - case MAIN_MENU_OK_SELECT: /* switch 6 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 6 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 6 */ + case MAIN_MENU_MODE_SELECT: /* switch 6 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 6 */ + case MAIN_MENU_OK_SELECT: /* switch 6 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 6 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 6 */ func_800A9C40(var_s1); break; } @@ -8561,10 +8567,10 @@ void func_800A7A4C(s32 arg0) { break; } switch (gPlayerSelectMenuSelection) { /* switch 10; irregular */ - case PLAYER_SELECT_MENU_MAIN: /* switch 10 */ + case PLAYER_SELECT_MENU_MAIN: /* switch 10 */ func_800AAB90(var_s1); break; - case PLAYER_SELECT_MENU_OK: /* switch 10 */ + case PLAYER_SELECT_MENU_OK: /* switch 10 */ case PLAYER_SELECT_MENU_OK_GO_BACK: /* switch 10 */ func_800AAA9C(var_s1); break; @@ -8580,12 +8586,12 @@ void func_800A7A4C(s32 arg0) { case 0x55: /* switch 8 */ case 0x56: /* switch 8 */ func_800AB164(var_s1); - switch (gSubMenuSelection) { /* switch 11; irregular */ + switch (gSubMenuSelection) { /* switch 11; irregular */ case SUB_MENU_MAP_SELECT_CUP: /* switch 11 */ func_800AB020(var_s1); break; case SUB_MENU_MAP_SELECT_COURSE: /* switch 11 */ - case SUB_MENU_MAP_SELECT_OK: /* switch 11 */ + case SUB_MENU_MAP_SELECT_OK: /* switch 11 */ func_800AB098(var_s1); break; } @@ -8846,7 +8852,8 @@ void func_800A8270(s32 arg0, struct_8018D9E0_entry* arg1) { gDisplayListHead = func_80098FC8(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x35); } for (var_s0 += 0x41, var_s2 = 0; var_s2 <= gPlayerModeSelection[arg0]; var_s2++, var_s0 += 0x12) { - if ((var_s2 == gGameModeMenuColumn[arg0]) && ((arg0 + 1) == gPlayerCount) && (gMainMenuSelection > MAIN_MENU_PLAYER_SELECT)) { + if ((var_s2 == gGameModeMenuColumn[arg0]) && ((arg0 + 1) == gPlayerCount) && + (gMainMenuSelection > MAIN_MENU_PLAYER_SELECT)) { if (gMainMenuSelection == MAIN_MENU_MODE_SELECT) { gDisplayListHead = draw_flash_select_case_slow(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x11); @@ -8873,14 +8880,13 @@ void func_800A8564(struct_8018D9E0_entry* arg0) { switch (arg0->type) { /* irregular */ case 0xF: var_a0 = D_0200487C; - if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || - (gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || (gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK)) { var_a1 = 1; } break; case 0x33: var_a0 = D_02004B74; - if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || + if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_GO_BACK)) { var_a1 = 1; } @@ -8977,8 +8983,10 @@ void func_800A8A98(struct_8018D9E0_entry* arg0) { gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); for (someIndex = 0; someIndex < NUM_COURSES_PER_CUP; someIndex++) { - if ((someIndex == gCourseIndexInCup) && (gSubMenuSelection > SUB_MENU_MAP_SELECT_CUP) && (gModeSelection != GRAND_PRIX)) { - if ((gSubMenuSelection == SUB_MENU_MAP_SELECT_COURSE) || (gSubMenuSelection == SUB_MENU_MAP_SELECT_BATTLE_COURSE)) { + if ((someIndex == gCourseIndexInCup) && (gSubMenuSelection > SUB_MENU_MAP_SELECT_CUP) && + (gModeSelection != GRAND_PRIX)) { + if ((gSubMenuSelection == SUB_MENU_MAP_SELECT_COURSE) || + (gSubMenuSelection == SUB_MENU_MAP_SELECT_BATTLE_COURSE)) { gDisplayListHead = draw_flash_select_case_slow( gDisplayListHead, D_800E7208[someIndex][0].column + temp_s2, D_800E7208[someIndex][0].row + temp_s3, D_800E7208[someIndex][1].column + temp_s2, D_800E7208[someIndex][1].row + temp_s3); @@ -9300,7 +9308,8 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { if (i < 7) { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1]; } else { - if ((gControllerPakVisibleTableRows[i - 1] == 0x10) || (gControllerPakVisibleTableRows[i - 1] == 0)) { + if ((gControllerPakVisibleTableRows[i - 1] == 0x10) || + (gControllerPakVisibleTableRows[i - 1] == 0)) { gControllerPakVisibleTableRows[i] = 0; } else { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1] + 1; @@ -9320,7 +9329,8 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { if (i > 1) { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1]; } else { - if ((gControllerPakVisibleTableRows[i + 1] == 1) || (gControllerPakVisibleTableRows[i + 1] == 0)) { + if ((gControllerPakVisibleTableRows[i + 1] == 1) || + (gControllerPakVisibleTableRows[i + 1] == 0)) { gControllerPakVisibleTableRows[i] = 0; } else { gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1] - 1; @@ -9339,17 +9349,11 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { // Don't know if this belongs here or inside func_800A9A98 // as a `static const`. But this matches so we'll leave // it here for now. -const s8 D_800F0CA0[] = { - 0x03, 0x03, 0x03, 0x02, 0x00, 0x02, 0x02, 0x01 -}; +const s8 D_800F0CA0[] = { 0x03, 0x03, 0x03, 0x02, 0x00, 0x02, 0x02, 0x01 }; -const s8 D_800F0CA8[] = { - 0x03, 0x02, 0x00 -}; +const s8 D_800F0CA8[] = { 0x03, 0x02, 0x00 }; -const s8 D_800F0CAC[] = { - 0x03, 0x03, 0x02 -}; +const s8 D_800F0CAC[] = { 0x03, 0x03, 0x02 }; void func_800A9A98(struct_8018D9E0_entry* arg0) { s32 sp4; @@ -9538,10 +9542,10 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { arg0->visible = 0; } else { arg0->unk20 = gGameModeMenuColumn[gPlayerCount - 1]; - switch (gMainMenuSelection) { /* switch 2 */ - case MAIN_MENU_MODE_SELECT: /* switch 2 */ + switch (gMainMenuSelection) { /* switch 2 */ + case MAIN_MENU_MODE_SELECT: /* switch 2 */ case MAIN_MENU_MODE_SUB_SELECT: /* switch 2 */ - case MAIN_MENU_OK_SELECT: /* switch 2 */ + case MAIN_MENU_OK_SELECT: /* switch 2 */ arg0->visible = 1; temp_v0 = func_800AAE68(); arg0->column = temp_v0->column; @@ -9565,13 +9569,13 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { } } break; - case 1: /* switch 5 */ - switch (gMainMenuSelection) { /* switch 3 */ - case MAIN_MENU_MODE_SELECT: /* switch 3 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 3 */ - case MAIN_MENU_OK_SELECT: /* switch 3 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 3 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 3 */ + case 1: /* switch 5 */ + switch (gMainMenuSelection) { /* switch 3 */ + case MAIN_MENU_MODE_SELECT: /* switch 3 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 3 */ + case MAIN_MENU_OK_SELECT: /* switch 3 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 3 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 3 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; @@ -9596,13 +9600,13 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { break; } break; - case 2: /* switch 5 */ - switch (gMainMenuSelection) { /* switch 4 */ - case MAIN_MENU_MODE_SELECT: /* switch 4 */ - case MAIN_MENU_MODE_SUB_SELECT: /* switch 4 */ - case MAIN_MENU_OK_SELECT: /* switch 4 */ - case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 4 */ - case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 4 */ + case 2: /* switch 5 */ + switch (gMainMenuSelection) { /* switch 4 */ + case MAIN_MENU_MODE_SELECT: /* switch 4 */ + case MAIN_MENU_MODE_SUB_SELECT: /* switch 4 */ + case MAIN_MENU_OK_SELECT: /* switch 4 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 4 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 4 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; diff --git a/src/menus.c b/src/menus.c index 8faeeab7b..d90b451fa 100644 --- a/src/menus.c +++ b/src/menus.c @@ -40,9 +40,9 @@ f32 gIntroModelPosY; f32 gIntroModelPosZ; s32 gMenuFadeType; -s8 gCharacterGridSelections[4]; // Map from each player to current grid position (1-4 top, 5-8 bottom) +s8 gCharacterGridSelections[4]; // Map from each player to current grid position (1-4 top, 5-8 bottom) bool8 gCharacterGridIsSelected[4]; // Sets true if a character is selected for each player -s8 gSubMenuSelection; // Map Select states, Options and Ghost Data text selection +s8 gSubMenuSelection; // Map Select states, Options and Ghost Data text selection s8 gMainMenuSelection; s8 gPlayerSelectMenuSelection; s8 gDebugMenuSelection; @@ -50,11 +50,12 @@ s8 gControllerPakMenuSelection; s8 gScreenModeListIndex; // 0-4 index, selects a screen mode in sScreenModePlayerTable u8 gSoundMode; s8 gPlayerCount; -s8 gVersusResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option -s8 gTimeTrialsResultCursorSelection; // 5 options indexed (5-9), gets set when selecting an option (excluding Save Ghost) -s8 gBattleResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option +s8 gVersusResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option +s8 gTimeTrialsResultCursorSelection; // 5 options indexed (5-9), gets set when selecting an option (excluding Save + // Ghost) +s8 gBattleResultCursorSelection; // 4 options indexed (10-13), gets set when selecting an option s8 gTimeTrialDataCourseIndex; -s8 gCourseRecordsMenuSelection; // Used for selecting an option in course record data +s8 gCourseRecordsMenuSelection; // Used for selecting an option in course record data s8 gCourseRecordsSubMenuSelection; // Used for erase records and ghosts (Quit - Erase) s8 gDebugGotoScene; bool8 gGhostPlayerInit; @@ -99,13 +100,9 @@ u32 sVIGammaOffDitherOn = (OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); /** RoData **/ // Sets the actual screen mode based on values set in sScreenModePlayerCount -const s8 sScreenModePlayerTable[] = { - SCREEN_MODE_1P, - SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL, - SCREEN_MODE_2P_SPLITSCREEN_VERTICAL, - SCREEN_MODE_3P_4P_SPLITSCREEN, - SCREEN_MODE_3P_4P_SPLITSCREEN -}; +const s8 sScreenModePlayerTable[] = { SCREEN_MODE_1P, SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL, + SCREEN_MODE_2P_SPLITSCREEN_VERTICAL, SCREEN_MODE_3P_4P_SPLITSCREEN, + SCREEN_MODE_3P_4P_SPLITSCREEN }; // Sets how many players can load on each screen mode set in sScreenModePlayerTable const s8 sScreenModePlayerCount[] = { 1, 2, 2, 3, 4 }; @@ -141,8 +138,7 @@ const s32 gGameModePlayerSelection[][3] = { // Map from character grid position id to character id // Note: changing order doesn't affect graphics, only the selection const s8 sCharacterGridOrder[] = { - MARIO, LUIGI, PEACH, TOAD, - YOSHI, DK, WARIO, BOWSER, + MARIO, LUIGI, PEACH, TOAD, YOSHI, DK, WARIO, BOWSER, }; const s16 gCupCourseOrder[5][4] = { @@ -450,7 +446,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: { - if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_FROM_GHOST_MAX) && (sp30[PLAYER_TWO].ghostDataSaved)) { + if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_FROM_GHOST_MAX) && + (sp30[PLAYER_TWO].ghostDataSaved)) { gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { @@ -458,7 +455,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } sp38->unk8 = 1; } - if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_COPY_PAK_FROM_GHOST_MIN) && sp30[PLAYER_ONE].ghostDataSaved) { + if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_COPY_PAK_FROM_GHOST_MIN) && + sp30[PLAYER_ONE].ghostDataSaved) { gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { @@ -473,7 +471,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { } if (btnAndStick & A_BUTTON) { sp38->unk20 = gSubMenuSelection - SUB_MENU_COPY_PAK_FROM_GHOST_MIN; - if (sp30[sp38->unk20].courseIndex == D_8018EE10[PLAYER_TWO].courseIndex && D_8018EE10[PLAYER_TWO].ghostDataSaved) { + if (sp30[sp38->unk20].courseIndex == D_8018EE10[PLAYER_TWO].courseIndex && + D_8018EE10[PLAYER_TWO].ghostDataSaved) { gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST2_2P; } else { gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST1_2P; @@ -485,7 +484,8 @@ void options_menu_act(struct Controller* controller, u16 controllerIdx) { case SUB_MENU_COPY_PAK_TO_GHOST1_2P: case SUB_MENU_COPY_PAK_TO_GHOST2_2P: { // bit of a fake match, but if it works it works? - if ((sp30[sp38->unk20].courseIndex != ((0, (D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->courseIndex))) || + if ((sp30[sp38->unk20].courseIndex != + ((0, (D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->courseIndex))) || ((D_8018EE10 + (gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN))->ghostDataSaved == 0)) { if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_COPY_PAK_TO_GHOST_MAX)) { gSubMenuSelection += 1; @@ -725,7 +725,8 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 controllerId sp28 = find_8018D9E0_entry_dupe(0xE8); sp24 = &gSaveData.allCourseTimeTrialRecords.cupRecords[gTimeTrialDataCourseIndex / 4] .courseRecords[gTimeTrialDataCourseIndex % 4]; - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && + func_800B639C(gTimeTrialDataCourseIndex) < 0) { gCourseRecordsMenuSelection -= 1; } @@ -747,11 +748,13 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 controllerId if ((btnAndStick & D_JPAD) && (gCourseRecordsMenuSelection < COURSE_RECORDS_MENU_MAX)) { gCourseRecordsMenuSelection += 1; - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && sp24->unknownBytes[0] == 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && + sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection += 1; } - if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && + func_800B639C(gTimeTrialDataCourseIndex) < 0) { if (sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection = COURSE_RECORDS_MENU_RETURN_MENU; } else { @@ -934,7 +937,8 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 controlle return; } } - } else if (((btnAndStick & D_JPAD) != 0) && (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE)) { + } else if (((btnAndStick & D_JPAD) != 0) && + (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE)) { ++gControllerPakSelectedTableRow; if (gControllerPakSelectedTableRow >= CONTROLLER_PAK_MENU_TABLE_GAME_DATA) { gControllerPakSelectedTableRow = CONTROLLER_PAK_MENU_QUIT; @@ -1414,12 +1418,14 @@ void main_menu_act(struct Controller* controller, u16 controllerIdx) { if (btnAndStick & D_JPAD) { cursorMoved = false; if (func_800B555C()) { - if (subMode < sGameModePlayerColumnExtra[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + if (subMode < + sGameModePlayerColumnExtra[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { cursorMoved = true; } } else { // L800B30D4 - if (subMode < sGameModePlayerColumnDefault[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + if (subMode < + sGameModePlayerColumnDefault[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { cursorMoved = true; } } @@ -1569,8 +1575,7 @@ void player_select_menu_act(struct Controller* controller, u16 controllerIdx) { // L800B36F4 selected = false; for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { - if ((gCharacterGridSelections[i] != 0) && - (gCharacterGridIsSelected[i] == 0)) { + if ((gCharacterGridSelections[i] != 0) && (gCharacterGridIsSelected[i] == 0)) { selected = true; break; } @@ -1793,7 +1798,8 @@ void course_select_menu_act(struct Controller* arg0, u16 controllerIdx) { } break; case SUB_MENU_MAP_SELECT_OK: - if ((controllerIdx == PLAYER_ONE) && ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { + if ((controllerIdx == PLAYER_ONE) && + ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { play_sound2(SOUND_MENU_OK); } diff --git a/src/menus.h b/src/menus.h index 036ea2cff..415151fd3 100644 --- a/src/menus.h +++ b/src/menus.h @@ -47,12 +47,12 @@ enum SubMenuSelectionType { SUB_MENU_ERASE_QUIT = SUB_MENU_ERASE_MIN, SUB_MENU_ERASE_ERASE, SUB_MENU_ERASE_MAX = SUB_MENU_ERASE_ERASE, // 0x1F - SUB_MENU_SAVE_DATA_ERASED, // 0x20 + SUB_MENU_SAVE_DATA_ERASED, // 0x20 SUB_MENU_COPY_PAK_FROM_GHOST_MIN = 0x28, SUB_MENU_COPY_PAK_FROM_GHOST1_1P = SUB_MENU_COPY_PAK_FROM_GHOST_MIN, SUB_MENU_COPY_PAK_FROM_GHOST2_1P, SUB_MENU_COPY_PAK_FROM_GHOST_MAX = SUB_MENU_COPY_PAK_FROM_GHOST2_1P, // 0x29 - SUB_MENU_COPY_PAK_ERROR_2P_MIN, // 0x2A + SUB_MENU_COPY_PAK_ERROR_2P_MIN, // 0x2A SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA = SUB_MENU_COPY_PAK_ERROR_2P_MIN, SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA, SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P, @@ -93,10 +93,10 @@ enum MainMenuSelectionType { MAIN_MENU_OPTION, MAIN_MENU_DATA, MAIN_MENU_PLAYER_SELECT, - MAIN_MENU_MODE_SELECT, // Mario GP - T. Trials - VS - Battle - MAIN_MENU_MODE_SUB_SELECT, // CC Selection and T.Trials options (Begin, Data) - MAIN_MENU_OK_SELECT, // OK option after selecting a submode - MAIN_MENU_OK_SELECT_GO_BACK, // OK option after going back from player select + MAIN_MENU_MODE_SELECT, // Mario GP - T. Trials - VS - Battle + MAIN_MENU_MODE_SUB_SELECT, // CC Selection and T.Trials options (Begin, Data) + MAIN_MENU_OK_SELECT, // OK option after selecting a submode + MAIN_MENU_OK_SELECT_GO_BACK, // OK option after going back from player select MAIN_MENU_MODE_SUB_SELECT_GO_BACK // Used in T.Trials after going back to Data option from course data }; @@ -106,7 +106,7 @@ enum MainMenuSelectionType { enum PlayerSelectMenuSelectionTypes { PLAYER_SELECT_MENU_NONE, PLAYER_SELECT_MENU_MAIN, - PLAYER_SELECT_MENU_OK, // OK option after selecting characters + PLAYER_SELECT_MENU_OK, // OK option after selecting characters PLAYER_SELECT_MENU_OK_GO_BACK // OK option after going back from map select }; @@ -176,11 +176,7 @@ enum DebugGotoSceneTypes { /** * @brief Options for gFadeModeSelection */ -enum FadeModeSelectionTypes { - FADE_MODE_NONE, - FADE_MODE_MAIN, - FADE_MODE_LOGO -}; +enum FadeModeSelectionTypes { FADE_MODE_NONE, FADE_MODE_MAIN, FADE_MODE_LOGO }; /** * @brief Options for gControllerPakScrollDirection @@ -191,7 +187,6 @@ enum ControllerPakScrollDirectionTypes { CONTROLLER_PAK_SCROLL_DIR_UP }; - /* functions */ void update_menus(void); void options_menu_act(struct Controller*, u16);