From 57533d7ba5c8fea1f135c7c865bd5627b4237b60 Mon Sep 17 00:00:00 2001 From: AloXado320 Date: Sat, 5 Oct 2024 13:23:18 -0500 Subject: [PATCH 1/4] Label menus.c and small documentation --- .../code_80091750/add_8018D9E0_entry.s | 64 +- .../code_80091750/func_8009F5E0.s | 24 +- .../code_80091750/func_800A09E0.s | 4 +- .../code_80091750/func_800A1FB0.s | 76 +- .../code_80091750/func_800AB314.s | 20 +- asm/non_matchings/menus/main_menu_act.s | 184 +-- .../menus/player_select_menu_act.s | 40 +- include/defines.h | 54 +- mk64.ld | 1 + src/code_80005FD0.c | 6 +- src/code_8006E9C0.c | 4 +- src/code_80091750.c | 636 +++++----- src/main.c | 2 +- src/menus.c | 1116 +++++++++-------- src/menus.h | 264 +++- src/racing/actors.c | 1 + src/racing/race_logic.c | 2 +- src/racing/skybox_and_splitscreen.c | 2 +- src/save.c | 6 +- src/save.h | 2 + src/spawn_players.c | 6 +- 21 files changed, 1349 insertions(+), 1165 deletions(-) diff --git a/asm/non_matchings/code_80091750/add_8018D9E0_entry.s b/asm/non_matchings/code_80091750/add_8018D9E0_entry.s index f24c3d8b93..eeee98aae6 100644 --- a/asm/non_matchings/code_80091750/add_8018D9E0_entry.s +++ b/asm/non_matchings/code_80091750/add_8018D9E0_entry.s @@ -176,63 +176,63 @@ glabel L8009E774 /* 09F390 8009E790 3C01800F */ lui $at, %hi(D_800E8534) # $at, 0x800f /* 09F394 8009E794 44800000 */ mtc1 $zero, $f0 /* 09F398 8009E798 E4268534 */ swc1 $f6, %lo(D_800E8534)($at) -/* 09F39C 8009E79C 3C018019 */ lui $at, %hi(D_8018EDC0) # $at, 0x8019 +/* 09F39C 8009E79C 3C018019 */ lui $at, %hi(gIntroModelZEye) # $at, 0x8019 /* 09F3A0 8009E7A0 241909C4 */ li $t9, 2500 -/* 09F3A4 8009E7A4 AC39EDC0 */ sw $t9, %lo(D_8018EDC0)($at) -/* 09F3A8 8009E7A8 3C018019 */ lui $at, %hi(D_8018EDC8) # $at, 0x8019 -/* 09F3AC 8009E7AC E420EDC8 */ swc1 $f0, %lo(D_8018EDC8)($at) +/* 09F3A4 8009E7A4 AC39EDC0 */ sw $t9, %lo(gIntroModelZEye)($at) +/* 09F3A8 8009E7A8 3C018019 */ lui $at, %hi(gIntroModelRotX) # $at, 0x8019 +/* 09F3AC 8009E7AC E420EDC8 */ swc1 $f0, %lo(gIntroModelRotX)($at) /* 09F3B0 8009E7B0 3C01C387 */ li $at, 0xC3870000 # -270.000000 /* 09F3B4 8009E7B4 44814000 */ mtc1 $at, $f8 -/* 09F3B8 8009E7B8 3C018019 */ lui $at, %hi(D_8018EDCC) # $at, 0x8019 +/* 09F3B8 8009E7B8 3C018019 */ lui $at, %hi(gIntroModelRotY) # $at, 0x8019 /* 09F3BC 8009E7BC 240EFFFF */ li $t6, -1 -/* 09F3C0 8009E7C0 E428EDCC */ swc1 $f8, %lo(D_8018EDCC)($at) -/* 09F3C4 8009E7C4 3C018019 */ lui $at, %hi(D_8018EDD0) # $at, 0x8019 -/* 09F3C8 8009E7C8 E420EDD0 */ swc1 $f0, %lo(D_8018EDD0)($at) -/* 09F3CC 8009E7CC 3C018019 */ lui $at, %hi(D_8018EDD4) # $at, 0x8019 -/* 09F3D0 8009E7D0 E420EDD4 */ swc1 $f0, %lo(D_8018EDD4)($at) -/* 09F3D4 8009E7D4 3C018019 */ lui $at, %hi(D_8018EDD8) # $at, 0x8019 -/* 09F3D8 8009E7D8 E420EDD8 */ swc1 $f0, %lo(D_8018EDD8)($at) -/* 09F3DC 8009E7DC 3C018019 */ lui $at, %hi(D_8018EDDC) # $at, 0x8019 -/* 09F3E0 8009E7E0 E420EDDC */ swc1 $f0, %lo(D_8018EDDC)($at) +/* 09F3C0 8009E7C0 E428EDCC */ swc1 $f8, %lo(gIntroModelRotY)($at) +/* 09F3C4 8009E7C4 3C018019 */ lui $at, %hi(gIntroModelRotZ) # $at, 0x8019 +/* 09F3C8 8009E7C8 E420EDD0 */ swc1 $f0, %lo(gIntroModelRotZ)($at) +/* 09F3CC 8009E7CC 3C018019 */ lui $at, %hi(gIntroModelPosX) # $at, 0x8019 +/* 09F3D0 8009E7D0 E420EDD4 */ swc1 $f0, %lo(gIntroModelPosX)($at) +/* 09F3D4 8009E7D4 3C018019 */ lui $at, %hi(gIntroModelPosY) # $at, 0x8019 +/* 09F3D8 8009E7D8 E420EDD8 */ swc1 $f0, %lo(gIntroModelPosY)($at) +/* 09F3DC 8009E7DC 3C018019 */ lui $at, %hi(gIntroModelPosZ) # $at, 0x8019 +/* 09F3E0 8009E7E0 E420EDDC */ swc1 $f0, %lo(gIntroModelPosZ)($at) /* 09F3E4 8009E7E4 3C014040 */ li $at, 0x40400000 # 3.000000 /* 09F3E8 8009E7E8 44815000 */ mtc1 $at, $f10 -/* 09F3EC 8009E7EC 3C018019 */ lui $at, %hi(D_8018EDC4) # $at, 0x8019 -/* 09F3F0 8009E7F0 E42AEDC4 */ swc1 $f10, %lo(D_8018EDC4)($at) +/* 09F3EC 8009E7EC 3C018019 */ lui $at, %hi(gIntroModelScale) # $at, 0x8019 +/* 09F3F0 8009E7F0 E42AEDC4 */ swc1 $f10, %lo(gIntroModelScale)($at) /* 09F3F4 8009E7F4 AFEE001C */ sw $t6, 0x1c($ra) /* 09F3F8 8009E7F8 10000375 */ b .L8009F5D0 /* 09F3FC 8009E7FC AFE30020 */ sw $v1, 0x20($ra) glabel L8009E800 /* 09F400 8009E800 240F0708 */ li $t7, 1800 -/* 09F404 8009E804 3C018019 */ lui $at, %hi(D_8018EDC0) # $at, 0x8019 -/* 09F408 8009E808 AC2FEDC0 */ sw $t7, %lo(D_8018EDC0)($at) +/* 09F404 8009E804 3C018019 */ lui $at, %hi(gIntroModelZEye) # $at, 0x8019 +/* 09F408 8009E808 AC2FEDC0 */ sw $t7, %lo(gIntroModelZEye)($at) /* 09F40C 8009E80C 3C01C24C */ li $at, 0xC24C0000 # -51.000000 /* 09F410 8009E810 44818000 */ mtc1 $at, $f16 -/* 09F414 8009E814 3C018019 */ lui $at, %hi(D_8018EDC8) # $at, 0x8019 +/* 09F414 8009E814 3C018019 */ lui $at, %hi(gIntroModelRotX) # $at, 0x8019 /* 09F418 8009E818 44800000 */ mtc1 $zero, $f0 -/* 09F41C 8009E81C E430EDC8 */ swc1 $f16, %lo(D_8018EDC8)($at) +/* 09F41C 8009E81C E430EDC8 */ swc1 $f16, %lo(gIntroModelRotX)($at) /* 09F420 8009E820 3C01C140 */ li $at, 0xC1400000 # -12.000000 /* 09F424 8009E824 44819000 */ mtc1 $at, $f18 -/* 09F428 8009E828 3C018019 */ lui $at, %hi(D_8018EDCC) # $at, 0x8019 +/* 09F428 8009E828 3C018019 */ lui $at, %hi(gIntroModelRotY) # $at, 0x8019 /* 09F42C 8009E82C 2418FFFF */ li $t8, -1 -/* 09F430 8009E830 E432EDCC */ swc1 $f18, %lo(D_8018EDCC)($at) +/* 09F430 8009E830 E432EDCC */ swc1 $f18, %lo(gIntroModelRotY)($at) /* 09F434 8009E834 3C01C190 */ li $at, 0xC1900000 # -18.000000 /* 09F438 8009E838 44812000 */ mtc1 $at, $f4 -/* 09F43C 8009E83C 3C018019 */ lui $at, %hi(D_8018EDD0) # $at, 0x8019 -/* 09F440 8009E840 E424EDD0 */ swc1 $f4, %lo(D_8018EDD0)($at) +/* 09F43C 8009E83C 3C018019 */ lui $at, %hi(gIntroModelRotZ) # $at, 0x8019 +/* 09F440 8009E840 E424EDD0 */ swc1 $f4, %lo(gIntroModelRotZ)($at) /* 09F444 8009E844 3C01C387 */ li $at, 0xC3870000 # -270.000000 /* 09F448 8009E848 44813000 */ mtc1 $at, $f6 -/* 09F44C 8009E84C 3C018019 */ lui $at, %hi(D_8018EDD4) # $at, 0x8019 -/* 09F450 8009E850 E426EDD4 */ swc1 $f6, %lo(D_8018EDD4)($at) +/* 09F44C 8009E84C 3C018019 */ lui $at, %hi(gIntroModelPosX) # $at, 0x8019 +/* 09F450 8009E850 E426EDD4 */ swc1 $f6, %lo(gIntroModelPosX)($at) /* 09F454 8009E854 3C01800F */ lui $at, %hi(D_800F15E0) # $at, 0x800f /* 09F458 8009E858 C42815E0 */ lwc1 $f8, %lo(D_800F15E0)($at) -/* 09F45C 8009E85C 3C018019 */ lui $at, %hi(D_8018EDD8) # $at, 0x8019 -/* 09F460 8009E860 E428EDD8 */ swc1 $f8, %lo(D_8018EDD8)($at) -/* 09F464 8009E864 3C018019 */ lui $at, %hi(D_8018EDDC) # $at, 0x8019 -/* 09F468 8009E868 E420EDDC */ swc1 $f0, %lo(D_8018EDDC)($at) +/* 09F45C 8009E85C 3C018019 */ lui $at, %hi(gIntroModelPosY) # $at, 0x8019 +/* 09F460 8009E860 E428EDD8 */ swc1 $f8, %lo(gIntroModelPosY)($at) +/* 09F464 8009E864 3C018019 */ lui $at, %hi(gIntroModelPosZ) # $at, 0x8019 +/* 09F468 8009E868 E420EDDC */ swc1 $f0, %lo(gIntroModelPosZ)($at) /* 09F46C 8009E86C 3C013F80 */ li $at, 0x3F800000 # 1.000000 /* 09F470 8009E870 44815000 */ mtc1 $at, $f10 -/* 09F474 8009E874 3C018019 */ lui $at, %hi(D_8018EDC4) # $at, 0x8019 -/* 09F478 8009E878 E42AEDC4 */ swc1 $f10, %lo(D_8018EDC4)($at) +/* 09F474 8009E874 3C018019 */ lui $at, %hi(gIntroModelScale) # $at, 0x8019 +/* 09F478 8009E878 E42AEDC4 */ swc1 $f10, %lo(gIntroModelScale)($at) /* 09F47C 8009E87C AFF8001C */ sw $t8, 0x1c($ra) /* 09F480 8009E880 10000353 */ b .L8009F5D0 /* 09F484 8009E884 AFE30020 */ sw $v1, 0x20($ra) diff --git a/asm/non_matchings/code_80091750/func_8009F5E0.s b/asm/non_matchings/code_80091750/func_8009F5E0.s index 3cf6765e0c..19a283c3e4 100644 --- a/asm/non_matchings/code_80091750/func_8009F5E0.s +++ b/asm/non_matchings/code_80091750/func_8009F5E0.s @@ -649,7 +649,7 @@ glabel L8009FD58 glabel L8009FD90 /* 0A0990 8009FD90 8E23001C */ lw $v1, 0x1c($s1) /* 0A0994 8009FD94 2506FFF1 */ addiu $a2, $t0, -0xf -/* 0A0998 8009FD98 3C098019 */ lui $t1, %hi(gMainMenuSelectionDepth) # $t1, 0x8019 +/* 0A0998 8009FD98 3C098019 */ lui $t1, %hi(gMainMenuSelection) # $t1, 0x8019 /* 0A099C 8009FD9C 28610020 */ slti $at, $v1, 0x20 /* 0A09A0 8009FDA0 50200030 */ beql $at, $zero, .L8009FE64 /* 0A09A4 8009FDA4 2518FFF6 */ addiu $t8, $t0, -0xa @@ -658,7 +658,7 @@ glabel L8009FD90 /* 0A09B0 8009FDB0 00084080 */ sll $t0, $t0, 2 /* 0A09B4 8009FDB4 01034021 */ addu $t0, $t0, $v1 /* 0A09B8 8009FDB8 00084040 */ sll $t0, $t0, 1 -/* 0A09BC 8009FDBC 8129EDED */ lb $t1, %lo(gMainMenuSelectionDepth)($t1) +/* 0A09BC 8009FDBC 8129EDED */ lb $t1, %lo(gMainMenuSelection)($t1) /* 0A09C0 8009FDC0 05010003 */ bgez $t0, .L8009FDD0 /* 0A09C4 8009FDC4 0008C983 */ sra $t9, $t0, 6 /* 0A09C8 8009FDC8 2501003F */ addiu $at, $t0, 0x3f @@ -721,10 +721,10 @@ glabel L8009FD90 glabel L8009FE9C /* 0A0A9C 8009FE9C 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0A0AA0 8009FEA0 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0A0AA4 8009FEA4 3C03800F */ lui $v1, %hi((D_800E86AC - 1)) # 0x800f -/* 0A0AA8 8009FEA8 3C06800F */ lui $a2, %hi((D_800E86B0 - 3)) # 0x800f +/* 0A0AA4 8009FEA4 3C03800F */ lui $v1, %hi((gGameModeMenuColumn - 1)) # 0x800f +/* 0A0AA8 8009FEA8 3C06800F */ lui $a2, %hi((gGameModeSubMenuColumn - 3)) # 0x800f /* 0A0AAC 8009FEAC 00621821 */ addu $v1, $v1, $v0 -/* 0A0AB0 8009FEB0 806386AB */ lb $v1, %lo((D_800E86AC - 1))($v1) # -0x7955($v1) +/* 0A0AB0 8009FEB0 806386AB */ lb $v1, %lo((gGameModeMenuColumn - 1))($v1) # -0x7955($v1) /* 0A0AB4 8009FEB4 00026880 */ sll $t5, $v0, 2 /* 0A0AB8 8009FEB8 00025880 */ sll $t3, $v0, 2 /* 0A0ABC 8009FEBC 01A26823 */ subu $t5, $t5, $v0 @@ -738,7 +738,7 @@ glabel L8009FE9C /* 0A0ADC 8009FEDC 00CC3021 */ addu $a2, $a2, $t4 /* 0A0AE0 8009FEE0 00AF2821 */ addu $a1, $a1, $t7 /* 0A0AE4 8009FEE4 2F010008 */ sltiu $at, $t8, 8 -/* 0A0AE8 8009FEE8 80C686AD */ lb $a2, %lo((D_800E86B0 - 3))($a2) # -0x7953($a2) +/* 0A0AE8 8009FEE8 80C686AD */ lb $a2, %lo((gGameModeSubMenuColumn - 3))($a2) # -0x7953($a2) /* 0A0AEC 8009FEEC 10200037 */ beqz $at, .L8009FFCC /* 0A0AF0 8009FEF0 8CA52B70 */ lw $a1, %lo((gGameModePlayerSelection - 0xC))($a1) # 0x2b70($a1) /* 0A0AF4 8009FEF4 0018C080 */ sll $t8, $t8, 2 @@ -805,8 +805,8 @@ glabel L8009FF90 .L8009FFCC: /* 0A0BCC 8009FFCC 2401FFFF */ li $at, -1 /* 0A0BD0 8009FFD0 10C1023C */ beq $a2, $at, .L800A08C4 -/* 0A0BD4 8009FFD4 3C028019 */ lui $v0, %hi(gMainMenuSelectionDepth) # $v0, 0x8019 -/* 0A0BD8 8009FFD8 8042EDED */ lb $v0, %lo(gMainMenuSelectionDepth)($v0) +/* 0A0BD4 8009FFD4 3C028019 */ lui $v0, %hi(gMainMenuSelection) # $v0, 0x8019 +/* 0A0BD8 8009FFD8 8042EDED */ lb $v0, %lo(gMainMenuSelection)($v0) /* 0A0BDC 8009FFDC 240E0001 */ li $t6, 1 /* 0A0BE0 8009FFE0 240F00FF */ li $t7, 255 /* 0A0BE4 8009FFE4 28410005 */ slti $at, $v0, 5 @@ -889,11 +889,11 @@ glabel L800A00FC /* 0A0D00 800A0100 3C188019 */ lui $t8, %hi(gCharacterGridSelections) # 0x8019 /* 0A0D04 800A0104 0305C021 */ addu $t8, $t8, $a1 /* 0A0D08 800A0108 8318EDE4 */ lb $t8, %lo(gCharacterGridSelections)($t8) # -0x121c($t8) -/* 0A0D0C 800A010C 3C198019 */ lui $t9, %hi(D_8018EDE8) # 0x8019 +/* 0A0D0C 800A010C 3C198019 */ lui $t9, %hi(gCharacterGridIsSelected) # 0x8019 /* 0A0D10 800A0110 0325C821 */ addu $t9, $t9, $a1 /* 0A0D14 800A0114 530001EC */ beql $t8, $zero, .L800A08C8 /* 0A0D18 800A0118 8FBF0034 */ lw $ra, 0x34($sp) -/* 0A0D1C 800A011C 8339EDE8 */ lb $t9, %lo(D_8018EDE8)($t9) # -0x1218($t9) +/* 0A0D1C 800A011C 8339EDE8 */ lb $t9, %lo(gCharacterGridIsSelected)($t9) # -0x1218($t9) /* 0A0D20 800A0120 3C06800E */ lui $a2, %hi(gGlobalTimer) # $a2, 0x800e /* 0A0D24 800A0124 17200003 */ bnez $t9, .L800A0134 /* 0A0D28 800A0128 00000000 */ nop @@ -1110,8 +1110,8 @@ glabel L800A0404 /* 0A1020 800A0420 10000129 */ b .L800A08C8 /* 0A1024 800A0424 8FBF0034 */ lw $ra, 0x34($sp) glabel L800A0428 -/* 0A1028 800A0428 3C028019 */ lui $v0, %hi(gMainMenuSelectionDepth) # $v0, 0x8019 -/* 0A102C 800A042C 8042EDED */ lb $v0, %lo(gMainMenuSelectionDepth)($v0) +/* 0A1028 800A0428 3C028019 */ lui $v0, %hi(gMainMenuSelection) # $v0, 0x8019 +/* 0A102C 800A042C 8042EDED */ lb $v0, %lo(gMainMenuSelection)($v0) /* 0A1030 800A0430 8FAB00A8 */ lw $t3, 0xa8($sp) /* 0A1034 800A0434 240D0001 */ li $t5, 1 /* 0A1038 800A0438 28410005 */ slti $at, $v0, 5 diff --git a/asm/non_matchings/code_80091750/func_800A09E0.s b/asm/non_matchings/code_80091750/func_800A09E0.s index 96a4051481..04fbeeebf8 100644 --- a/asm/non_matchings/code_80091750/func_800A09E0.s +++ b/asm/non_matchings/code_80091750/func_800A09E0.s @@ -17,11 +17,11 @@ glabel func_800A09E0 /* 0A161C 800A0A1C 3C18004F */ lui $t8, (0x004FC308 >> 16) # lui $t8, 0x4f /* 0A1620 800A0A20 3718C308 */ ori $t8, (0x004FC308 & 0xFFFF) # ori $t8, $t8, 0xc308 /* 0A1624 800A0A24 3C0FED00 */ lui $t7, 0xed00 -/* 0A1628 800A0A28 3C13800F */ lui $s3, %hi(D_800E86D0) # $s3, 0x800f +/* 0A1628 800A0A28 3C13800F */ lui $s3, %hi(gControllerPakScrollDirection) # $s3, 0x800f /* 0A162C 800A0A2C 3C160200 */ lui $s6, %hi(D_0200157C) # $s6, 0x200 /* 0A1630 800A0A30 00809025 */ move $s2, $a0 /* 0A1634 800A0A34 26D6157C */ addiu $s6, %lo(D_0200157C) # addiu $s6, $s6, 0x157c -/* 0A1638 800A0A38 267386D0 */ addiu $s3, %lo(D_800E86D0) # addiu $s3, $s3, -0x7930 +/* 0A1638 800A0A38 267386D0 */ addiu $s3, %lo(gControllerPakScrollDirection) # addiu $s3, $s3, -0x7930 /* 0A163C 800A0A3C 00008025 */ move $s0, $zero /* 0A1640 800A0A40 24140008 */ li $s4, 8 /* 0A1644 800A0A44 24150009 */ li $s5, 9 diff --git a/asm/non_matchings/code_80091750/func_800A1FB0.s b/asm/non_matchings/code_80091750/func_800A1FB0.s index 270a7a7669..db6af69470 100644 --- a/asm/non_matchings/code_80091750/func_800A1FB0.s +++ b/asm/non_matchings/code_80091750/func_800A1FB0.s @@ -79,8 +79,8 @@ glabel func_800A1FB0 /* 0A2C1C 800A201C 0C02637E */ jal draw_box /* 0A2C20 800A2020 24070140 */ li $a3, 320 /* 0A2C24 800A2024 AE020000 */ sw $v0, ($s0) -/* 0A2C28 800A2028 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 -/* 0A2C2C 800A202C 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2C28 800A2028 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 +/* 0A2C2C 800A202C 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) /* 0A2C30 800A2030 2478FFEB */ addiu $t8, $v1, -0x15 /* 0A2C34 800A2034 2F010033 */ sltiu $at, $t8, 0x33 /* 0A2C38 800A2038 10200310 */ beqz $at, .L800A2C7C @@ -112,8 +112,8 @@ glabel L800A2054 /* 0A2C98 800A2098 E7B40010 */ swc1 $f20, 0x10($sp) /* 0A2C9C 800A209C 0C024CC9 */ jal func_80093324 /* 0A2CA0 800A20A0 E7B60014 */ swc1 $f22, 0x14($sp) -/* 0A2CA4 800A20A4 3C048019 */ lui $a0, %hi(D_8018EDEC) # $a0, 0x8019 -/* 0A2CA8 800A20A8 8084EDEC */ lb $a0, %lo(D_8018EDEC)($a0) +/* 0A2CA4 800A20A4 3C048019 */ lui $a0, %hi(gSubMenuSelection) # $a0, 0x8019 +/* 0A2CA8 800A20A8 8084EDEC */ lb $a0, %lo(gSubMenuSelection)($a0) /* 0A2CAC 800A20AC 26310004 */ addiu $s1, $s1, 4 /* 0A2CB0 800A20B0 24190032 */ li $t9, 50 /* 0A2CB4 800A20B4 2484FFEB */ addiu $a0, $a0, -0x15 @@ -139,9 +139,9 @@ glabel L800A2054 /* 0A2D00 800A2100 E7B60010 */ swc1 $f22, 0x10($sp) /* 0A2D04 800A2104 0C024DBB */ jal draw_text /* 0A2D08 800A2108 E7B60014 */ swc1 $f22, 0x14($sp) -/* 0A2D0C 800A210C 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2D0C 800A210C 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2D10 800A2110 100002DA */ b .L800A2C7C -/* 0A2D14 800A2114 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2D14 800A2114 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A2118 /* 0A2D18 800A2118 0C024C36 */ jal set_text_color /* 0A2D1C 800A211C 24040003 */ li $a0, 3 @@ -164,8 +164,8 @@ glabel L800A2118 /* 0A2D5C 800A215C 0232082B */ sltu $at, $s1, $s2 /* 0A2D60 800A2160 1420FFF6 */ bnez $at, .L800A213C /* 0A2D64 800A2164 26100014 */ addiu $s0, $s0, 0x14 -/* 0A2D68 800A2168 3C048019 */ lui $a0, %hi(D_8018EDEC) # $a0, 0x8019 -/* 0A2D6C 800A216C 8084EDEC */ lb $a0, %lo(D_8018EDEC)($a0) +/* 0A2D68 800A2168 3C048019 */ lui $a0, %hi(gSubMenuSelection) # $a0, 0x8019 +/* 0A2D6C 800A216C 8084EDEC */ lb $a0, %lo(gSubMenuSelection)($a0) /* 0A2D70 800A2170 3C11800E */ lui $s1, %hi(D_800E7840) # $s1, 0x800e /* 0A2D74 800A2174 26317840 */ addiu $s1, %lo(D_800E7840) # addiu $s1, $s1, 0x7840 /* 0A2D78 800A2178 00009025 */ move $s2, $zero @@ -182,8 +182,8 @@ glabel L800A2118 /* 0A2DA0 800A21A0 E7B60010 */ swc1 $f22, 0x10($sp) /* 0A2DA4 800A21A4 0C024CC9 */ jal func_80093324 /* 0A2DA8 800A21A8 E7B60014 */ swc1 $f22, 0x14($sp) -/* 0A2DAC 800A21AC 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 -/* 0A2DB0 800A21B0 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2DAC 800A21AC 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 +/* 0A2DB0 800A21B0 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) /* 0A2DB4 800A21B4 26310004 */ addiu $s1, $s1, 4 /* 0A2DB8 800A21B8 24010002 */ li $at, 2 /* 0A2DBC 800A21BC 2464FFE2 */ addiu $a0, $v1, -0x1e @@ -218,14 +218,14 @@ glabel L800A21E4 /* 0A2E24 800A2224 26310004 */ addiu $s1, $s1, 4 /* 0A2E28 800A2228 1632FFF7 */ bne $s1, $s2, .L800A2208 /* 0A2E2C 800A222C 26100014 */ addiu $s0, $s0, 0x14 -/* 0A2E30 800A2230 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2E30 800A2230 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2E34 800A2234 10000291 */ b .L800A2C7C -/* 0A2E38 800A2238 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2E38 800A2238 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A223C /* 0A2E3C 800A223C 0C024C36 */ jal set_text_color /* 0A2E40 800A2240 24040002 */ li $a0, 2 -/* 0A2E44 800A2244 3C028019 */ lui $v0, %hi(D_8018EDEC) # $v0, 0x8019 -/* 0A2E48 800A2248 8042EDEC */ lb $v0, %lo(D_8018EDEC)($v0) +/* 0A2E44 800A2244 3C028019 */ lui $v0, %hi(gSubMenuSelection) # $v0, 0x8019 +/* 0A2E48 800A2248 8042EDEC */ lb $v0, %lo(gSubMenuSelection)($v0) /* 0A2E4C 800A224C 3C0D800E */ lui $t5, %hi(D_800E78D0) # $t5, 0x800e /* 0A2E50 800A2250 25AD78D0 */ addiu $t5, %lo(D_800E78D0) # addiu $t5, $t5, 0x78d0 /* 0A2E54 800A2254 2442FFD6 */ addiu $v0, $v0, -0x2a @@ -248,14 +248,14 @@ glabel L800A223C /* 0A2E94 800A2294 26100014 */ addiu $s0, $s0, 0x14 /* 0A2E98 800A2298 1612FFF7 */ bne $s0, $s2, .L800A2278 /* 0A2E9C 800A229C 26310004 */ addiu $s1, $s1, 4 -/* 0A2EA0 800A22A0 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2EA0 800A22A0 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2EA4 800A22A4 10000275 */ b .L800A2C7C -/* 0A2EA8 800A22A8 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2EA8 800A22A8 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A22AC /* 0A2EAC 800A22AC 0C024C36 */ jal set_text_color /* 0A2EB0 800A22B0 24040002 */ li $a0, 2 -/* 0A2EB4 800A22B4 3C028019 */ lui $v0, %hi(D_8018EDEC) # $v0, 0x8019 -/* 0A2EB8 800A22B8 8042EDEC */ lb $v0, %lo(D_8018EDEC)($v0) +/* 0A2EB4 800A22B4 3C028019 */ lui $v0, %hi(gSubMenuSelection) # $v0, 0x8019 +/* 0A2EB8 800A22B8 8042EDEC */ lb $v0, %lo(gSubMenuSelection)($v0) /* 0A2EBC 800A22BC 3C18800E */ lui $t8, %hi(D_800E7890) # $t8, 0x800e /* 0A2EC0 800A22C0 27187890 */ addiu $t8, %lo(D_800E7890) # addiu $t8, $t8, 0x7890 /* 0A2EC4 800A22C4 244EFFCC */ addiu $t6, $v0, -0x34 @@ -276,14 +276,14 @@ glabel L800A22AC /* 0A2EFC 800A22FC 26100014 */ addiu $s0, $s0, 0x14 /* 0A2F00 800A2300 1612FFF7 */ bne $s0, $s2, .L800A22E0 /* 0A2F04 800A2304 26310004 */ addiu $s1, $s1, 4 -/* 0A2F08 800A2308 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2F08 800A2308 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2F0C 800A230C 1000025B */ b .L800A2C7C -/* 0A2F10 800A2310 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2F10 800A2310 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A2314 /* 0A2F14 800A2314 0C024C36 */ jal set_text_color /* 0A2F18 800A2318 24040002 */ li $a0, 2 -/* 0A2F1C 800A231C 3C028019 */ lui $v0, %hi(D_8018EDEC) # $v0, 0x8019 -/* 0A2F20 800A2320 8042EDEC */ lb $v0, %lo(D_8018EDEC)($v0) +/* 0A2F1C 800A231C 3C028019 */ lui $v0, %hi(gSubMenuSelection) # $v0, 0x8019 +/* 0A2F20 800A2320 8042EDEC */ lb $v0, %lo(gSubMenuSelection)($v0) /* 0A2F24 800A2324 3C09800E */ lui $t1, %hi(D_800E7900) # $t1, 0x800e /* 0A2F28 800A2328 25297900 */ addiu $t1, %lo(D_800E7900) # addiu $t1, $t1, 0x7900 /* 0A2F2C 800A232C 2442FFBF */ addiu $v0, $v0, -0x41 @@ -306,9 +306,9 @@ glabel L800A2314 /* 0A2F6C 800A236C 26100014 */ addiu $s0, $s0, 0x14 /* 0A2F70 800A2370 1612FFF7 */ bne $s0, $s2, .L800A2350 /* 0A2F74 800A2374 26310004 */ addiu $s1, $s1, 4 -/* 0A2F78 800A2378 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2F78 800A2378 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2F7C 800A237C 1000023F */ b .L800A2C7C -/* 0A2F80 800A2380 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2F80 800A2380 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A2384 /* 0A2F84 800A2384 0C024C36 */ jal set_text_color /* 0A2F88 800A2388 24040003 */ li $a0, 3 @@ -330,9 +330,9 @@ glabel L800A2384 /* 0A2FC4 800A23C4 26310004 */ addiu $s1, $s1, 4 /* 0A2FC8 800A23C8 1632FFF7 */ bne $s1, $s2, .L800A23A8 /* 0A2FCC 800A23CC 26100014 */ addiu $s0, $s0, 0x14 -/* 0A2FD0 800A23D0 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A2FD0 800A23D0 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A2FD4 800A23D4 10000229 */ b .L800A2C7C -/* 0A2FD8 800A23D8 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A2FD8 800A23D8 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A23DC /* 0A2FDC 800A23DC 24010028 */ li $at, 40 /* 0A2FE0 800A23E0 1061000B */ beq $v1, $at, .L800A2410 @@ -404,14 +404,14 @@ glabel L800A23DC /* 0A30D4 800A24D4 8FB80078 */ lw $t8, 0x78($sp) /* 0A30D8 800A24D8 1278000F */ beq $s3, $t8, .L800A2518 /* 0A30DC 800A24DC 00000000 */ nop -/* 0A30E0 800A24E0 3C198019 */ lui $t9, %hi(D_8018EDEC) # $t9, 0x8019 -/* 0A30E4 800A24E4 8339EDEC */ lb $t9, %lo(D_8018EDEC)($t9) +/* 0A30E0 800A24E0 3C198019 */ lui $t9, %hi(gSubMenuSelection) # $t9, 0x8019 +/* 0A30E4 800A24E4 8339EDEC */ lb $t9, %lo(gSubMenuSelection)($t9) /* 0A30E8 800A24E8 02002825 */ move $a1, $s0 /* 0A30EC 800A24EC 24060001 */ li $a2, 1 /* 0A30F0 800A24F0 0C024870 */ jal text_rainbow_effect /* 0A30F4 800A24F4 03352023 */ subu $a0, $t9, $s5 -/* 0A30F8 800A24F8 3C088019 */ lui $t0, %hi(D_8018EDEC) # $t0, 0x8019 -/* 0A30FC 800A24FC 8108EDEC */ lb $t0, %lo(D_8018EDEC)($t0) +/* 0A30F8 800A24F8 3C088019 */ lui $t0, %hi(gSubMenuSelection) # $t0, 0x8019 +/* 0A30FC 800A24FC 8108EDEC */ lb $t0, %lo(gSubMenuSelection)($t0) /* 0A3100 800A2500 01154823 */ subu $t1, $t0, $s5 /* 0A3104 800A2504 5609001C */ bnel $s0, $t1, .L800A2578 /* 0A3108 800A2508 26110001 */ addiu $s1, $s0, 1 @@ -527,9 +527,9 @@ glabel L800A23DC /* 0A3290 800A2690 AFB80088 */ sw $t8, 0x88($sp) /* 0A3294 800A2694 1661FF83 */ bne $s3, $at, .L800A24A4 /* 0A3298 800A2698 26D60089 */ addiu $s6, $s6, 0x89 -/* 0A329C 800A269C 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A329C 800A269C 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A32A0 800A26A0 10000176 */ b .L800A2C7C -/* 0A32A4 800A26A4 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A32A4 800A26A4 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A26A8 /* 0A32A8 800A26A8 0C024C36 */ jal set_text_color /* 0A32AC 800A26AC 24040002 */ li $a0, 2 @@ -725,8 +725,8 @@ glabel L800A26A8 /* 0A3560 800A2960 00009025 */ move $s2, $zero /* 0A3564 800A2964 2411006E */ li $s1, 110 .L800A2968: -/* 0A3568 800A2968 3C048019 */ lui $a0, %hi(D_8018EDEC) # $a0, 0x8019 -/* 0A356C 800A296C 8084EDEC */ lb $a0, %lo(D_8018EDEC)($a0) +/* 0A3568 800A2968 3C048019 */ lui $a0, %hi(gSubMenuSelection) # $a0, 0x8019 +/* 0A356C 800A296C 8084EDEC */ lb $a0, %lo(gSubMenuSelection)($a0) /* 0A3570 800A2970 240F00D2 */ li $t7, 210 /* 0A3574 800A2974 02002825 */ move $a1, $s0 /* 0A3578 800A2978 2484FFC8 */ addiu $a0, $a0, -0x38 @@ -749,9 +749,9 @@ glabel L800A26A8 /* 0A35B8 800A29B8 26310032 */ addiu $s1, $s1, 0x32 /* 0A35BC 800A29BC 1641FFEA */ bne $s2, $at, .L800A2968 /* 0A35C0 800A29C0 26730004 */ addiu $s3, $s3, 4 -/* 0A35C4 800A29C4 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 +/* 0A35C4 800A29C4 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 /* 0A35C8 800A29C8 100000AC */ b .L800A2C7C -/* 0A35CC 800A29CC 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A35CC 800A29CC 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) glabel L800A29D0 /* 0A35D0 800A29D0 2475FFC6 */ addiu $s5, $v1, -0x3a /* 0A35D4 800A29D4 06A10003 */ bgez $s5, .L800A29E4 @@ -938,8 +938,8 @@ glabel L800A29D0 /* 0A3868 800A2C68 AFA90088 */ sw $t1, 0x88($sp) /* 0A386C 800A2C6C 1661FF81 */ bne $s3, $at, .L800A2A74 /* 0A3870 800A2C70 26D60089 */ addiu $s6, $s6, 0x89 -/* 0A3874 800A2C74 3C038019 */ lui $v1, %hi(D_8018EDEC) # $v1, 0x8019 -/* 0A3878 800A2C78 8063EDEC */ lb $v1, %lo(D_8018EDEC)($v1) +/* 0A3874 800A2C74 3C038019 */ lui $v1, %hi(gSubMenuSelection) # $v1, 0x8019 +/* 0A3878 800A2C78 8063EDEC */ lb $v1, %lo(gSubMenuSelection)($v1) .L800A2C7C: glabel L800A2C7C /* 0A387C 800A2C7C 246FFFD8 */ addiu $t7, $v1, -0x28 diff --git a/asm/non_matchings/code_80091750/func_800AB314.s b/asm/non_matchings/code_80091750/func_800AB314.s index 664099db71..829c4e1d96 100644 --- a/asm/non_matchings/code_80091750/func_800AB314.s +++ b/asm/non_matchings/code_80091750/func_800AB314.s @@ -20,10 +20,10 @@ glabel func_800AB314 /* 0ABF58 800AB358 AC62FFFC */ sw $v0, -4($v1) /* 0ABF5C 800AB35C 3C0E800E */ lui $t6, %hi(gModeSelection) # $t6, 0x800e /* 0ABF60 800AB360 8DCEC53C */ lw $t6, %lo(gModeSelection)($t6) -/* 0ABF64 800AB364 3C0F8019 */ lui $t7, %hi(D_8018EDEC) # $t7, 0x8019 +/* 0ABF64 800AB364 3C0F8019 */ lui $t7, %hi(gSubMenuSelection) # $t7, 0x8019 /* 0ABF68 800AB368 51C00053 */ beql $t6, $zero, .L800AB4B8 /* 0ABF6C 800AB36C 8CC20004 */ lw $v0, 4($a2) -/* 0ABF70 800AB370 81EFEDEC */ lb $t7, %lo(D_8018EDEC)($t7) +/* 0ABF70 800AB370 81EFEDEC */ lb $t7, %lo(gSubMenuSelection)($t7) /* 0ABF74 800AB374 24040001 */ li $a0, 1 /* 0ABF78 800AB378 24030003 */ li $v1, 3 /* 0ABF7C 800AB37C 108F003A */ beq $a0, $t7, .L800AB468 @@ -124,10 +124,10 @@ glabel func_800AB314 /* 0AC0CC 800AB4CC 3C038019 */ lui $v1, %hi(gCupSelection) # $v1, 0x8019 /* 0AC0D0 800AB4D0 24010002 */ li $at, 2 /* 0AC0D4 800AB4D4 1041005C */ beq $v0, $at, .L800AB648 -/* 0AC0D8 800AB4D8 3C0D8019 */ lui $t5, %hi(D_8018EDEC) # 0x8019 +/* 0AC0D8 800AB4D8 3C0D8019 */ lui $t5, %hi(gSubMenuSelection) # 0x8019 /* 0AC0DC 800AB4DC 24030003 */ li $v1, 3 /* 0AC0E0 800AB4E0 1043006A */ beq $v0, $v1, .L800AB68C -/* 0AC0E4 800AB4E4 3C198019 */ lui $t9, %hi(D_8018EDEC) # 0x8019 +/* 0AC0E4 800AB4E4 3C198019 */ lui $t9, %hi(gSubMenuSelection) # 0x8019 /* 0AC0E8 800AB4E8 1000006F */ b .L800AB6A8 /* 0AC0EC 800AB4EC 00000000 */ nop /* 0AC0F0 800AB4F0 8CD9001C */ lw $t9, 0x1c($a2) @@ -163,8 +163,8 @@ glabel func_800AB314 /* 0AC158 800AB558 000A5880 */ sll $t3, $t2, 2 /* 0AC15C 800AB55C ACCB001C */ sw $t3, 0x1c($a2) .L800AB560: -/* 0AC160 800AB560 3C0C8019 */ lui $t4, %hi(D_8018EDEC) # $t4, 0x8019 -/* 0AC164 800AB564 818CEDEC */ lb $t4, %lo(D_8018EDEC)($t4) +/* 0AC160 800AB560 3C0C8019 */ lui $t4, %hi(gSubMenuSelection) # $t4, 0x8019 +/* 0AC164 800AB564 818CEDEC */ lb $t4, %lo(gSubMenuSelection)($t4) /* 0AC168 800AB568 24030003 */ li $v1, 3 /* 0AC16C 800AB56C 240D0002 */ li $t5, 2 /* 0AC170 800AB570 146C0003 */ bne $v1, $t4, .L800AB580 @@ -219,8 +219,8 @@ glabel func_800AB314 /* 0AC21C 800AB61C 10000022 */ b .L800AB6A8 /* 0AC220 800AB620 ACCA001C */ sw $t2, 0x1c($a2) .L800AB624: -/* 0AC224 800AB624 3C0B8019 */ lui $t3, %hi(D_8018EDEC) # $t3, 0x8019 -/* 0AC228 800AB628 816BEDEC */ lb $t3, %lo(D_8018EDEC)($t3) +/* 0AC224 800AB624 3C0B8019 */ lui $t3, %hi(gSubMenuSelection) # $t3, 0x8019 +/* 0AC228 800AB628 816BEDEC */ lb $t3, %lo(gSubMenuSelection)($t3) /* 0AC22C 800AB62C 24030003 */ li $v1, 3 /* 0AC230 800AB630 146B0003 */ bne $v1, $t3, .L800AB640 /* 0AC234 800AB634 240C0002 */ li $t4, 2 @@ -239,7 +239,7 @@ glabel func_800AB314 /* 0AC260 800AB660 ACC30004 */ sw $v1, 4($a2) /* 0AC264 800AB664 ACC00020 */ sw $zero, 0x20($a2) .L800AB668: -/* 0AC268 800AB668 81ADEDEC */ lb $t5, %lo(D_8018EDEC)($t5) # -0x1214($t5) +/* 0AC268 800AB668 81ADEDEC */ lb $t5, %lo(gSubMenuSelection)($t5) # -0x1214($t5) /* 0AC26C 800AB66C 24030003 */ li $v1, 3 /* 0AC270 800AB670 106D0004 */ beq $v1, $t5, .L800AB684 /* 0AC274 800AB674 00000000 */ nop @@ -250,7 +250,7 @@ glabel func_800AB314 /* 0AC284 800AB684 10000008 */ b .L800AB6A8 /* 0AC288 800AB688 8CC20004 */ lw $v0, 4($a2) .L800AB68C: -/* 0AC28C 800AB68C 8339EDEC */ lb $t9, %lo(D_8018EDEC)($t9) # -0x1214($t9) +/* 0AC28C 800AB68C 8339EDEC */ lb $t9, %lo(gSubMenuSelection)($t9) # -0x1214($t9) /* 0AC290 800AB690 10790005 */ beq $v1, $t9, .L800AB6A8 /* 0AC294 800AB694 00000000 */ nop /* 0AC298 800AB698 ACC00004 */ sw $zero, 4($a2) diff --git a/asm/non_matchings/menus/main_menu_act.s b/asm/non_matchings/menus/main_menu_act.s index f03d69c88d..35ded8da71 100644 --- a/asm/non_matchings/menus/main_menu_act.s +++ b/asm/non_matchings/menus/main_menu_act.s @@ -29,13 +29,13 @@ glabel main_menu_act .L800B2A24: /* 0B3624 800B2A24 A7A3002E */ sh $v1, 0x2e($sp) .L800B2A28: -/* 0B3628 800B2A28 0C02D148 */ jal func_800B4520 +/* 0B3628 800B2A28 0C02D148 */ jal is_screen_being_faded /* 0B362C 800B2A2C A7A50036 */ sh $a1, 0x36($sp) /* 0B3630 800B2A30 97A3002E */ lhu $v1, 0x2e($sp) /* 0B3634 800B2A34 144002A8 */ bnez $v0, .L800B34D8 /* 0B3638 800B2A38 97A50036 */ lhu $a1, 0x36($sp) -/* 0B363C 800B2A3C 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B3640 800B2A40 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B363C 800B2A3C 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B3640 800B2A40 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B3644 800B2A44 910C0000 */ lbu $t4, ($t0) /* 0B3648 800B2A48 3C188019 */ lui $t8, %hi(gPlayerCount) # 0x8019 /* 0B364C 800B2A4C 2D810009 */ sltiu $at, $t4, 9 @@ -49,10 +49,10 @@ glabel main_menu_act glabel L800B2A6C # case 0 /* 0B366C 800B2A6C 3C0D8019 */ lui $t5, %hi(gPlayerCount) # $t5, 0x8019 /* 0B3670 800B2A70 81ADEDF3 */ lb $t5, %lo(gPlayerCount)($t5) -/* 0B3674 800B2A74 3C0F800F */ lui $t7, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3674 800B2A74 3C0F800F */ lui $t7, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3678 800B2A78 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B367C 800B2A7C 01ED7821 */ addu $t7, $t7, $t5 -/* 0B3680 800B2A80 81EF86AB */ lb $t7, %lo((D_800E86AC - 1))($t7) # -0x7955($t7) +/* 0B3680 800B2A80 81EF86AB */ lb $t7, %lo((gGameModeMenuColumn - 1))($t7) # -0x7955($t7) /* 0B3684 800B2A84 000D7080 */ sll $t6, $t5, 2 /* 0B3688 800B2A88 01CD7023 */ subu $t6, $t6, $t5 /* 0B368C 800B2A8C 000E7080 */ sll $t6, $t6, 2 @@ -72,13 +72,13 @@ glabel L800B2AA4 # case 3 /* 0B36C0 800B2AC0 244A0001 */ addiu $t2, $v0, 1 /* 0B36C4 800B2AC4 3C018019 */ lui $at, %hi(gPlayerCount) # $at, 0x8019 /* 0B36C8 800B2AC8 A02AEDF3 */ sb $t2, %lo(gPlayerCount)($at) -/* 0B36CC 800B2ACC 0C02D12B */ jal func_800B44AC +/* 0B36CC 800B2ACC 0C02D12B */ jal reset_cycle_flash_menu /* 0B36D0 800B2AD0 AFA3001C */ sw $v1, 0x1c($sp) /* 0B36D4 800B2AD4 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B36D8 800B2AD8 0C032384 */ jal play_sound2 /* 0B36DC 800B2ADC 34848000 */ ori $a0, (0x49008000 & 0xFFFF) # ori $a0, $a0, 0x8000 -/* 0B36E0 800B2AE0 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B36E4 800B2AE4 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B36E0 800B2AE0 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B36E4 800B2AE4 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B36E8 800B2AE8 8FA6001C */ lw $a2, 0x1c($sp) .L800B2AEC: /* 0B36EC 800B2AEC 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 @@ -90,14 +90,14 @@ glabel L800B2AA4 # case 3 /* 0B3704 800B2B04 244CFFFF */ addiu $t4, $v0, -1 /* 0B3708 800B2B08 3C018019 */ lui $at, %hi(gPlayerCount) # $at, 0x8019 /* 0B370C 800B2B0C A02CEDF3 */ sb $t4, %lo(gPlayerCount)($at) -/* 0B3710 800B2B10 0C02D12B */ jal func_800B44AC +/* 0B3710 800B2B10 0C02D12B */ jal reset_cycle_flash_menu /* 0B3714 800B2B14 AFA6001C */ sw $a2, 0x1c($sp) /* 0B3718 800B2B18 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B371C 800B2B1C 0C032384 */ jal play_sound2 /* 0B3720 800B2B20 34848000 */ ori $a0, (0x49008000 & 0xFFFF) # ori $a0, $a0, 0x8000 /* 0B3724 800B2B24 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 -/* 0B3728 800B2B28 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B372C 800B2B2C 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B3728 800B2B28 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B372C 800B2B2C 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B3730 800B2B30 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) /* 0B3734 800B2B34 8FA6001C */ lw $a2, 0x1c($sp) .L800B2B38: @@ -137,17 +137,17 @@ glabel L800B2AA4 # case 3 /* 0B37A8 800B2BA8 0C0328CC */ jal func_800CA330 /* 0B37AC 800B2BAC 24040019 */ li $a0, 25 /* 0B37B0 800B2BB0 24070001 */ li $a3, 1 -/* 0B37B4 800B2BB4 3C018019 */ lui $at, %hi(D_8018EDE0) # $at, 0x8019 +/* 0B37B4 800B2BB4 3C018019 */ lui $at, %hi(gMenuFadeType) # $at, 0x8019 /* 0B37B8 800B2BB8 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 -/* 0B37BC 800B2BBC AC27EDE0 */ sw $a3, %lo(D_8018EDE0)($at) +/* 0B37BC 800B2BBC AC27EDE0 */ sw $a3, %lo(gMenuFadeType)($at) /* 0B37C0 800B2BC0 0C032384 */ jal play_sound2 /* 0B37C4 800B2BC4 34848002 */ ori $a0, (0x49008002 & 0xFFFF) # ori $a0, $a0, 0x8002 /* 0B37C8 800B2BC8 3C0F8019 */ lui $t7, %hi(gPlayerCount) # $t7, 0x8019 /* 0B37CC 800B2BCC 81EFEDF3 */ lb $t7, %lo(gPlayerCount)($t7) -/* 0B37D0 800B2BD0 3C18800F */ lui $t8, %hi((D_800E86AC - 1)) # 0x800f +/* 0B37D0 800B2BD0 3C18800F */ lui $t8, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B37D4 800B2BD4 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B37D8 800B2BD8 030FC021 */ addu $t8, $t8, $t7 -/* 0B37DC 800B2BDC 831886AB */ lb $t8, %lo((D_800E86AC - 1))($t8) # -0x7955($t8) +/* 0B37DC 800B2BDC 831886AB */ lb $t8, %lo((gGameModeMenuColumn - 1))($t8) # -0x7955($t8) /* 0B37E0 800B2BE0 000F7080 */ sll $t6, $t7, 2 /* 0B37E4 800B2BE4 01CF7023 */ subu $t6, $t6, $t7 /* 0B37E8 800B2BE8 000E7080 */ sll $t6, $t6, 2 @@ -160,17 +160,17 @@ glabel L800B2AA4 # case 3 /* 0B3800 800B2C00 11400015 */ beqz $t2, .L800B2C58 /* 0B3804 800B2C04 30D90020 */ andi $t9, $a2, 0x20 /* 0B3808 800B2C08 240B0004 */ li $t3, 4 -/* 0B380C 800B2C0C 0C02D12B */ jal func_800B44AC +/* 0B380C 800B2C0C 0C02D12B */ jal reset_cycle_flash_menu /* 0B3810 800B2C10 A10B0000 */ sb $t3, ($t0) /* 0B3814 800B2C14 3C044900 */ lui $a0, (0x49008001 >> 16) # lui $a0, 0x4900 /* 0B3818 800B2C18 0C032384 */ jal play_sound2 /* 0B381C 800B2C1C 34848001 */ ori $a0, (0x49008001 & 0xFFFF) # ori $a0, $a0, 0x8001 /* 0B3820 800B2C20 3C0C8019 */ lui $t4, %hi(gPlayerCount) # $t4, 0x8019 /* 0B3824 800B2C24 818CEDF3 */ lb $t4, %lo(gPlayerCount)($t4) -/* 0B3828 800B2C28 3C0F800F */ lui $t7, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3828 800B2C28 3C0F800F */ lui $t7, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B382C 800B2C2C 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3830 800B2C30 01EC7821 */ addu $t7, $t7, $t4 -/* 0B3834 800B2C34 81EF86AB */ lb $t7, %lo((D_800E86AC - 1))($t7) # -0x7955($t7) +/* 0B3834 800B2C34 81EF86AB */ lb $t7, %lo((gGameModeMenuColumn - 1))($t7) # -0x7955($t7) /* 0B3838 800B2C38 000C6880 */ sll $t5, $t4, 2 /* 0B383C 800B2C3C 01AC6823 */ subu $t5, $t5, $t4 /* 0B3840 800B2C40 000D6880 */ sll $t5, $t5, 2 @@ -189,10 +189,10 @@ glabel L800B2AA4 # case 3 /* 0B3870 800B2C70 34849010 */ ori $a0, (0x49009010 & 0xFFFF) # ori $a0, $a0, 0x9010 /* 0B3874 800B2C74 3C098019 */ lui $t1, %hi(gPlayerCount) # $t1, 0x8019 /* 0B3878 800B2C78 8129EDF3 */ lb $t1, %lo(gPlayerCount)($t1) -/* 0B387C 800B2C7C 3C0B800F */ lui $t3, %hi((D_800E86AC - 1)) # 0x800f +/* 0B387C 800B2C7C 3C0B800F */ lui $t3, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3880 800B2C80 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3884 800B2C84 01695821 */ addu $t3, $t3, $t1 -/* 0B3888 800B2C88 816B86AB */ lb $t3, %lo((D_800E86AC - 1))($t3) # -0x7955($t3) +/* 0B3888 800B2C88 816B86AB */ lb $t3, %lo((gGameModeMenuColumn - 1))($t3) # -0x7955($t3) /* 0B388C 800B2C8C 00095080 */ sll $t2, $t1, 2 /* 0B3890 800B2C90 01495023 */ subu $t2, $t2, $t1 /* 0B3894 800B2C94 000A5080 */ sll $t2, $t2, 2 @@ -212,10 +212,10 @@ glabel L800B2AA4 # case 3 /* 0B38C8 800B2CC8 34849011 */ ori $a0, (0x49009011 & 0xFFFF) # ori $a0, $a0, 0x9011 /* 0B38CC 800B2CCC 3C0E8019 */ lui $t6, %hi(gPlayerCount) # $t6, 0x8019 /* 0B38D0 800B2CD0 81CEEDF3 */ lb $t6, %lo(gPlayerCount)($t6) -/* 0B38D4 800B2CD4 3C09800F */ lui $t1, %hi((D_800E86AC - 1)) # 0x800f +/* 0B38D4 800B2CD4 3C09800F */ lui $t1, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B38D8 800B2CD8 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B38DC 800B2CDC 012E4821 */ addu $t1, $t1, $t6 -/* 0B38E0 800B2CE0 812986AB */ lb $t1, %lo((D_800E86AC - 1))($t1) # -0x7955($t1) +/* 0B38E0 800B2CE0 812986AB */ lb $t1, %lo((gGameModeMenuColumn - 1))($t1) # -0x7955($t1) /* 0B38E4 800B2CE4 000EC880 */ sll $t9, $t6, 2 /* 0B38E8 800B2CE8 032EC823 */ subu $t9, $t9, $t6 /* 0B38EC 800B2CEC 0019C880 */ sll $t9, $t9, 2 @@ -225,9 +225,9 @@ glabel L800B2AA4 # case 3 /* 0B38FC 800B2CFC 100001F4 */ b .L800B34D0 /* 0B3900 800B2D00 8C632B70 */ lw $v1, %lo((gGameModePlayerSelection - 0xC))($v1) # 0x2b70($v1) .L800B2D04: -/* 0B3904 800B2D04 3C0F800F */ lui $t7, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3904 800B2D04 3C0F800F */ lui $t7, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3908 800B2D08 01E27821 */ addu $t7, $t7, $v0 -/* 0B390C 800B2D0C 81EF86AB */ lb $t7, %lo((D_800E86AC - 1))($t7) # -0x7955($t7) +/* 0B390C 800B2D0C 81EF86AB */ lb $t7, %lo((gGameModeMenuColumn - 1))($t7) # -0x7955($t7) /* 0B3910 800B2D10 01826023 */ subu $t4, $t4, $v0 /* 0B3914 800B2D14 000C6080 */ sll $t4, $t4, 2 /* 0B3918 800B2D18 000F6880 */ sll $t5, $t7, 2 @@ -242,8 +242,8 @@ glabel L800B2D30 # case 4 /* 0B3938 800B2D38 00603025 */ move $a2, $v1 /* 0B393C 800B2D3C 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3940 800B2D40 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3944 800B2D44 3C09800F */ lui $t1, %hi(D_800E86AC) # $t1, 0x800f -/* 0B3948 800B2D48 252986AC */ addiu $t1, %lo(D_800E86AC) # addiu $t1, $t1, -0x7954 +/* 0B3944 800B2D44 3C09800F */ lui $t1, %hi(gGameModeMenuColumn) # $t1, 0x800f +/* 0B3948 800B2D48 252986AC */ addiu $t1, %lo(gGameModeMenuColumn) # addiu $t1, $t1, -0x7954 /* 0B394C 800B2D4C 3C19800F */ lui $t9, %hi((gPlayerModeSelection - 1)) # 0x800f /* 0B3950 800B2D50 0322C821 */ addu $t9, $t9, $v0 /* 0B3954 800B2D54 00491821 */ addu $v1, $v0, $t1 @@ -254,13 +254,13 @@ glabel L800B2D30 # case 4 /* 0B3968 800B2D68 5020000B */ beql $at, $zero, .L800B2D98 /* 0B396C 800B2D6C 30CA0800 */ andi $t2, $a2, 0x800 /* 0B3970 800B2D70 A06BFFFF */ sb $t3, -1($v1) -/* 0B3974 800B2D74 0C02D12B */ jal func_800B44AC +/* 0B3974 800B2D74 0C02D12B */ jal reset_cycle_flash_menu /* 0B3978 800B2D78 AFA6001C */ sw $a2, 0x1c($sp) /* 0B397C 800B2D7C 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B3980 800B2D80 0C032384 */ jal play_sound2 /* 0B3984 800B2D84 34848000 */ ori $a0, (0x49008000 & 0xFFFF) # ori $a0, $a0, 0x8000 -/* 0B3988 800B2D88 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B398C 800B2D8C 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B3988 800B2D88 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B398C 800B2D8C 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B3990 800B2D90 8FA6001C */ lw $a2, 0x1c($sp) .L800B2D94: /* 0B3994 800B2D94 30CA0800 */ andi $t2, $a2, 0x800 @@ -268,37 +268,37 @@ glabel L800B2D30 # case 4 /* 0B3998 800B2D98 11400011 */ beqz $t2, .L800B2DE0 /* 0B399C 800B2D9C 3C0F8019 */ lui $t7, %hi(gPlayerCount) # $t7, 0x8019 /* 0B39A0 800B2DA0 81EFEDF3 */ lb $t7, %lo(gPlayerCount)($t7) -/* 0B39A4 800B2DA4 3C0C800F */ lui $t4, %hi(D_800E86AC) # $t4, 0x800f -/* 0B39A8 800B2DA8 258C86AC */ addiu $t4, %lo(D_800E86AC) # addiu $t4, $t4, -0x7954 +/* 0B39A4 800B2DA4 3C0C800F */ lui $t4, %hi(gGameModeMenuColumn) # $t4, 0x800f +/* 0B39A8 800B2DA8 258C86AC */ addiu $t4, %lo(gGameModeMenuColumn) # addiu $t4, $t4, -0x7954 /* 0B39AC 800B2DAC 01EC1821 */ addu $v1, $t7, $t4 /* 0B39B0 800B2DB0 8064FFFF */ lb $a0, -1($v1) /* 0B39B4 800B2DB4 1880000A */ blez $a0, .L800B2DE0 /* 0B39B8 800B2DB8 248DFFFF */ addiu $t5, $a0, -1 /* 0B39BC 800B2DBC A06DFFFF */ sb $t5, -1($v1) -/* 0B39C0 800B2DC0 0C02D12B */ jal func_800B44AC +/* 0B39C0 800B2DC0 0C02D12B */ jal reset_cycle_flash_menu /* 0B39C4 800B2DC4 AFA6001C */ sw $a2, 0x1c($sp) /* 0B39C8 800B2DC8 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B39CC 800B2DCC 0C032384 */ jal play_sound2 /* 0B39D0 800B2DD0 34848000 */ ori $a0, (0x49008000 & 0xFFFF) # ori $a0, $a0, 0x8000 -/* 0B39D4 800B2DD4 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B39D8 800B2DD8 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B39D4 800B2DD4 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B39D8 800B2DD8 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B39DC 800B2DDC 8FA6001C */ lw $a2, 0x1c($sp) .L800B2DE0: /* 0B39E0 800B2DE0 30D84000 */ andi $t8, $a2, 0x4000 /* 0B39E4 800B2DE4 13000015 */ beqz $t8, .L800B2E3C /* 0B39E8 800B2DE8 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B39EC 800B2DEC 24040003 */ li $a0, 3 -/* 0B39F0 800B2DF0 0C02D12B */ jal func_800B44AC +/* 0B39F0 800B2DF0 0C02D12B */ jal reset_cycle_flash_menu /* 0B39F4 800B2DF4 A1040000 */ sb $a0, ($t0) /* 0B39F8 800B2DF8 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 /* 0B39FC 800B2DFC 0C032384 */ jal play_sound2 /* 0B3A00 800B2E00 34848002 */ ori $a0, (0x49008002 & 0xFFFF) # ori $a0, $a0, 0x8002 /* 0B3A04 800B2E04 3C0E8019 */ lui $t6, %hi(gPlayerCount) # $t6, 0x8019 /* 0B3A08 800B2E08 81CEEDF3 */ lb $t6, %lo(gPlayerCount)($t6) -/* 0B3A0C 800B2E0C 3C19800F */ lui $t9, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3A0C 800B2E0C 3C19800F */ lui $t9, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3A10 800B2E10 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3A14 800B2E14 032EC821 */ addu $t9, $t9, $t6 -/* 0B3A18 800B2E18 833986AB */ lb $t9, %lo((D_800E86AC - 1))($t9) # -0x7955($t9) +/* 0B3A18 800B2E18 833986AB */ lb $t9, %lo((gGameModeMenuColumn - 1))($t9) # -0x7955($t9) /* 0B3A1C 800B2E1C 000E4880 */ sll $t1, $t6, 2 /* 0B3A20 800B2E20 012E4823 */ subu $t1, $t1, $t6 /* 0B3A24 800B2E24 00094880 */ sll $t1, $t1, 2 @@ -309,11 +309,11 @@ glabel L800B2D30 # case 4 /* 0B3A38 800B2E38 8C632B70 */ lw $v1, %lo((gGameModePlayerSelection - 0xC))($v1) # 0x2b70($v1) .L800B2E3C: /* 0B3A3C 800B2E3C 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3A40 800B2E40 3C04800F */ lui $a0, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3A40 800B2E40 3C04800F */ lui $a0, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3A44 800B2E44 30CF8000 */ andi $t7, $a2, 0x8000 /* 0B3A48 800B2E48 00822021 */ addu $a0, $a0, $v0 /* 0B3A4C 800B2E4C 11E0003F */ beqz $t7, .L800B2F4C -/* 0B3A50 800B2E50 808486AB */ lb $a0, %lo((D_800E86AC - 1))($a0) # -0x7955($a0) +/* 0B3A50 800B2E50 808486AB */ lb $a0, %lo((gGameModeMenuColumn - 1))($a0) # -0x7955($a0) /* 0B3A54 800B2E54 00026080 */ sll $t4, $v0, 2 /* 0B3A58 800B2E58 01826023 */ subu $t4, $t4, $v0 /* 0B3A5C 800B2E5C 000C6080 */ sll $t4, $t4, 2 @@ -363,14 +363,14 @@ glabel L800B2D30 # case 4 /* 0B3AFC 800B2EFC 0C032384 */ jal play_sound2 /* 0B3B00 800B2F00 3484900D */ ori $a0, (0x4900900D & 0xFFFF) # ori $a0, $a0, 0x900d .L800B2F04: -/* 0B3B04 800B2F04 0C02D12B */ jal func_800B44AC +/* 0B3B04 800B2F04 0C02D12B */ jal reset_cycle_flash_menu /* 0B3B08 800B2F08 00000000 */ nop /* 0B3B0C 800B2F0C 3C0F8019 */ lui $t7, %hi(gPlayerCount) # $t7, 0x8019 /* 0B3B10 800B2F10 81EFEDF3 */ lb $t7, %lo(gPlayerCount)($t7) -/* 0B3B14 800B2F14 3C0D800F */ lui $t5, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3B14 800B2F14 3C0D800F */ lui $t5, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3B18 800B2F18 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3B1C 800B2F1C 01AF6821 */ addu $t5, $t5, $t7 -/* 0B3B20 800B2F20 81AD86AB */ lb $t5, %lo((D_800E86AC - 1))($t5) # -0x7955($t5) +/* 0B3B20 800B2F20 81AD86AB */ lb $t5, %lo((gGameModeMenuColumn - 1))($t5) # -0x7955($t5) /* 0B3B24 800B2F24 000F6080 */ sll $t4, $t7, 2 /* 0B3B28 800B2F28 018F6023 */ subu $t4, $t4, $t7 /* 0B3B2C 800B2F2C 000C6080 */ sll $t4, $t4, 2 @@ -409,10 +409,10 @@ glabel L800B2F70 # case 5, 8 /* 0B3BA8 800B2FA8 00000000 */ nop .L800B2FAC: /* 0B3BAC 800B2FAC 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3BB0 800B2FB0 3C18800F */ lui $t8, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3BB0 800B2FB0 3C18800F */ lui $t8, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3BB4 800B2FB4 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3BB8 800B2FB8 0302C021 */ addu $t8, $t8, $v0 -/* 0B3BBC 800B2FBC 831886AB */ lb $t8, %lo((D_800E86AC - 1))($t8) # -0x7955($t8) +/* 0B3BBC 800B2FBC 831886AB */ lb $t8, %lo((gGameModeMenuColumn - 1))($t8) # -0x7955($t8) /* 0B3BC0 800B2FC0 00026080 */ sll $t4, $v0, 2 /* 0B3BC4 800B2FC4 01826023 */ subu $t4, $t4, $v0 /* 0B3BC8 800B2FC8 000C6080 */ sll $t4, $t4, 2 @@ -433,13 +433,13 @@ glabel L800B2F70 # case 5, 8 .L800B3000: /* 0B3C00 800B3000 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3C04 800B3004 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3C08 800B3008 3C0B800F */ lui $t3, %hi((D_800E86AC - 1)) # 0x800f -/* 0B3C0C 800B300C 3C0F800F */ lui $t7, %hi(D_800E86B0) # $t7, 0x800f +/* 0B3C08 800B3008 3C0B800F */ lui $t3, %hi((gGameModeMenuColumn - 1)) # 0x800f +/* 0B3C0C 800B300C 3C0F800F */ lui $t7, %hi(gGameModeSubMenuColumn) # $t7, 0x800f /* 0B3C10 800B3010 01625821 */ addu $t3, $t3, $v0 -/* 0B3C14 800B3014 816B86AB */ lb $t3, %lo((D_800E86AC - 1))($t3) # -0x7955($t3) +/* 0B3C14 800B3014 816B86AB */ lb $t3, %lo((gGameModeMenuColumn - 1))($t3) # -0x7955($t3) /* 0B3C18 800B3018 00024880 */ sll $t1, $v0, 2 /* 0B3C1C 800B301C 01224823 */ subu $t1, $t1, $v0 -/* 0B3C20 800B3020 25EF86B0 */ addiu $t7, %lo(D_800E86B0) # addiu $t7, $t7, -0x7950 +/* 0B3C20 800B3020 25EF86B0 */ addiu $t7, %lo(gGameModeSubMenuColumn) # addiu $t7, $t7, -0x7950 /* 0B3C24 800B3024 012B5021 */ addu $t2, $t1, $t3 /* 0B3C28 800B3028 014F1821 */ addu $v1, $t2, $t7 /* 0B3C2C 800B302C 8064FFFD */ lb $a0, -3($v1) @@ -450,7 +450,7 @@ glabel L800B2F70 # case 5, 8 /* 0B3C40 800B3040 2498FFFF */ addiu $t8, $a0, -1 /* 0B3C44 800B3044 A078FFFD */ sb $t8, -3($v1) /* 0B3C48 800B3048 AFA40028 */ sw $a0, 0x28($sp) -/* 0B3C4C 800B304C 0C02D12B */ jal func_800B44AC +/* 0B3C4C 800B304C 0C02D12B */ jal reset_cycle_flash_menu /* 0B3C50 800B3050 AFA6001C */ sw $a2, 0x1c($sp) /* 0B3C54 800B3054 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B3C58 800B3058 0C032384 */ jal play_sound2 @@ -471,15 +471,15 @@ glabel L800B2F70 # case 5, 8 /* 0B3C90 800B3090 8FA6001C */ lw $a2, 0x1c($sp) /* 0B3C94 800B3094 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3C98 800B3098 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3C9C 800B309C 3C04800F */ lui $a0, %hi((D_800E86AC - 1)) # 0x800f -/* 0B3CA0 800B30A0 3C09800F */ lui $t1, %hi((gGameModePlayerColumnExtra - 3)) # 0x800f +/* 0B3C9C 800B309C 3C04800F */ lui $a0, %hi((gGameModeMenuColumn - 1)) # 0x800f +/* 0B3CA0 800B30A0 3C09800F */ lui $t1, %hi((sGameModePlayerColumnExtra - 3)) # 0x800f /* 0B3CA4 800B30A4 00822021 */ addu $a0, $a0, $v0 -/* 0B3CA8 800B30A8 808486AB */ lb $a0, %lo((D_800E86AC - 1))($a0) # -0x7955($a0) +/* 0B3CA8 800B30A8 808486AB */ lb $a0, %lo((gGameModeMenuColumn - 1))($a0) # -0x7955($a0) /* 0B3CAC 800B30AC 00027080 */ sll $t6, $v0, 2 /* 0B3CB0 800B30B0 01C27023 */ subu $t6, $t6, $v0 /* 0B3CB4 800B30B4 01C4C821 */ addu $t9, $t6, $a0 /* 0B3CB8 800B30B8 01394821 */ addu $t1, $t1, $t9 -/* 0B3CBC 800B30BC 81292B6D */ lb $t1, %lo((gGameModePlayerColumnExtra - 3))($t1) # 0x2b6d($t1) +/* 0B3CBC 800B30BC 81292B6D */ lb $t1, %lo((sGameModePlayerColumnExtra - 3))($t1) # 0x2b6d($t1) /* 0B3CC0 800B30C0 00A9082A */ slt $at, $a1, $t1 /* 0B3CC4 800B30C4 10200012 */ beqz $at, .L800B3110 /* 0B3CC8 800B30C8 00000000 */ nop @@ -488,15 +488,15 @@ glabel L800B2F70 # case 5, 8 .L800B30D4: /* 0B3CD4 800B30D4 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3CD8 800B30D8 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3CDC 800B30DC 3C04800F */ lui $a0, %hi((D_800E86AC - 1)) # 0x800f -/* 0B3CE0 800B30E0 3C0F800F */ lui $t7, %hi((gGameModePlayerColumnDefault - 3)) # 0x800f +/* 0B3CDC 800B30DC 3C04800F */ lui $a0, %hi((gGameModeMenuColumn - 1)) # 0x800f +/* 0B3CE0 800B30E0 3C0F800F */ lui $t7, %hi((sGameModePlayerColumnDefault - 3)) # 0x800f /* 0B3CE4 800B30E4 00822021 */ addu $a0, $a0, $v0 -/* 0B3CE8 800B30E8 808486AB */ lb $a0, %lo((D_800E86AC - 1))($a0) # -0x7955($a0) +/* 0B3CE8 800B30E8 808486AB */ lb $a0, %lo((gGameModeMenuColumn - 1))($a0) # -0x7955($a0) /* 0B3CEC 800B30EC 00025880 */ sll $t3, $v0, 2 /* 0B3CF0 800B30F0 01625823 */ subu $t3, $t3, $v0 /* 0B3CF4 800B30F4 01645021 */ addu $t2, $t3, $a0 /* 0B3CF8 800B30F8 01EA7821 */ addu $t7, $t7, $t2 -/* 0B3CFC 800B30FC 81EF2B61 */ lb $t7, %lo((gGameModePlayerColumnDefault - 3))($t7) # 0x2b61($t7) +/* 0B3CFC 800B30FC 81EF2B61 */ lb $t7, %lo((sGameModePlayerColumnDefault - 3))($t7) # 0x2b61($t7) /* 0B3D00 800B3100 00AF082A */ slt $at, $a1, $t7 /* 0B3D04 800B3104 10200002 */ beqz $at, .L800B3110 /* 0B3D08 800B3108 00000000 */ nop @@ -505,14 +505,14 @@ glabel L800B2F70 # case 5, 8 /* 0B3D10 800B3110 1060000F */ beqz $v1, .L800B3150 /* 0B3D14 800B3114 00026880 */ sll $t5, $v0, 2 /* 0B3D18 800B3118 01A26823 */ subu $t5, $t5, $v0 -/* 0B3D1C 800B311C 3C0C800F */ lui $t4, %hi(D_800E86B0) # $t4, 0x800f -/* 0B3D20 800B3120 258C86B0 */ addiu $t4, %lo(D_800E86B0) # addiu $t4, $t4, -0x7950 +/* 0B3D1C 800B311C 3C0C800F */ lui $t4, %hi(gGameModeSubMenuColumn) # $t4, 0x800f +/* 0B3D20 800B3120 258C86B0 */ addiu $t4, %lo(gGameModeSubMenuColumn) # addiu $t4, $t4, -0x7950 /* 0B3D24 800B3124 01A4C021 */ addu $t8, $t5, $a0 /* 0B3D28 800B3128 030C1821 */ addu $v1, $t8, $t4 /* 0B3D2C 800B312C 806EFFFD */ lb $t6, -3($v1) /* 0B3D30 800B3130 AFA6001C */ sw $a2, 0x1c($sp) /* 0B3D34 800B3134 25D90001 */ addiu $t9, $t6, 1 -/* 0B3D38 800B3138 0C02D12B */ jal func_800B44AC +/* 0B3D38 800B3138 0C02D12B */ jal reset_cycle_flash_menu /* 0B3D3C 800B313C A079FFFD */ sb $t9, -3($v1) /* 0B3D40 800B3140 3C044900 */ lui $a0, (0x49008000 >> 16) # lui $a0, 0x4900 /* 0B3D44 800B3144 0C032384 */ jal play_sound2 @@ -521,31 +521,31 @@ glabel L800B2F70 # case 5, 8 .L800B3150: /* 0B3D50 800B3150 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3D54 800B3154 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3D58 800B3158 3C04800F */ lui $a0, %hi((D_800E86AC - 1)) # 0x800f -/* 0B3D5C 800B315C 3C05800F */ lui $a1, %hi((D_800E86B0 - 3)) # 0x800f +/* 0B3D58 800B3158 3C04800F */ lui $a0, %hi((gGameModeMenuColumn - 1)) # 0x800f +/* 0B3D5C 800B315C 3C05800F */ lui $a1, %hi((gGameModeSubMenuColumn - 3)) # 0x800f /* 0B3D60 800B3160 00822021 */ addu $a0, $a0, $v0 -/* 0B3D64 800B3164 808486AB */ lb $a0, %lo((D_800E86AC - 1))($a0) # -0x7955($a0) +/* 0B3D64 800B3164 808486AB */ lb $a0, %lo((gGameModeMenuColumn - 1))($a0) # -0x7955($a0) /* 0B3D68 800B3168 00024880 */ sll $t1, $v0, 2 /* 0B3D6C 800B316C 01224823 */ subu $t1, $t1, $v0 /* 0B3D70 800B3170 01245821 */ addu $t3, $t1, $a0 -/* 0B3D74 800B3174 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 +/* 0B3D74 800B3174 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 /* 0B3D78 800B3178 00AB2821 */ addu $a1, $a1, $t3 /* 0B3D7C 800B317C 30CA4000 */ andi $t2, $a2, 0x4000 -/* 0B3D80 800B3180 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B3D80 800B3180 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B3D84 800B3184 11400015 */ beqz $t2, .L800B31DC -/* 0B3D88 800B3188 80A586AD */ lb $a1, %lo((D_800E86B0 - 3))($a1) # -0x7953($a1) +/* 0B3D88 800B3188 80A586AD */ lb $a1, %lo((gGameModeSubMenuColumn - 3))($a1) # -0x7953($a1) /* 0B3D8C 800B318C 240F0004 */ li $t7, 4 -/* 0B3D90 800B3190 0C02D12B */ jal func_800B44AC +/* 0B3D90 800B3190 0C02D12B */ jal reset_cycle_flash_menu /* 0B3D94 800B3194 A10F0000 */ sb $t7, ($t0) /* 0B3D98 800B3198 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 /* 0B3D9C 800B319C 0C032384 */ jal play_sound2 /* 0B3DA0 800B31A0 34848002 */ ori $a0, (0x49008002 & 0xFFFF) # ori $a0, $a0, 0x8002 /* 0B3DA4 800B31A4 3C0D8019 */ lui $t5, %hi(gPlayerCount) # $t5, 0x8019 /* 0B3DA8 800B31A8 81ADEDF3 */ lb $t5, %lo(gPlayerCount)($t5) -/* 0B3DAC 800B31AC 3C0C800F */ lui $t4, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3DAC 800B31AC 3C0C800F */ lui $t4, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3DB0 800B31B0 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3DB4 800B31B4 018D6021 */ addu $t4, $t4, $t5 -/* 0B3DB8 800B31B8 818C86AB */ lb $t4, %lo((D_800E86AC - 1))($t4) # -0x7955($t4) +/* 0B3DB8 800B31B8 818C86AB */ lb $t4, %lo((gGameModeMenuColumn - 1))($t4) # -0x7955($t4) /* 0B3DBC 800B31BC 000DC080 */ sll $t8, $t5, 2 /* 0B3DC0 800B31C0 030DC023 */ subu $t8, $t8, $t5 /* 0B3DC4 800B31C4 0018C080 */ sll $t8, $t8, 2 @@ -558,16 +558,16 @@ glabel L800B2F70 # case 5, 8 /* 0B3DDC 800B31DC 30C98000 */ andi $t1, $a2, 0x8000 /* 0B3DE0 800B31E0 1120002C */ beqz $t1, .L800B3294 /* 0B3DE4 800B31E4 0002C880 */ sll $t9, $v0, 2 -/* 0B3DE8 800B31E8 0C02D12B */ jal func_800B44AC +/* 0B3DE8 800B31E8 0C02D12B */ jal reset_cycle_flash_menu /* 0B3DEC 800B31EC AFA50028 */ sw $a1, 0x28($sp) /* 0B3DF0 800B31F0 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3DF4 800B31F4 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) /* 0B3DF8 800B31F8 24070001 */ li $a3, 1 /* 0B3DFC 800B31FC 8FA50028 */ lw $a1, 0x28($sp) /* 0B3E00 800B3200 14E2000E */ bne $a3, $v0, .L800B323C -/* 0B3E04 800B3204 3C0B800F */ lui $t3, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3E04 800B3204 3C0B800F */ lui $t3, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3E08 800B3208 01625821 */ addu $t3, $t3, $v0 -/* 0B3E0C 800B320C 816B86AB */ lb $t3, %lo((D_800E86AC - 1))($t3) # -0x7955($t3) +/* 0B3E0C 800B320C 816B86AB */ lb $t3, %lo((gGameModeMenuColumn - 1))($t3) # -0x7955($t3) /* 0B3E10 800B3210 54EB000B */ bnel $a3, $t3, .L800B3240 /* 0B3E14 800B3214 240A0006 */ li $t2, 6 /* 0B3E18 800B3218 54A70009 */ bnel $a1, $a3, .L800B3240 @@ -582,9 +582,9 @@ glabel L800B2F70 # case 5, 8 .L800B323C: /* 0B3E3C 800B323C 240A0006 */ li $t2, 6 .L800B3240: -/* 0B3E40 800B3240 3C018019 */ lui $at, %hi(gMainMenuSelectionDepth) # $at, 0x8019 +/* 0B3E40 800B3240 3C018019 */ lui $at, %hi(gMainMenuSelection) # $at, 0x8019 /* 0B3E44 800B3244 3C044900 */ lui $a0, (0x49008001 >> 16) # lui $a0, 0x4900 -/* 0B3E48 800B3248 A02AEDED */ sb $t2, %lo(gMainMenuSelectionDepth)($at) +/* 0B3E48 800B3248 A02AEDED */ sb $t2, %lo(gMainMenuSelection)($at) /* 0B3E4C 800B324C 0C032384 */ jal play_sound2 /* 0B3E50 800B3250 34848001 */ ori $a0, (0x49008001 & 0xFFFF) # ori $a0, $a0, 0x8001 /* 0B3E54 800B3254 3C018019 */ lui $at, %hi(gMenuTimingCounter) # $at, 0x8019 @@ -592,10 +592,10 @@ glabel L800B2F70 # case 5, 8 .L800B325C: /* 0B3E5C 800B325C 3C0F8019 */ lui $t7, %hi(gPlayerCount) # $t7, 0x8019 /* 0B3E60 800B3260 81EFEDF3 */ lb $t7, %lo(gPlayerCount)($t7) -/* 0B3E64 800B3264 3C0C800F */ lui $t4, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3E64 800B3264 3C0C800F */ lui $t4, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3E68 800B3268 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3E6C 800B326C 018F6021 */ addu $t4, $t4, $t7 -/* 0B3E70 800B3270 818C86AB */ lb $t4, %lo((D_800E86AC - 1))($t4) # -0x7955($t4) +/* 0B3E70 800B3270 818C86AB */ lb $t4, %lo((gGameModeMenuColumn - 1))($t4) # -0x7955($t4) /* 0B3E74 800B3274 000F6880 */ sll $t5, $t7, 2 /* 0B3E78 800B3278 01AF6823 */ subu $t5, $t5, $t7 /* 0B3E7C 800B327C 000D6880 */ sll $t5, $t5, 2 @@ -633,8 +633,8 @@ glabel L800B32B4 # case 6, 7 .L800B32F4: /* 0B3EF4 800B32F4 0C032384 */ jal play_sound2 /* 0B3EF8 800B32F8 AFA6001C */ sw $a2, 0x1c($sp) -/* 0B3EFC 800B32FC 3C088019 */ lui $t0, %hi(gMainMenuSelectionDepth) # $t0, 0x8019 -/* 0B3F00 800B3300 2508EDED */ addiu $t0, %lo(gMainMenuSelectionDepth) # addiu $t0, $t0, -0x1213 +/* 0B3EFC 800B32FC 3C088019 */ lui $t0, %hi(gMainMenuSelection) # $t0, 0x8019 +/* 0B3F00 800B3300 2508EDED */ addiu $t0, %lo(gMainMenuSelection) # addiu $t0, $t0, -0x1213 /* 0B3F04 800B3304 8FA6001C */ lw $a2, 0x1c($sp) .L800B3308: /* 0B3F08 800B3308 30CD4000 */ andi $t5, $a2, 0x4000 @@ -643,10 +643,10 @@ glabel L800B32B4 # case 6, 7 /* 0B3F10 800B3310 30D98000 */ andi $t9, $a2, 0x8000 /* 0B3F14 800B3314 3C028019 */ lui $v0, %hi(gPlayerCount) # $v0, 0x8019 /* 0B3F18 800B3318 8042EDF3 */ lb $v0, %lo(gPlayerCount)($v0) -/* 0B3F1C 800B331C 3C0E800F */ lui $t6, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3F1C 800B331C 3C0E800F */ lui $t6, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3F20 800B3320 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3F24 800B3324 01C27021 */ addu $t6, $t6, $v0 -/* 0B3F28 800B3328 81CE86AB */ lb $t6, %lo((D_800E86AC - 1))($t6) # -0x7955($t6) +/* 0B3F28 800B3328 81CE86AB */ lb $t6, %lo((gGameModeMenuColumn - 1))($t6) # -0x7955($t6) /* 0B3F2C 800B332C 0002C080 */ sll $t8, $v0, 2 /* 0B3F30 800B3330 0302C023 */ subu $t8, $t8, $v0 /* 0B3F34 800B3334 0018C080 */ sll $t8, $t8, 2 @@ -672,17 +672,17 @@ glabel L800B32B4 # case 6, 7 .L800B3380: /* 0B3F80 800B3380 A10A0000 */ sb $t2, ($t0) .L800B3384: -/* 0B3F84 800B3384 0C02D12B */ jal func_800B44AC +/* 0B3F84 800B3384 0C02D12B */ jal reset_cycle_flash_menu /* 0B3F88 800B3388 00000000 */ nop /* 0B3F8C 800B338C 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 /* 0B3F90 800B3390 0C032384 */ jal play_sound2 /* 0B3F94 800B3394 34848002 */ ori $a0, (0x49008002 & 0xFFFF) # ori $a0, $a0, 0x8002 /* 0B3F98 800B3398 3C0F8019 */ lui $t7, %hi(gPlayerCount) # $t7, 0x8019 /* 0B3F9C 800B339C 81EFEDF3 */ lb $t7, %lo(gPlayerCount)($t7) -/* 0B3FA0 800B33A0 3C0D800F */ lui $t5, %hi((D_800E86AC - 1)) # 0x800f +/* 0B3FA0 800B33A0 3C0D800F */ lui $t5, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B3FA4 800B33A4 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B3FA8 800B33A8 01AF6821 */ addu $t5, $t5, $t7 -/* 0B3FAC 800B33AC 81AD86AB */ lb $t5, %lo((D_800E86AC - 1))($t5) # -0x7955($t5) +/* 0B3FAC 800B33AC 81AD86AB */ lb $t5, %lo((gGameModeMenuColumn - 1))($t5) # -0x7955($t5) /* 0B3FB0 800B33B0 000F6080 */ sll $t4, $t7, 2 /* 0B3FB4 800B33B4 018F6023 */ subu $t4, $t4, $t7 /* 0B3FB8 800B33B8 000C6080 */ sll $t4, $t4, 2 @@ -701,14 +701,14 @@ glabel L800B32B4 # case 6, 7 /* 0B3FE8 800B33E8 3C044900 */ lui $a0, (0x49008016 >> 16) # lui $a0, 0x4900 /* 0B3FEC 800B33EC 0C032384 */ jal play_sound2 /* 0B3FF0 800B33F0 34848016 */ ori $a0, (0x49008016 & 0xFFFF) # ori $a0, $a0, 0x8016 -/* 0B3FF4 800B33F4 0C02CA32 */ jal func_800B28C8 +/* 0B3FF4 800B33F4 0C02CA32 */ jal setup_game_mode_selected /* 0B3FF8 800B33F8 00000000 */ nop /* 0B3FFC 800B33FC 3C098019 */ lui $t1, %hi(gPlayerCount) # $t1, 0x8019 /* 0B4000 800B3400 8129EDF3 */ lb $t1, %lo(gPlayerCount)($t1) -/* 0B4004 800B3404 3C0A800F */ lui $t2, %hi((D_800E86AC - 1)) # 0x800f +/* 0B4004 800B3404 3C0A800F */ lui $t2, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B4008 800B3408 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B400C 800B340C 01495021 */ addu $t2, $t2, $t1 -/* 0B4010 800B3410 814A86AB */ lb $t2, %lo((D_800E86AC - 1))($t2) # -0x7955($t2) +/* 0B4010 800B3410 814A86AB */ lb $t2, %lo((gGameModeMenuColumn - 1))($t2) # -0x7955($t2) /* 0B4014 800B3414 00095880 */ sll $t3, $t1, 2 /* 0B4018 800B3418 01695823 */ subu $t3, $t3, $t1 /* 0B401C 800B341C 000B5880 */ sll $t3, $t3, 2 @@ -719,10 +719,10 @@ glabel L800B32B4 # case 6, 7 /* 0B4030 800B3430 8C632B70 */ lw $v1, %lo((gGameModePlayerSelection - 0xC))($v1) # 0x2b70($v1) .L800B3434: /* 0B4034 800B3434 818CEDF3 */ lb $t4, %lo(gPlayerCount)($t4) -/* 0B4038 800B3438 3C18800F */ lui $t8, %hi((D_800E86AC - 1)) # 0x800f +/* 0B4038 800B3438 3C18800F */ lui $t8, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B403C 800B343C 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B4040 800B3440 030CC021 */ addu $t8, $t8, $t4 -/* 0B4044 800B3444 831886AB */ lb $t8, %lo((D_800E86AC - 1))($t8) # -0x7955($t8) +/* 0B4044 800B3444 831886AB */ lb $t8, %lo((gGameModeMenuColumn - 1))($t8) # -0x7955($t8) /* 0B4048 800B3448 000C7080 */ sll $t6, $t4, 2 /* 0B404C 800B344C 01CC7023 */ subu $t6, $t6, $t4 /* 0B4050 800B3450 000E7080 */ sll $t6, $t6, 2 @@ -734,10 +734,10 @@ glabel L800B32B4 # case 6, 7 glabel L800B3468 # case 1, 2 /* 0B4068 800B3468 3C0A8019 */ lui $t2, %hi(gPlayerCount) # $t2, 0x8019 /* 0B406C 800B346C 814AEDF3 */ lb $t2, %lo(gPlayerCount)($t2) -/* 0B4070 800B3470 3C0F800F */ lui $t7, %hi((D_800E86AC - 1)) # 0x800f +/* 0B4070 800B3470 3C0F800F */ lui $t7, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B4074 800B3474 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B4078 800B3478 01EA7821 */ addu $t7, $t7, $t2 -/* 0B407C 800B347C 81EF86AB */ lb $t7, %lo((D_800E86AC - 1))($t7) # -0x7955($t7) +/* 0B407C 800B347C 81EF86AB */ lb $t7, %lo((gGameModeMenuColumn - 1))($t7) # -0x7955($t7) /* 0B4080 800B3480 000A5880 */ sll $t3, $t2, 2 /* 0B4084 800B3484 016A5823 */ subu $t3, $t3, $t2 /* 0B4088 800B3488 000B5880 */ sll $t3, $t3, 2 @@ -748,10 +748,10 @@ glabel L800B3468 # case 1, 2 /* 0B409C 800B349C 8C632B70 */ lw $v1, %lo((gGameModePlayerSelection - 0xC))($v1) # 0x2b70($v1) .L800B34A0: # default /* 0B40A0 800B34A0 8318EDF3 */ lb $t8, %lo(gPlayerCount)($t8) # -0x120d($t8) -/* 0B40A4 800B34A4 3C19800F */ lui $t9, %hi((D_800E86AC - 1)) # 0x800f +/* 0B40A4 800B34A4 3C19800F */ lui $t9, %hi((gGameModeMenuColumn - 1)) # 0x800f /* 0B40A8 800B34A8 3C03800F */ lui $v1, %hi((gGameModePlayerSelection - 0xC)) # 0x800f /* 0B40AC 800B34AC 0338C821 */ addu $t9, $t9, $t8 -/* 0B40B0 800B34B0 833986AB */ lb $t9, %lo((D_800E86AC - 1))($t9) # -0x7955($t9) +/* 0B40B0 800B34B0 833986AB */ lb $t9, %lo((gGameModeMenuColumn - 1))($t9) # -0x7955($t9) /* 0B40B4 800B34B4 00187080 */ sll $t6, $t8, 2 /* 0B40B8 800B34B8 01D87023 */ subu $t6, $t6, $t8 /* 0B40BC 800B34BC 000E7080 */ sll $t6, $t6, 2 diff --git a/asm/non_matchings/menus/player_select_menu_act.s b/asm/non_matchings/menus/player_select_menu_act.s index 6684b4a0d6..7adc12d102 100644 --- a/asm/non_matchings/menus/player_select_menu_act.s +++ b/asm/non_matchings/menus/player_select_menu_act.s @@ -18,12 +18,12 @@ glabel player_select_menu_act /* 0B4194 800B3594 3069FFFF */ andi $t1, $v1, 0xffff /* 0B4198 800B3598 01201825 */ move $v1, $t1 .L800B359C: -/* 0B419C 800B359C 0C02D148 */ jal func_800B4520 +/* 0B419C 800B359C 0C02D148 */ jal is_screen_being_faded /* 0B41A0 800B35A0 A7A30036 */ sh $v1, 0x36($sp) /* 0B41A4 800B35A4 14400167 */ bnez $v0, .L800B3B44 /* 0B41A8 800B35A8 97A30036 */ lhu $v1, 0x36($sp) -/* 0B41AC 800B35AC 3C028019 */ lui $v0, %hi(D_8018EDEE) # $v0, 0x8019 -/* 0B41B0 800B35B0 8042EDEE */ lb $v0, %lo(D_8018EDEE)($v0) +/* 0B41AC 800B35AC 3C028019 */ lui $v0, %hi(gPlayerSelectMenuSelection) # $v0, 0x8019 +/* 0B41B0 800B35B0 8042EDEE */ lb $v0, %lo(gPlayerSelectMenuSelection)($v0) /* 0B41B4 800B35B4 24010001 */ li $at, 1 /* 0B41B8 800B35B8 97AB0046 */ lhu $t3, 0x46($sp) /* 0B41BC 800B35BC 1041000A */ beq $v0, $at, .L800B35E8 @@ -59,8 +59,8 @@ glabel player_select_menu_act .L800B3630: /* 0B4230 800B3630 13000014 */ beqz $t8, .L800B3684 /* 0B4234 800B3634 97B90046 */ lhu $t9, 0x46($sp) -/* 0B4238 800B3638 3C038019 */ lui $v1, %hi(D_8018EDE8) # $v1, 0x8019 -/* 0B423C 800B363C 2463EDE8 */ addiu $v1, %lo(D_8018EDE8) # addiu $v1, $v1, -0x1218 +/* 0B4238 800B3638 3C038019 */ lui $v1, %hi(gCharacterGridIsSelected) # $v1, 0x8019 +/* 0B423C 800B363C 2463EDE8 */ addiu $v1, %lo(gCharacterGridIsSelected) # addiu $v1, $v1, -0x1218 /* 0B4240 800B3640 00793821 */ addu $a3, $v1, $t9 /* 0B4244 800B3644 80E80000 */ lb $t0, ($a3) /* 0B4248 800B3648 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 @@ -81,14 +81,14 @@ glabel player_select_menu_act /* 0B4280 800B3680 8FA6002C */ lw $a2, 0x2c($sp) .L800B3684: /* 0B4284 800B3684 97A90046 */ lhu $t1, 0x46($sp) -/* 0B4288 800B3688 3C038019 */ lui $v1, %hi(D_8018EDE8) # $v1, 0x8019 -/* 0B428C 800B368C 2463EDE8 */ addiu $v1, %lo(D_8018EDE8) # addiu $v1, $v1, -0x1218 +/* 0B4288 800B3688 3C038019 */ lui $v1, %hi(gCharacterGridIsSelected) # $v1, 0x8019 +/* 0B428C 800B368C 2463EDE8 */ addiu $v1, %lo(gCharacterGridIsSelected) # addiu $v1, $v1, -0x1218 /* 0B4290 800B3690 30CA8000 */ andi $t2, $a2, 0x8000 /* 0B4294 800B3694 11400017 */ beqz $t2, .L800B36F4 /* 0B4298 800B3698 00693821 */ addu $a3, $v1, $t1 /* 0B429C 800B369C 80EB0000 */ lb $t3, ($a3) /* 0B42A0 800B36A0 240C0001 */ li $t4, 1 -/* 0B42A4 800B36A4 3C05800F */ lui $a1, %hi((D_800F2BAC - 1)) # 0x800f +/* 0B42A4 800B36A4 3C05800F */ lui $a1, %hi((sCharacterGridOrder - 1)) # 0x800f /* 0B42A8 800B36A8 55600013 */ bnel $t3, $zero, .L800B36F8 /* 0B42AC 800B36AC 00002025 */ move $a0, $zero /* 0B42B0 800B36B0 8FAD0028 */ lw $t5, 0x28($sp) @@ -98,14 +98,14 @@ glabel player_select_menu_act /* 0B42C0 800B36C0 3421800E */ ori $at, (0x2900800E & 0xFFFF) # ori $at, $at, 0x800e /* 0B42C4 800B36C4 AFA70020 */ sw $a3, 0x20($sp) /* 0B42C8 800B36C8 00AE2821 */ addu $a1, $a1, $t6 -/* 0B42CC 800B36CC 80A52BAB */ lb $a1, %lo((D_800F2BAC - 1))($a1) # 0x2bab($a1) +/* 0B42CC 800B36CC 80A52BAB */ lb $a1, %lo((sCharacterGridOrder - 1))($a1) # 0x2bab($a1) /* 0B42D0 800B36D0 AFA6002C */ sw $a2, 0x2c($sp) /* 0B42D4 800B36D4 93A40047 */ lbu $a0, 0x47($sp) /* 0B42D8 800B36D8 00057900 */ sll $t7, $a1, 4 /* 0B42DC 800B36DC 0C03243D */ jal func_800C90F4 /* 0B42E0 800B36E0 01E12821 */ addu $a1, $t7, $at -/* 0B42E4 800B36E4 3C038019 */ lui $v1, %hi(D_8018EDE8) # $v1, 0x8019 -/* 0B42E8 800B36E8 2463EDE8 */ addiu $v1, %lo(D_8018EDE8) # addiu $v1, $v1, -0x1218 +/* 0B42E4 800B36E4 3C038019 */ lui $v1, %hi(gCharacterGridIsSelected) # $v1, 0x8019 +/* 0B42E8 800B36E8 2463EDE8 */ addiu $v1, %lo(gCharacterGridIsSelected) # addiu $v1, $v1, -0x1218 /* 0B42EC 800B36EC 8FA6002C */ lw $a2, 0x2c($sp) /* 0B42F0 800B36F0 8FA70020 */ lw $a3, 0x20($sp) .L800B36F4: @@ -133,10 +133,10 @@ glabel player_select_menu_act .L800B3738: /* 0B4338 800B3738 1480000B */ bnez $a0, .L800B3768 /* 0B433C 800B373C 240C0002 */ li $t4, 2 -/* 0B4340 800B3740 3C018019 */ lui $at, %hi(D_8018EDEE) # $at, 0x8019 -/* 0B4344 800B3744 A02CEDEE */ sb $t4, %lo(D_8018EDEE)($at) +/* 0B4340 800B3740 3C018019 */ lui $at, %hi(gPlayerSelectMenuSelection) # $at, 0x8019 +/* 0B4344 800B3744 A02CEDEE */ sb $t4, %lo(gPlayerSelectMenuSelection)($at) /* 0B4348 800B3748 AFA6002C */ sw $a2, 0x2c($sp) -/* 0B434C 800B374C 0C02D12B */ jal func_800B44AC +/* 0B434C 800B374C 0C02D12B */ jal reset_cycle_flash_menu /* 0B4350 800B3750 AFA70020 */ sw $a3, 0x20($sp) /* 0B4354 800B3754 3C038019 */ lui $v1, %hi(gMenuTimingCounter) # $v1, 0x8019 /* 0B4358 800B3758 2463EE00 */ addiu $v1, %lo(gMenuTimingCounter) # addiu $v1, $v1, -0x1200 @@ -375,11 +375,11 @@ glabel player_select_menu_act /* 0B46A8 800B3AA8 11A00011 */ beqz $t5, .L800B3AF0 /* 0B46AC 800B3AAC 30C88000 */ andi $t0, $a2, 0x8000 /* 0B46B0 800B3AB0 97AF0046 */ lhu $t7, 0x46($sp) -/* 0B46B4 800B3AB4 3C038019 */ lui $v1, %hi(D_8018EDE8) # $v1, 0x8019 -/* 0B46B8 800B3AB8 2463EDE8 */ addiu $v1, %lo(D_8018EDE8) # addiu $v1, $v1, -0x1218 +/* 0B46B4 800B3AB4 3C038019 */ lui $v1, %hi(gCharacterGridIsSelected) # $v1, 0x8019 +/* 0B46B8 800B3AB8 2463EDE8 */ addiu $v1, %lo(gCharacterGridIsSelected) # addiu $v1, $v1, -0x1218 /* 0B46BC 800B3ABC 240E0001 */ li $t6, 1 -/* 0B46C0 800B3AC0 3C018019 */ lui $at, %hi(D_8018EDEE) # $at, 0x8019 -/* 0B46C4 800B3AC4 A02EEDEE */ sb $t6, %lo(D_8018EDEE)($at) +/* 0B46C0 800B3AC0 3C018019 */ lui $at, %hi(gPlayerSelectMenuSelection) # $at, 0x8019 +/* 0B46C4 800B3AC4 A02EEDEE */ sb $t6, %lo(gPlayerSelectMenuSelection)($at) /* 0B46C8 800B3AC8 3C044900 */ lui $a0, (0x49008002 >> 16) # lui $a0, 0x4900 /* 0B46CC 800B3ACC 006FC021 */ addu $t8, $v1, $t7 /* 0B46D0 800B3AD0 A3000000 */ sb $zero, ($t8) @@ -407,10 +407,10 @@ glabel player_select_menu_act /* 0B4720 800B3B20 8063EDE4 */ lb $v1, %lo(gCharacterGridSelections)($v1) # -0x121c($v1) .L800B3B24: /* 0B4724 800B3B24 10600007 */ beqz $v1, .L800B3B44 -/* 0B4728 800B3B28 3C0A800F */ lui $t2, %hi((D_800F2BAC - 1)) # 0x800f +/* 0B4728 800B3B28 3C0A800F */ lui $t2, %hi((sCharacterGridOrder - 1)) # 0x800f /* 0B472C 800B3B2C 97AB0046 */ lhu $t3, 0x46($sp) /* 0B4730 800B3B30 01435021 */ addu $t2, $t2, $v1 -/* 0B4734 800B3B34 814A2BAB */ lb $t2, %lo((D_800F2BAC - 1))($t2) # 0x2bab($t2) +/* 0B4734 800B3B34 814A2BAB */ lb $t2, %lo((sCharacterGridOrder - 1))($t2) # 0x2bab($t2) /* 0B4738 800B3B38 3C01800F */ lui $at, %hi(gCharacterSelections) # 0x800f /* 0B473C 800B3B3C 002B0821 */ addu $at, $at, $t3 /* 0B4740 800B3B40 A02A86A8 */ sb $t2, %lo(gCharacterSelections)($at) # -0x7958($at) diff --git a/include/defines.h b/include/defines.h index b4ce22de17..84e0c325f6 100644 --- a/include/defines.h +++ b/include/defines.h @@ -38,36 +38,14 @@ * */ #if defined(GCC) || defined(DEBUG) -#define DEBUG_MODE 1 -#define DEBUG_MENU 2 +#define ENABLE_DEBUG_MODE 1 #else -#define DEBUG_MODE 0 -#define DEBUG_MENU 1 +#define ENABLE_DEBUG_MODE 0 #endif #define HOLD_ALL_DPAD_AND_C_BUTTONS \ (U_JPAD | L_JPAD | R_JPAD | D_JPAD | U_CBUTTONS | L_CBUTTONS | R_CBUTTONS | D_CBUTTONS) -/** - * @brief Options for gDebugMenuSelection - */ -#define DEBUG_MENU_DISABLED 1 -#define DEBUG_MENU_DEBUG_MODE 2 -#define DEBUG_MENU_COURSE 3 -#define DEBUG_MENU_SCREEN_MODE 4 -#define DEBUG_MENU_PLAYER 5 -#define DEBUG_MENU_SOUND_MODE 6 -#define DEBUG_MENU_GIVE_ALL_GOLD_CUP 7 -#define DEBUG_MENU_EXITED 64 - -/** - * @brief Options for gDebugGotoScene - */ -#define DEBUG_GOTO_RACING 0 -#define DEBUG_GOTO_ENDING 1 -#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_50 2 -#define DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA 3 - /** * @brief Jump to demo mode from the debug menu using L and A */ @@ -214,34 +192,6 @@ enum { COURSE_ONE, COURSE_TWO, COURSE_THREE, COURSE_FOUR }; #define ENDING 5 #define CREDITS_SEQUENCE 9 -/** - * @brief Options for gMainMenuSelectionDepth - */ -#define BLANK_MAIN_MENU 0 -#define OPTIONS_SELECTION 1 -#define DATA_SELECTION 2 -#define PLAYER_NUM_SELECTION 3 -#define GAME_MODE_SELECTION 4 -#define GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION \ - 5 // Selecting CC for GP and Versus. Selecting "Begin" or "Data" for Time Trials. Unused for Battle -#define CONFIRM_OK_SELECTION 6 -#define CONFIRM_OK_SELECTION_FROM_BACK_OUT 7 -#define TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT 8 - -/** - * @brief Options for gControllerPakMenuSelection - */ -#define CONTROLLER_PAK_MENU_SELECT_RECORD 1 -#define CONTROLLER_PAK_MENU_END 2 -#define CONTROLLER_PAK_MENU_ERASE 3 -#define CONTROLLER_PAK_MENU_QUIT 4 -#define CONTROLLER_PAK_MENU_TABLE_GAME_DATA 5 -#define CONTROLLER_PAK_MENU_GO_TO_ERASING 6 -#define CONTROLLER_PAK_MENU_ERASING 7 -#define CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED 8 -#define CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK 9 -#define CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED 10 - /** * @brief Options for gScreenModeSelection and gActiveScreenMode */ diff --git a/mk64.ld b/mk64.ld index 7e83bfac3c..f524abc5d5 100644 --- a/mk64.ld +++ b/mk64.ld @@ -338,6 +338,7 @@ SECTIONS BUILD_DIR/src/code_80091750.jp.o(.bss*); BUILD_DIR/src/code_800AF9B0.o(.bss*); BUILD_DIR/src/menus.o(.bss*); + BUILD_DIR/src/save.o(.bss*); #if DEBUG BUILD_DIR/src/os/osCartRomInit.o(.bss*); BUILD_DIR/src/debug/crash_screen_enhancement.o(.bss*); diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 4536b944b3..5e22b168c6 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -3590,7 +3590,7 @@ void func_8000F628(void) { } } } - if ((D_8018EE08 == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) { + if ((gDemoUseController == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) { for (i = 0; i < NUM_PLAYERS; i++) { D_80163330[i] = 0; } @@ -3642,7 +3642,7 @@ void func_8000F628(void) { D_8016348C = 0; D_801634EC = 0; func_8001AB00(); - if (D_8018EE08 == 1) { + if (gDemoUseController == 1) { if (gDemoMode == 1) { for (i = 0; i < NUM_PLAYERS; i++) { @@ -5444,7 +5444,7 @@ void func_80014DE4(s32 cameraIndex) { D_801646D0[cameraIndex].unk0 = 0; D_801646D0[cameraIndex].unk2 = 0; D_801646D0[cameraIndex].unk4 = 0; - if ((gModeSelection == 1) && (D_8018EDFC == 0)) { + if ((gModeSelection == 1) && (gCourseMapInit == 0)) { D_80164678[cameraIndex] = 0; } diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index c2c8302172..15bee53c69 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -366,8 +366,8 @@ void func_8006F824(s32 arg0) { } void func_8006F8CC(void) { - if (D_8018EDFC == 0) { - D_8018EDFC = 1; + if (gCourseMapInit == 0) { + gCourseMapInit = 1; D_801657E4 = 0; D_801657E6 = 0; D_801657F0 = 0; diff --git a/src/code_80091750.c b/src/code_80091750.c index b6208f4ac9..84ecc6d90f 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1151,9 +1151,9 @@ void func_80091B78(void) { if (D_800E852C) { D_800E852C = why; - D_8018EDF4 = 10; - D_8018EDF5 = 5; - D_8018EDF6 = 10; + gVersusResultCursorSelection = 10; + gTimeTrialsResultCursorSelection = 5; + gBattleResultCursorSelection = 10; if (osEepromProbe(&gSIEventMesgQueue) != 0) { load_save_data(); } @@ -1172,7 +1172,7 @@ void func_80091B78(void) { D_8018D9B8 = (u8*) get_next_available_memory_addr(0x00012C00); D_8018D9C0 = (struct_8018EE10_entry*) get_next_available_memory_addr(0x00001000); func_800AF9B0(); - D_8018EE0C = 0; + unref_8018EE0C = 0; for (i = 0; i < 5; i++) { D_8018E7AC[i] = 0; @@ -1186,7 +1186,7 @@ void func_80091B78(void) { D_800DC5EC->screenStartY = 120; D_800DC5EC->screenWidth = SCREEN_WIDTH; D_800DC5EC->screenHeight = SCREEN_HEIGHT; - D_800E86A4 = 1; + gFadeModeSelection = FADE_MODE_MAIN; func_80094C60(); for (i = 0; i < 4; i++) { @@ -1197,7 +1197,7 @@ void func_80091B78(void) { func_800C9D0C((u8) i); } - func_800B44BC(); + set_sound_mode(); osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON); } @@ -1247,7 +1247,7 @@ void func_80091EE4(void) { gControllerPak1State = BAD; tmp = func_800B5F30(); - if ((D_8018EDFB != 0) && (tmp == 0)) { + if ((gGhostPlayerInit != 0) && (tmp == 0)) { temp_s2 = (gCupSelection * 4) + gCourseIndexInCup; func_800B6708(); @@ -1255,7 +1255,7 @@ void func_80091EE4(void) { if ((D_8018EE10[temp_s0].ghostDataSaved != 0) && (temp_s2 == D_8018EE10[temp_s0].courseIndex)) { func_800B64EC(temp_s0); temp_s0 = 2; - D_8018EDFB = 0; + gGhostPlayerInit = 0; } } } @@ -1293,7 +1293,7 @@ void func_80091FA4(void) { if ((D_8015F890 != 0) && (gModeSelection == TIME_TRIALS)) { add_8018D9E0_entry(0x000000BD, 0, 0, 0); } - if (!(gControllerBits & 1) && (D_8018EE08 != 0)) { + if (!(gControllerBits & 1) && (gDemoUseController != 0)) { add_8018D9E0_entry(4, 0, 0, 2); } func_800B5F30(); @@ -1322,7 +1322,7 @@ void func_800921B4(void) { // if selected and detect kind menu void text_rainbow_effect(s32 test, s32 target, s32 alternative_color) { if (test == target) { - if (func_800B4520() != 0) { + if (is_screen_being_faded() != 0) { set_text_color(gGlobalTimer % 3); } else { set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_2); @@ -2143,9 +2143,9 @@ void func_800942D0(void) { test = &gGfxPool->mtxObject[0]; gSPMatrix(gDisplayListHead++, &gGfxPool->mtxScreen, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(gDisplayListHead++, &gGfxPool->mtxLookAt[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - guRotate(test, D_8018EDC8, 1.0f, 0.0f, 0.0f); - guRotate(test + 1, D_8018EDCC, 0.0f, 1.0f, 0.0f); - guScale(test + 2, 1.0f, 1.0f, D_8018EDC4); + guRotate(test, gIntroModelRotX, 1.0f, 0.0f, 0.0f); + guRotate(test + 1, gIntroModelRotY, 0.0f, 1.0f, 0.0f); + guScale(test + 2, 1.0f, 1.0f, gIntroModelScale); gSPMatrix(gDisplayListHead++, test++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPMatrix(gDisplayListHead++, test++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); gSPMatrix(gDisplayListHead++, test++, G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW); @@ -2179,7 +2179,7 @@ void func_80094660(struct GfxPool* arg0, UNUSED s32 arg1) { gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP); guPerspective(&arg0->mtxScreen, &perspNorm, 45.0f, 1.3333334f, 100.0f, 12800.0f, 1.0f); gSPPerspNormalize(gDisplayListHead++, perspNorm); - guLookAt(&arg0->mtxLookAt[0], 0.0f, 0.0f, (f32) D_8018EDC0, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); + guLookAt(&arg0->mtxLookAt[0], 0.0f, 0.0f, (f32) gIntroModelZEye, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); func_800942D0(); gDPPipeSync(gDisplayListHead++); gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE); @@ -2191,12 +2191,12 @@ void func_800947B4(struct GfxPool* arg0, UNUSED s32 arg1) { move_segment_table_to_dmem(); guPerspective(&arg0->mtxPersp[0], &perspNorm, 45.0f, 1.3333334f, 100.0f, 12800.0f, 1.0f); gSPPerspNormalize(gDisplayListHead++, perspNorm); - guLookAt(&arg0->mtxLookAt[1], 0.0f, 0.0f, (f32) D_8018EDC0, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); - guRotate(&arg0->mtxObject[0], D_8018EDC8, 1.0f, 0, 0); - guRotate(&arg0->mtxObject[1], D_8018EDCC, 0, 1.0f, 0); - guRotate(&arg0->mtxObject[2], D_8018EDD0, 0, 0, 1.0f); - guScale(&arg0->mtxObject[3], D_8018EDC4, D_8018EDC4, D_8018EDC4); - guTranslate(&arg0->mtxObject[4], D_8018EDD4, D_8018EDD8, D_8018EDDC); + guLookAt(&arg0->mtxLookAt[1], 0.0f, 0.0f, (f32) gIntroModelZEye, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f); + guRotate(&arg0->mtxObject[0], gIntroModelRotX, 1.0f, 0, 0); + guRotate(&arg0->mtxObject[1], gIntroModelRotY, 0, 1.0f, 0); + guRotate(&arg0->mtxObject[2], gIntroModelRotZ, 0, 0, 1.0f); + guScale(&arg0->mtxObject[3], gIntroModelScale, gIntroModelScale, gIntroModelScale); + guTranslate(&arg0->mtxObject[4], gIntroModelPosX, gIntroModelPosY, gIntroModelPosZ); gSPMatrix(gDisplayListHead++, &arg0->mtxPersp[0], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(gDisplayListHead++, &arg0->mtxLookAt[1], G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(gDisplayListHead++, &arg0->mtxObject[0], G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); @@ -2246,7 +2246,7 @@ void func_80094A64(struct GfxPool* pool) { } void func_80094C60(void) { - if (D_800E86A4 != 0) { + if (gFadeModeSelection != FADE_MODE_NONE) { func_80099110(); func_8009A344(); func_8009E620(); @@ -2254,7 +2254,7 @@ void func_80094C60(void) { func_80092258(); func_800B5F30(); func_800B6014(); - func_800B3F74(gMenuSelection); + load_menu_states(gMenuSelection); switch (gMenuSelection) { case OPTIONS_MENU: add_8018D9E0_entry(0x00000023, 0, 0, 2); @@ -2314,7 +2314,7 @@ void func_80094C60(void) { } add_8018D9E0_entry(5, 0, 0, 6); gDemoMode = 0; - D_8018EE08 = 0; + gDemoUseController = 0; break; case MAIN_MENU: add_8018D9E0_entry(0x00000023, 0, 0, 2); @@ -2394,22 +2394,22 @@ void func_80094C60(void) { default: break; } - if (D_800E86A4 != 2) { + if (gFadeModeSelection != FADE_MODE_LOGO) { func_8009DF4C(0x00000014); } else { func_8009DF6C(0x00000014); } - D_800E86A4 = 0; + gFadeModeSelection = FADE_MODE_NONE; } } void func_80095574(void) { s32 var_v0; - if ((D_8018EE0C < 3) || (D_8018E7AC[4] != 0)) { + if ((unref_8018EE0C < 3) || (D_8018E7AC[4] != 0)) { func_800A8230(); } - if (gDebugMenuSelection >= 2) { + if (gDebugMenuSelection > DEBUG_MENU_DISABLED) { // If not disabled load_debug_font(); debug_print_str2(0x00000050, 0x00000064, "debug_mode"); switch (gDebugMenuSelection) { @@ -2448,7 +2448,7 @@ void func_80095574(void) { } debug_print_str2(var_v0 + 0xB9, 0x0000006E, gDebugCourseNames[gCurrentCourseId]); debug_print_str2(0x00000050, 0x00000078, "screen_mode"); - debug_print_str2(0x000000AA, 0x00000078, gDebugScreenModeNames[D_8018EDF1]); + debug_print_str2(0x000000AA, 0x00000078, gDebugScreenModeNames[gScreenModeListIndex]); debug_print_str2(0x00000050, 0x00000082, "player"); debug_print_str2(0x000000AA, 0x00000082, gDebugCharacterNames[gCharacterSelections[0]]); debug_print_str2(0x00000050, 0x0000008C, "sound mode"); @@ -2463,10 +2463,10 @@ void func_80095574(void) { } else { gMenuTimingCounter = 3; } - if (gMenuTimingCounter == DEBUG_MENU_DEBUG_MODE) { + if (gMenuTimingCounter == 2) { play_sound2(SOUND_INTRO_WELCOME); } - if (gMenuTimingCounter >= 0x12D) { + if (gMenuTimingCounter > 300) { func_8009E230(); func_800CA0A0(); } @@ -4602,7 +4602,7 @@ void func_8009CBE4(s32 arg0, s32 arg1, s32 arg2) { return; } D_8018E7AC[arg0] = 0; - D_8018EE0C = 0; + unref_8018EE0C = 0; } } @@ -4760,22 +4760,22 @@ void func_8009CE64(s32 arg0) { } } else { D_8018E7AC[arg0] = 0; - if (gDebugMenuSelection != 0x40) { - switch (D_8018EDE0) { /* switch 3 */ - case 0: /* switch 3 */ - if (gMenuSelection == 8) { - gMenuSelection = 0x0000000A; - D_800E86A4 = 2; + if (gDebugMenuSelection != DEBUG_MENU_OPTION_SELECTED) { + switch (gMenuFadeType) { /* switch 3 */ + case MENU_FADE_TYPE_MAIN: /* switch 3 */ + if (gMenuSelection == LOGO_INTRO_MENU) { + gMenuSelection = START_MENU; + gFadeModeSelection = FADE_MODE_LOGO; } else { gMenuSelection++; } break; - case 1: /* switch 3 */ + case MENU_FADE_TYPE_BACK: /* switch 3 */ gMenuSelection -= 1; break; - case 2: /* switch 3 */ + case MENU_FADE_TYPE_DEMO: /* switch 3 */ gDemoMode = 1; - D_8018EE08 = 1; + gDemoUseController = 1; gGamestateNext = 4; gCCSelection = (s32) 1; switch (gNextDemoId) { /* switch 4 */ @@ -4844,7 +4844,7 @@ void func_8009CE64(s32 arg0) { D_800DC540 = (s32) gCupSelection; gCourseIndexInCup = (s8) gPerCupIndexByCourseId[gCurrentCourseId]; break; - case 3: /* switch 3 */ + case MENU_FADE_TYPE_DATA: /* switch 3 */ switch (gMenuSelection) { case 11: gMenuSelection = 6; @@ -4854,7 +4854,7 @@ void func_8009CE64(s32 arg0) { break; } break; - case 4: /* switch 3 */ + case MENU_FADE_TYPE_OPTION: /* switch 3 */ switch (gMenuSelection) { case 11: gMenuSelection = 5; @@ -4865,31 +4865,31 @@ void func_8009CE64(s32 arg0) { } break; } - if (D_800E86A4 == 0) { - D_800E86A4 = 1; + if (gFadeModeSelection == FADE_MODE_NONE) { + gFadeModeSelection = FADE_MODE_MAIN; } if (gMenuSelection >= 0xE) { gGamestateNext = 4; if (gModeSelection == 1) { - D_8018EDFB = (s8) 1; + gGhostPlayerInit = (s8) 1; } func_8009CE1C(); } - D_8018EE0C = 0; + unref_8018EE0C = 0; } else { switch (gDebugGotoScene) { /* switch 5; irregular */ - case 1: /* switch 5 */ + case DEBUG_GOTO_ENDING: /* switch 5 */ gGamestateNext = (s32) 5; break; - case 2: /* switch 5 */ - case 3: /* switch 5 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 5 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 5 */ gGamestateNext = 9; gCreditsCourseId = 8; break; default: /* switch 5 */ gGamestateNext = 4; if (gModeSelection == (s32) 1) { - D_8018EDFB = 1; + gGhostPlayerInit = 1; } break; } @@ -4926,12 +4926,12 @@ void func_8009CE64(s32 arg0) { D_800DC540 = gCupSelection; gCourseIndexInCup = gPerCupIndexByCourseId[gCurrentCourseId]; switch (gDebugGotoScene) { /* switch 6; irregular */ - case 1: /* switch 6 */ + case DEBUG_GOTO_ENDING: /* switch 6 */ break; - case 2: /* switch 6 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT: /* switch 6 */ gCCSelection = 0; break; - case 3: /* switch 6 */ + case DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA: /* switch 6 */ gCCSelection = 3; break; default: /* switch 6 */ @@ -5217,32 +5217,32 @@ void func_8009E17C(u32 arg0) { void func_8009E1C0(void) { func_8009DFE0(10); - D_8018EDE0 = 0; + gMenuFadeType = MENU_FADE_TYPE_MAIN; } void func_8009E1E4(void) { func_8009E000(10); - D_8018EDE0 = 0; + gMenuFadeType = MENU_FADE_TYPE_MAIN; } void func_8009E208(void) { func_8009DFE0(10); - D_8018EDE0 = 1; + gMenuFadeType = MENU_FADE_TYPE_BACK; } void func_8009E230(void) { func_8009DFE0(10); - D_8018EDE0 = 2; + gMenuFadeType = MENU_FADE_TYPE_DEMO; } void func_8009E258(void) { func_8009DFE0(10); - D_8018EDE0 = 3; + gMenuFadeType = MENU_FADE_TYPE_DATA; } void func_8009E280(void) { func_8009DFE0(10); - D_8018EDE0 = 4; + gMenuFadeType = MENU_FADE_TYPE_OPTION; } void func_8009E2A8(s32 arg0) { @@ -5329,14 +5329,11 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { var_v0 = 0; var_ra = D_8018D9E0; - // ???????? - // Credit to Vetri for the idea to mess around with this loop - // to fix the issue near the 0xD4 case - while (1 & 0xFFFFFFFFFFFFFFFF) { - var_v0++; - if (var_ra->type == 0) + while (1) { + if (var_ra->type == 0) { break; - + } + var_v0++; if (var_v0 > 0x20) { while (1) {} } @@ -5356,26 +5353,26 @@ void add_8018D9E0_entry(s32 type, s32 column, s32 row, s8 priority) { s8018ED94 = 0; D_800E8530 = 0.0f; D_800E8534 = 3.0f; - D_8018EDC0 = 0x000009C4; - D_8018EDC8 = 0; - D_8018EDCC = -270.0f; - D_8018EDD0 = 0; - D_8018EDD4 = 0; - D_8018EDD8 = 0; - D_8018EDDC = 0; - D_8018EDC4 = 3; + gIntroModelZEye = 2500; + gIntroModelRotX = 0; + gIntroModelRotY = -270.0f; + gIntroModelRotZ = 0; + gIntroModelPosX = 0; + gIntroModelPosY = 0; + gIntroModelPosZ = 0; + gIntroModelScale = 3; var_ra->unk1C = -1; var_ra->unk20 = one; break; case 0xFB: - D_8018EDC0 = 0x00000708; - D_8018EDC8 = -51.0f; - D_8018EDCC = -12.0f; - D_8018EDD0 = -18.0f; - D_8018EDD4 = -270.0f; - D_8018EDD8 = 750.0f; - D_8018EDDC = 0; - D_8018EDC4 = 1.0f; + gIntroModelZEye = 1800; + gIntroModelRotX = -51.0f; + gIntroModelRotY = -12.0f; + gIntroModelRotZ = -18.0f; + gIntroModelPosX = -270.0f; + gIntroModelPosY = 750.0f; + gIntroModelPosZ = 0; + gIntroModelScale = 1.0f; var_ra->unk1C = -1; var_ra->unk20 = one; break; @@ -5893,7 +5890,7 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { var_a1 = arg0->type - 0xF; if (arg0->unk1C < 0x20) { temp_t9 = (arg0->unk1C * 0x3A) / 64; - if (var_a1 == gMainMenuSelectionDepth) { + if (var_a1 == gMainMenuSelection) { gDisplayListHead = draw_flash_select_case_fast(gDisplayListHead, arg0->column + temp_t9, arg0->row, (arg0->column - temp_t9) + 0x39, arg0->row + 0x12); @@ -5915,8 +5912,8 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { case 0x17: /* switch 6 */ case 0x18: /* switch 6 */ case 0x19: /* switch 6 */ - var_v1 = D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; - var_a1 = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + var_v1 = gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; + var_a1 = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; switch (arg0->type) { /* switch 5 */ case 0x12: /* switch 5 */ case 0x13: /* switch 5 */ @@ -5948,8 +5945,8 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { break; } if (var_v1 != -1) { - if ((gMainMenuSelectionDepth >= 5) && (var_v1 == (arg0->type - var_a1))) { - if (gMainMenuSelectionDepth >= 6) { + if ((gMainMenuSelection >= MAIN_MENU_MODE_SUB_SELECT) && (var_v1 == (arg0->type - var_a1))) { + if (gMainMenuSelection > MAIN_MENU_MODE_SUB_SELECT) { gDisplayListHead = draw_box_fill(gDisplayListHead, arg0->column, arg0->row, arg0->column + 0x3F, arg0->row + 0x11, 0x000000FF, 0x000000F9, 0x000000DC, 0x000000FF); @@ -5977,7 +5974,7 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { case 0x37: /* switch 6 */ temp_a0 = arg0->type - 0x34; if (gCharacterGridSelections[temp_a0]) { - if (D_8018EDE8[temp_a0] == 0) { + if (gCharacterGridIsSelected[temp_a0] == 0) { temp_t2 = 0x000000FF; } else { temp_t2 = gGlobalTimer % 16; @@ -6079,8 +6076,8 @@ void func_8009F5E0(struct_8018D9E0_entry* arg0) { func_800A143C(arg0, var_a1); break; case 0x8C: /* switch 6 */ - if ((gMainMenuSelectionDepth >= 5) && (var_a1 == (arg0->type - var_v1))) { - if (gMainMenuSelectionDepth >= 6) { + if ((gMainMenuSelection >= MAIN_MENU_MODE_SUB_SELECT) && (var_a1 == (arg0->type - var_v1))) { + if (gMainMenuSelection > MAIN_MENU_MODE_SUB_SELECT) { gDisplayListHead = draw_box_fill(gDisplayListHead, arg0->column, arg0->row, arg0->column + 0x3F, arg0->row + 0x11, 0x000000FF, 0x000000F9, 0x000000DC, 0x000000FF); @@ -6331,7 +6328,7 @@ 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 ((D_800E86D0[0] != 0) || ((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); } @@ -6364,12 +6361,12 @@ void func_800A0B80(struct_8018D9E0_entry* arg0) { gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x32, 0xFF); for (var_s5 = 0; var_s5 < 9; var_s5++) { - if (D_800E86C4[var_s5] == 0) { + if (gControllerPakVisibleTableRows[var_s5] == 0) { continue; } temp_s1 = var_s5 * 0xA; - var_s0 = D_800E86C4[var_s5]; + var_s0 = gControllerPakVisibleTableRows[var_s5]; if (var_s0 < 0xA) { func_800A08D8(var_s0 + 0x10, 0x00000032, arg0->row + temp_s1 + 1); } else { @@ -6378,8 +6375,8 @@ void func_800A0B80(struct_8018D9E0_entry* arg0) { func_800A08D8(0x11U, 0x0000002F, arg0->row + temp_s1 + 1); } temp_s2 = arg0->row + temp_s1 + 1; - if (pfsError[D_800E86C4[var_s5] - 1] == 0) { - temp_s4 = &pfsState[D_800E86C4[var_s5] - 1]; + if (pfsError[gControllerPakVisibleTableRows[var_s5] - 1] == 0) { + temp_s4 = &pfsState[gControllerPakVisibleTableRows[var_s5] - 1]; var_s0 = func_800A095C(temp_s4->game_name, 0x00000010, 0x0000004F, temp_s2); if (temp_s4->ext_name[0] != 0) { func_800A08D8(0x3CU, (var_s0 * 8) + 0x4F, temp_s2); @@ -6430,7 +6427,7 @@ void func_800A0EB8(UNUSED struct_8018D9E0_entry* arg0, s32 arg1) { } else { thing = gControllerPakMenuSelection; // ? if ((thing == CONTROLLER_PAK_MENU_ERASE) || (thing == CONTROLLER_PAK_MENU_QUIT)) { - var_t1 = ((arg1 * 2) + gControllerPakMenuSelection) - 3; + var_t1 = ((arg1 * 2) + gControllerPakMenuSelection) - CONTROLLER_PAK_MENU_ERASE; } else { return; } @@ -6662,7 +6659,7 @@ void func_800A1BE0(struct_8018D9E0_entry* arg0) { temp_s6 = &gSaveData.allCourseTimeTrialRecords.cupRecords[gTimeTrialDataCourseIndex / 4] .courseRecords[gTimeTrialDataCourseIndex % 4]; - for (var_s0 = 0; var_s0 < 3; var_s0++) { + for (var_s0 = 0; var_s0 < ARRAY_COUNT(D_800E7834); var_s0++) { wut = D_800E7834[var_s0]; var_s1 = 0; if (var_s0 == gCourseRecordsMenuSelection) { @@ -6670,12 +6667,12 @@ void func_800A1BE0(struct_8018D9E0_entry* arg0) { } else { var_s2 = 1; switch (var_s0) { /* irregular */ - case 1: + case COURSE_RECORDS_MENU_ERASE_RECORDS: if (temp_s6->unknownBytes[0] == 0) { var_s1 = 1; } break; - case 2: + case COURSE_RECORDS_MENU_ERASE_GHOST: if (func_800B639C((s32) gTimeTrialDataCourseIndex) < 0) { var_s1 = 1; } @@ -6716,9 +6713,9 @@ void func_800A1DE0(struct_8018D9E0_entry* arg0) { 0.65f, 0.65f); } - for (var_s1 = 0; var_s1 < 2; var_s1++) { + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_800E7840); var_s1++) { wut = D_800E7840[var_s1]; - if (var_s1 == D_8018EDF9) { + if (var_s1 == gCourseRecordsSubMenuSelection) { var_a0 = 5; } else { var_a0 = 1; @@ -6728,7 +6725,7 @@ void func_800A1DE0(struct_8018D9E0_entry* arg0) { } sp58.column = 0x003B; - sp58.row = (D_8018EDF9 * 0xD) + 0x66; + sp58.row = (gCourseRecordsSubMenuSelection * 0xD) + 0x66; func_800A66A8(arg0, &sp58); } @@ -6767,94 +6764,94 @@ 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 (D_8018EDEC) { /* switch 1 */ - case 0x15: /* switch 1 */ - case 0x16: /* switch 1 */ - case 0x17: /* switch 1 */ - case 0x18: /* switch 1 */ - for (stackPadding0 = 0; stackPadding0 < 4; stackPadding0++) { - set_text_color_rainbow_if_selected(D_8018EDEC - 0x15, stackPadding0, 3); + 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 */ + case SUB_MENU_OPTION_ERASE_ALL_DATA: /* switch 1 */ + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7868); stackPadding0++) { + set_text_color_rainbow_if_selected(gSubMenuSelection - SUB_MENU_OPTION_MIN, stackPadding0, 3); func_80093324(0x00000032, 0x55 + (0x23 * stackPadding0), D_800E7868[stackPadding0], 0, 0.9f, 1.0f); - if (stackPadding0 == (D_8018EDEC - 0x15)) { + if (stackPadding0 == (gSubMenuSelection - SUB_MENU_OPTION_MIN)) { spE0.column = 0x0032; spE0.row = 0x55 + (0x23 * stackPadding0); } } set_text_color(1); - draw_text(0x000000E6, 0x00000078, gSoundModeNames[gSoundMode], 0, 1.0f, 1.0f); + draw_text(0x000000E6, 0x55 + 0x23, gSoundModeNames[gSoundMode], 0, 1.0f, 1.0f); break; - case 0x1E: /* switch 1 */ - case 0x1F: /* switch 1 */ + case SUB_MENU_ERASE_QUIT: /* switch 1 */ + case SUB_MENU_ERASE_ERASE: /* switch 1 */ set_text_color(3); - for (stackPadding0 = 0; stackPadding0 < 3; stackPadding0++) { + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7878); stackPadding0++) { func_80093324(0x00000028, 0x55 + (0x14 * stackPadding0), D_800E7878[stackPadding0], 0, 1.0f, 1.0f); } - for (stackPadding0 = 0; stackPadding0 < 2; stackPadding0++) { - set_text_color_rainbow_if_selected(D_8018EDEC - 0x1E, stackPadding0, 1); + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7840); stackPadding0++) { + set_text_color_rainbow_if_selected(gSubMenuSelection - SUB_MENU_ERASE_MIN, stackPadding0, 1); func_80093324(0x00000084, 0x96 + (0x19 * stackPadding0), D_800E7840[stackPadding0], 0, 1.0f, 1.0f); - if (stackPadding0 == (D_8018EDEC - 0x1E)) { + if (stackPadding0 == (gSubMenuSelection - SUB_MENU_ERASE_MIN)) { spE0.column = 0x0084; spE0.row = 0x96 + (0x19 * stackPadding0); } } break; - case 0x20: /* switch 1 */ + case SUB_MENU_SAVE_DATA_ERASED: /* switch 1 */ set_text_color(3); - for (stackPadding0 = 0; stackPadding0 < 3; stackPadding0++) { + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7884); stackPadding0++) { func_80093324(0x00000032, 0x55 + (0x14 * stackPadding0), D_800E7884[stackPadding0], 0, 1.0f, 1.0f); } break; - case 0x2A: /* switch 1 */ - case 0x2B: /* switch 1 */ - case 0x2C: /* switch 1 */ - case 0x2D: /* switch 1 */ + 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 */ set_text_color(2); - var_s1 = D_8018EDEC - 0x2A; - for (stackPadding0 = 0; stackPadding0 < 3; stackPadding0++) { + var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_2P_MIN; + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E78D0) / 4; stackPadding0++) { // 12 / 4 = 3 func_80093324(0x00000032, 0x55 + (0x14 * stackPadding0), D_800E78D0[(var_s1 * 3) + stackPadding0], 0, 0.9f, 0.9f); } break; - case 0x34: /* switch 1 */ - case 0x35: /* switch 1 */ - case 0x36: /* switch 1 */ - case 0x37: /* 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 */ set_text_color(2); - var_s1 = D_8018EDEC - 0x34; - for (stackPadding0 = 0; stackPadding0 < 4; stackPadding0++) { + var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_ERROR_1P_MIN; + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7890) / 4; stackPadding0++) { // 16 / 4 = 4 func_80093324(0x00000023, 0x55 + (0x14 * stackPadding0), D_800E7890[(var_s1 * 4) + stackPadding0], 0, 0.8f, 0.8f); } break; - case 0x41: /* switch 1 */ - case 0x42: /* switch 1 */ + case SUB_MENU_COPY_PAK_UNABLE_COPY_FROM_1P: /* switch 1 */ + case SUB_MENU_COPY_PAK_UNABLE_READ_FROM_2P: /* switch 1 */ set_text_color(2); - var_s1 = D_8018EDEC - 0x41; - for (stackPadding0 = 0; stackPadding0 < 3; stackPadding0++) { + var_s1 = gSubMenuSelection - SUB_MENU_COPY_PAK_UNABLE_ERROR_MIN; + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7900) / 2; stackPadding0++) { // 6 / 2 = 3 func_80093324(0x00000041, 0x55 + (0x14 * stackPadding0), D_800E7900[(var_s1 * 3) + stackPadding0], 0, 0.9f, 0.9f); } break; - case 0x46: /* switch 1 */ - case 0x47: /* switch 1 */ + case SUB_MENU_COPY_PAK_CREATE_GAME_DATA_INIT: /* switch 1 */ + case SUB_MENU_COPY_PAK_CREATE_GAME_DATA_DONE: /* switch 1 */ set_text_color(3); - for (stackPadding0 = 0; stackPadding0 < 3; stackPadding0++) { + for (stackPadding0 = 0; stackPadding0 < ARRAY_COUNT(D_800E7A48); stackPadding0++) { func_80093324(0x00000050, 0x55 + (0x14 * stackPadding0), D_800E7A48[stackPadding0], 0, 1.0f, 1.0f); } break; - case 0x28: /* switch 1 */ - case 0x29: /* switch 1 */ - case 0x32: /* switch 1 */ - case 0x33: /* switch 1 */ - switch (D_8018EDEC) { - case 0x28: - case 0x29: - var_s5 = 0x28; + 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 */ + switch (gSubMenuSelection) { + case SUB_MENU_COPY_PAK_FROM_GHOST1_1P: + case SUB_MENU_COPY_PAK_FROM_GHOST2_1P: + var_s5 = SUB_MENU_COPY_PAK_FROM_GHOST_MIN; var_s4 = 0; break; - case 0x32: - case 0x33: - var_s5 = 0x32; + case SUB_MENU_COPY_PAK_TO_GHOST1_2P: + case SUB_MENU_COPY_PAK_TO_GHOST2_2P: + var_s5 = SUB_MENU_COPY_PAK_TO_GHOST_MIN; var_s4 = 1; default: // var_s5 = spC4; @@ -6863,13 +6860,13 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } set_text_color(var_s4 + 1); draw_text(0x000000A0, 0x00000055, D_800E7920[var_s4], 0, 0.6f, 0.6f); - for (var_s1 = 0; var_s1 < 2; var_s1++) { + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_800E7918); var_s1++) { set_text_color(3); draw_text(0x5C + (0x82 * var_s1), 0x0000007D, D_800E7918[var_s1], 0, 0.75f, 0.75f); for (var_s2 = 0; var_s2 < 2; var_s2++) { if (var_s1 != var_s4) { - text_rainbow_effect(D_8018EDEC - var_s5, var_s2, TEXT_GREEN); - if (var_s2 == (D_8018EDEC - var_s5)) { + text_rainbow_effect(gSubMenuSelection - var_s5, var_s2, TEXT_GREEN); + if (var_s2 == (gSubMenuSelection - var_s5)) { spE0.column = 0x20 + (0x89 * var_s1); spE0.row = 0x96 + (0x1E * var_s2); } @@ -6896,13 +6893,13 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } } break; - case 0x38: /* switch 1 */ - case 0x39: /* switch 1 */ + case SUB_MENU_COPY_PAK_PROMPT_QUIT: /* switch 1 */ + case SUB_MENU_COPY_PAK_PROMPT_COPY: /* switch 1 */ set_text_color(2); - for (var_s1 = 0; var_s1 < 2; var_s1++) { + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_800E7928); var_s1++) { draw_text(0x000000A0, 0x4D + (0x14 * var_s1), D_800E7928[var_s1], 0, 0.8f, 0.8f); } - for (var_s1 = 0; var_s1 < 2; var_s1++) { + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_800E7918); var_s1++) { set_text_color(3); draw_text(0x5C + (0x82 * var_s1), 0x0000007D, D_800E7918[var_s1], 0, 0.75f, 0.75f); for (var_s2 = 0; var_s2 != 2; var_s2++) { @@ -6935,22 +6932,22 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } } // Register allocation diffs here - for (var_s2 = 0; var_s2 < 2; var_s2++) { - if (var_s2 == (D_8018EDEC - 0x38)) { + for (var_s2 = 0; var_s2 < ARRAY_COUNT(D_800E7930); var_s2++) { + if (var_s2 == (gSubMenuSelection - SUB_MENU_COPY_PAK_PROMPT_MIN)) { spE0.column = 0x6E + (0x32 * var_s2); spE0.row = 0x00D2; } - text_rainbow_effect((D_8018EDEC - 0x38), var_s2, TEXT_YELLOW); + text_rainbow_effect((gSubMenuSelection - SUB_MENU_COPY_PAK_PROMPT_MIN), var_s2, TEXT_YELLOW); func_80093324(0x6E + (0x32 * var_s2), 0x000000D2, D_800E7930[var_s2], 0, 0.75f, 0.75f); } break; - case 0x3A: /* switch 1 */ - case 0x3B: /* switch 1 */ - case 0x3C: /* switch 1 */ - var_s5 = (D_8018EDEC - 0x3A) / 2; + 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); draw_text(0x000000A0, 0x00000055, D_800E7938[var_s5], 0, 1.0f, 1.0f); - for (var_s1 = 0; var_s1 < 2; var_s1++) { + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_800E7918); var_s1++) { set_text_color(3); draw_text(0x5C + (0x82 * var_s1), 0x0000007D, D_800E7918[var_s1], 0, 0.75f, 0.75f); for (var_s2 = 0; var_s2 < 2; var_s2++) { @@ -6988,13 +6985,13 @@ void func_800A1FB0(struct_8018D9E0_entry* arg0) { } break; } - switch (D_8018EDEC) { /* switch 2 */ - case 0x28: /* switch 2 */ - case 0x29: /* switch 2 */ - case 0x32: /* switch 2 */ - case 0x33: /* switch 2 */ - case 0x38: /* switch 2 */ - case 0x39: /* 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; @@ -7026,7 +7023,7 @@ void func_800A2D1C(struct_8018D9E0_entry* arg0) { } break; default: - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (gDemoUseController != 0)) { arg0->type = 0; } else { arg0->unk1C -= 2; @@ -7081,7 +7078,7 @@ 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[D_800E86B0[gPlayerCount - 1][D_800E86AC[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) { @@ -7197,7 +7194,7 @@ 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[D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]], 0, 0.6f, 0.6f); + D_800E76CC[gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]], 0, 0.6f, 0.6f); } } @@ -8438,16 +8435,16 @@ void func_800A7A4C(s32 arg0) { } else if (s8018ED94 < 0x190) { D_800E8534 += 0.3; } - D_8018EDCC -= D_800E8534; + gIntroModelRotY -= D_800E8534; s8018ED94 += 1; - if (D_8018EDCC < -360.0f) { - D_8018EDCC += 360.0f; + if (gIntroModelRotY < -360.0f) { + gIntroModelRotY += 360.0f; } var_s1->unk1C++; if (var_s1->unk1C == 0x000000B4) { func_8009E000(0x00000028); func_800CA388(0x64U); - D_8018EDE0 = 0; + gMenuFadeType = MENU_FADE_TYPE_MAIN; } if ((var_s1->unk20 != 0) && (var_s1->unk1C >= 3)) { var_s1->unk20 = 0; @@ -8484,17 +8481,17 @@ void func_800A7A4C(s32 arg0) { break; case 0x10: /* switch 8 */ case 0x11: /* switch 8 */ - switch (gMainMenuSelectionDepth) { /* switch 5 */ - case OPTIONS_SELECTION: /* switch 5 */ - case DATA_SELECTION: /* switch 5 */ - case PLAYER_NUM_SELECTION: /* switch 5 */ + switch (gMainMenuSelection) { /* switch 5 */ + case MAIN_MENU_OPTION: /* switch 5 */ + case MAIN_MENU_DATA: /* switch 5 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 5 */ func_800A9B9C(var_s1); break; - case GAME_MODE_SELECTION: /* switch 5 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION: /* switch 5 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 5 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* 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_BACK_OUT: /* switch 5 */ + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 5 */ func_800A9C40(var_s1); break; } @@ -8507,17 +8504,17 @@ void func_800A7A4C(s32 arg0) { case 0xC: /* switch 8 */ case 0xD: /* switch 8 */ case 0xE: /* switch 8 */ - switch (gMainMenuSelectionDepth) { /* switch 6 */ - case OPTIONS_SELECTION: /* switch 6 */ - case DATA_SELECTION: /* switch 6 */ - case PLAYER_NUM_SELECTION: /* switch 6 */ + switch (gMainMenuSelection) { /* switch 6 */ + case MAIN_MENU_OPTION: /* switch 6 */ + case MAIN_MENU_DATA: /* switch 6 */ + case MAIN_MENU_PLAYER_SELECT: /* switch 6 */ func_800A9B9C(var_s1); break; - case GAME_MODE_SELECTION: /* switch 6 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION: /* switch 6 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 6 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* 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_BACK_OUT: /* switch 6 */ + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 6 */ func_800A9C40(var_s1); break; } @@ -8563,12 +8560,12 @@ void func_800A7A4C(s32 arg0) { func_800AA69C(var_s1); break; } - switch (D_8018EDEE) { /* switch 10; irregular */ - case 1: /* switch 10 */ + switch (gPlayerSelectMenuSelection) { /* switch 10; irregular */ + case PLAYER_SELECT_MENU_MAIN: /* switch 10 */ func_800AAB90(var_s1); break; - case 2: /* switch 10 */ - case 3: /* switch 10 */ + case PLAYER_SELECT_MENU_OK: /* switch 10 */ + case PLAYER_SELECT_MENU_OK_BACK_OUT: /* switch 10 */ func_800AAA9C(var_s1); break; } @@ -8583,12 +8580,12 @@ void func_800A7A4C(s32 arg0) { case 0x55: /* switch 8 */ case 0x56: /* switch 8 */ func_800AB164(var_s1); - switch (D_8018EDEC) { /* switch 11; irregular */ - case 1: /* switch 11 */ + switch (gSubMenuSelection) { /* switch 11; irregular */ + case SUB_MENU_MAP_SELECT_CUP: /* switch 11 */ func_800AB020(var_s1); break; - case 2: /* switch 11 */ - case 3: /* switch 11 */ + case SUB_MENU_MAP_SELECT_COURSE: /* switch 11 */ + case SUB_MENU_MAP_SELECT_OK: /* switch 11 */ func_800AB098(var_s1); break; } @@ -8838,8 +8835,8 @@ void func_800A8270(s32 arg0, struct_8018D9E0_entry* arg1) { gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); if ((arg0 + 1) == gPlayerCount) { - if ((gMainMenuSelectionDepth == OPTIONS_SELECTION) || (gMainMenuSelectionDepth == DATA_SELECTION) || - (gMainMenuSelectionDepth == PLAYER_NUM_SELECTION)) { + if ((gMainMenuSelection == MAIN_MENU_OPTION) || (gMainMenuSelection == MAIN_MENU_DATA) || + (gMainMenuSelection == MAIN_MENU_PLAYER_SELECT)) { gDisplayListHead = draw_flash_select_case_slow(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x35); } else { gDisplayListHead = draw_box_fill(gDisplayListHead, var_s3, var_s0, var_s4, var_s0 + 0x35, 0x000000FF, @@ -8849,8 +8846,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 == D_800E86AC[arg0]) && ((arg0 + 1) == gPlayerCount) && (gMainMenuSelectionDepth >= 4)) { - if (gMainMenuSelectionDepth == GAME_MODE_SELECTION) { + 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); } else { @@ -8876,20 +8873,21 @@ void func_800A8564(struct_8018D9E0_entry* arg0) { switch (arg0->type) { /* irregular */ case 0xF: var_a0 = D_0200487C; - if ((gMainMenuSelectionDepth == CONFIRM_OK_SELECTION) || - (gMainMenuSelectionDepth == CONFIRM_OK_SELECTION_FROM_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || + (gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT)) { var_a1 = 1; } break; case 0x33: var_a0 = D_02004B74; - if ((D_8018EDEE == 2) || (D_8018EDEE == 3)) { + if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || + (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT)) { var_a1 = 1; } break; case 0x5D: var_a0 = D_02004E80; - if (D_8018EDEC == 3) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_OK) { var_a1 = 1; } break; @@ -8954,7 +8952,7 @@ void func_800A890C(s32 arg0, struct_8018D9E0_entry* arg1) { gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); if (arg0 == gCupSelection) { - if (D_8018EDEC == 1) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_CUP) { gDisplayListHead = draw_flash_select_case_slow(gDisplayListHead, temp_t1 + temp_t7, temp_a2, (temp_t1 - temp_t7) + 64, temp_a2 + 39); } else { @@ -8979,8 +8977,8 @@ 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) && (D_8018EDEC >= 2) && (gModeSelection != GRAND_PRIX)) { - if ((D_8018EDEC == 2) || (D_8018EDEC == 4)) { + 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); @@ -9011,7 +9009,7 @@ void func_800A8CA4(struct_8018D9E0_entry* arg0) { gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGBA, G_CC_DECALRGBA); if (gModeSelection == GRAND_PRIX) { - if (D_8018EDEC != 3) { + if (gSubMenuSelection != SUB_MENU_MAP_SELECT_OK) { for (var_s0 = 0; var_s0 < 4; var_s0++) { // Wut? if ((var_s0 != (temp_v0->unk1C % 4)) != 0) { @@ -9048,8 +9046,8 @@ void func_800A8F48(UNUSED struct_8018D9E0_entry* arg0) { s32 temp_s2; s32 var_s1; - switch (D_8018EDEC) { /* irregular */ - case 1: + switch (gSubMenuSelection) { /* irregular */ + case SUB_MENU_MAP_SELECT_CUP: for (var_s1 = 0; var_s1 < 4; var_s1++) { if (func_800B639C((gCupSelection * 4) + var_s1) >= 0) { temp_v0 = &D_800E7168[var_s1]; @@ -9063,7 +9061,7 @@ void func_800A8F48(UNUSED struct_8018D9E0_entry* arg0) { } } break; - case 2: + case SUB_MENU_MAP_SELECT_COURSE: default: if (func_800B639C((gCupSelection * 4) + gCourseIndexInCup) >= 0) { gDisplayListHead = func_80098FC8(gDisplayListHead, 0x00000057, 0x00000070, 0x00000096, 0x00000081); @@ -9292,47 +9290,47 @@ void func_800A9710(struct_8018D9E0_entry* arg0) { void func_800A97BC(struct_8018D9E0_entry* arg0) { s32 i; - switch (*D_800E86D0) { - case 1: + switch (gControllerPakScrollDirection) { + case CONTROLLER_PAK_SCROLL_DIR_DOWN: arg0->row -= 2; if (arg0->row < 0x60) { arg0->row = 0x69; - *D_800E86D0 = 0; + gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_NONE; for (i = 0; i < 8; i++) { if (i < 7) { - D_800E86C4[i] = D_800E86C4[i + 1]; + gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1]; } else { - if ((D_800E86C4[i - 1] == 0x10) || (D_800E86C4[i - 1] == 0)) { - D_800E86C4[i] = 0; + if ((gControllerPakVisibleTableRows[i - 1] == 0x10) || (gControllerPakVisibleTableRows[i - 1] == 0)) { + gControllerPakVisibleTableRows[i] = 0; } else { - D_800E86C4[i] = D_800E86C4[i - 1] + 1; + gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1] + 1; } } } - D_800E86C4[0] = D_800E86C4[8] = 0; + gControllerPakVisibleTableRows[0] = gControllerPakVisibleTableRows[8] = 0; } break; - case 2: + case CONTROLLER_PAK_SCROLL_DIR_UP: arg0->row += 2; if (arg0->row >= 0x73) { arg0->row = 0x69; - *D_800E86D0 = 0; + gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_NONE; for (i = 8; i > 0; i--) { if (i > 1) { - D_800E86C4[i] = D_800E86C4[i - 1]; + gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i - 1]; } else { - if ((D_800E86C4[i + 1] == 1) || (D_800E86C4[i + 1] == 0)) { - D_800E86C4[i] = 0; + if ((gControllerPakVisibleTableRows[i + 1] == 1) || (gControllerPakVisibleTableRows[i + 1] == 0)) { + gControllerPakVisibleTableRows[i] = 0; } else { - D_800E86C4[i] = D_800E86C4[i + 1] - 1; + gControllerPakVisibleTableRows[i] = gControllerPakVisibleTableRows[i + 1] - 1; } } } - D_800E86C4[0] = D_800E86C4[8] = 0; + gControllerPakVisibleTableRows[0] = gControllerPakVisibleTableRows[8] = 0; break; default: - *D_800E86D0 = 0; + gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_NONE; break; } } @@ -9342,7 +9340,15 @@ void func_800A97BC(struct_8018D9E0_entry* arg0) { // 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, 0x03, 0x02, 0x00, 0x00, 0x03, 0x03, 0x02, 0x00 + 0x03, 0x03, 0x03, 0x02, 0x00, 0x02, 0x02, 0x01 +}; + +const s8 D_800F0CA8[] = { + 0x03, 0x02, 0x00 +}; + +const s8 D_800F0CAC[] = { + 0x03, 0x03, 0x02 }; void func_800A9A98(struct_8018D9E0_entry* arg0) { @@ -9354,13 +9360,13 @@ void func_800A9A98(struct_8018D9E0_entry* arg0) { var_v0 = sp4; // wut? break; case 0xF: - var_v0 = D_800F0CA0[gMainMenuSelectionDepth - 1]; + var_v0 = D_800F0CA0[gMainMenuSelection - 1]; break; case 0x5D: - var_v0 = D_800F0CA0[D_8018EDEC + 11]; + var_v0 = D_800F0CAC[gSubMenuSelection - 1]; break; case 0x33: - var_v0 = D_800F0CA0[D_8018EDEE + 7]; + var_v0 = D_800F0CA8[gPlayerSelectMenuSelection - 1]; break; } switch (var_v0) { /* switch 1; irregular */ @@ -9437,8 +9443,8 @@ void func_800A9C40(struct_8018D9E0_entry* arg0) { arg0->cursor = 1; case 1: func_800AA280(arg0); - if ((gMainMenuSelectionDepth == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || - (gMainMenuSelectionDepth == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { arg0->unk1C = 0x00000020; } else { if (arg0->unk1C < 0x20) { @@ -9471,8 +9477,8 @@ void func_800A9D5C(struct_8018D9E0_entry* arg0) { switch (arg0->cursor) { case 2: - if ((gMainMenuSelectionDepth == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || - (gMainMenuSelectionDepth == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { arg0->column = 0x00000080; arg0->row = 0x0000003E; } else { @@ -9525,30 +9531,30 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { break; } - temp_a1 = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + temp_a1 = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; switch (arg0->cursor) { /* switch 5; irregular */ case 0: /* switch 5 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; } else { - arg0->unk20 = D_800E86AC[gPlayerCount - 1]; - switch (gMainMenuSelectionDepth) { /* switch 2 */ - case GAME_MODE_SELECTION: /* switch 2 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 2 */ - case CONFIRM_OK_SELECTION: /* switch 2 */ + arg0->unk20 = gGameModeMenuColumn[gPlayerCount - 1]; + 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 */ arg0->visible = 1; temp_v0 = func_800AAE68(); arg0->column = temp_v0->column; - arg0->row = (D_800E86AC[gPlayerCount - 1] * 0x12) + temp_v0->row + 0x41; + arg0->row = (gGameModeMenuColumn[gPlayerCount - 1] * 0x12) + temp_v0->row + 0x41; arg0->unk1C = 0; arg0->cursor = 1; break; - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 2 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* switch 2 */ + case MAIN_MENU_OK_SELECT_BACK_OUT: /* switch 2 */ + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 2 */ temp_v0 = func_800AAE68(); temp_v1_2 = &D_800E70E8[arg0->type - sp24]; arg0->column = temp_v0->column + temp_v1_2->column; - arg0->row = (D_800E86AC[gPlayerCount - 1] * 0x12) + temp_v0->row + temp_v1_2->row; + arg0->row = (gGameModeMenuColumn[gPlayerCount - 1] * 0x12) + temp_v0->row + temp_v1_2->row; arg0->unk1C = arg0->row - temp_v0->row; arg0->visible = 1; arg0->cursor = 2; @@ -9560,17 +9566,17 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { } break; case 1: /* switch 5 */ - switch (gMainMenuSelectionDepth) { /* switch 3 */ - case GAME_MODE_SELECTION: /* switch 3 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 3 */ - case CONFIRM_OK_SELECTION: /* switch 3 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 3 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* switch 3 */ + 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_BACK_OUT: /* switch 3 */ + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 3 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; } else { - if (arg0->unk20 != D_800E86AC[gPlayerCount - 1]) { + if (arg0->unk20 != gGameModeMenuColumn[gPlayerCount - 1]) { arg0->cursor = 0; } temp_v0 = func_800AAE68(); @@ -9591,17 +9597,17 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { } break; case 2: /* switch 5 */ - switch (gMainMenuSelectionDepth) { /* switch 4 */ - case GAME_MODE_SELECTION: /* switch 4 */ - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: /* switch 4 */ - case CONFIRM_OK_SELECTION: /* switch 4 */ - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: /* switch 4 */ - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: /* switch 4 */ + 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_BACK_OUT: /* switch 4 */ + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 4 */ if ((temp_a1 != sp20) && (temp_a1 != sp1C)) { arg0->visible = 0; arg0->cursor = 0; } else { - if (arg0->unk20 != D_800E86AC[gPlayerCount - 1]) { + if (arg0->unk20 != gGameModeMenuColumn[gPlayerCount - 1]) { arg0->cursor = 0; } temp_v0 = func_800AAE68(); @@ -9609,7 +9615,7 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { arg0->column = temp_v0->column + temp_v1_2->column; arg0->row = temp_v0->row + arg0->unk1C; func_800A91D8(arg0, arg0->column, - (D_800E86AC[gPlayerCount - 1] * 0x12) + temp_v0->row + temp_v1_2->row); + (gGameModeMenuColumn[gPlayerCount - 1] * 0x12) + temp_v0->row + temp_v1_2->row); arg0->unk1C = arg0->row - temp_v0->row; } break; @@ -9626,8 +9632,8 @@ void func_800AA280(struct_8018D9E0_entry* arg0) { Unk_D_800E70A0* temp_v0; temp_v0 = &D_800E70A0[arg0->type - 0xA]; - if ((gMainMenuSelectionDepth == CONFIRM_OK_SELECTION_FROM_BACK_OUT) || - (gMainMenuSelectionDepth == TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { arg0->column = temp_v0->column; arg0->row = temp_v0->row; } else { @@ -9640,24 +9646,24 @@ void func_800AA2EC(struct_8018D9E0_entry* arg0) { s32 var_t1; var_t1 = 0; - switch (gMainMenuSelectionDepth) { - case OPTIONS_SELECTION: - case DATA_SELECTION: - case PLAYER_NUM_SELECTION: - case GAME_MODE_SELECTION: + switch (gMainMenuSelection) { + case MAIN_MENU_OPTION: + case MAIN_MENU_DATA: + case MAIN_MENU_PLAYER_SELECT: + case MAIN_MENU_MODE_SELECT: arg0->cursor = 0; break; - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: - case CONFIRM_OK_SELECTION: - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: + case MAIN_MENU_MODE_SUB_SELECT: + case MAIN_MENU_OK_SELECT: + case MAIN_MENU_OK_SELECT_BACK_OUT: + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: if (arg0->cursor != 0) { break; } if (gPlayerCount != 1) { break; } - if (D_800E86AC[gPlayerCount - 1] != 1) { + if (gGameModeMenuColumn[gPlayerCount - 1] != 1) { break; } @@ -9772,7 +9778,7 @@ void func_800AA69C(struct_8018D9E0_entry* arg0) { } switch (arg0->unk8) { case 0: - if ((D_8018EDE8[temp_v0] != 0) && (var_a0 != 0)) { + if ((gCharacterGridIsSelected[temp_v0] != 0) && (var_a0 != 0)) { arg0->unk8 = 1; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[temp_a0])); @@ -9793,7 +9799,7 @@ void func_800AA69C(struct_8018D9E0_entry* arg0) { if (D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex >= D_800E8440[temp_a0]) { arg0->unk8 = 2; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E83A0[temp_a0])); - } else if ((D_8018EDE8[temp_v0] == 0) && (var_a0 != 0)) { + } else if ((gCharacterGridIsSelected[temp_v0] == 0) && (var_a0 != 0)) { arg0->unk8 = 3; func_8009A594(arg0->D_8018DEE0_index, D_800E8460[temp_a0] - D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex, @@ -9801,7 +9807,7 @@ void func_800AA69C(struct_8018D9E0_entry* arg0) { } break; case 2: - if ((D_8018EDE8[temp_v0] == 0) && (var_a0 != 0)) { + if ((gCharacterGridIsSelected[temp_v0] == 0) && (var_a0 != 0)) { arg0->unk8 = 3; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterDeselectAnimation[temp_a0])); @@ -9811,7 +9817,7 @@ void func_800AA69C(struct_8018D9E0_entry* arg0) { if (D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex >= D_800E8460[temp_a0]) { arg0->unk8 = 0; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E8360[temp_a0])); - } else if ((D_8018EDE8[temp_v0] != 0) && (var_a0 != 0)) { + } else if ((gCharacterGridIsSelected[temp_v0] != 0) && (var_a0 != 0)) { arg0->unk8 = 1; func_8009A594(arg0->D_8018DEE0_index, D_800E8460[temp_a0] - D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex, @@ -9820,7 +9826,7 @@ void func_800AA69C(struct_8018D9E0_entry* arg0) { break; case 4: case 5: - if ((D_8018EDE8[temp_v0] != 0) && (var_a0 != 0)) { + if ((gCharacterGridIsSelected[temp_v0] != 0) && (var_a0 != 0)) { arg0->unk8 = 1; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[temp_a0])); @@ -9847,7 +9853,7 @@ void func_800AAA9C(struct_8018D9E0_entry* arg0) { arg0->cursor = 1; /* fallthrough */ case 1: - if (D_8018EDEE == 3) { + if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT) { arg0->unk1C = 0x00000020; } else { if (arg0->unk1C < 0x20) { @@ -9917,7 +9923,7 @@ void func_800AAC18(struct_8018D9E0_entry* arg0) { temp_a1 = arg0->type - 0x2B; switch (arg0->cursor) { case 0: - if (D_8018EDEE == 3) { + if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT) { temp_v0 = func_800AAFCC(temp_a1); if (temp_v0 >= 0) { var_t0 = &D_800E7188[(gScreenModeSelection * 4) + temp_v0]; @@ -10081,7 +10087,7 @@ s32 func_800AAFCC(s32 arg0) { s32 someIndex = 0; s32 ret = 0; - for (; someIndex < 4; someIndex++) { + for (; someIndex < ARRAY_COUNT(gCharacterGridSelections); someIndex++) { if ((arg0 + 1) == gCharacterGridSelections[someIndex]) { ret = 1; break; @@ -10222,7 +10228,7 @@ void func_800AB314(struct_8018D9E0_entry* arg0) { } switch (gModeSelection) { default: - if (D_8018EDEC != one) { + if (gSubMenuSelection != SUB_MENU_MAP_SELECT_CUP) { arg0->cursor = 0; arg0->unk20 = 0; for (var_a1 = 0; var_a1 < 4; var_a1++) { @@ -10258,7 +10264,7 @@ void func_800AB314(struct_8018D9E0_entry* arg0) { arg0->unk20 = 0; arg0->unk1C = gCupSelection * 4; } - if (D_8018EDEC == 3) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_OK) { arg0->cursor = 2; arg0->unk20 = 0; } @@ -10274,7 +10280,7 @@ void func_800AB314(struct_8018D9E0_entry* arg0) { arg0->unk20 = 0; arg0->unk1C = (gCupSelection * 4) + (((arg0->unk1C % 4) + one) % 4); } else { - if (D_8018EDEC == 3) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_OK) { arg0->cursor = 2; arg0->unk20 = 0; } @@ -10287,14 +10293,14 @@ void func_800AB314(struct_8018D9E0_entry* arg0) { arg0->cursor = 3; arg0->unk20 = 0; } - if (D_8018EDEC != 3) { + if (gSubMenuSelection != SUB_MENU_MAP_SELECT_OK) { arg0->cursor = 0; arg0->unk20 = 0; arg0->unk1C = 0; } break; case 3: - if (D_8018EDEC != 3) { + if (gSubMenuSelection != SUB_MENU_MAP_SELECT_OK) { arg0->cursor = 0; arg0->unk20 = 0; arg0->unk1C = 0; @@ -10344,15 +10350,15 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AB314.s") void func_800AB904(struct_8018D9E0_entry* arg0) { Unk_D_800E70A0* temp_a1; - switch (D_8018EDEC) { /* irregular */ - case 1: + switch (gSubMenuSelection) { /* irregular */ + case SUB_MENU_MAP_SELECT_CUP: temp_a1 = &D_800E7248[arg0->type - 0x65]; if (arg0->column != temp_a1->column) { func_800A9208(arg0, temp_a1->column); } break; - case 2: - case 3: + case SUB_MENU_MAP_SELECT_COURSE: + case SUB_MENU_MAP_SELECT_OK: temp_a1 = &D_800E7258[arg0->type - 0x65]; if (arg0->column != temp_a1->column) { func_800A9208(arg0, temp_a1->column); @@ -10376,13 +10382,13 @@ void func_800AB9B0(struct_8018D9E0_entry* arg0) { switch (arg0->cursor) { /* irregular */ case 0: func_800A91D8(arg0, (s32) temp_v1->column, (s32) temp_v1->row); - if (D_8018EDEC == 3) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_OK) { arg0->cursor = 1; } break; case 1: func_800A91D8(arg0, (s32) temp_v1->column, (s32) temp_v1->row); - if (D_8018EDEC == 1) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_CUP) { arg0->cursor = 0; } break; @@ -10441,7 +10447,7 @@ void func_800ABC38(struct_8018D9E0_entry* arg0) { } break; default: - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != (s32) 1U) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != (s32) 1U) || (gDemoUseController != 0)) { arg0->type = 0; } else { if (arg0->row >= -0x13) { @@ -10503,7 +10509,7 @@ void func_800ABEAC(struct_8018D9E0_entry* arg0) { } break; default: - if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != why) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != why) || (gDemoUseController != 0)) { arg0->type = 0; } else { if (arg0->row < 0x104) { @@ -10815,7 +10821,7 @@ void func_800ACA14(struct_8018D9E0_entry* arg0) { break; case 11: case 12: - if (func_800B4520()) { + if (is_screen_being_faded()) { break; } @@ -10879,9 +10885,9 @@ void func_800ACC50(struct_8018D9E0_entry* arg0) { arg0->unk1C += 0x20; if (arg0->unk1C >= 0x100) { if (gModeSelection == VERSUS) { - arg0->cursor = (s32) D_8018EDF4; + arg0->cursor = (s32) gVersusResultCursorSelection; } else { - arg0->cursor = (s32) D_8018EDF6; + arg0->cursor = (s32) gBattleResultCursorSelection; } arg0->unk1C = 0; } @@ -10890,7 +10896,7 @@ void func_800ACC50(struct_8018D9E0_entry* arg0) { case 11: case 12: case 13: - if (func_800B4520() == 0) { + if (is_screen_being_faded() == 0) { if ((gControllerFive->buttonPressed | gControllerFive->stickPressed) & 0x800) { if (arg0->cursor >= 0xB) { arg0->cursor--; @@ -10915,9 +10921,9 @@ void func_800ACC50(struct_8018D9E0_entry* arg0) { func_8009DFE0(0x0000001E); play_sound2(SOUND_MENU_OK_CLICKED); if (gModeSelection == VERSUS) { - D_8018EDF4 = (s8) arg0->cursor; + gVersusResultCursorSelection = (s8) arg0->cursor; } else { - D_8018EDF6 = (s8) arg0->cursor; + gBattleResultCursorSelection = (s8) arg0->cursor; } if (arg0->unk24 < 4.2) { arg0->unk24 += 4.0; @@ -11069,7 +11075,7 @@ void func_800AD2E8(struct_8018D9E0_entry* arg0) { } else { arg0->unk20 = 0; arg0->column = 0; - arg0->cursor = D_8018EDF5; + arg0->cursor = gTimeTrialsResultCursorSelection; if ((arg0->cursor == 9) && (D_80162DF8 == 1)) { arg0->cursor--; } @@ -11083,7 +11089,7 @@ void func_800AD2E8(struct_8018D9E0_entry* arg0) { case 8: /* switch 3 */ case 9: /* switch 3 */ case 10: /* switch 3 */ - if (func_800B4520() == 0) { + if (is_screen_being_faded() == 0) { if ((gControllerOne->buttonPressed | gControllerOne->stickPressed) & 0x800) { if (arg0->cursor >= 6) { arg0->cursor--; @@ -11196,7 +11202,7 @@ void func_800AD2E8(struct_8018D9E0_entry* arg0) { } } else { arg0->unk1C = arg0->cursor; - D_8018EDF5 = arg0->cursor; + gTimeTrialsResultCursorSelection = arg0->cursor; arg0->cursor = 0x0000001E; arg0->unk20 = arg0->row; play_sound2(SOUND_ACTION_NEXT_COURSE); @@ -11409,7 +11415,7 @@ void func_800ADF48(struct_8018D9E0_entry* arg0) { case 42: case 43: case 44: - if (func_800B4520() == 0) { + if (is_screen_being_faded() == 0) { controller = &gControllers[gIsGamePaused - 1]; if ((controller->buttonPressed | controller->stickPressed) & 0x800) { if (D_800F0B50[gModeSelection] < arg0->cursor) { @@ -11497,7 +11503,7 @@ void func_800AE218(struct_8018D9E0_entry* arg0) { case 14: /* switch 1 */ case 15: /* switch 1 */ case 16: /* switch 1 */ - if (func_800B4520() == 0) { + if (is_screen_being_faded() == 0) { if ((gControllerOne->buttonPressed | gControllerOne->stickPressed) & 0x800) { if (arg0->cursor >= 0xC) { arg0->cursor--; @@ -11794,7 +11800,7 @@ void func_800AEDBC(struct_8018D9E0_entry* arg0) { } void func_800AEE90(struct_8018D9E0_entry* arg0) { - if (D_8018EDEC != 0xB) { + if (gSubMenuSelection != SUB_MENU_DATA_OPTIONS) { arg0->visible = 0; } else { arg0->visible = 1; @@ -11802,7 +11808,7 @@ void func_800AEE90(struct_8018D9E0_entry* arg0) { } void func_800AEEBC(struct_8018D9E0_entry* arg0) { - if (D_8018EDEC != 0xC) { + if (gSubMenuSelection != SUB_MENU_DATA_ERASE_CONFIRM) { arg0->visible = 0; } else { arg0->visible = 1; @@ -11810,7 +11816,7 @@ void func_800AEEBC(struct_8018D9E0_entry* arg0) { } void func_800AEEE8(struct_8018D9E0_entry* arg0) { - if (D_8018EDEC != 0xD) { + if (gSubMenuSelection != SUB_MENU_DATA_CANT_ERASE) { arg0->visible = 0; } else { arg0->visible = 1; diff --git a/src/main.c b/src/main.c index eba4715098..3526b5d6b9 100644 --- a/src/main.c +++ b/src/main.c @@ -170,7 +170,7 @@ u16 D_800DC510 = 0; u16 D_800DC514 = 0; u16 creditsRenderMode = 0; // Renders the whole track. Displays red if used in normal race mode. u16 gDemoMode = DEMO_MODE_INACTIVE; -u16 gEnableDebugMode = DEBUG_MODE; +u16 gEnableDebugMode = ENABLE_DEBUG_MODE; s32 gGamestateNext = 7; // = COURSE_DATA_MENU?; UNUSED s32 D_800DC528 = 1; s32 gActiveScreenMode = SCREEN_MODE_1P; diff --git a/src/menus.c b/src/menus.c index 1dcb6e5c2b..5efcea553b 100644 --- a/src/menus.c +++ b/src/menus.c @@ -19,78 +19,102 @@ #include #include "spawn_players.h" +#if ENABLE_DEBUG_MODE +#define DEBUG_MODE_TOGGLE true +#define DEBUG_MENU_SELECTION DEBUG_MENU_DEBUG_MODE +#else +#define DEBUG_MODE_TOGGLE false +#define DEBUG_MENU_SELECTION DEBUG_MENU_DISABLED +#endif + /** BSS **/ -s32 D_8018EDC0; -f32 D_8018EDC4; -f32 D_8018EDC8; -f32 D_8018EDCC; -f32 D_8018EDD0; -f32 D_8018EDD4; -f32 D_8018EDD8; -f32 D_8018EDDC; -s32 D_8018EDE0; -s8 gCharacterGridSelections[4]; // map from player id to current grid position -bool8 D_8018EDE8[4]; // map player id to isCharSelected on CSS -s8 D_8018EDEC; -s8 gMainMenuSelectionDepth; -s8 D_8018EDEE; // grid screen state? +// Variables used to maniplate the model for Intro Logo +// and checkerboard on the start screen +s32 gIntroModelZEye; +f32 gIntroModelScale; // XYZ scale on checkerboard flag, Z scale on intro logo +f32 gIntroModelRotX; +f32 gIntroModelRotY; +f32 gIntroModelRotZ; +f32 gIntroModelPosX; +f32 gIntroModelPosY; +f32 gIntroModelPosZ; + +s32 gMenuFadeType; +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 gMainMenuSelection; +s8 gPlayerSelectMenuSelection; s8 gDebugMenuSelection; s8 gControllerPakMenuSelection; -s8 D_8018EDF1; +s8 gScreenModeListIndex; // 0-4 index, selects a screen mode in sScreenModePlayerTable u8 gSoundMode; -s8 gPlayerCount; // main menu row id? but it is also the number of players define -s8 D_8018EDF4; -s8 D_8018EDF5; -s8 D_8018EDF6; +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 gTimeTrialDataCourseIndex; -s8 gCourseRecordsMenuSelection; -s8 D_8018EDF9; +s8 gCourseRecordsMenuSelection; // Used for selecting an option in course record data +s8 gCourseRecordsSubMenuSelection; // Used for erase records and ghosts (Quit - Erase) s8 gDebugGotoScene; -s8 D_8018EDFB; -s8 D_8018EDFC; +bool8 gGhostPlayerInit; +bool8 gCourseMapInit; s32 gMenuTimingCounter; s32 gMenuDelayTimer; -s8 D_8018EE08; +s8 gDemoUseController; // Sets true alongside gDemoMode, controller related s8 gCupSelection; -s8 D_8018EE0A; +s8 sTempCupSelection; // Same as gCupSelection but it's only set in map select, not referenced s8 gCourseIndexInCup; -s8 D_8018EE0C; -struct_8018EE10_entry D_8018EE10[2]; +s8 unref_8018EE0C; // Set to 0 but never referenced /** Data **/ s32 gMenuSelection = LOGO_INTRO_MENU; -s32 D_800E86A4 = 0; +s32 gFadeModeSelection = FADE_MODE_NONE; + +// Default selected character for each player s8 gCharacterSelections[4] = { MARIO, LUIGI, YOSHI, TOAD }; -// gGameModeRowSelectionForNumPlayers is (D_800E86AC - 1) -// gGameModeSubMenuRowSelectionForNumPlayers (D_800E86AC + 1) +// The current row selected in the mode column for each player indexed +// 0-1 1p / 0-2 2p´/ 0-1 3p / 0-1 4p +s8 gGameModeMenuColumn[4] = { 0, 0, 0, 0 }; -// the current row selected in column i on main menu -s8 D_800E86AC[4] = { 0, 0, 0, 0 }; // For Grand Prix and Versus, this will be the CC mode selected. For Time Trials, it will // be whether 'Begin' or 'Data' is selected. Not used for Battle. // indexed as [column][row] -s8 D_800E86B0[4][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; +s8 gGameModeSubMenuColumn[4][3] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }; s8 gNextDemoId = 0; -s8 gControllerPakSelectedTableRow = 0; -s8 D_800E86C4[12] = { 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 }; -s8 D_800E86D0[16] = { 0 }; // this doesn't make a lot of sense... +s8 gControllerPakSelectedTableRow = 0; // 0-4 index, value of the current visible row select + +// Numbers starting from the second 0 to number 6 get altered +// as you move up or down the page table of content (min value is 0, max value is 16 +s8 gControllerPakVisibleTableRows[12] = { 0, 0, 1, 2, 3, 4, 5, 6, 0, 0, 0, 0 }; + +s8 gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_NONE; // 1 is down, 2 is up +s8 unref_D_800E86D4[12] = { 0 }; s8 unref_800E86E0[4] = { 0, 0, 0, 1 }; -u32 sVIGammaOffDitherOn = OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON; +u32 sVIGammaOffDitherOn = (OS_VI_GAMMA_OFF | OS_VI_DITHER_FILTER_ON); -// Used to set gScreenModeSelection; might be smaller; could be function static data -const s8 D_800F2B50[] = { 0, 1, 2, 3, 3 }; +/** RoData **/ -// Set to gPlayerCount, then that sets gPlayerCountSelection1 -const s8 D_800F2B58[] = { 1, 2, 2, 3, 4 }; +// 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 +}; + +// Sets how many players can load on each screen mode set in sScreenModePlayerTable +const s8 sScreenModePlayerCount[] = { 1, 2, 2, 3, 4 }; // Set indexed slots numbers for one-two-three-four mode selection const s8 gPlayerModeSelection[] = { 1, 2, 1, 1 }; // Limit for each index column in one-two-three-four mode selection -const s8 gGameModePlayerColumnDefault[][3] = { +const s8 sGameModePlayerColumnDefault[][3] = { { 2, 1, 0 }, // 1p (GP options, TT options, ...) { 2, 2, 0 }, // 2p (GP options, VS options, Battle) { 2, 0, 0 }, // 3p (VS options, Battle, ...) @@ -99,7 +123,7 @@ const s8 gGameModePlayerColumnDefault[][3] = { // Limit for each index column in one-two-three-four mode selection // for extra mode (mirror mode), hence the extra value (3 instead of 2) -const s8 gGameModePlayerColumnExtra[][3] = { +const s8 sGameModePlayerColumnExtra[][3] = { { 3, 1, 0 }, // 1p (GP options, TT options, ...) { 3, 3, 0 }, // 2p (GP options, VS options, Battle) { 3, 0, 0 }, // 3p (VS options, Battle, ...) @@ -114,9 +138,11 @@ const s32 gGameModePlayerSelection[][3] = { { VERSUS, BATTLE, 0x00000000 }, // 4p game modes }; -// map from character grid position id to character id -const s8 D_800F2BAC[] = { - MARIO, LUIGI, PEACH, TOAD, YOSHI, DK, WARIO, BOWSER, +// 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, }; const s16 gCupCourseOrder[5][4] = { @@ -132,24 +158,27 @@ const s16 gCupCourseOrder[5][4] = { { COURSE_BIG_DONUT, COURSE_BLOCK_FORT, COURSE_DOUBLE_DECK, COURSE_SKYSCRAPER }, }; -const s8 D_800F2BDC[4] = { 1, 0, 0, 0 }; -const s8 D_800F2BE0[4] = { 0, 1, 3, 4 }; +const s8 unref_800F2BDC[4] = { 1, 0, 0, 0 }; + +// Uses player count to set gScreenModeListIndex, the latter variable then selects a mode +// from sScreenModePlayerTable, note the 2 is not set since that's for vertical 2p screen +const s8 sScreenModeIdxFromPlayerMode[4] = { 0, 1, 3, 4 }; -const union GameModePack gSoundMenuPack = { { SOUND_STEREO, SOUND_HEADPHONES, SOUND_UNUSED, SOUND_MONO } }; +const union GameModePack sSoundMenuPack = { { SOUND_STEREO, SOUND_HEADPHONES, SOUND_UNUSED, SOUND_MONO } }; /**************************/ /** + * General menu main handler * Includes opening logo and splash screens */ void update_menus(void) { u16 controllerIdx; - if (D_800E86A4 == 0) { + if (gFadeModeSelection == FADE_MODE_NONE) { for (controllerIdx = 0; controllerIdx < 4; controllerIdx++) { - // Debug, quick jump through menus using the start button. - if ((func_800B4520() == 0) && (gEnableDebugMode) && + if ((is_screen_being_faded() == 0) && (gEnableDebugMode) && ((gControllers[controllerIdx].buttonPressed & START_BUTTON) != 0)) { // this is certainly a way to write these... switch (gMenuSelection) { @@ -210,13 +239,15 @@ void update_menus(void) { } } -// navigation of the options menu -void options_menu_act(struct Controller* controller, u16 arg1) { +/** + * Navigation of the options menu + */ +void options_menu_act(struct Controller* controller, u16 controllerIdx) { u16 btnAndStick; // sp3E struct_8018D9E0_entry* sp38; s32 res; struct_8018EE10_entry* sp30; - bool sp2C; // cursorWasMoved or communicateStoredAction + bool tempVar; // cursorWasMoved or communicateStoredAction UNUSED u32 pad; btnAndStick = (controller->buttonPressed | controller->stickPressed); @@ -225,34 +256,34 @@ void options_menu_act(struct Controller* controller, u16 arg1) { btnAndStick |= A_BUTTON; } - if (!func_800B4520()) { + if (!is_screen_being_faded()) { sp38 = find_8018D9E0_entry_dupe(0xF0); sp30 = (struct_8018EE10_entry*) D_8018D9C0; - switch (D_8018EDEC) { - case 0x15: - case 0x16: - case 0x17: - case 0x18: { - sp2C = false; - if ((btnAndStick & D_JPAD) && (D_8018EDEC < 0x18)) { - D_8018EDEC += 1; + switch (gSubMenuSelection) { + case SUB_MENU_OPTION_RETURN_GAME_SELECT: + case SUB_MENU_OPTION_SOUND_MODE: + case SUB_MENU_OPTION_COPY_CONTROLLER_PAK: + case SUB_MENU_OPTION_ERASE_ALL_DATA: { + tempVar = false; + if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_OPTION_MAX)) { + gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } sp38->unk8 = 1; - sp2C = true; + tempVar = true; } - if ((btnAndStick & U_JPAD) && (D_8018EDEC >= 0x16)) { - D_8018EDEC -= 1; + if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_OPTION_MIN)) { + gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } - sp2C = true; + tempVar = true; sp38->unk8 = -1; } - if (sp2C && gSoundMode != sp38->cursor) { + if (tempVar && gSoundMode != sp38->cursor) { gSaveData.main.saveInfo.soundMode = gSoundMode; write_save_data_grand_prix_points_and_sound_mode(); update_save_data_backup(); @@ -270,8 +301,8 @@ void options_menu_act(struct Controller* controller, u16 arg1) { return; } if (btnAndStick & A_BUTTON) { - switch (D_8018EDEC) { - case 0x16: + switch (gSubMenuSelection) { + case SUB_MENU_OPTION_SOUND_MODE: if (gSoundMode < 3) { gSoundMode += 1; } else { @@ -280,7 +311,7 @@ void options_menu_act(struct Controller* controller, u16 arg1) { if (gSoundMode == SOUND_UNUSED) { gSoundMode = SOUND_MONO; } - func_800B44BC(); + set_sound_mode(); switch (gSoundMode) { case SOUND_STEREO: play_sound2(SOUND_MENU_STEREO); @@ -293,18 +324,18 @@ void options_menu_act(struct Controller* controller, u16 arg1) { return; } break; - case 0x17: + case SUB_MENU_OPTION_COPY_CONTROLLER_PAK: switch (controller_pak_2_status()) { case PFS_INVALID_DATA: - D_8018EDEC = 0x2B; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; case PFS_NO_ERROR: func_800B6798(); - sp2C = controller_pak_1_status(); - switch (sp2C) { + tempVar = controller_pak_1_status(); + switch (tempVar) { case PFS_INVALID_DATA: - D_8018EDEC = 0x46; + gSubMenuSelection = SUB_MENU_COPY_PAK_CREATE_GAME_DATA_INIT; sp38->cursor = 0; play_sound2(SOUND_MENU_SELECT); break; @@ -312,56 +343,56 @@ void options_menu_act(struct Controller* controller, u16 arg1) { func_800B6708(); break; case PFS_NO_PAK_INSERTED: - D_8018EDEC = 0x34; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); break; case PFS_FILE_OVERFLOW: - D_8018EDEC = 0x37; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); break; case PFS_PAK_BAD_READ: - case 3: + case PFS_PAK_CORRUPTED: // unreachable, bad reads always returns previous case default: - D_8018EDEC = 0x35; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); break; } - if (sp2C == PFS_INVALID_DATA && !sp30[0].ghostDataSaved && - !sp30[1].ghostDataSaved) { - D_8018EDEC = 0x2A; + if (tempVar == PFS_INVALID_DATA && !sp30[PLAYER_ONE].ghostDataSaved && + !sp30[PLAYER_TWO].ghostDataSaved) { + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - if (sp2C == PFS_NO_ERROR) { - if (sp30[0].ghostDataSaved) { - D_8018EDEC = 0x28; + if (tempVar == PFS_NO_ERROR) { + if (sp30[PLAYER_ONE].ghostDataSaved) { + gSubMenuSelection = SUB_MENU_COPY_PAK_FROM_GHOST1_1P; play_sound2(SOUND_MENU_SELECT); - } else if (sp30[1].ghostDataSaved) { - D_8018EDEC = 0x29; + } else if (sp30[PLAYER_TWO].ghostDataSaved) { + gSubMenuSelection = SUB_MENU_COPY_PAK_FROM_GHOST2_1P; play_sound2(SOUND_MENU_SELECT); } else { - D_8018EDEC = 0x2A; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA; play_sound2(SOUND_MENU_FILE_NOT_FOUND); } } // else return? return; case PFS_NO_PAK_INSERTED: - D_8018EDEC = 0x2C; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; case PFS_PAK_BAD_READ: default: - D_8018EDEC = 0x2D; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - case 0x18: { - D_8018EDEC = 0x1E; + case SUB_MENU_OPTION_ERASE_ALL_DATA: { + gSubMenuSelection = SUB_MENU_ERASE_QUIT; play_sound2(SOUND_MENU_SELECT); return; } - case 0x15: { + case SUB_MENU_OPTION_RETURN_GAME_SELECT: { func_8009E280(); play_sound2(SOUND_MENU_GO_BACK); return; @@ -371,18 +402,18 @@ void options_menu_act(struct Controller* controller, u16 arg1) { // maybe else return?; break; } - case 0x1E: - case 0x1F: { - if ((btnAndStick & D_JPAD) && (D_8018EDEC < 0x1F)) { - D_8018EDEC += 1; + case SUB_MENU_ERASE_QUIT: + case SUB_MENU_ERASE_ERASE: { + if ((btnAndStick & D_JPAD) && (gSubMenuSelection < SUB_MENU_ERASE_MAX)) { + gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } sp38->unk8 = 1; } - if ((btnAndStick & U_JPAD) && (D_8018EDEC >= 0x1F)) { - D_8018EDEC -= 1; + if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_ERASE_MIN)) { + gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; @@ -390,18 +421,18 @@ void options_menu_act(struct Controller* controller, u16 arg1) { sp38->unk8 = -1; } if (btnAndStick & B_BUTTON) { - D_8018EDEC = 0x18; + gSubMenuSelection = SUB_MENU_OPTION_ERASE_ALL_DATA; play_sound2(SOUND_MENU_GO_BACK); return; } if (btnAndStick & A_BUTTON) { - switch (D_8018EDEC) { - case 0x1E: - D_8018EDEC = 0x18; + switch (gSubMenuSelection) { + case SUB_MENU_ERASE_QUIT: + gSubMenuSelection = SUB_MENU_OPTION_ERASE_ALL_DATA; play_sound2(SOUND_MENU_GO_BACK); break; - case 0x1F: - D_8018EDEC = 0x20; + case SUB_MENU_ERASE_ERASE: + gSubMenuSelection = SUB_MENU_SAVE_DATA_ERASED; func_800B46D0(); D_800DC5AC = 0; play_sound2(SOUND_MENU_EXPLOSION); @@ -410,25 +441,25 @@ void options_menu_act(struct Controller* controller, u16 arg1) { } break; // or return? } - case 0x20: { + case SUB_MENU_SAVE_DATA_ERASED: { if (btnAndStick & (A_BUTTON | B_BUTTON | START_BUTTON)) { - D_8018EDEC = 0x18; + gSubMenuSelection = SUB_MENU_OPTION_ERASE_ALL_DATA; play_sound2(SOUND_MENU_GO_BACK); } break; } - case 0x28: - case 0x29: { - if ((btnAndStick & D_JPAD) && (D_8018EDEC < 0x29) && (sp30[1].ghostDataSaved)) { - D_8018EDEC += 1; + 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)) { + gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } sp38->unk8 = 1; } - if ((btnAndStick & U_JPAD) && (D_8018EDEC >= 0x29) && sp30[0].ghostDataSaved) { - D_8018EDEC -= 1; + 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) { sp38->unk24 += 4.0; @@ -436,36 +467,36 @@ void options_menu_act(struct Controller* controller, u16 arg1) { sp38->unk8 = -1; } if (btnAndStick & B_BUTTON) { - D_8018EDEC = 0x17; + gSubMenuSelection = SUB_MENU_OPTION_COPY_CONTROLLER_PAK; play_sound2(SOUND_MENU_GO_BACK); return; } if (btnAndStick & A_BUTTON) { - sp38->unk20 = D_8018EDEC - 0x28; - if (sp30[sp38->unk20].courseIndex == D_8018EE10[1].courseIndex && D_8018EE10[1].ghostDataSaved) { - D_8018EDEC = 0x33; + 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) { + gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST2_2P; } else { - D_8018EDEC = 0x32; + gSubMenuSelection = SUB_MENU_COPY_PAK_TO_GHOST1_2P; } play_sound2(SOUND_MENU_SELECT); } break; } - case 0x32: - case 0x33: { + 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 + (D_8018EDEC - 0x32))->courseIndex))) || - ((D_8018EE10 + (D_8018EDEC - 0x32))->ghostDataSaved == 0)) { - if ((btnAndStick & D_JPAD) && (D_8018EDEC < 0x33)) { - D_8018EDEC += 1; + 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; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } sp38->unk8 = 1; } - if ((btnAndStick & U_JPAD) && (D_8018EDEC >= 0x33)) { - D_8018EDEC -= 1; + if ((btnAndStick & U_JPAD) && (gSubMenuSelection > SUB_MENU_COPY_PAK_TO_GHOST_MIN)) { + gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; @@ -474,48 +505,48 @@ void options_menu_act(struct Controller* controller, u16 arg1) { } } if (btnAndStick & B_BUTTON) { - D_8018EDEC = sp38->unk20 + 0x28; + gSubMenuSelection = sp38->unk20 + SUB_MENU_COPY_PAK_FROM_GHOST_MIN; play_sound2(SOUND_MENU_GO_BACK); } else if (btnAndStick & A_BUTTON) { - sp38->unk1C = D_8018EDEC - 0x32; + sp38->unk1C = gSubMenuSelection - SUB_MENU_COPY_PAK_TO_GHOST_MIN; if (D_8018EE10[(sp38->unk1C)].ghostDataSaved) { - D_8018EDEC = 0x38; + gSubMenuSelection = SUB_MENU_COPY_PAK_PROMPT_QUIT; } else { - D_8018EDEC = 0x3A; + gSubMenuSelection = SUB_MENU_COPY_PAK_START; sp38->cursor = 0; } play_sound2(SOUND_MENU_SELECT); } break; } - case 0x2A: - case 0x2B: - case 0x2C: - case 0x2D: - case 0x34: - case 0x35: - case 0x37: - case 0x3C: - case 0x41: - case 0x42: { + case SUB_MENU_COPY_PAK_ERROR_NO_GHOST_DATA: + case SUB_MENU_COPY_PAK_ERROR_NO_GAME_DATA: + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_2P: + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P: + case SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P: + case SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P: + case SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P: + case SUB_MENU_COPY_PAK_COMPLETED: + case SUB_MENU_COPY_PAK_UNABLE_COPY_FROM_1P: + case SUB_MENU_COPY_PAK_UNABLE_READ_FROM_2P: { if (btnAndStick & (A_BUTTON | B_BUTTON | START_BUTTON)) { - D_8018EDEC = 0x17; + gSubMenuSelection = SUB_MENU_OPTION_COPY_CONTROLLER_PAK; play_sound2(SOUND_MENU_GO_BACK); } break; } - case 0x38: - case 0x39: { - if ((btnAndStick & R_JPAD) && D_8018EDEC < 0x39) { - D_8018EDEC += 1; + case SUB_MENU_COPY_PAK_PROMPT_QUIT: + case SUB_MENU_COPY_PAK_PROMPT_COPY: { + if ((btnAndStick & R_JPAD) && gSubMenuSelection < SUB_MENU_COPY_PAK_PROMPT_MAX) { + gSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; } sp38->unk8 = 1; } - if ((btnAndStick & L_JPAD) && D_8018EDEC >= 0x39) { - D_8018EDEC -= 1; + if ((btnAndStick & L_JPAD) && gSubMenuSelection > SUB_MENU_COPY_PAK_PROMPT_MIN) { + gSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp38->unk24 < 4.2) { sp38->unk24 += 4.0; @@ -523,16 +554,16 @@ void options_menu_act(struct Controller* controller, u16 arg1) { sp38->unk8 = -1; } if (btnAndStick & B_BUTTON) { - D_8018EDEC = sp38->unk1C + 0x32; + gSubMenuSelection = sp38->unk1C + SUB_MENU_COPY_PAK_TO_GHOST_MIN; play_sound2(SOUND_MENU_GO_BACK); return; } if (btnAndStick & A_BUTTON) { - if (D_8018EDEC == 0x38) { - D_8018EDEC = 0x17; + if (gSubMenuSelection == SUB_MENU_COPY_PAK_PROMPT_QUIT) { + gSubMenuSelection = SUB_MENU_OPTION_COPY_CONTROLLER_PAK; play_sound2(SOUND_MENU_GO_BACK); } else { - D_8018EDEC = 0x3A; + gSubMenuSelection = SUB_MENU_COPY_PAK_START; play_sound2(SOUND_MENU_SELECT); sp38->cursor = 0; } @@ -540,22 +571,22 @@ void options_menu_act(struct Controller* controller, u16 arg1) { // return? break; } - case 0x3A: { - if (arg1 == 0) { + case SUB_MENU_COPY_PAK_START: { + if (controllerIdx == PLAYER_ONE) { sp38->cursor += 1; } if (sp38->cursor >= 3) { - D_8018EDEC = 0x3B; + gSubMenuSelection = SUB_MENU_COPY_PAK_COPYING; } break; } - case 0x3B: { + case SUB_MENU_COPY_PAK_COPYING: { res = controller_pak_2_status(); if (res == PFS_NO_ERROR) { res = func_800B65F4(sp38->unk20, sp38->unk1C); } if (res != 0) { - D_8018EDEC = 0x42; + gSubMenuSelection = SUB_MENU_COPY_PAK_UNABLE_READ_FROM_2P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } @@ -565,32 +596,32 @@ void options_menu_act(struct Controller* controller, u16 arg1) { res = func_800B6178(sp38->unk1C); } if (res != 0) { - D_8018EDEC = 0x41; + gSubMenuSelection = SUB_MENU_COPY_PAK_UNABLE_COPY_FROM_1P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); return; } - D_8018EDEC = 0x3C; + gSubMenuSelection = SUB_MENU_COPY_PAK_COMPLETED; D_8018EE10[sp38->unk1C].courseIndex = (sp30 + sp38->unk20)->courseIndex; func_800B6088(sp38->unk1C); break; } - case 0x46: { - if (arg1 == 0) { + case SUB_MENU_COPY_PAK_CREATE_GAME_DATA_INIT: { + if (controllerIdx == PLAYER_ONE) { sp38->cursor += 1; } if (sp38->cursor >= 3) { - D_8018EDEC = 0x47; + gSubMenuSelection = SUB_MENU_COPY_PAK_CREATE_GAME_DATA_DONE; } break; } - case 0x47: { + case SUB_MENU_COPY_PAK_CREATE_GAME_DATA_DONE: { if (func_800B6A68()) { - D_8018EDEC = 0x36; + gSubMenuSelection = SUB_MENU_COPY_PAK_ERROR_CANT_CREATE_1P; play_sound2(SOUND_MENU_FILE_NOT_FOUND); } else if (sp30[0].ghostDataSaved) { - D_8018EDEC = 0x28; + gSubMenuSelection = SUB_MENU_COPY_PAK_FROM_GHOST1_1P; } else { - D_8018EDEC = 0x29; + gSubMenuSelection = SUB_MENU_COPY_PAK_FROM_GHOST2_1P; } break; } @@ -600,68 +631,73 @@ void options_menu_act(struct Controller* controller, u16 arg1) { } } -// Handle navigating the data menu interface -void data_menu_act(struct Controller* controller, UNUSED u16 arg1) { - u16 buttonAndStickPress = (controller->buttonPressed | controller->stickPressed); +/** + * Navigation of the data menu + */ +void data_menu_act(struct Controller* controller, UNUSED u16 controllerIdx) { + u16 btnAndStick = (controller->buttonPressed | controller->stickPressed); // Make pressing Start have the same effect as pressing A - if ((gEnableDebugMode == 0) && ((buttonAndStickPress & 0x1000) != 0)) { - buttonAndStickPress |= 0x8000; + if ((gEnableDebugMode == 0) && ((btnAndStick & START_BUTTON) != 0)) { + btnAndStick |= A_BUTTON; } - if (func_800B4520() == 0) { - if (D_8018EDEC == 1) { + if (is_screen_being_faded() == 0) { + if (gSubMenuSelection == SUB_MENU_DATA) { // If DPad/Stick down pressed, move selection down if not already in bottom row - if ((buttonAndStickPress & 0x400) != 0) { + if ((btnAndStick & D_JPAD) != 0) { if ((gTimeTrialDataCourseIndex % 4) != 3) { ++gTimeTrialDataCourseIndex; play_sound2(SOUND_MENU_CURSOR_MOVE); } } // If DPad/Stick up pressed, move selection up if not already in top row - if ((buttonAndStickPress & 0x800) != 0) { - if ((gTimeTrialDataCourseIndex & 3) != 0) { + if ((btnAndStick & U_JPAD) != 0) { + if ((gTimeTrialDataCourseIndex % 4) != 0) { --gTimeTrialDataCourseIndex; play_sound2(SOUND_MENU_CURSOR_MOVE); } } // If DPad/Stick right pressed, move selection right if not already in right-most column - if ((buttonAndStickPress & 0x100) != 0) { + if ((btnAndStick & R_JPAD) != 0) { if ((gTimeTrialDataCourseIndex / 4) != 3) { gTimeTrialDataCourseIndex += 4; play_sound2(SOUND_MENU_CURSOR_MOVE); } } // If DPad/Stick left pressed, move selection left if not already in left-most column - if ((buttonAndStickPress & 0x200) != 0) { + if ((btnAndStick & L_JPAD) != 0) { if ((gTimeTrialDataCourseIndex / 4) != 0) { gTimeTrialDataCourseIndex -= 4; play_sound2(SOUND_MENU_CURSOR_MOVE); } } // If B pressed, go to main menu - if ((buttonAndStickPress & 0x4000) != 0) { + if ((btnAndStick & B_BUTTON) != 0) { func_8009E258(); play_sound2(SOUND_MENU_GO_BACK); return; } // If A pressed, go to selected course's records - if ((buttonAndStickPress & 0x8000) != 0) { - gCourseRecordsMenuSelection = 0; + if ((btnAndStick & A_BUTTON) != 0) { + gCourseRecordsMenuSelection = COURSE_RECORDS_MENU_RETURN_MENU; func_8009E1C0(); play_sound2(SOUND_MENU_OK_CLICKED); } } - // If D_8018EDEC != 1 and A pressed, go to main menu - // (Will D_8018EDEC ever not equal 1 when entering the data menu?) - else if ((buttonAndStickPress & 0x8000) != 0) { + // If gSubMenuSelection is not SUB_MENU_DATA and A pressed, go to main menu + // This condition is not reachable but this failsafe was added nonetheless + else if ((btnAndStick & A_BUTTON) != 0) { func_8009E258(); play_sound2(SOUND_MENU_OK_CLICKED); } } } -void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { +/** + * Navigation of the course records data menu + */ +void course_data_menu_act(struct Controller* controller, UNUSED u16 controllerIdx) { u16 btnAndStick; // sp2E struct_8018D9E0_entry* sp28; CourseTimeTrialRecords* sp24; @@ -673,9 +709,9 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { btnAndStick |= A_BUTTON; } - if (!func_800B4520()) { - switch (D_8018EDEC) { - case 0x0B: { + if (!is_screen_being_faded()) { + switch (gSubMenuSelection) { + case SUB_MENU_DATA_OPTIONS: { if ((btnAndStick & L_JPAD) && (gTimeTrialDataCourseIndex > 0)) { gTimeTrialDataCourseIndex -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); @@ -689,15 +725,15 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { sp28 = find_8018D9E0_entry_dupe(0xE8); sp24 = &gSaveData.allCourseTimeTrialRecords.cupRecords[gTimeTrialDataCourseIndex / 4] .courseRecords[gTimeTrialDataCourseIndex % 4]; - if (gCourseRecordsMenuSelection == 2 && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { gCourseRecordsMenuSelection -= 1; } - if (gCourseRecordsMenuSelection == 1 && sp24->unknownBytes[0] == 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection -= 1; } - if ((btnAndStick & U_JPAD) && (gCourseRecordsMenuSelection > 0)) { + if ((btnAndStick & U_JPAD) && (gCourseRecordsMenuSelection > COURSE_RECORDS_MENU_MIN)) { gCourseRecordsMenuSelection -= 1; if (gCourseRecordsMenuSelection == 1 && sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection -= 1; @@ -709,17 +745,17 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { sp28->unk8 = -1; } - if ((btnAndStick & D_JPAD) && (gCourseRecordsMenuSelection < 2)) { + if ((btnAndStick & D_JPAD) && (gCourseRecordsMenuSelection < COURSE_RECORDS_MENU_MAX)) { gCourseRecordsMenuSelection += 1; - if (gCourseRecordsMenuSelection == 1 && sp24->unknownBytes[0] == 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_RECORDS && sp24->unknownBytes[0] == 0) { gCourseRecordsMenuSelection += 1; } - if (gCourseRecordsMenuSelection == 2 && func_800B639C(gTimeTrialDataCourseIndex) < 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_ERASE_GHOST && func_800B639C(gTimeTrialDataCourseIndex) < 0) { if (sp24->unknownBytes[0] == 0) { - gCourseRecordsMenuSelection = 0; + gCourseRecordsMenuSelection = COURSE_RECORDS_MENU_RETURN_MENU; } else { - gCourseRecordsMenuSelection = 1; + gCourseRecordsMenuSelection = COURSE_RECORDS_MENU_ERASE_RECORDS; } } else { play_sound2(SOUND_MENU_CURSOR_MOVE); @@ -737,21 +773,21 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { if (sp28->unk24 < 4.2) { sp28->unk24 += 4.0; } - if (gCourseRecordsMenuSelection == 0) { + if (gCourseRecordsMenuSelection == COURSE_RECORDS_MENU_RETURN_MENU) { func_8009E208(); play_sound2(SOUND_MENU_GO_BACK); } else { - D_8018EDEC = 0x0C; - D_8018EDF9 = 0; + gSubMenuSelection = SUB_MENU_DATA_ERASE_CONFIRM; + gCourseRecordsSubMenuSelection = COURSE_RECORDS_SUB_MENU_QUIT; play_sound2(SOUND_MENU_SELECT); } } break; } - case 0x0C: { + case SUB_MENU_DATA_ERASE_CONFIRM: { sp28 = find_8018D9E0_entry_dupe(0xE9); - if ((btnAndStick & U_JPAD) && (D_8018EDF9 > 0)) { - D_8018EDF9 -= 1; + if ((btnAndStick & U_JPAD) && (gCourseRecordsSubMenuSelection > COURSE_RECORDS_SUB_MENU_MIN)) { + gCourseRecordsSubMenuSelection -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp28->unk24 < 4.2) { sp28->unk24 += 4.0; @@ -759,8 +795,8 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { sp28->unk8 = -1; } - if ((btnAndStick & D_JPAD) && (D_8018EDF9 <= 0)) { - D_8018EDF9 += 1; + if ((btnAndStick & D_JPAD) && (gCourseRecordsSubMenuSelection < COURSE_RECORDS_SUB_MENU_MAX)) { + gCourseRecordsSubMenuSelection += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); if (sp28->unk24 < 4.2) { sp28->unk24 += 4.0; @@ -769,28 +805,28 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { } if (btnAndStick & B_BUTTON) { - D_8018EDEC = 0xB; + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; play_sound2(SOUND_MENU_GO_BACK); } else if (btnAndStick & A_BUTTON) { - if (D_8018EDF9 != 0) { + if (gCourseRecordsSubMenuSelection != COURSE_RECORDS_SUB_MENU_QUIT) { res = 0; switch (gCourseRecordsMenuSelection) { - case 1: { + case COURSE_RECORDS_MENU_ERASE_RECORDS: { func_800B4728(gTimeTrialDataCourseIndex); func_800B559C(gTimeTrialDataCourseIndex); play_sound2(SOUND_MENU_EXPLOSION); res = -1; break; } - case 2: { + case COURSE_RECORDS_MENU_ERASE_GHOST: { res = func_800B639C(gTimeTrialDataCourseIndex); if (res >= 0) { if (func_800B69BC(res) != 0) { - D_8018EDEC = 0x0D; + gSubMenuSelection = SUB_MENU_DATA_CANT_ERASE; play_sound2(SOUND_MENU_FILE_NOT_FOUND); } else { play_sound2(SOUND_MENU_EXPLOSION); - D_8018EDEC = 0x0B; + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; } } break; @@ -798,18 +834,18 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { } if (!(res + 1)) { - D_8018EDEC = 0xB; + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; } } else { play_sound2(SOUND_MENU_GO_BACK); - D_8018EDEC = 0xB; + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; } } break; } - case 0x0D: { + case SUB_MENU_DATA_CANT_ERASE: { if (btnAndStick & (A_BUTTON | B_BUTTON | START_BUTTON)) { - D_8018EDEC = 0xB; + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; } break; } @@ -820,87 +856,76 @@ void course_data_menu_act(struct Controller* controller, UNUSED u16 arg1) { /** * On input skip logo screen **/ -void logo_intro_menu_act(struct Controller* arg0, UNUSED u16 arg1) { - u16 anyInput = arg0->buttonPressed | arg0->stickPressed; - -// Note: Choosing a course in the middle of a cup -// will contain no definition for player staging/lineup. -// #define SKIP_TO_RACE -#ifdef SKIP_TO_RACE - gGamestateNext = 4; // Enter race state - gCCSelection = CC_100; - gCupSelection = 1; - gCourseIndexInCup = 0; - gCurrentCourseId = 0; - gScreenModeSelection = SCREEN_MODE_1P; - gCharacterSelections[0] = 0; - gModeSelection = GRAND_PRIX; - gPlayerCount = 1; -#endif +void logo_intro_menu_act(struct Controller* controller, UNUSED u16 controllerIdx) { + u16 btnAndStick = (controller->buttonPressed | controller->stickPressed); - if ((func_800B4520() == 0) && (anyInput)) { - // Audio related + // If any button is pressed then fade audio out + if ((is_screen_being_faded() == 0) && (btnAndStick)) { + // TODO: Label audio functions func_800CA388(0x3C); func_8009E1E4(); } } -void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { - u16 buttonAndStickPress; +/** + * Navigation of the controller pak table data + */ +void controller_pak_menu_act(struct Controller* controller, UNUSED u16 controllerIdx) { + u16 btnAndStick; OSPfsState* osPfsState; s32 selectedTableRow; UNUSED s8 pad; - buttonAndStickPress = controller->buttonPressed | controller->stickPressed; - if (func_800B4520() == 0) { + btnAndStick = controller->buttonPressed | controller->stickPressed; + if (is_screen_being_faded() == 0) { switch (gControllerPakMenuSelection) { case CONTROLLER_PAK_MENU_SELECT_RECORD: - if ((buttonAndStickPress & 0x9000) != 0) { + if ((btnAndStick & (A_BUTTON | START_BUTTON)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; play_sound2(SOUND_MENU_SELECT); return; } - if ((buttonAndStickPress & 0x300) != 0) { + if ((btnAndStick & (L_JPAD | R_JPAD)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_END; play_sound2(SOUND_MENU_CURSOR_MOVE); return; } break; case CONTROLLER_PAK_MENU_END: - if ((buttonAndStickPress & 0x9000) != 0) { + if ((btnAndStick & (A_BUTTON | START_BUTTON)) != 0) { play_sound2(SOUND_MENU_SELECT); func_8009E1C0(); gControllerPak1State = BAD; return; } - if ((buttonAndStickPress & 0x300) != 0) { + if ((btnAndStick & (L_JPAD | R_JPAD)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; play_sound2(SOUND_MENU_CURSOR_MOVE); return; } break; case CONTROLLER_PAK_MENU_TABLE_GAME_DATA: - if ((buttonAndStickPress & 0x9000) != 0) { - selectedTableRow = D_800E86C4[gControllerPakSelectedTableRow + 2] - 1; + if ((btnAndStick & (A_BUTTON | START_BUTTON)) != 0) { + selectedTableRow = gControllerPakVisibleTableRows[gControllerPakSelectedTableRow + 2] - 1; if (pfsError[selectedTableRow] == 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT; play_sound2(SOUND_MENU_SELECT); return; } - } else if ((buttonAndStickPress & 0x4000) != 0) { - if (D_800E86D0[0] == 0) { + } else if ((btnAndStick & B_BUTTON) != 0) { + if (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; play_sound2(SOUND_MENU_GO_BACK); return; } - } else if ((buttonAndStickPress & 0x800) != 0) { - if (D_800E86D0[0] == 0) { + } else if ((btnAndStick & U_JPAD) != 0) { + if (gControllerPakScrollDirection == CONTROLLER_PAK_SCROLL_DIR_NONE) { --gControllerPakSelectedTableRow; if (gControllerPakSelectedTableRow < 0) { gControllerPakSelectedTableRow = 0; - if (D_800E86C4[gControllerPakSelectedTableRow + 2] != 1) { - D_800E86D0[0] = 2; + if (gControllerPakVisibleTableRows[gControllerPakSelectedTableRow + 2] != 1) { + gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_UP; play_sound2(SOUND_MENU_CURSOR_MOVE); return; } @@ -909,12 +934,12 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { return; } } - } else if (((buttonAndStickPress & 0x400) != 0) && (D_800E86D0[0] == 0)) { + } 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; - if (D_800E86C4[gControllerPakSelectedTableRow + 2] != 0x10) { - D_800E86D0[0] = 1; + if (gControllerPakVisibleTableRows[gControllerPakSelectedTableRow + 2] != 16) { + gControllerPakScrollDirection = CONTROLLER_PAK_SCROLL_DIR_DOWN; play_sound2(SOUND_MENU_CURSOR_MOVE); return; } @@ -925,29 +950,29 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { } break; case CONTROLLER_PAK_MENU_QUIT: - if ((buttonAndStickPress & 0xD000) != 0) { + if ((btnAndStick & (A_BUTTON | B_BUTTON | START_BUTTON)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; play_sound2(SOUND_MENU_GO_BACK); return; } - if ((buttonAndStickPress & 0x300) != 0) { + if ((btnAndStick & (L_JPAD | R_JPAD)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASE; play_sound2(SOUND_MENU_CURSOR_MOVE); return; } break; case CONTROLLER_PAK_MENU_ERASE: - if ((buttonAndStickPress & 0x9000) != 0) { + if ((btnAndStick & (A_BUTTON | START_BUTTON)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_GO_TO_ERASING; play_sound2(SOUND_MENU_SELECT); return; } - if ((buttonAndStickPress & 0x4000) != 0) { + if ((btnAndStick & B_BUTTON) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; play_sound2(SOUND_MENU_GO_BACK); return; } - if ((buttonAndStickPress & 0x300) != 0) { + if ((btnAndStick & (L_JPAD | R_JPAD)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_QUIT; play_sound2(SOUND_MENU_CURSOR_MOVE); return; @@ -957,7 +982,7 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_ERASING; return; case CONTROLLER_PAK_MENU_ERASING: - selectedTableRow = D_800E86C4[gControllerPakSelectedTableRow + 2] - 1; + selectedTableRow = gControllerPakVisibleTableRows[gControllerPakSelectedTableRow + 2] - 1; osPfsState = &pfsState[selectedTableRow]; switch (osPfsDeleteFile(&gControllerPak1FileHandle, osPfsState->company_code, osPfsState->game_code, @@ -981,7 +1006,7 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { case CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED: case CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK: case CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED: - if ((buttonAndStickPress & 0x9000) != 0) { + if ((btnAndStick & (A_BUTTON | START_BUTTON)) != 0) { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_TABLE_GAME_DATA; } break; @@ -989,22 +1014,26 @@ void controller_pak_menu_act(struct Controller* controller, UNUSED u16 arg1) { } } -void splash_menu_act(struct Controller* controller, u16 arg1) { +/** + * Navigation of the main splash start screen menu + * Also handles debug menu options + */ +void splash_menu_act(struct Controller* controller, u16 controllerIdx) { u16 btnAndStick; u16 i; - s32 sp28; + s32 isDebug; - sp28 = true; + isDebug = true; btnAndStick = controller->buttonPressed | controller->stickPressed; - if (func_800B4520() == 0) { - if (arg1 == 0) { + if (is_screen_being_faded() == 0) { + if (controllerIdx == PLAYER_ONE) { gMenuDelayTimer += 1; } switch (gDebugMenuSelection) { case DEBUG_MENU_DISABLED: { - sp28 = false; - if ((gMenuDelayTimer >= 0x2E) && (btnAndStick & (A_BUTTON | START_BUTTON))) { + isDebug = false; + if ((gMenuDelayTimer >= 46) && (btnAndStick & (A_BUTTON | START_BUTTON))) { func_8009E1C0(); func_800CA330(0x19); play_sound2(SOUND_INTRO_ENTER_MENU); @@ -1017,7 +1046,7 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { if (btnAndStick & (R_JPAD | L_JPAD)) { play_sound2(SOUND_MENU_CURSOR_MOVE); if (gEnableDebugMode) { - gEnableDebugMode = DEBUG_MODE; + gEnableDebugMode = DEBUG_MODE_TOGGLE; } else { gEnableDebugMode = true; } @@ -1056,15 +1085,15 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { break; } case DEBUG_MENU_SCREEN_MODE: { - if ((btnAndStick & R_JPAD) && (D_8018EDF1 < 4)) { - D_8018EDF1 += 1; + if ((btnAndStick & R_JPAD) && (gScreenModeListIndex < 4)) { + gScreenModeListIndex += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); - gScreenModeSelection = D_800F2B50[D_8018EDF1]; + gScreenModeSelection = sScreenModePlayerTable[gScreenModeListIndex]; } - if ((btnAndStick & L_JPAD) && (D_8018EDF1 > 0)) { - D_8018EDF1 -= 1; + if ((btnAndStick & L_JPAD) && (gScreenModeListIndex > 0)) { + gScreenModeListIndex -= 1; play_sound2(SOUND_MENU_CURSOR_MOVE); - gScreenModeSelection = D_800F2B50[D_8018EDF1]; + gScreenModeSelection = sScreenModePlayerTable[gScreenModeListIndex]; } if (btnAndStick & U_JPAD) { gDebugMenuSelection = DEBUG_MENU_COURSE; @@ -1077,7 +1106,7 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { break; } case DEBUG_MENU_PLAYER: { - if ((btnAndStick & R_JPAD) && (*gCharacterSelections < 7)) { + if ((btnAndStick & R_JPAD) && (gCharacterSelections[0] < 7)) { gCharacterSelections[0] += 1; play_sound2(SOUND_MENU_CURSOR_MOVE); } @@ -1102,7 +1131,7 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { gSoundMode = SOUND_MONO; } play_sound2(SOUND_MENU_CURSOR_MOVE); - func_800B44BC(); + set_sound_mode(); gSaveData.main.saveInfo.soundMode = gSoundMode; write_save_data_grand_prix_points_and_sound_mode(); update_save_data_backup(); @@ -1113,7 +1142,7 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { gSoundMode = SOUND_HEADPHONES; } play_sound2(SOUND_MENU_CURSOR_MOVE); - func_800B44BC(); + set_sound_mode(); gSaveData.main.saveInfo.soundMode = gSoundMode; write_save_data_grand_prix_points_and_sound_mode(); } @@ -1164,13 +1193,13 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { break; } - gPlayerCountSelection1 = gPlayerCount = D_800F2B58[D_8018EDF1]; + gPlayerCountSelection1 = gPlayerCount = sScreenModePlayerCount[gScreenModeListIndex]; - if (sp28) { + if (isDebug) { if (btnAndStick & (A_BUTTON | START_BUTTON)) { func_8009E1C0(); func_800CA330(0x19); - gDebugMenuSelection = DEBUG_MENU_EXITED; + gDebugMenuSelection = DEBUG_MENU_OPTION_SELECTED; if (controller->button & CONT_L) { gDemoMode = DEMO_MODE_ACTIVE; @@ -1182,15 +1211,15 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { if (btnAndStick & A_BUTTON) { gDebugGotoScene = DEBUG_GOTO_ENDING; } else { - gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_CC_EXTRA; + gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA; } } play_sound2(SOUND_MENU_OK_CLICKED); } else if ((btnAndStick & B_BUTTON) && (controller->button & Z_TRIG)) { func_8009E1C0(); func_800CA330(0x19); - gDebugMenuSelection = DEBUG_MENU_EXITED; - gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_CC_50; + gDebugMenuSelection = DEBUG_MENU_OPTION_SELECTED; + gDebugGotoScene = DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT; play_sound2(SOUND_MENU_OK_CLICKED); } else if (btnAndStick & CONT_R) { gDebugMenuSelection = DEBUG_MENU_DISABLED; @@ -1200,21 +1229,21 @@ void splash_menu_act(struct Controller* controller, u16 arg1) { } } -void func_800B28C8(void) { +void setup_game_mode_selected(void) { // For Grand Prix and Versus, this will be the CC mode selected. For Time Trials, it will // be whether 'Begin' or 'Data' is selected. Not used for Battle. - s8 temp_v0 = D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + s8 subMenuMode = gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; // Determine which game mode was selected based on the number of players and the row selected on the main menu - switch (gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]) { + switch (gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { case GRAND_PRIX: - gCCSelection = temp_v0; + gCCSelection = subMenuMode; gPlaceItemBoxes = 1; - gIsMirrorMode = (temp_v0 == CC_EXTRA) ? 1 : 0; + gIsMirrorMode = (subMenuMode == CC_EXTRA) ? 1 : 0; break; case VERSUS: - gCCSelection = temp_v0; + gCCSelection = subMenuMode; gPlaceItemBoxes = 1; - gIsMirrorMode = (temp_v0 == CC_EXTRA) ? 1 : 0; + gIsMirrorMode = (subMenuMode == CC_EXTRA) ? 1 : 0; break; case BATTLE: gPlaceItemBoxes = 1; @@ -1225,18 +1254,22 @@ void func_800B28C8(void) { gIsMirrorMode = 0; gPlaceItemBoxes = 0; - if ((temp_v0 && temp_v0) && temp_v0) {} + if ((subMenuMode && subMenuMode) && subMenuMode) {} break; } } +/** + * Navigation of the main game mode select screen + */ #ifdef NON_MATCHING -// nonmatching: regalloc; arg1 is not AND-ed back into $a1, reg chaos follows -void main_menu_act(struct Controller* controller, u16 arg1) { +// https://decomp.me/scratch/93qj8 +// nonmatching: regalloc; controllerIdx is not AND-ed back into $a1, reg chaos follows +void main_menu_act(struct Controller* controller, u16 controllerIdx) { u16 btnAndStick; // sp2E - s32 sp28; - bool sp24; + s32 subMode; + bool cursorMoved; s32 newMode; // temp_v1_2? btnAndStick = controller->buttonPressed | controller->stickPressed; @@ -1244,21 +1277,21 @@ void main_menu_act(struct Controller* controller, u16 arg1) { btnAndStick |= A_BUTTON; } - if (!func_800B4520()) { - switch (gMainMenuSelectionDepth) { - case BLANK_MAIN_MENU: { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + if (!is_screen_being_faded()) { + switch (gMainMenuSelection) { + case MAIN_MENU_NONE: { + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; break; } - case PLAYER_NUM_SELECTION: { + case MAIN_MENU_PLAYER_SELECT: { if ((btnAndStick & R_JPAD) && gPlayerCount < 4) { gPlayerCount += 1; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } if ((btnAndStick & L_JPAD) && gPlayerCount >= 2) { gPlayerCount -= 1; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } // L800B2B38 @@ -1279,190 +1312,190 @@ void main_menu_act(struct Controller* controller, u16 arg1) { if (btnAndStick & B_BUTTON) { func_8009E0F0(0x14); func_800CA330(0x19); - D_8018EDE0 = 1; + gMenuFadeType = MENU_FADE_TYPE_BACK; play_sound2(SOUND_MENU_GO_BACK); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & A_BUTTON) { // L800B2C00 - gMainMenuSelectionDepth = GAME_MODE_SELECTION; - func_800B44AC(); + gMainMenuSelection = MAIN_MENU_MODE_SELECT; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_SELECT); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & CONT_L) { // L800B2C58 - gMainMenuSelectionDepth = OPTIONS_SELECTION; + gMainMenuSelection = MAIN_MENU_OPTION; func_8009E280(); play_sound2(SOUND_MENU_OPTION); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & CONT_R) { - gMainMenuSelectionDepth = DATA_SELECTION; + gMainMenuSelection = MAIN_MENU_DATA; func_8009E258(); play_sound2(SOUND_MENU_DATA); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } break; } - case GAME_MODE_SELECTION: { + case MAIN_MENU_MODE_SELECT: { if (btnAndStick & D_JPAD) { - if (D_800E86AC[gPlayerCount - 1] < gPlayerModeSelection[gPlayerCount - 1]) { - D_800E86AC[gPlayerCount - 1] += 1; - func_800B44AC(); + if (gGameModeMenuColumn[gPlayerCount - 1] < gPlayerModeSelection[gPlayerCount - 1]) { + gGameModeMenuColumn[gPlayerCount - 1] += 1; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } } // L800B2D94 if (btnAndStick & U_JPAD) { - if (D_800E86AC[gPlayerCount - 1] > 0) { - D_800E86AC[gPlayerCount - 1] -= 1; - func_800B44AC(); + if (gGameModeMenuColumn[gPlayerCount - 1] > 0) { + gGameModeMenuColumn[gPlayerCount - 1] -= 1; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } } // L800B2DE0 if (btnAndStick & B_BUTTON) { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; - func_800B44AC(); + gMainMenuSelection = MAIN_MENU_PLAYER_SELECT; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_GO_BACK); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & A_BUTTON) { // L800B2E3C - switch (gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]) { + switch (gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { case 0: - gMainMenuSelectionDepth = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT; play_sound2(SOUND_MENU_GP); break; case 2: - gMainMenuSelectionDepth = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT; play_sound2(SOUND_MENU_VERSUS); break; case 1: - gMainMenuSelectionDepth = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT; play_sound2(SOUND_MENU_TIME_TRIALS); break; case 3: - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION; + gMainMenuSelection = MAIN_MENU_OK_SELECT; play_sound2(SOUND_MENU_BATTLE); break; default: - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION; + gMainMenuSelection = MAIN_MENU_OK_SELECT; break; } // L800B2F04 - func_800B44AC(); + reset_cycle_flash_menu(); gMenuTimingCounter = 0; - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } break; } - case GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION: - case TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT: { - if (arg1 == 0) { + case MAIN_MENU_MODE_SUB_SELECT: + case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: { + if (controllerIdx == PLAYER_ONE) { gMenuTimingCounter++; if ((gMenuTimingCounter == 100 || gMenuTimingCounter % 300 == 0)) { // L800B2FAC - if (gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]] == 0 || - gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]] == 2) { + if (gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]] == 0 || + gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]] == 2) { play_sound2(SOUND_MENU_SELECT_LEVEL); } } } // L800B3000 - sp28 = D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; - if ((btnAndStick & U_JPAD) && (sp28 > 0)) { - D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]] -= 1; - func_800B44AC(); + subMode = gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; + if ((btnAndStick & U_JPAD) && (subMode > 0)) { + gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]] -= 1; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } // L800B3068 if (btnAndStick & D_JPAD) { - sp24 = false; + cursorMoved = false; if (func_800B555C()) { - if (sp28 < gGameModePlayerColumnExtra[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1] + 1]) { - sp24 = true; + if (subMode < sGameModePlayerColumnExtra[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + cursorMoved = true; } } else { // L800B30D4 - if (sp28 < gGameModePlayerColumnDefault[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1] + 1]) { - sp24 = true; + if (subMode < sGameModePlayerColumnDefault[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { + cursorMoved = true; } } // L800B3110 - if (sp24) { - D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]++; - func_800B44AC(); + if (cursorMoved) { + gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]++; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } } // L800B3150 - sp28 = D_800E86B0[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + subMode = gGameModeSubMenuColumn[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; if (btnAndStick & B_BUTTON) { - gMainMenuSelectionDepth = GAME_MODE_SELECTION; - func_800B44AC(); + gMainMenuSelection = MAIN_MENU_MODE_SELECT; + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_GO_BACK); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & A_BUTTON) { // L800B31DC - func_800B44AC(); - if (gPlayerCount == 1 && D_800E86AC[gPlayerCount - 1] == 1 && sp28 == 1) { + reset_cycle_flash_menu(); + if (gPlayerCount == 1 && gGameModeMenuColumn[gPlayerCount - 1] == 1 && subMode == 1) { // DATA func_8009E258(); play_sound2(SOUND_MENU_DATA); - } else { - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION; + } else { // BEGIN + gMainMenuSelection = MAIN_MENU_OK_SELECT; play_sound2(SOUND_MENU_SELECT); gMenuTimingCounter = 0; } - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else { // L800B3294 - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } break; } - case CONFIRM_OK_SELECTION: - case CONFIRM_OK_SELECTION_FROM_BACK_OUT: { - if ((arg1 == 0) && (++gMenuTimingCounter == 60 || gMenuTimingCounter % 300 == 0)) { + case MAIN_MENU_OK_SELECT: + case MAIN_MENU_OK_SELECT_BACK_OUT: { + if ((controllerIdx == PLAYER_ONE) && (++gMenuTimingCounter == 60 || gMenuTimingCounter % 300 == 0)) { play_sound2(SOUND_MENU_OK); } // L800B330C if (btnAndStick & B_BUTTON) { - switch (gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]) { + switch (gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]) { case 0: case 1: case 2: - gMainMenuSelectionDepth = GAME_MODE_CC_OR_TIME_TRIALS_OPTIONS_SELECTION; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT; break; case 3: default: - gMainMenuSelectionDepth = GAME_MODE_SELECTION; + gMainMenuSelection = MAIN_MENU_MODE_SELECT; break; } // L800B3384 - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_GO_BACK); gMenuTimingCounter = 0; - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else if (btnAndStick & A_BUTTON) { // L800B33D8 func_8009E1C0(); play_sound2(SOUND_MENU_OK_CLICKED); - func_800B28C8(); - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + setup_game_mode_selected(); + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } else { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; } break; } - case OPTIONS_SELECTION: - case DATA_SELECTION: { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + case MAIN_MENU_OPTION: + case MAIN_MENU_DATA: { + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; break; } default: { - newMode = gGameModePlayerSelection[gPlayerCount - 1][D_800E86AC[gPlayerCount - 1]]; + newMode = gGameModePlayerSelection[gPlayerCount - 1][gGameModeMenuColumn[gPlayerCount - 1]]; break; } } @@ -1473,7 +1506,10 @@ void main_menu_act(struct Controller* controller, u16 arg1) { GLOBAL_ASM("asm/non_matchings/menus/main_menu_act.s") #endif -// check if there is no currently selected and/or hovered character at grid position `gridId` +/** + * Check if there is no currently selected and/or + * hovered character at grid position `gridId` + */ bool is_character_spot_free(s32 gridId) { s32 i; for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { @@ -1484,14 +1520,18 @@ bool is_character_spot_free(s32 gridId) { return true; } +/** + * Navigation of the player select screen + * Grid positions are from right to left, then top to bottom + */ #ifdef NON_MATCHING -// grid positions are from right to left, then top to bottom +// https://decomp.me/scratch/6R4jX // nonmatching: the gCharacterGridSelections pointer is not promoted to $s0 -void player_select_menu_act(struct Controller* controller, u16 arg1) { +void player_select_menu_act(struct Controller* controller, u16 controllerIdx) { s8* bar; s8 selected; s8 i; - s8 saved_selection; + s8 savedSelection; u16 btnAndStick; btnAndStick = (controller->buttonPressed) | (controller->stickPressed); @@ -1499,11 +1539,11 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { btnAndStick |= A_BUTTON; } - if (!func_800B4520()) { - switch (D_8018EDEE) { - case 1: { - saved_selection = gCharacterGridSelections[arg1]; - if (saved_selection == 0) { + if (!is_screen_being_faded()) { + switch (gPlayerSelectMenuSelection) { + case PLAYER_SELECT_MENU_MAIN: { + savedSelection = gCharacterGridSelections[controllerIdx]; + if (savedSelection == 0) { if (btnAndStick & B_BUTTON) { func_8009E208(); play_sound2(0x49008002); @@ -1512,8 +1552,8 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B3630 if (btnAndStick & B_BUTTON) { - if (D_8018EDE8[arg1]) { - D_8018EDE8[arg1] = false; + if (gCharacterGridIsSelected[controllerIdx]) { + gCharacterGridIsSelected[controllerIdx] = false; play_sound2(SOUND_MENU_GO_BACK); } else { func_8009E208(); @@ -1521,16 +1561,16 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } } // L800B3684 - if ((btnAndStick & A_BUTTON) && (D_8018EDE8[arg1] == 0)) { - D_8018EDE8[arg1] = true; - i = D_800F2BAC[gCharacterGridSelections[arg1] - 1]; - func_800C90F4(arg1, 0x2900800e + (i << 4)); + if ((btnAndStick & A_BUTTON) && (gCharacterGridIsSelected[controllerIdx] == 0)) { + gCharacterGridIsSelected[controllerIdx] = true; + i = sCharacterGridOrder[gCharacterGridSelections[controllerIdx] - 1]; + func_800C90F4(controllerIdx, 0x2900800e + (i << 4)); } // L800B36F4 selected = false; - for (i = 0; i < 4; i++) { // for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { + for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { if ((gCharacterGridSelections[i] != 0) && - (D_8018EDE8[i] == 0)) { //(gCharacterGridSelections[i] && D_8018EDE8[i]) { + (gCharacterGridIsSelected[i] == 0)) { selected = true; break; } @@ -1538,19 +1578,19 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { // L800B3738 if (!selected) { - D_8018EDEE = 2; - func_800B44AC(); + gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_OK; + reset_cycle_flash_menu(); gMenuTimingCounter = 0; } // L800B3768 - if (D_8018EDE8[arg1] == 0) { + if (gCharacterGridIsSelected[controllerIdx] == 0) { if ((btnAndStick & CONT_RIGHT) && (btnAndStick & CONT_DOWN)) { - if (saved_selection == 1 || saved_selection == 2 || saved_selection == 3) { + if (savedSelection == 1 || savedSelection == 2 || savedSelection == 3) { // L800B37B0 - saved_selection += 5; - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + savedSelection += 5; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); } } @@ -1558,10 +1598,10 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B37E4 if ((btnAndStick & CONT_LEFT) && (btnAndStick & CONT_DOWN)) { - if (saved_selection == 2 || saved_selection == 3 || saved_selection == 4) { - saved_selection += 3; - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (savedSelection == 2 || savedSelection == 3 || savedSelection == 4) { + savedSelection += 3; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); } } @@ -1569,10 +1609,10 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B3844 if ((btnAndStick & CONT_RIGHT) && (btnAndStick & CONT_UP)) { - if (saved_selection == 5 || saved_selection == 6 || saved_selection == 7) { - saved_selection -= 3; - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (savedSelection == 5 || savedSelection == 6 || savedSelection == 7) { + savedSelection -= 3; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); } } @@ -1580,10 +1620,10 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B38A0 if ((btnAndStick & CONT_LEFT) && (btnAndStick & CONT_UP)) { - if (saved_selection == 6 || saved_selection == 7 || saved_selection == 8) { - saved_selection -= 5; - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (savedSelection == 6 || savedSelection == 7 || savedSelection == 8) { + savedSelection -= 5; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); } } @@ -1591,49 +1631,49 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B38FC if (btnAndStick & CONT_RIGHT) { - if (saved_selection == 4 || saved_selection == 8) + if (savedSelection == 4 || savedSelection == 8) return; - saved_selection += 1; + savedSelection += 1; do { // L800B391C - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); // play_sound2(0x49008000); break; } - saved_selection += 1; - if ((saved_selection == 5) || (saved_selection == 9)) + savedSelection += 1; + if ((savedSelection == 5) || (savedSelection == 9)) return; - } while (saved_selection < 10); + } while (savedSelection < 10); return; } // L800B3978 if (btnAndStick & CONT_LEFT) { - if (saved_selection == 1 || saved_selection == 5) + if (savedSelection == 1 || savedSelection == 5) return; - saved_selection -= 1; + savedSelection -= 1; do { - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); break; } - saved_selection -= 1; - if ((saved_selection == 0) || (saved_selection == 4)) + savedSelection -= 1; + if ((savedSelection == 0) || (savedSelection == 4)) return; - } while (saved_selection >= 0); + } while (savedSelection >= 0); return; } // L800B39F4 - if ((btnAndStick & CONT_UP) && (saved_selection >= 5)) { - saved_selection = saved_selection - 4; + if ((btnAndStick & CONT_UP) && (savedSelection >= 5)) { + savedSelection = savedSelection - 4; } - if ((btnAndStick & CONT_DOWN) && (saved_selection < 5)) { - saved_selection = saved_selection + 4; + if ((btnAndStick & CONT_DOWN) && (savedSelection < 5)) { + savedSelection = savedSelection + 4; } // L800B3A30 - if (is_character_spot_free(saved_selection)) { - gCharacterGridSelections[arg1] = saved_selection; + if (is_character_spot_free(savedSelection)) { + gCharacterGridSelections[controllerIdx] = savedSelection; play_sound2(0x49008000); } } @@ -1641,7 +1681,7 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } case 2: case 3: - if (arg1 == 0) { + if (controllerIdx == 0) { gMenuTimingCounter++; if ((gMenuTimingCounter == 60) || ((gMenuTimingCounter % 300) == 0)) { // L800B3A94 @@ -1650,8 +1690,8 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { } // L800B3AA4 if (btnAndStick & B_BUTTON) { - D_8018EDEE = 1; - D_8018EDE8[arg1] = false; + gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_MAIN; + gCharacterGridIsSelected[controllerIdx] = false; play_sound2(SOUND_MENU_GO_BACK); break; } @@ -1665,8 +1705,8 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { break; } // L800B3B24 - if (gCharacterGridSelections[arg1] != 0) { - gCharacterSelections[arg1] = D_800F2BAC[gCharacterGridSelections[arg1] - 1]; + if (gCharacterGridSelections[controllerIdx] != 0) { + gCharacterSelections[controllerIdx] = sCharacterGridOrder[gCharacterGridSelections[controllerIdx] - 1]; } } // L800B3B44 @@ -1675,104 +1715,106 @@ void player_select_menu_act(struct Controller* controller, u16 arg1) { GLOBAL_ASM("asm/non_matchings/menus/player_select_menu_act.s") #endif -// Handle navigating the course menu interface -void course_select_menu_act(struct Controller* arg0, u16 arg1) { - u16 buttonAndStickPress = (arg0->buttonPressed | arg0->stickPressed); +/** + * Navigation of the map select course menu screen + */ +void course_select_menu_act(struct Controller* arg0, u16 controllerIdx) { + u16 btnAndStick = (arg0->buttonPressed | arg0->stickPressed); - if ((!gEnableDebugMode) && ((buttonAndStickPress & START_BUTTON) != 0)) { - buttonAndStickPress |= A_BUTTON; + if ((!gEnableDebugMode) && ((btnAndStick & START_BUTTON) != 0)) { + btnAndStick |= A_BUTTON; } - if (func_800B4520() == 0) { - switch (D_8018EDEC) { - case 1: - if ((buttonAndStickPress & R_JPAD) != 0) { + if (is_screen_being_faded() == 0) { + switch (gSubMenuSelection) { + case SUB_MENU_MAP_SELECT_CUP: + if ((btnAndStick & R_JPAD) != 0) { if (gCupSelection < SPECIAL_CUP) { - D_8018EE0A = gCupSelection; + sTempCupSelection = gCupSelection; ++gCupSelection; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } } - if (((buttonAndStickPress & L_JPAD) != 0) && (gCupSelection > MUSHROOM_CUP)) { - D_8018EE0A = gCupSelection; + if (((btnAndStick & L_JPAD) != 0) && (gCupSelection > MUSHROOM_CUP)) { + sTempCupSelection = gCupSelection; --gCupSelection; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } D_800DC540 = gCupSelection; gCurrentCourseId = gCupCourseOrder[gCupSelection][gCourseIndexInCup]; - if ((buttonAndStickPress & B_BUTTON) != 0) { + if ((btnAndStick & B_BUTTON) != 0) { func_8009E208(); play_sound2(SOUND_MENU_GO_BACK); - } else if ((buttonAndStickPress & A_BUTTON) != 0) { + } else if ((btnAndStick & A_BUTTON) != 0) { if (gModeSelection != GRAND_PRIX) { - D_8018EDEC = 2; + gSubMenuSelection = SUB_MENU_MAP_SELECT_COURSE; play_sound2(SOUND_MENU_SELECT); } else { - D_8018EDEC = 3; + gSubMenuSelection = SUB_MENU_MAP_SELECT_OK; play_sound2(SOUND_MENU_SELECT); gCurrentCourseId = gCupCourseOrder[gCupSelection][COURSE_ONE]; gMenuTimingCounter = 0; } - func_800B44AC(); + reset_cycle_flash_menu(); } break; - case 2: - case 4: - if (((buttonAndStickPress & D_JPAD) != 0) && (gCourseIndexInCup < COURSE_FOUR)) { + case SUB_MENU_MAP_SELECT_COURSE: + case SUB_MENU_MAP_SELECT_BATTLE_COURSE: + if (((btnAndStick & D_JPAD) != 0) && (gCourseIndexInCup < COURSE_FOUR)) { ++gCourseIndexInCup; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } - if (((buttonAndStickPress & U_JPAD) != 0) && (gCourseIndexInCup > COURSE_ONE)) { + if (((btnAndStick & U_JPAD) != 0) && (gCourseIndexInCup > COURSE_ONE)) { --gCourseIndexInCup; - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_CURSOR_MOVE); } gCurrentCourseId = gCupCourseOrder[gCupSelection][gCourseIndexInCup]; - if ((buttonAndStickPress & B_BUTTON) != 0) { - if (D_8018EDEC == 2) { - D_8018EDEC = 1; + if ((btnAndStick & B_BUTTON) != 0) { + if (gSubMenuSelection == SUB_MENU_MAP_SELECT_COURSE) { + gSubMenuSelection = SUB_MENU_MAP_SELECT_CUP; } else { func_8009E208(); } - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_GO_BACK); return; } - if ((buttonAndStickPress & A_BUTTON) != 0) { - D_8018EDEC = 3; + if ((btnAndStick & A_BUTTON) != 0) { + gSubMenuSelection = SUB_MENU_MAP_SELECT_OK; play_sound2(SOUND_MENU_SELECT); - func_800B44AC(); + reset_cycle_flash_menu(); gMenuTimingCounter = 0; } break; - case 3: - if ((arg1 == 0) && ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { + case SUB_MENU_MAP_SELECT_OK: + if ((controllerIdx == PLAYER_ONE) && ((++gMenuTimingCounter == 0x3C) || ((gMenuTimingCounter % 300) == 0))) { play_sound2(SOUND_MENU_OK); } - if ((buttonAndStickPress & B_BUTTON) != 0) { + if ((btnAndStick & B_BUTTON) != 0) { switch (gModeSelection) { case GRAND_PRIX: - D_8018EDEC = 1; + gSubMenuSelection = SUB_MENU_MAP_SELECT_CUP; break; case BATTLE: - D_8018EDEC = 4; + gSubMenuSelection = SUB_MENU_MAP_SELECT_BATTLE_COURSE; break; default: - D_8018EDEC = 2; + gSubMenuSelection = SUB_MENU_MAP_SELECT_COURSE; break; } - func_800B44AC(); + reset_cycle_flash_menu(); play_sound2(SOUND_MENU_GO_BACK); return; } - if ((buttonAndStickPress & A_BUTTON) != 0) { + if ((btnAndStick & A_BUTTON) != 0) { func_8009E1C0(); func_800CA330(0x19); play_sound2(SOUND_MENU_OK_CLICKED); @@ -1782,17 +1824,20 @@ void course_select_menu_act(struct Controller* arg0, u16 arg1) { } } -void func_800B3F74(s32 menuSelection) { +/** + * Loads menu states so they are preserved between menu changes + */ +void load_menu_states(s32 menuSelection) { s32 i; - gDebugMenuSelection = DEBUG_MENU; + gDebugMenuSelection = DEBUG_MENU_SELECTION; gMenuTimingCounter = 0; gMenuDelayTimer = 0; - D_8018EE08 = 0; + gDemoUseController = 0; D_8015F890 = 0; D_8015F892 = 0; gDebugGotoScene = DEBUG_GOTO_RACING; - D_8018EDFB = 0; + gGhostPlayerInit = 0; D_8016556E = 0; D_80162DD4 = 1; D_80162DD8 = 1; @@ -1801,27 +1846,27 @@ void func_800B3F74(s32 menuSelection) { D_80162DCC = 0; switch (menuSelection) { - case 5: - D_8018EDEC = 21; + case OPTIONS_MENU: + gSubMenuSelection = SUB_MENU_OPTION_RETURN_GAME_SELECT; break; - case 6: - D_8018EDEC = 1; + case DATA_MENU: + gSubMenuSelection = SUB_MENU_DATA; break; - case 7: - D_8018EDEC = 11; + case COURSE_DATA_MENU: + gSubMenuSelection = SUB_MENU_DATA_OPTIONS; break; - case 8: + case LOGO_INTRO_MENU: func_800CA008(0, 0); break; - case 9: { + case CONTROLLER_PAK_MENU: { gControllerPakMenuSelection = CONTROLLER_PAK_MENU_SELECT_RECORD; func_800CA008(0, 0); break; } case 0: - case 10: { + case START_MENU: { gIsMirrorMode = 0; - gEnableDebugMode = DEBUG_MODE; + gEnableDebugMode = DEBUG_MODE_TOGGLE; gCupSelection = MUSHROOM_CUP; gCourseIndexInCup = 0; gTimeTrialDataCourseIndex = 0; @@ -1831,17 +1876,17 @@ void func_800B3F74(s32 menuSelection) { if (gPlayerCount >= 5) { gPlayerCount = 4; } - D_8018EDF1 = D_800F2BE0[gPlayerCount - 1]; + gScreenModeListIndex = sScreenModeIdxFromPlayerMode[gPlayerCount - 1]; func_800CA008(0, 0); func_800C8EAC(1); - D_8018EDFC = 0; + gCourseMapInit = 0; break; } case 1: - case 11: { - gEnableDebugMode = DEBUG_MODE; + case MAIN_MENU: { + gEnableDebugMode = DEBUG_MODE_TOGGLE; gIsMirrorMode = 0; - D_8018EDFC = 0; + gCourseMapInit = 0; func_800B5F30(); func_8000F0E0(); @@ -1853,9 +1898,9 @@ void func_800B3F74(s32 menuSelection) { func_800C8EAC(2); } - switch (D_8018EDE0) { - case 0: { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; + switch (gMenuFadeType) { + case MENU_FADE_TYPE_MAIN: { + gMainMenuSelection = MAIN_MENU_PLAYER_SELECT; func_800C8EAC(2); gPlayerCount = 1; if (gScreenModeSelection >= NUM_SCREEN_MODES || gScreenModeSelection < 0) { @@ -1863,35 +1908,35 @@ void func_800B3F74(s32 menuSelection) { } break; } - case 1: { - gMainMenuSelectionDepth = CONFIRM_OK_SELECTION_FROM_BACK_OUT; + case MENU_FADE_TYPE_BACK: { + gMainMenuSelection = MAIN_MENU_OK_SELECT_BACK_OUT; break; } - case 3: { + case MENU_FADE_TYPE_DATA: { // why... - switch (gMainMenuSelectionDepth) { + switch (gMainMenuSelection) { default: - gMainMenuSelectionDepth = TIME_TRIALS_DATA_SELECTION_FROM_BACK_OUT; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT_BACK_OUT; break; - case OPTIONS_SELECTION: - case DATA_SELECTION: - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; + case MAIN_MENU_OPTION: + case MAIN_MENU_DATA: + gMainMenuSelection = MAIN_MENU_PLAYER_SELECT; break; } break; } - case 4: { - gMainMenuSelectionDepth = PLAYER_NUM_SELECTION; + case MENU_FADE_TYPE_OPTION: { + gMainMenuSelection = MAIN_MENU_PLAYER_SELECT; break; } } break; } case 2: - case 12: { - switch (D_8018EDE0) { - case 0: { - D_8018EDEE = 1; + case PLAYER_SELECT_MENU: { + switch (gMenuFadeType) { + case MENU_FADE_TYPE_MAIN: { + gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_MAIN; if (gGamestate == 0) { for (i = 0; i < ARRAY_COUNT(gCharacterGridSelections); i++) { if (i < gPlayerCount) { @@ -1899,7 +1944,7 @@ void func_800B3F74(s32 menuSelection) { } else { gCharacterGridSelections[i] = 0; } - D_8018EDE8[i] = false; + gCharacterGridIsSelected[i] = false; gCharacterSelections[i] = i; } play_sound2(SOUND_MENU_SELECT_PLAYER); @@ -1909,19 +1954,19 @@ void func_800B3F74(s32 menuSelection) { gGamestate = 0; gGamestateNext = 0; func_800C8EAC(2); - for (i = 0; i < ARRAY_COUNT(D_8018EDE8); i++) { - D_8018EDE8[i] = false; + for (i = 0; i < ARRAY_COUNT(gCharacterGridIsSelected); i++) { + gCharacterGridIsSelected[i] = false; } } break; } - case 1: { - D_8018EDEE = 3; - for (i = 0; i < ARRAY_COUNT(D_8018EDE8); i++) { + case MENU_FADE_TYPE_BACK: { + gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_OK_BACK_OUT; + for (i = 0; i < ARRAY_COUNT(gCharacterGridIsSelected); i++) { if (gPlayerCount > i) { - D_8018EDE8[i] = true; + gCharacterGridIsSelected[i] = true; } else { - D_8018EDE8[i] = false; + gCharacterGridIsSelected[i] = false; } } break; @@ -1930,16 +1975,16 @@ void func_800B3F74(s32 menuSelection) { break; } case 3: - case 13: { + case COURSE_SELECT_MENU: { if (gModeSelection == BATTLE) { gCupSelection = BATTLE_CUP; D_800DC540 = 4; - D_8018EDEC = 4; + gSubMenuSelection = SUB_MENU_MAP_SELECT_BATTLE_COURSE; } else { if (gCupSelection == BATTLE_CUP) { gCupSelection = MUSHROOM_CUP; } - D_8018EDEC = 1; + gSubMenuSelection = SUB_MENU_MAP_SELECT_CUP; } if (gGamestate != 0) { func_800CA008(0, 0); @@ -1949,7 +1994,7 @@ void func_800B3F74(s32 menuSelection) { func_800C8EAC(2); } play_sound2(SOUND_MENU_SELECT_MAP); - D_8018EE0A = 0; + sTempCupSelection = 0; if (gModeSelection == GRAND_PRIX) { gCourseIndexInCup = 0; } @@ -1960,33 +2005,44 @@ void func_800B3F74(s32 menuSelection) { break; } } - func_800B44AC(); + reset_cycle_flash_menu(); } -void func_800B44AC(void) { +/** + * Self explanatory, gets reset when moving cursor option or after a fade + */ +void reset_cycle_flash_menu(void) { gCycleFlashMenu = 0x20; } -void func_800B44BC(void) { +/** + * Self explanatory, changes sound mode pack + */ +void set_sound_mode(void) { UNUSED u32 pad; union GameModePack pack; - pack = gSoundMenuPack; + pack = sSoundMenuPack; if ((gSoundMode == SOUND_STEREO) || (gSoundMode == SOUND_HEADPHONES) || (gSoundMode == SOUND_MONO)) { func_800C3448(pack.modes[gSoundMode] | 0xE0000000); } } -// Likely checks that the user is actually in the menus and not racing. -bool func_800B4520(void) { - +/** + * Checks is a fade render mode is active so menus can't be + * interacted while a fade transition is active + */ +bool is_screen_being_faded(void) { if ((D_8018E7AC[4] == 2) || (D_8018E7AC[4] == 3) || (D_8018E7AC[4] == 4) || (D_8018E7AC[4] == 7)) { return true; } return false; } -UNUSED void func_800B4560(s32 arg0, s32 arg1) { +/** + * Unused debug function, prints the character id for the player and both controller pak ghosts + */ +UNUSED void debug_print_ghost_kart_character_id(s32 arg0, s32 arg1) { struct_8018EE10_entry* pak1 = D_8018EE10; struct_8018EE10_entry* pak2 = (struct_8018EE10_entry*) D_8018D9C0; diff --git a/src/menus.h b/src/menus.h index f3007cc008..e63daeeb67 100644 --- a/src/menus.h +++ b/src/menus.h @@ -5,9 +5,6 @@ #include #include -// D_8018EDEC is position on options screen? -enum MenuOptionsCursorPositions { MENU_OPTIONS_CSRPOS_SOUNDMODE = 0x16 }; - // needs to be a union (or array...?) to go into rodata as a const // terrible for endianness... Best guess as to what this is for.. union GameModePack { @@ -15,8 +12,185 @@ union GameModePack { s32 word; }; -// This really, really shouldn't be in this header file, but I don't know where else to put it -void rmonPrintf(const char*, ...); +/** + * @brief Options for gMenuFadeType + */ +enum MenuFadeTypes { + MENU_FADE_TYPE_MAIN, + MENU_FADE_TYPE_BACK, + MENU_FADE_TYPE_DEMO, + MENU_FADE_TYPE_DATA, + MENU_FADE_TYPE_OPTION, + MENU_FADE_TYPE_MAX +}; + +/** + * @brief Options for gSubMenuSelection + */ +enum SubMenuSelectionType { + SUB_MENU_NONE, + SUB_MENU_DATA, // 0x01, value repurposed in map select + SUB_MENU_MAP_SELECT_CUP = 0x01, + SUB_MENU_MAP_SELECT_COURSE, + SUB_MENU_MAP_SELECT_OK, + SUB_MENU_MAP_SELECT_BATTLE_COURSE, + SUB_MENU_DATA_OPTIONS = 0x0B, + SUB_MENU_DATA_ERASE_CONFIRM, + SUB_MENU_DATA_CANT_ERASE, + SUB_MENU_OPTION_MIN = 0x15, + SUB_MENU_OPTION_RETURN_GAME_SELECT = SUB_MENU_OPTION_MIN, + SUB_MENU_OPTION_SOUND_MODE, + SUB_MENU_OPTION_COPY_CONTROLLER_PAK, + SUB_MENU_OPTION_ERASE_ALL_DATA, + SUB_MENU_OPTION_MAX = SUB_MENU_OPTION_ERASE_ALL_DATA, // 0x18 + SUB_MENU_ERASE_MIN = 0x1E, + 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_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_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, + SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P, + SUB_MENU_COPY_PAK_ERROR_2P_MAX = SUB_MENU_COPY_PAK_ERROR_BAD_READ_2P, // 0x2D + SUB_MENU_COPY_PAK_TO_GHOST_MIN = 0x32, + SUB_MENU_COPY_PAK_TO_GHOST1_2P = SUB_MENU_COPY_PAK_TO_GHOST_MIN, + SUB_MENU_COPY_PAK_TO_GHOST2_2P, + SUB_MENU_COPY_PAK_TO_GHOST_MAX = SUB_MENU_COPY_PAK_TO_GHOST2_2P, // 0x33 + SUB_MENU_COPY_PAK_ERROR_1P_MIN, + SUB_MENU_COPY_PAK_ERROR_NO_PAK_1P = SUB_MENU_COPY_PAK_ERROR_1P_MIN, // 0x34 + SUB_MENU_COPY_PAK_ERROR_BAD_READ_1P, + SUB_MENU_COPY_PAK_ERROR_CANT_CREATE_1P, + SUB_MENU_COPY_PAK_ERROR_NO_PAGES_1P, + SUB_MENU_COPY_PAK_ERROR_1P_MAX, + SUB_MENU_COPY_PAK_PROMPT_MIN = SUB_MENU_COPY_PAK_ERROR_1P_MAX, // 0x38 + SUB_MENU_COPY_PAK_PROMPT_QUIT = SUB_MENU_COPY_PAK_PROMPT_MIN, + SUB_MENU_COPY_PAK_PROMPT_COPY, + SUB_MENU_COPY_PAK_PROMPT_MAX = SUB_MENU_COPY_PAK_PROMPT_COPY, // 0x39 + SUB_MENU_COPY_PAK_ACTION_MIN, + SUB_MENU_COPY_PAK_START = SUB_MENU_COPY_PAK_ACTION_MIN, // 0x3A + SUB_MENU_COPY_PAK_COPYING, + SUB_MENU_COPY_PAK_COMPLETED, + SUB_MENU_COPY_PAK_ACTION_MAX = SUB_MENU_COPY_PAK_COMPLETED, // 0x3C + SUB_MENU_COPY_PAK_UNABLE_ERROR_MIN = 0x41, + SUB_MENU_COPY_PAK_UNABLE_COPY_FROM_1P = SUB_MENU_COPY_PAK_UNABLE_ERROR_MIN, + SUB_MENU_COPY_PAK_UNABLE_READ_FROM_2P, + SUB_MENU_COPY_PAK_UNABLE_ERROR_MAX = SUB_MENU_COPY_PAK_UNABLE_READ_FROM_2P, + SUB_MENU_COPY_PAK_CREATE_GAME_DATA_INIT = 0x46, + SUB_MENU_COPY_PAK_CREATE_GAME_DATA_DONE +}; + +/** + * @brief Options for gMainMenuSelection + */ +enum MainMenuSelectionType { + MAIN_MENU_NONE, + 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_BACK_OUT, // OK option after backing out player select + MAIN_MENU_MODE_SUB_SELECT_BACK_OUT // Used in T.Trials after backing out Data menu +}; + +/** + * @brief Options for gPlayerSelectMenuSelection + */ +enum PlayerSelectMenuSelectionTypes { + PLAYER_SELECT_MENU_NONE, + PLAYER_SELECT_MENU_MAIN, + PLAYER_SELECT_MENU_OK, // OK option after selecting characters + PLAYER_SELECT_MENU_OK_BACK_OUT // OK option after backing out map select +}; + +/** + * @brief Options for gDebugMenuSelection + */ +enum DebugMenuSelectionTypes { + DEBUG_MENU_NONE, + DEBUG_MENU_DISABLED, + DEBUG_MENU_DEBUG_MODE, + DEBUG_MENU_COURSE, + DEBUG_MENU_SCREEN_MODE, + DEBUG_MENU_PLAYER, + DEBUG_MENU_SOUND_MODE, + DEBUG_MENU_GIVE_ALL_GOLD_CUP, + DEBUG_MENU_OPTION_SELECTED = 0x40 +}; + +/** + * @brief Options for gControllerPakMenuSelection + */ +enum ControllerPakMenuSelectionTypes { + CONTROLLER_PAK_MENU_NONE, + CONTROLLER_PAK_MENU_SELECT_RECORD, + CONTROLLER_PAK_MENU_END, + CONTROLLER_PAK_MENU_ERASE, + CONTROLLER_PAK_MENU_QUIT, + CONTROLLER_PAK_MENU_TABLE_GAME_DATA, + CONTROLLER_PAK_MENU_GO_TO_ERASING, + CONTROLLER_PAK_MENU_ERASING, + CONTROLLER_PAK_MENU_ERASE_ERROR_NOT_ERASED, + CONTROLLER_PAK_MENU_ERASE_ERROR_NO_PAK, + CONTROLLER_PAK_MENU_ERASE_ERROR_PAK_CHANGED +}; + +/** + * @brief Options for gCourseRecordsMenuSelection + */ +enum CourseRecordsMenuSelectionTypes { + COURSE_RECORDS_MENU_MIN, + COURSE_RECORDS_MENU_RETURN_MENU = COURSE_RECORDS_MENU_MIN, + COURSE_RECORDS_MENU_ERASE_RECORDS, + COURSE_RECORDS_MENU_ERASE_GHOST, + COURSE_RECORDS_MENU_MAX = COURSE_RECORDS_MENU_ERASE_GHOST +}; + +/** + * @brief Options for gCourseRecordsSubMenuSelection + */ +enum CourseRecordsSubMenuSelectionTypes { + COURSE_RECORDS_SUB_MENU_MIN, + COURSE_RECORDS_SUB_MENU_QUIT = COURSE_RECORDS_SUB_MENU_MIN, + COURSE_RECORDS_SUB_MENU_ERASE, + COURSE_RECORDS_SUB_MENU_MAX = COURSE_RECORDS_SUB_MENU_ERASE +}; + +/** + * @brief Options for gDebugGotoScene + */ +enum DebugGotoSceneTypes { + DEBUG_GOTO_RACING, + DEBUG_GOTO_ENDING, + DEBUG_GOTO_CREDITS_SEQUENCE_DEFAULT, + DEBUG_GOTO_CREDITS_SEQUENCE_EXTRA +}; + +/** + * @brief Options for gFadeModeSelection + */ +enum FadeModeSelectionTypes { + FADE_MODE_NONE, + FADE_MODE_MAIN, + FADE_MODE_LOGO +}; + +/** + * @brief Options for gControllerPakScrollDirection + */ +enum ControllerPakScrollDirectionTypes { + CONTROLLER_PAK_SCROLL_DIR_NONE, + CONTROLLER_PAK_SCROLL_DIR_DOWN, + CONTROLLER_PAK_SCROLL_DIR_UP +}; + /* functions */ void update_menus(void); @@ -26,79 +200,69 @@ void course_data_menu_act(struct Controller*, u16); void logo_intro_menu_act(struct Controller*, u16); void controller_pak_menu_act(struct Controller*, u16); void splash_menu_act(struct Controller*, u16); -void func_800B28C8(void); +void setup_game_mode_selected(void); void main_menu_act(struct Controller*, u16); bool is_character_spot_free(s32); void player_select_menu_act(struct Controller*, u16); void course_select_menu_act(struct Controller*, u16); -void func_800B3F74(s32); -void func_800B44AC(void); -void func_800B44BC(void); -bool func_800B4520(void); +void load_menu_states(s32); +void reset_cycle_flash_menu(void); +void set_sound_mode(void); +bool is_screen_being_faded(void); /* data */ -extern s32 D_8018EDC0; -extern f32 D_8018EDC4; -extern f32 D_8018EDC8; -extern f32 D_8018EDCC; -extern f32 D_8018EDD0; -extern f32 D_8018EDD4; -extern f32 D_8018EDD8; -extern f32 D_8018EDDC; -extern s32 D_8018EDE0; - -extern s8 gCharacterGridSelections[]; -extern s8 D_8018EDE8[]; -extern s8 D_8018EDEC; -extern s8 gMainMenuSelectionDepth; -extern s8 D_8018EDEE; +extern s32 gIntroModelZEye; +extern f32 gIntroModelScale; +extern f32 gIntroModelRotX; +extern f32 gIntroModelRotY; +extern f32 gIntroModelRotZ; +extern f32 gIntroModelPosX; +extern f32 gIntroModelPosY; +extern f32 gIntroModelPosZ; + +extern s32 gMenuFadeType; + +extern s8 gCharacterGridSelections[4]; +extern s8 gCharacterGridIsSelected[4]; +extern s8 gSubMenuSelection; +extern s8 gMainMenuSelection; +extern s8 gPlayerSelectMenuSelection; extern s8 gDebugMenuSelection; extern s8 gControllerPakMenuSelection; -extern s8 D_8018EDF1; +extern s8 gScreenModeListIndex; extern u8 gSoundMode; extern s8 gPlayerCount; -extern s8 D_8018EDF4; -extern s8 D_8018EDF5; -extern s8 D_8018EDF6; +extern s8 gVersusResultCursorSelection; +extern s8 gTimeTrialsResultCursorSelection; +extern s8 gBattleResultCursorSelection; extern s8 gTimeTrialDataCourseIndex; extern s8 gCourseRecordsMenuSelection; -extern s8 D_8018EDF9; +extern s8 gCourseRecordsSubMenuSelection; extern s8 gDebugGotoScene; -extern s8 D_8018EDFB; -extern s8 D_8018EDFC; +extern s8 gGhostPlayerInit; +extern s8 gCourseMapInit; extern s32 gMenuTimingCounter; extern s32 gMenuDelayTimer; -extern s8 D_8018EE08; +extern s8 gDemoUseController; extern s8 gCupSelection; -extern s8 D_8018EE0A; extern s8 gCourseIndexInCup; -extern s8 D_8018EE0C; -extern struct_8018EE10_entry D_8018EE10[]; +extern s8 unref_8018EE0C; extern s32 gMenuSelection; // D_800E86A0 -extern s32 D_800E86A4; +extern s32 gFadeModeSelection; extern s8 gCharacterSelections[]; -extern s8 D_800E86AC[]; -extern s8 D_800E86B0[4][3]; +extern s8 gGameModeMenuColumn[]; +extern s8 gGameModeSubMenuColumn[4][3]; extern s8 gNextDemoId; extern s8 gControllerPakSelectedTableRow; -extern s8 D_800E86C4[]; -extern s8 D_800E86D0[]; -extern s8 unref_800E86E0[]; -extern u32 sVIGammaOffDitherOn; +extern s8 gControllerPakVisibleTableRows[]; +extern s8 gControllerPakScrollDirection; -extern const s8 D_800F2B50[5]; -extern const s8 D_800F2B58[5]; extern const s8 gPlayerModeSelection[]; -extern const s8 gGameModePlayerColumnDefault[][3]; -extern const s8 gGameModePlayerColumnExtra[][3]; extern const s32 gGameModePlayerSelection[][3]; -extern const s8 D_800F2BAC[8]; extern const s16 gCupCourseOrder[NUM_CUPS][NUM_COURSES_PER_CUP]; -extern const union GameModePack gSoundMenuPack; - // end of menus.c variables #endif /* MENUS_H */ diff --git a/src/racing/actors.c b/src/racing/actors.c index 1e7ee087ad..0882d0f4d3 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -1208,6 +1208,7 @@ void init_actors_and_load_textures(void) { dma_textures(gTextureFinishLineBanner8, 0x0000025BU, 0x00000800U); dma_textures(gTexture671A88, 0x00000400U, 0x00000800U); dma_textures(gTexture6774D8, 0x00000400U, 0x00000800U); + // 0x9000 switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); diff --git a/src/racing/race_logic.c b/src/racing/race_logic.c index c18fef7618..33d61cdc1d 100644 --- a/src/racing/race_logic.c +++ b/src/racing/race_logic.c @@ -891,7 +891,7 @@ void func_8028FCBC(void) { s32 i; u32 phi_v0_4; - if (D_8018EE08) { + if (gDemoUseController) { func_8028FC34(); } switch (D_800DC510) { diff --git a/src/racing/skybox_and_splitscreen.c b/src/racing/skybox_and_splitscreen.c index 14b12bf8ba..25a45c4416 100644 --- a/src/racing/skybox_and_splitscreen.c +++ b/src/racing/skybox_and_splitscreen.c @@ -127,7 +127,7 @@ void func_802A38B4(void) { gGamestate = 255; gIsInQuitToMenuTransition = 0; gQuitToMenuTransitionCounter = 0; - D_800E86A4 = 1; + gFadeModeSelection = FADE_MODE_MAIN; switch (gGotoMode) { case START_MENU_FROM_QUIT: diff --git a/src/save.c b/src/save.c index b182aede16..3564522e71 100644 --- a/src/save.c +++ b/src/save.c @@ -17,6 +17,10 @@ // very fragile! #define EEPROM_ADDR(ptr) (((uintptr_t) (ptr) - (uintptr_t) (&gSaveData)) / 8) +/** BSS **/ +// stores ghost data +struct_8018EE10_entry D_8018EE10[2]; + /*** data ***/ u16 gCompanyCode = PFS_COMPANY_CODE('0', '1'); u32 gGameCode = PFS_GAME_CODE('N', 'K', 'T', 'J'); @@ -91,7 +95,7 @@ void reset_save_data_grand_prix_points_and_sound_mode(void) { } main->saveInfo.soundMode = SOUND_STEREO; gSoundMode = SOUND_STEREO; - func_800B44BC(); + set_sound_mode(); write_save_data_grand_prix_points_and_sound_mode(); } diff --git a/src/save.h b/src/save.h index 201bbe0846..b986ba26a2 100644 --- a/src/save.h +++ b/src/save.h @@ -14,6 +14,7 @@ #define PFS_NO_ERROR 0 // controller pak no error return #define PFS_NO_PAK_INSERTED 1 // no pak pressent or wrong device inserted into the controller #define PFS_PAK_BAD_READ 2 // controller pak error while data transfer +#define PFS_PAK_CORRUPTED 3 // controller pak has courrupted or weird data #define PFS_FILE_OVERFLOW 4 // too many files written to in the controller pak #define PFS_INVALID_DATA -1 // bad arguments, game note does not exist, osPfsInit was not called. // controller pak test functions @@ -87,6 +88,7 @@ s32 func_800B6A68(void); // these might not be in this file, but for now... extern u32* D_800DC714; +extern struct_8018EE10_entry D_8018EE10[]; extern u16 gCompanyCode; extern u32 gGameCode; // osPfs gamecode diff --git a/src/spawn_players.c b/src/spawn_players.c index dc8e8b8e8e..24375c051b 100644 --- a/src/spawn_players.c +++ b/src/spawn_players.c @@ -466,7 +466,7 @@ void func_80039DA4(void) { }; if (((gCourseIndexInCup == COURSE_ONE) && (D_8016556E == 0)) || (gDemoMode == 1) || - (gDebugMenuSelection == DEBUG_MENU_EXITED)) { + (gDebugMenuSelection == DEBUG_MENU_OPTION_SELECTED)) { for (i = 0; i < NUM_PLAYERS; i++) { D_80165270[i] = sp2C[i]; } @@ -484,7 +484,7 @@ UNUSED s16 D_800E43A8 = 0; void spawn_players_gp_one_player(f32* arg0, f32* arg1, f32 arg2) { func_80039DA4(); if (((gCourseIndexInCup == COURSE_ONE) && (D_8016556E == 0)) || (gDemoMode == 1) || - (gDebugMenuSelection == DEBUG_MENU_EXITED)) { + (gDebugMenuSelection == DEBUG_MENU_OPTION_SELECTED)) { s16 rand; s16 i; @@ -607,7 +607,7 @@ void spawn_players_versus_one_player(f32* arg0, f32* arg1, f32 arg2) { void spawn_players_gp_two_player(f32* arg0, f32* arg1, f32 arg2) { func_80039DA4(); - if ((gCourseIndexInCup == COURSE_ONE) || (gDemoMode == 1) || (gDebugMenuSelection == DEBUG_MENU_EXITED)) { + if ((gCourseIndexInCup == COURSE_ONE) || (gDemoMode == 1) || (gDebugMenuSelection == DEBUG_MENU_OPTION_SELECTED)) { s16 rand; s16 i; From a399ad84f61d3f67d5444c0f64e5ffc8901ac5b5 Mon Sep 17 00:00:00 2001 From: AloXado320 Date: Sat, 5 Oct 2024 13:26:16 -0500 Subject: [PATCH 2/4] remove test --- src/menus.c | 12 ++++++------ src/racing/actors.c | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/menus.c b/src/menus.c index 5efcea553b..862606753a 100644 --- a/src/menus.c +++ b/src/menus.c @@ -99,12 +99,12 @@ 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[] = { +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 + 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 @@ -1507,7 +1507,7 @@ GLOBAL_ASM("asm/non_matchings/menus/main_menu_act.s") #endif /** - * Check if there is no currently selected and/or + * Check if there is no currently selected and/or * hovered character at grid position `gridId` */ bool is_character_spot_free(s32 gridId) { diff --git a/src/racing/actors.c b/src/racing/actors.c index 0882d0f4d3..1e7ee087ad 100644 --- a/src/racing/actors.c +++ b/src/racing/actors.c @@ -1208,7 +1208,6 @@ void init_actors_and_load_textures(void) { dma_textures(gTextureFinishLineBanner8, 0x0000025BU, 0x00000800U); dma_textures(gTexture671A88, 0x00000400U, 0x00000800U); dma_textures(gTexture6774D8, 0x00000400U, 0x00000800U); - // 0x9000 switch (gCurrentCourseId) { case COURSE_MARIO_RACEWAY: dma_textures(gTextureTrees1, 0x0000035BU, 0x00000800U); From 0dbb7e34c0c91eaabe1a5292ba2b31200dfee80e Mon Sep 17 00:00:00 2001 From: AloXado320 Date: Sat, 5 Oct 2024 13:29:04 -0500 Subject: [PATCH 3/4] save.h --- src/save.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/save.h b/src/save.h index b986ba26a2..a6d142128b 100644 --- a/src/save.h +++ b/src/save.h @@ -14,9 +14,9 @@ #define PFS_NO_ERROR 0 // controller pak no error return #define PFS_NO_PAK_INSERTED 1 // no pak pressent or wrong device inserted into the controller #define PFS_PAK_BAD_READ 2 // controller pak error while data transfer -#define PFS_PAK_CORRUPTED 3 // controller pak has courrupted or weird data +#define PFS_PAK_CORRUPTED 3 // controller pak has courrupted or has weird data #define PFS_FILE_OVERFLOW 4 // too many files written to in the controller pak -#define PFS_INVALID_DATA -1 // bad arguments, game note does not exist, osPfsInit was not called. +#define PFS_INVALID_DATA -1 // bad arguments, game note does not exist, osPfsInit was not called // controller pak test functions #define PFS_NUM_FILES_ERROR -2 #define PFS_FREE_BLOCKS_ERROR -3 From af9af6107b2fe0c55018116299f709a121f96e94 Mon Sep 17 00:00:00 2001 From: AloXado320 Date: Sat, 5 Oct 2024 15:10:29 -0500 Subject: [PATCH 4/4] BACK_OUT -> GO_BACK --- src/code_80091750.c | 46 ++++++++++++++++++++++----------------------- src/menus.c | 10 +++++----- src/menus.h | 6 +++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/code_80091750.c b/src/code_80091750.c index 84ecc6d90f..f50cbb0864 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -8490,8 +8490,8 @@ void func_800A7A4C(s32 arg0) { 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_BACK_OUT: /* switch 5 */ - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* 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; } @@ -8513,8 +8513,8 @@ void func_800A7A4C(s32 arg0) { 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_BACK_OUT: /* switch 6 */ - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* 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; } @@ -8565,7 +8565,7 @@ void func_800A7A4C(s32 arg0) { func_800AAB90(var_s1); break; case PLAYER_SELECT_MENU_OK: /* switch 10 */ - case PLAYER_SELECT_MENU_OK_BACK_OUT: /* switch 10 */ + case PLAYER_SELECT_MENU_OK_GO_BACK: /* switch 10 */ func_800AAA9C(var_s1); break; } @@ -8874,14 +8874,14 @@ void func_800A8564(struct_8018D9E0_entry* arg0) { case 0xF: var_a0 = D_0200487C; if ((gMainMenuSelection == MAIN_MENU_OK_SELECT) || - (gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT)) { + (gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK)) { var_a1 = 1; } break; case 0x33: var_a0 = D_02004B74; if ((gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK) || - (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT)) { + (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_GO_BACK)) { var_a1 = 1; } break; @@ -9443,8 +9443,8 @@ void func_800A9C40(struct_8018D9E0_entry* arg0) { arg0->cursor = 1; case 1: func_800AA280(arg0); - if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || - (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_GO_BACK)) { arg0->unk1C = 0x00000020; } else { if (arg0->unk1C < 0x20) { @@ -9477,8 +9477,8 @@ void func_800A9D5C(struct_8018D9E0_entry* arg0) { switch (arg0->cursor) { case 2: - if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || - (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_GO_BACK)) { arg0->column = 0x00000080; arg0->row = 0x0000003E; } else { @@ -9549,8 +9549,8 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { arg0->unk1C = 0; arg0->cursor = 1; break; - case MAIN_MENU_OK_SELECT_BACK_OUT: /* switch 2 */ - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* switch 2 */ + case MAIN_MENU_OK_SELECT_GO_BACK: /* switch 2 */ + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: /* switch 2 */ temp_v0 = func_800AAE68(); temp_v1_2 = &D_800E70E8[arg0->type - sp24]; arg0->column = temp_v0->column + temp_v1_2->column; @@ -9570,8 +9570,8 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { 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_BACK_OUT: /* switch 3 */ - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* 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; @@ -9601,8 +9601,8 @@ void func_800A9E58(struct_8018D9E0_entry* arg0) { 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_BACK_OUT: /* switch 4 */ - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: /* 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; @@ -9632,8 +9632,8 @@ void func_800AA280(struct_8018D9E0_entry* arg0) { Unk_D_800E70A0* temp_v0; temp_v0 = &D_800E70A0[arg0->type - 0xA]; - if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_BACK_OUT) || - (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_BACK_OUT)) { + if ((gMainMenuSelection == MAIN_MENU_OK_SELECT_GO_BACK) || + (gMainMenuSelection == MAIN_MENU_MODE_SUB_SELECT_GO_BACK)) { arg0->column = temp_v0->column; arg0->row = temp_v0->row; } else { @@ -9655,8 +9655,8 @@ void func_800AA2EC(struct_8018D9E0_entry* arg0) { break; case MAIN_MENU_MODE_SUB_SELECT: case MAIN_MENU_OK_SELECT: - case MAIN_MENU_OK_SELECT_BACK_OUT: - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: + case MAIN_MENU_OK_SELECT_GO_BACK: + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: if (arg0->cursor != 0) { break; } @@ -9853,7 +9853,7 @@ void func_800AAA9C(struct_8018D9E0_entry* arg0) { arg0->cursor = 1; /* fallthrough */ case 1: - if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT) { + if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_GO_BACK) { arg0->unk1C = 0x00000020; } else { if (arg0->unk1C < 0x20) { @@ -9923,7 +9923,7 @@ void func_800AAC18(struct_8018D9E0_entry* arg0) { temp_a1 = arg0->type - 0x2B; switch (arg0->cursor) { case 0: - if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_BACK_OUT) { + if (gPlayerSelectMenuSelection == PLAYER_SELECT_MENU_OK_GO_BACK) { temp_v0 = func_800AAFCC(temp_a1); if (temp_v0 >= 0) { var_t0 = &D_800E7188[(gScreenModeSelection * 4) + temp_v0]; diff --git a/src/menus.c b/src/menus.c index 862606753a..8faeeab7bb 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1392,7 +1392,7 @@ void main_menu_act(struct Controller* controller, u16 controllerIdx) { break; } case MAIN_MENU_MODE_SUB_SELECT: - case MAIN_MENU_MODE_SUB_SELECT_BACK_OUT: { + case MAIN_MENU_MODE_SUB_SELECT_GO_BACK: { if (controllerIdx == PLAYER_ONE) { gMenuTimingCounter++; if ((gMenuTimingCounter == 100 || gMenuTimingCounter % 300 == 0)) { @@ -1456,7 +1456,7 @@ void main_menu_act(struct Controller* controller, u16 controllerIdx) { break; } case MAIN_MENU_OK_SELECT: - case MAIN_MENU_OK_SELECT_BACK_OUT: { + case MAIN_MENU_OK_SELECT_GO_BACK: { if ((controllerIdx == PLAYER_ONE) && (++gMenuTimingCounter == 60 || gMenuTimingCounter % 300 == 0)) { play_sound2(SOUND_MENU_OK); } @@ -1909,14 +1909,14 @@ void load_menu_states(s32 menuSelection) { break; } case MENU_FADE_TYPE_BACK: { - gMainMenuSelection = MAIN_MENU_OK_SELECT_BACK_OUT; + gMainMenuSelection = MAIN_MENU_OK_SELECT_GO_BACK; break; } case MENU_FADE_TYPE_DATA: { // why... switch (gMainMenuSelection) { default: - gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT_BACK_OUT; + gMainMenuSelection = MAIN_MENU_MODE_SUB_SELECT_GO_BACK; break; case MAIN_MENU_OPTION: case MAIN_MENU_DATA: @@ -1961,7 +1961,7 @@ void load_menu_states(s32 menuSelection) { break; } case MENU_FADE_TYPE_BACK: { - gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_OK_BACK_OUT; + gPlayerSelectMenuSelection = PLAYER_SELECT_MENU_OK_GO_BACK; for (i = 0; i < ARRAY_COUNT(gCharacterGridIsSelected); i++) { if (gPlayerCount > i) { gCharacterGridIsSelected[i] = true; diff --git a/src/menus.h b/src/menus.h index e63daeeb67..036ea2cff2 100644 --- a/src/menus.h +++ b/src/menus.h @@ -96,8 +96,8 @@ enum MainMenuSelectionType { 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_BACK_OUT, // OK option after backing out player select - MAIN_MENU_MODE_SUB_SELECT_BACK_OUT // Used in T.Trials after backing out Data menu + 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 }; /** @@ -107,7 +107,7 @@ enum PlayerSelectMenuSelectionTypes { PLAYER_SELECT_MENU_NONE, PLAYER_SELECT_MENU_MAIN, PLAYER_SELECT_MENU_OK, // OK option after selecting characters - PLAYER_SELECT_MENU_OK_BACK_OUT // OK option after backing out map select + PLAYER_SELECT_MENU_OK_GO_BACK // OK option after going back from map select }; /**