From bd6c82588a3774e63acd95a6bba90e5272995307 Mon Sep 17 00:00:00 2001 From: CoderStig <79828759+CoderStig@users.noreply.github.com> Date: Tue, 23 Nov 2021 13:34:54 -0700 Subject: [PATCH] Added gamemode and CC defines (#64) * Added gamemode and CC defines --- include/actor_types.h | 2 +- include/defines.h | 12 +++++++++ src/audio/external.c | 3 ++- src/code_800029B0.c | 5 ++-- src/code_80005FD0.c | 40 ++++++++++++++--------------- src/code_8001C4D0.c | 6 ++--- src/code_80027D00.c | 14 +++++----- src/code_800393C0.c | 41 ++++++++++++++---------------- src/code_800431B0.c | 4 +-- src/code_80057C60.c | 41 +++++++++++++++--------------- src/code_8006E9C0.c | 23 +++++++++-------- src/code_80071F00.c | 11 ++++---- src/code_8008C1D0.c | 26 +++++++++---------- src/code_80091750.c | 59 ++++++++++++++++++++++--------------------- src/code_800AF9B0.c | 9 ++++--- src/code_80281780.c | 3 ++- src/code_80281FA0.c | 2 +- src/code_8028DF00.c | 57 +++++++++++++++++++---------------------- src/code_80290C20.c | 3 ++- src/code_80296A50.c | 13 +++++----- src/code_802B0210.c | 2 +- src/main.c | 19 +++----------- src/staff_ghosts.c | 10 ++++---- 23 files changed, 204 insertions(+), 201 deletions(-) diff --git a/include/actor_types.h b/include/actor_types.h index b3db20153..2ce7afaf9 100644 --- a/include/actor_types.h +++ b/include/actor_types.h @@ -176,4 +176,4 @@ struct bigboi { /* 0x01F4 */ s32 unk_1F4; /* 0x01F8 */ f32 unk_1F8; /* 0x01FC */ f32 unk_1FC; -}; \ No newline at end of file +}; diff --git a/include/defines.h b/include/defines.h index 69e561f1e..8290ec50f 100644 --- a/include/defines.h +++ b/include/defines.h @@ -20,4 +20,16 @@ // Compiles to -0x1000 in diff.py #define PLAYER_HUMAN_AND_CPU PLAYER_EXISTS | PLAYER_HUMAN | PLAYER_CPU | PLAYER_START_SEQUENCE +#define GRAND_PRIX 0 +#define TIME_TRIALS 1 +#define VERSUS 2 +#define BATTTLE 3 + +#define CC_50 0 +#define CC_100 1 +#define CC_150 2 +#define CC_EXTRA 3 +#define CC_BATTLE 4 + + #endif // DEFINES_H diff --git a/src/audio/external.c b/src/audio/external.c index e98223df5..7b8d8681b 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -1,5 +1,6 @@ #include #include +#include GLOBAL_ASM("asm/non_matchings/audio/external/func_800C13F0.s") @@ -4800,7 +4801,7 @@ void func_800C8CCC(void) { } phi_s0_2 = 0; phi_s0_3 = 0; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { do { func_800C8770(phi_s0_2 & 0xFF); func_800C8C7C(phi_s0_2 & 0xFF); diff --git a/src/code_800029B0.c b/src/code_800029B0.c index c6e3e5f54..cf9dea38c 100644 --- a/src/code_800029B0.c +++ b/src/code_800029B0.c @@ -2,6 +2,7 @@ #include #include "types.h" #include "variables.h" +#include extern void func_800C8F44(u16 arg0); extern u16 D_800DC5A8; @@ -135,7 +136,7 @@ void func_80002A18(void) { } else { gCourseDirection = 1.0f; } - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { gCurrentCourseId = gCupTrackOrder[gCupSelection][gCourseSelection]; } D_800DC52C = D_800DC530; @@ -164,7 +165,7 @@ void func_80002A18(void) { func_80091FA4(); func_8029E158(); - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { D_8015F8D0.unk4 = (f32) (D_80164490->unk2 - 15);; D_8015F8D0.unk8 = D_80164490->unk4; if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 3e2f9e3b1..db5802cf3 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -2022,7 +2022,7 @@ extern ? gPlayers; *temp_t5 = -1; *temp_t4 = -1; phi_a1 = arg1; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { return 1; } if (arg1 < 0) { @@ -2540,7 +2540,7 @@ block_25: if (temp_f0_2 < sp38) { temp_t1 = *temp_v0_3 + 1; *temp_v0_3 = temp_t1; - if ((gModeSelection == 0) && (temp_t1 == 5)) { + if ((gModeSelection == GRAND_PRIX) && (temp_t1 == 5)) { phi_v0 = &lapCount; if (*(&D_80164408 + phi_a3_2) == 7) { do { @@ -2599,7 +2599,7 @@ block_25: arg0 = phi_a0_4; func_800065D0(phi_a0_4, arg1, &D_80163448); phi_a0_5 = (bitwise f32) arg0; - if ((gModeSelection == 0) && (D_8018EDF3 == 2) && (arg0 == 0)) { + if ((gModeSelection == GRAND_PRIX) && (D_8018EDF3 == 2) && (arg0 == 0)) { if (D_80164408 < D_8016440C) { D_80163478 = 0; } else { @@ -2651,7 +2651,7 @@ void func_800097E0(void) { return; } if ((D_8016337C & 1) != 0) { - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { do { func_8000DF8C(phi_s0_2); temp_s0_2 = phi_s0_2 + 1; @@ -6041,7 +6041,7 @@ void func_8000F124(void) { if (D_800DC51C != 1) { phi_s1 = &D_80163348; phi_s0 = 0; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { do { loop_5: temp_a2 = D_8018EDF3; @@ -6564,7 +6564,7 @@ void func_8000F628(void) { *spD0 = -1; *spCC = 0.0f; *spC8 = 0.0f; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { temp_v0_2 = *(phi_fp + D_80165270); *phi_s4 = temp_v0_2; *phi_s6 = temp_v0_2; @@ -6679,7 +6679,7 @@ void func_8000F628(void) { D_801637BC.unk2 = 0; if (D_800DC51C == 0) { phi_v0_2 = &D_80163344; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { phi_a0 = &D_80163348; do { temp_v0_4 = phi_v0_2 + 2; @@ -6707,7 +6707,7 @@ void func_8000F628(void) { temp_s2->unk-2 = 0; phi_s2_2 = temp_s2; } while (temp_s2 < &D_80163340); - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { temp_t6 = D_8016479E; temp_t8 = (temp_t6 & 0xFFFF) * 2; *(&D_80163330 + temp_t8) = 1; @@ -6744,7 +6744,7 @@ void func_8000F628(void) { } while (temp_v1_3 < &D_80164448); D_8016347A = 0; phi_v1_2 = &D_80162F10; - if (gCCSelection == 3) { + if (gCCSelection == CC_EXTRA) { D_8016347A = 1; } phi_v0_5 = &D_80162F50; @@ -8526,7 +8526,7 @@ loop_2: } else { phi_s6_2 = &D_801635A0; - if (gModeSelection != 0) { + if (gModeSelection != GRAND_PRIX) { do { temp_s6_2 = phi_s6_2 + 0x10C; temp_s6_2->unk-E8 = 1; @@ -9190,14 +9190,14 @@ void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, void *arg4, s32 arg5) phi_s0->unk30 = 0; phi_s0->unk31 = 0; phi_s0->unkC = temp_v0->unk4; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_s0->unk2E = phi_s3 % 3; } else { phi_s0->unk2E = random_int(3); } temp_v0_2 = phi_s0->unk2E; phi_s0->unk24 = (temp_v0_2 - 1) * D_800ED168; - if (((gCCSelection > 0) || (gModeSelection == 1)) && (temp_v0_2 == 2)) { + if (((gCCSelection > 0) || (gModeSelection == TIME_TRIALS)) && (temp_v0_2 == 2)) { phi_s0->unk20 = arg0; } else { phi_s0->unk20 = arg1; @@ -9644,7 +9644,7 @@ void func_800147E0(void) { temp_f0 = (gCCSelection * D_800ED1B8) / 216.0; phi_a2 = 7; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_a2 = 8; } func_800139E4(temp_f0 + D_800ED1C0, temp_f0 + D_800ED1C8, phi_a2, 0, &D_80163818, D_80164550); @@ -9712,7 +9712,7 @@ void func_80014934(void) { temp_f0 = (gCCSelection * D_800ED1D0) / 216.0; phi_a2 = 7; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_a2 = 8; } func_800139E4(temp_f0 + D_800ED1D8, temp_f0 + D_800ED1E0, phi_a2, 0x4B, &D_80163988, D_80164550); @@ -9780,7 +9780,7 @@ void func_80014A88(void) { temp_f0 = (gCCSelection * D_800ED1E8) / 216.0; phi_a2 = 7; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_a2 = 8; } func_800139E4(temp_f0 + D_800ED1F0, temp_f0 + D_800ED1F8, phi_a2, 0x32, &D_80163AF8, D_80164550); @@ -9848,7 +9848,7 @@ void func_80014BDC(void) { temp_f0 = (gCCSelection * D_800ED200) / 216.0; phi_a2 = 7; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_a2 = 8; } func_800139E4(temp_f0 + D_800ED208, temp_f0 + D_800ED210, phi_a2, 0x19, &D_80163C68, D_80164550); @@ -12449,7 +12449,7 @@ void func_8001A588(s32 arg0, void *arg1, u16 *arg2, s8 arg3, s32 cameraId) { s32 phi_a3; phi_s0 = arg1->unkAE; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_s0 = 0; } func_80019FB4(cameraId); @@ -12515,7 +12515,7 @@ void func_8001A588(s32 arg0, void *arg1, u16 *arg2, s8 arg3, s32 cameraId) { phi_t0 = &D_801646C8; } phi_a3 = cameraId; - if ((gModeSelection != 1) && (cameraId == 1) && ((temp_v0_6 = *phi_t0, (temp_v0_6 == 0x104)) || (temp_v0_6 == 0x105))) { + if ((gModeSelection != TIME_TRIALS) && (cameraId == 1) && ((temp_v0_6 = *phi_t0, (temp_v0_6 == 0x104)) || (temp_v0_6 == 0x105))) { phi_v1 = 0; if (D_8018EDF3 == 2) { func_8001A518(phi_s0, *(&D_801643B8 + (phi_s0 * 4)), 1, cameraId); @@ -12767,7 +12767,7 @@ void func_8001AC10(s32 playerId, s32 *arg2) { temp_t9 = (playerId * 0xDD8) + D_800DC4DC; sp2C = temp_t9; - if ((gModeSelection != 1) && (D_801646CC != 1) && ((*temp_t9 & 0x800) == 0)) { + if ((gModeSelection != TIME_TRIALS) && (D_801646CC != 1) && ((*temp_t9 & 0x800) == 0)) { temp_s0 = (playerId * 0x10) + &D_801642D8; temp_a1 = temp_s0->unk0; switch (temp_a1) { /* switch 1 */ @@ -13368,7 +13368,7 @@ void func_8001C3C4(void) { // Duplicate return node #5. Try simplifying control flow for better match return; } - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { func_80057114(); } } diff --git a/src/code_8001C4D0.c b/src/code_8001C4D0.c index 611ee09e5..062fcfcd3 100644 --- a/src/code_8001C4D0.c +++ b/src/code_8001C4D0.c @@ -122,7 +122,7 @@ void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) { if (temp_v0 != 2) { if (temp_v0 != 3) { - } else if (gModeSelection == 3) { + } else if (gModeSelection == BATTTLE) { cameras[cameraId].unk4 = (bitwise s32) 0.0f; cameras[cameraId].unk7 = (bitwise s32) 0.0f; cameras[cameraId].unk8 = (bitwise s32) 0.0f; @@ -140,7 +140,7 @@ void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) { } else { goto block_7; } - } else if (gModeSelection == 3) { + } else if (gModeSelection == BATTTLE) { cameras[cameraId].unk4 = (bitwise s32) 0.0f; cameras[cameraId].unk7 = (bitwise s32) 0.0f; cameras[cameraId].unk8 = (bitwise s32) 0.0f; @@ -157,7 +157,7 @@ void func_8001C4D0(f32 x, f32 y, f32 z, s16 rot, u32 arg4, s32 cameraId) { } } else { block_7: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { cameras[cameraId].unk4 = (bitwise s32) 0.0f; cameras[cameraId].unk7 = (bitwise s32) 0.0f; cameras[cameraId].unk8 = (bitwise s32) 0.0f; diff --git a/src/code_80027D00.c b/src/code_80027D00.c index 6799f8b98..df644b8c5 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -643,7 +643,7 @@ void func_80028864(Player *arg0, s32 arg1, s8 arg2, s8 arg3) { phi_a0 = arg0; block_17: } - if ((sp1E == 1) || ((phi_a0->unk_000 & PLAYER_INVISIBLE_OR_BOMB) == PLAYER_INVISIBLE_OR_BOMB) || (gModeSelection == 3) || (temp_v0_7 = phi_a0->unk_0CA, ((temp_v0_7 & 2) != 0)) || ((temp_v0_7 & 8) != 0) || (*(&D_801633F8 + (arg2 * 2)) == 1)) { + if ((sp1E == 1) || ((phi_a0->unk_000 & PLAYER_INVISIBLE_OR_BOMB) == PLAYER_INVISIBLE_OR_BOMB) || (gModeSelection == BATTTLE) || (temp_v0_7 = phi_a0->unk_0CA, ((temp_v0_7 & 2) != 0)) || ((temp_v0_7 & 8) != 0) || (*(&D_801633F8 + (arg2 * 2)) == 1)) { temp_t4 = phi_a0->unk_0BC & ~0x1000; phi_a0->unk_0BC = temp_t4; if (((temp_t4 & 0x80) == 0x80) || ((temp_t4 & 0x40) == 0x40) || ((temp_t4 & 0x400) == 0x400) || ((temp_t4 & 0x4000) == 0x4000) || ((temp_t4 & 0x80000) == 0x80000) || ((temp_t4 & 0x800000) == 0x800000) || ((temp_t4 & 0x1000000) == 0x1000000) || ((temp_t4 & 0x2000000) == 0x2000000) || ((temp_t4 & 0x20000) == 0x20000) || ((phi_a0->unk_044 & 0x800) != 0)) { @@ -5596,7 +5596,7 @@ void func_80032700(void *arg0) { } if (D_801656F0 == 1) { phi_v0 = 8; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_v0 = 0x14; } if (((gRaceFrameCounter - D_801652E0[func_80027D00()]) < phi_v0) && ((arg0->unk44 & 0x20) != 0x20)) { @@ -6282,7 +6282,7 @@ void func_80033AE0(void *arg0, void *arg1, s8 arg2) { arg0->unkFA = temp_t9; if (((sp2D0 >= 0x5A) || (sp2D0 < -0x59)) && ((arg0->unk44 & 0x4000) == 0)) { temp_v1_4 = arg0->unkBC; - if (((temp_v1_4 & 0x10) == 0) && (gCCSelection == 2) && (gModeSelection != 3) && ((temp_v1_4 & 8) == 0) && (((arg0->unk94 / 18.0f) * 216.0f) >= 40.0f) && (arg0->unk204 == 0)) { + if (((temp_v1_4 & 0x10) == 0) && (gCCSelection == CC_150) && (gModeSelection != BATTTLE) && ((temp_v1_4 & 8) == 0) && (((arg0->unk94 / 18.0f) * 216.0f) >= 40.0f) && (arg0->unk204 == 0)) { arg0->unkC = arg0->unkC | 0x80; } } @@ -6622,7 +6622,7 @@ block_125: arg0->unk78 = phi_t4; } } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { arg0->unk78 = arg0->unk78 * D_800EDD80; } } @@ -7232,7 +7232,7 @@ void func_80037BB4(void *arg0, void *arg1) { arg0->unk2E = arg0->unk2E + temp_v0; } if ((arg0->unk0 & 0x1000) == 0) { - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_800378E8(&sp20, arg1); return; } @@ -7246,7 +7246,7 @@ void func_80037BB4(void *arg0, void *arg1) { arg0->unk2E = arg0->unk2E + temp_v0; } if ((arg0->unk0 & 0x1000) == 0) { - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_80037A4C(&sp20, arg1); return; } @@ -7340,7 +7340,7 @@ block_21: func_80030FC8(arg0); func_80030E00(arg0); } else { - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_80031F48(arg0, 0x40000000); } else { func_80031F48(arg0, 0x3F800000); diff --git a/src/code_800393C0.c b/src/code_800393C0.c index 708815999..d3c6236fc 100644 --- a/src/code_800393C0.c +++ b/src/code_800393C0.c @@ -30,26 +30,23 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg player->unk_100 = gKartGravityTable[player->characterId]; switch (gModeSelection) { - // Mario Grand Prix - case 0: - // Versus - case 2: + case GRAND_PRIX: + case VERSUS: player->unk_084 = D_800E2400.unk_00[gCCSelection][player->characterId]; player->unk_088 = D_800E24B4.unk_00[gCCSelection][player->characterId]; player->unk_210 = D_800E2568.unk_00[gCCSelection][player->characterId]; player->unk_214 = D_800E261C.unk_00[gCCSelection][player->characterId]; break; - // Time Trial (uses 100CC values) - case 1: + // Uses 100CC values + case TIME_TRIALS: player->unk_084 = D_800E2400.unk_00[1][player->characterId]; player->unk_088 = D_800E24B4.unk_00[1][player->characterId]; player->unk_210 = D_800E2568.unk_00[1][player->characterId]; player->unk_214 = D_800E261C.unk_00[1][player->characterId]; break; - // Battle - case 3: + case BATTTLE: player->unk_084 = D_800E2400.unk_00[4][player->characterId]; player->unk_088 = D_800E24B4.unk_00[4][player->characterId]; player->unk_210 = D_800E2568.unk_00[4][player->characterId]; @@ -296,7 +293,7 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg func_80295BF8(arg1); func_8005D6C0(player); func_8006B87C(player, arg1); - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B7E4(player, arg1); } func_802B6540(player->unk_150, player->unk_058, player->unk_05C, player->unk_060, player->unk_02E); @@ -333,7 +330,7 @@ void func_80039AE4(void) { case 1: case 2: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { D_80165578 = 0x898; D_8016557A = 0; D_8016557C = 0x320; @@ -359,7 +356,7 @@ void func_80039AE4(void) { break; default: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { D_80165578 = 0x898; D_8016557A = 0; D_8016557C = 0x320; @@ -769,7 +766,7 @@ void func_8003C0F0(void) { switch (D_800DC52C) { case 0: switch (gModeSelection) { - case 0: + case GRAND_PRIX: D_80165210[0] = D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E + 0x14; D_80165210[1] = D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E - 0x14; D_80165230[0] = sp5C + 0x1E; @@ -783,7 +780,7 @@ void func_8003C0F0(void) { func_80039F44(D_80165210, D_80165230, sp5A); break; - case 1: + case TIME_TRIALS: D_80165210[0] = D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E; D_80165210[1] = D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E; D_80165230[0] = sp5C + 0x1E; @@ -802,7 +799,7 @@ void func_8003C0F0(void) { case 1: case 2: switch (gModeSelection) { - case 0: + case GRAND_PRIX: D_80165210[0] = D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E + 0x14; D_80165210[1] = D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E - 0x14; D_80165230[0] = sp5C + 0x1E; @@ -816,7 +813,7 @@ void func_8003C0F0(void) { func_8003A9F0(D_80165210, D_80165230, sp5A); break; - case 2: + case VERSUS: D_80165210[0] = D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E + 0xA; D_80165210[1] = D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E - 0xA; D_80165230[0] = sp5C + 0x1E; @@ -834,7 +831,7 @@ void func_8003C0F0(void) { case 3: switch (gModeSelection) { - case 2: + case VERSUS: D_80165210[0] = sp5E + 0x1E; D_80165210[2] = D_80165210[4] = D_80165210[6] = sp5E - 0xA; D_80165210[3] = D_80165210[5] = D_80165210[7] = sp5E - 0x1E; @@ -1032,7 +1029,7 @@ void func_8003C0F0(void) { break; } - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { func_8000F628(); } } @@ -1090,7 +1087,7 @@ void func_8003D080(void) { switch (D_800DC52C) { case 0: switch (gModeSelection) { - case 0: + case GRAND_PRIX: if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { func_8001C4D0(0.0f, D_800DC4DC->unk_0A8, D_8016524C, D_800DC4DC->unk_0BC, 8, 0); } else { @@ -1098,7 +1095,7 @@ void func_8003D080(void) { } break; - case 1: + case TIME_TRIALS: func_8001C4D0(D_800DC4DC->unk_0A4, D_800DC4DC->unk_0A8, D_8016524C, D_800DC4DC->unk_0BC, 1, 0); break; @@ -1111,12 +1108,12 @@ void func_8003D080(void) { case 1: case 2: switch (gModeSelection) { - case 0: + case GRAND_PRIX: func_8001C4D0(D_800DC4DC->unk_0A4, D_800DC4DC->unk_0A8, D_800DC4DC->unk_0AC, D_800DC4DC->unk_0BC, 1, 0); func_8001C4D0(D_800DC4E0->posX, D_800DC4E0->posY, D_800DC4E0->posZ, D_800DC4E0->unk_02E, 1, 1); break; - case 3: + case BATTTLE: func_8001C4D0(D_800DC4DC->unk_0A4, D_800DC4DC->unk_0A8, D_800DC4DC->unk_0AC, D_800DC4DC->unk_0BC, 9, 0); func_8001C4D0(D_800DC4E0->posX, D_800DC4E0->posY, D_800DC4E0->posZ, D_800DC4E0->unk_02E, 9, 1); break; @@ -1129,7 +1126,7 @@ void func_8003D080(void) { break; case 3: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { ptr = &D_800DC4E4; func_8001C4D0(D_800DC4DC->unk_0A4, D_800DC4DC->unk_0A8, D_800DC4DC->unk_0AC, D_800DC4DC->unk_0BC, 9, 0); func_8001C4D0(D_800DC4E0->posX, D_800DC4E0->posY, D_800DC4E0->posZ, D_800DC4E0->unk_02E, 9, 1); diff --git a/src/code_800431B0.c b/src/code_800431B0.c index 6f90c91d8..fa8434ae3 100644 --- a/src/code_800431B0.c +++ b/src/code_800431B0.c @@ -6207,7 +6207,7 @@ void func_800508C0(void) { s32 phi_s1_2; s32 phi_s2_2; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { phi_s0 = D_80164378; } else { phi_s0 = D_80164360; @@ -6584,7 +6584,7 @@ void func_800514BC(void) { phi_s1 = temp_s1; } while (temp_s1 != phi_s3); } - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { func_80050E34(0, D_80164408); } else if (gPlayerCountSelection1 == 1) { func_80050E34(0, *D_801643B8); diff --git a/src/code_80057C60.c b/src/code_80057C60.c index cb16d2761..84e2c13d7 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -5,6 +5,7 @@ #include #include #include +#include extern Mtx *D_80183D60; extern Vp D_802B8880; @@ -438,7 +439,7 @@ void func_800588F4(s32 arg0) { if (D_80165730 != 0) { func_80053E6C(arg0); } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_80056AC0(arg0); } } @@ -843,21 +844,21 @@ void func_800591B4(void) { if ((D_800DC51C == 0) && (D_801657E8 != 0)) { if (D_80165800 != 0) { func_8004EE54(0); - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { func_8004F020(0); } func_8004F3E4(0); } if ((D_800DC530 == 1) && (D_80165801 != 0)) { func_8004EE54(1); - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { func_8004F020(1); } func_8004F3E4(1); } } } - if ((D_801657E4 != 2) && (gModeSelection == 0) && (D_8018D2BC != 0)) { + if ((D_801657E4 != 2) && (gModeSelection == GRAND_PRIX) && (D_8018D2BC != 0)) { func_80050320(); } func_800590D4(); @@ -941,7 +942,7 @@ extern ? D_80165800; extern s32 D_8018D188; void func_80059488(s32 arg0) { - if ((gModeSelection != 3) && (*(&D_80165800 + arg0) == 0) && (D_8018D188 != 0)) { + if ((gModeSelection != BATTTLE) && (*(&D_80165800 + arg0) == 0) && (D_8018D188 != 0)) { func_8004FA78(); func_8004E78C(arg0); } @@ -1018,7 +1019,7 @@ void func_80059560(s32 arg0) { void *temp_v0; void *temp_v0_2; - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { if ((D_801657F8 != 0) && (D_8018D188 != 0)) { temp_v0 = (arg0 * 0x84) + &D_8018CA70; sp3C = temp_v0; @@ -1334,7 +1335,7 @@ void func_80059AC8(void) { } } else if (D_800DC50C != 9) { func_80059A88(0); - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { func_8005995C(); } } else { @@ -1713,14 +1714,14 @@ void func_8005A3C0(s32 arg2) { D_80165800.unk0 = (D_80165800.unk0 + 1) & 1; phi_a1 = 1; phi_a2 = 3; - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { D_801657F0 = (D_801657F0 + 1) & 1; phi_a1 = 1; phi_a2 = 3; } } } else if (((D_800DC4BC->buttonPressed & 1) != 0) || ((D_800DC4C0->unk6 & 1) != 0) || (phi_a2 = 3, ((D_800DC4C4->unk6 & 1) != 0))) { - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { D_801657F0 = (D_801657F0 + 1) & 1; } D_801657E4 = (D_801657E4 + 1) & 1; @@ -1729,7 +1730,7 @@ void func_8005A3C0(s32 arg2) { } } else { phi_a2 = 3; - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { if ((D_800DC4BC->buttonPressed & 1) != 0) { D_80165800.unk0 = (D_80165800.unk0 + 1) & 1; phi_a1 = 1; @@ -1836,7 +1837,7 @@ void func_8005A74C(void) { if (D_800DC50C != 9) { func_8007E1AC(); func_8007E4C4(); - if (gModeSelection != 1) { + if (gModeSelection != TIME_TRIALS) { func_8007DB44(); } func_8007C340(); @@ -2042,7 +2043,7 @@ GLOBAL_ASM("asm/non_matchings/code_80057C60/func_8005AAF0.s") ? func_8005AA6C(?); // extern void func_8005AB20(void) { - if ((gModeSelection == 0) && (gPlayerCountSelection1 == 1)) { + if ((gModeSelection == GRAND_PRIX) && (gPlayerCountSelection1 == 1)) { func_8005AA6C(0x14); } } @@ -2765,7 +2766,7 @@ block_76: phi_v0_3 = D_8018D1CC; break; case 2: /* switch 2 */ - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { D_8018CA70.unk80 = 1; } D_8018CA70.unk78 = 1; @@ -3233,7 +3234,7 @@ void func_8005CB60(s32 arg0, s32 arg1) { temp_s0->unk8 = (temp_s0 + (*temp_v1 * 4))->unk14; } phi_a2 = 1; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { temp_v0_2 = D_80165638; temp_a0_2 = temp_s0->unkC; if (temp_v0_2 >= temp_a0_2) { @@ -3308,7 +3309,7 @@ void func_8005CB60(s32 arg0, s32 arg1) { arg0 = phi_a3; func_80079084(phi_a3); func_800C9060(arg0 & 0xFF, 0x1900F015); - if ((gCurrentCourseId == 8) && (D_80165898 == 0) && (gModeSelection != 1)) { + if ((gCurrentCourseId == 8) && (D_80165898 == 0) && (gModeSelection != TIME_TRIALS)) { D_80165898 = 1; } } @@ -3379,7 +3380,7 @@ extern s32 D_8016439C; extern s32 lapCount; void func_8005D0FC(s32 arg0) { - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { if (arg0 != 0) { if (arg0 != 1) { if (arg0 != 2) { @@ -3411,7 +3412,7 @@ extern s32 D_8018D2A4; extern s32 D_8018D2BC; void func_8005D18C(void) { - if ((gModeSelection == 0) && (gPlayerCountSelection1 == 1)) { + if ((gModeSelection == GRAND_PRIX) && (gPlayerCountSelection1 == 1)) { D_801657D8 = 1; D_8018D2BC = 0; D_8018D2A4 = 0; @@ -3440,7 +3441,7 @@ void func_8005D1F4(s32 arg0) { void *temp_v1; ? *phi_a2; - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { temp_v1 = (arg0 * 0x84) + &D_8018CA70; temp_v1->unk74 = 0; phi_a2 = &D_80163DE8; @@ -11992,7 +11993,7 @@ void func_8006D474(void *arg0, s8 arg1, s8 arg2) { phi_s2 = temp_s2; } while (temp_s2 < 0xA); } - if ((gModeSelection == 3) && ((arg0->unk2 & (2 << sp44)) != 0)) { + if ((gModeSelection == BATTTLE) && ((arg0->unk2 & (2 << sp44)) != 0)) { func_8006BA94(arg0, arg1, arg2); } } @@ -12229,7 +12230,7 @@ void func_8006E420(u16 *arg0, s8 arg1, s8 arg2) { temp_s0 = phi_s0 + 1; phi_s0 = temp_s0; } while (temp_s0 < 0xA); - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B9CC(arg0, arg1); } } diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index fd35f7caf..acb34f57a 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -1,5 +1,6 @@ #include #include +#include void func_8006EA5C(void); extern s32 D_800DC530; @@ -635,7 +636,7 @@ void func_8006F8CC(void) { D_80165800.unk0 = D_80165800.unk1; temp_a0 = D_8018EDF3; if (temp_a0 == 4) { - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { D_801657E4 = 1; D_801657F0 = 1; D_801657F8 = 1; @@ -649,7 +650,7 @@ void func_8006F8CC(void) { D_801657E8 = 0; D_801657F8 = 1; } else if (temp_a0 == 2) { - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { D_80165800.unk1 = 0; D_801657E4 = 1; D_801657F0 = 1; @@ -814,7 +815,7 @@ void func_8006FA94(void) { if (temp_ra != 4) { } else { - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { D_8018D114 = 0xA; D_8018D178 = 0x1E; D_8018D180 = 0x1E; @@ -825,7 +826,7 @@ void func_8006FA94(void) { } D_8018D2AC = 0xA; } - } else if (gModeSelection == 2) { + } else if (gModeSelection == VERSUS) { D_8018D114 = 8; D_8018D178 = 0x64; D_8018D180 = 0x96; @@ -864,7 +865,7 @@ void func_8006FA94(void) { D_8018D114 = 7; } } - } else if (gModeSelection == 0) { + } else if (gModeSelection == GRAND_PRIX) { D_8018D114 = 0; D_8018D178 = 0x96; D_8018D114 = 0xF0; @@ -1462,7 +1463,7 @@ void func_80070780(void) { switch (temp_t6) { case 0: if (D_800DC50C != 9) { - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { func_80070714(); } phi_s0 = &D_8018C630; @@ -1677,7 +1678,7 @@ void func_80070780(void) { return; case 7: if (D_800DC50C != 9) { - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { func_80070714(); } phi_s0_3 = &D_8018C630; @@ -1699,7 +1700,7 @@ void func_80070780(void) { return; case 8: if (D_800DC50C != 9) { - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { func_80070714(); } D_80165898 = 0; @@ -1725,7 +1726,7 @@ void func_80070780(void) { if (D_800DC50C != 9) { temp_v0_10 = D_8018EDF3; phi_s1_8 = &D_80183EA0; - if ((temp_v0_10 == 1) || ((temp_v0_10 == 2) && (gModeSelection == 2))) { + if ((temp_v0_10 == 1) || ((temp_v0_10 == 2) && (gModeSelection == VERSUS))) { temp_v0_11 = gCCSelection; if (temp_v0_11 != 0) { if (temp_v0_11 != 1) { @@ -2217,7 +2218,7 @@ void func_80071A20(void) { D_8018CA70.unkDC = 0x7F; D_8018CA70.unkDE = 0x101; D_8018CA70.unkE4 = 0xDA; - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { D_8018CA70.unk44 = 0x5E; D_8018CA70.unkC8 = 0xD0; } @@ -2342,7 +2343,7 @@ void func_80071C28(void) { D_8018CA70.unk1EC = 0xD4; D_8018CA70.unk1F8 = 0xC8; D_8018CA70.unk1FA = 0xC0; - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { D_8018CA70.unk44 = 0xC8; D_8018CA70.unkC8 = 0xC8; D_8018CA70.unk14C = 0xB8; diff --git a/src/code_80071F00.c b/src/code_80071F00.c index e5e615c7b..aea173223 100644 --- a/src/code_80071F00.c +++ b/src/code_80071F00.c @@ -1,5 +1,6 @@ #include #include +#include #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -160,7 +161,7 @@ extern s32 D_80162DF8; void func_80072180(void) { u16 temp_v0; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { temp_v0 = D_800DC4DC->unk_000; if (((temp_v0 & 0x8000) != 0) && ((temp_v0 & 0x1100) == 0)) { D_80162DF8 = 1; @@ -6393,7 +6394,7 @@ extern s32 D_80183E88; phi_a3 = 0; phi_a3_2 = 0; phi_t3 = 0; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { if (random_int(0x64) < 0x51) { temp_v0 = arg1 * 4; phi_v1 = func_8007AF40(*(&D_80164392 + temp_v0), *(&D_801643BA + temp_v0)); @@ -7427,7 +7428,7 @@ s16 func_8007C9F8(void) { return 0; } if (temp_v0 == 2) { - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { if (D_801643B8->unk0 < D_801643B8->unk4) { return 0; } @@ -8269,7 +8270,7 @@ void func_8007E1AC(void) { temp_a0 = D_80183EA4; sp1C = temp_a0; func_8007E00C(temp_a0); - if (gModeSelection != 1) { + if (gModeSelection != TIME_TRIALS) { func_8007DDC0(temp_a0); } } @@ -8431,7 +8432,7 @@ void func_8007E4C4(void) { temp_a0 = D_80183EA8; sp1C = temp_a0; func_8007E3EC(temp_a0); - if (gModeSelection != 1) { + if (gModeSelection != TIME_TRIALS) { func_8007E1F4(temp_a0); } } diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 4983af4aa..cebf2762c 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -290,7 +290,7 @@ void func_8008C62C(Player *player, s8 arg1) { if (player->unk_236 == 0) { player->unk_0A8 = 0x2000; func_8008C6D0(player, arg1); - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(player, arg1); } } @@ -411,7 +411,7 @@ void func_8008C8C4(void *arg0, s8 arg1) { if ((*(&D_80165460 + temp_v1) == 1) && ((arg0->unk0 & 0x4000) == 0x4000)) { arg0->unk9C = arg0->unk9C + 100.0f; } - if ((gModeSelection == 2) && ((arg0->unk0 & 0x1000) == 0x1000) && (D_800DC51C == 0) && ((arg0->unkCA & 2) == 0) && (*(&D_801643B8 + temp_v1) != 0)) { + if ((gModeSelection == VERSUS) && ((arg0->unk0 & 0x1000) == 0x1000) && (D_800DC51C == 0) && ((arg0->unkCA & 2) == 0) && (*(&D_801643B8 + temp_v1) != 0)) { arg0->unkC = arg0->unkC | 0x400000; } } @@ -469,7 +469,7 @@ void func_8008C9EC(void *arg0, s8 arg1) { if (((temp_t7 & 0xFFFF) / (0x10000 / (0x168 / (*(&sp30 + (temp_v1 * 2)) / 182)))) == 0) { arg0->unkB2 = temp_v1 - 1; if (arg0->unkB2 <= 0) { - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg0, arg1, &sp30); } func_8008C8C4(arg0, arg1); @@ -486,7 +486,7 @@ void func_8008C9EC(void *arg0, s8 arg1) { arg0->unkB2 = temp_v1_2 - 1; if (arg0->unkB2 <= 0) { func_8008C8C4(arg0, arg1); - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg0, arg1); } } @@ -1303,7 +1303,7 @@ void func_8008DF98(void *arg0, s8 arg1) { } else { func_800098FC(arg1, arg0); } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg0, arg1); } } @@ -1479,7 +1479,7 @@ void func_8008E4A4(void *arg0, s8 arg1) { if ((*(&D_80165460 + (temp_a1 * 4)) == 1) && ((temp_t3 & 0x4000) == 0x4000)) { arg0->unk9C = arg0->unk9C + 100.0f; } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(temp_a1, 3); return; } @@ -1499,7 +1499,7 @@ void func_8008E4A4(void *arg0, s8 arg1) { temp_v0_2->unk20 = 1; temp_v0_2->unk30 = 1; arg0->unk42 = 0; - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { arg1 = temp_a1; func_8006B8B4(temp_a1, 3); phi_a1 = arg1; @@ -1560,12 +1560,12 @@ void func_8008E6C0(void *arg0, s8 arg1) { arg0->unkE0 = 0; arg0->unkEC = *(&D_800E3710 + temp_v0); if (((temp_v1 & 0x4000) == 0x4000) && ((temp_v1 & 0x100) != 0x100)) { - if ((gModeSelection == 2) && ((temp_v1 & 0x1000) != 0) && (D_800DC51C == 0)) { + if ((gModeSelection == VERSUS) && ((temp_v1 & 0x1000) != 0) && (D_800DC51C == 0)) { func_800CA24C(arg1); } sp20 = arg1; func_800C90F4(arg1, (arg0->unk254 * 0x10) + 0x29008005, arg0->unk254); - if ((gModeSelection == 2) && ((arg0->unk0 & 0x1000) != 0) && (D_800DC51C == 0)) { + if ((gModeSelection == VERSUS) && ((arg0->unk0 & 0x1000) != 0) && (D_800DC51C == 0)) { func_800CA24C(unksp23); } func_800C9060(unksp23, 0x19009005); @@ -1645,7 +1645,7 @@ void func_8008E8D8(void *arg0, s8 arg1) { if ((*(&D_80165460 + (arg1 * 4)) == 1) && ((arg0->unk0 & 0x4000) == 0x4000)) { arg0->unk9C = arg0->unk9C + 100.0f; } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg1); return; } @@ -1668,7 +1668,7 @@ void func_8008E8D8(void *arg0, s8 arg1) { if ((*(&D_80165460 + (arg1 * 4)) == 1) && ((arg0->unk0 & 0x4000) == 0x4000)) { arg0->unk9C = arg0->unk9C + 100.0f; } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg1); } } @@ -2083,7 +2083,7 @@ void func_8008F494(void *arg0, s8 arg1) { temp_v0 = arg0->unkBC; temp_a2 = arg0; temp_a0 = temp_a2; - if ((((temp_v0 & 0x80) != 0) || ((temp_v0 & 0x40) != 0) || ((temp_v0 << 7) < 0) || ((temp_v0 << 6) < 0) || ((temp_v0 & 0x400) != 0)) && (gModeSelection == 3)) { + if ((((temp_v0 & 0x80) != 0) || ((temp_v0 & 0x40) != 0) || ((temp_v0 << 7) < 0) || ((temp_v0 << 6) < 0) || ((temp_v0 & 0x400) != 0)) && (gModeSelection == BATTTLE)) { temp_a2->unk44 = temp_a2->unk44 | 0x8000; } arg0 = temp_a2; @@ -3164,7 +3164,7 @@ block_41: if ((arg0->unk0 & 0x4000) != 0) { func_800C9018(arg1, 0x100FA28); } - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8006B8B4(arg0, arg1); } arg0->unkCA = arg0->unkCA & 0xFFFD; diff --git a/src/code_80091750.c b/src/code_80091750.c index 99de82a9b..bc3f37af5 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1,5 +1,6 @@ #include #include +#include #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -471,11 +472,11 @@ void func_80091FA4(void) { func_8009E650(0x97, 0x64, 0xDD, 1); func_8009E650(0x98, 0, 0, 0); func_8009E650(0xC7, 0, 0, 0); - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { func_8009E650(0xBE, 0, 0, 0); func_8009E650(0x10E, 0, 0, 0); } - if ((D_8015F890 != 0) && (gModeSelection == 1)) { + if ((D_8015F890 != 0) && (gModeSelection == TIME_TRIALS)) { func_8009E650(0xBD, 0, 0, 0); } if (((gControllerBits & 1) == 0) && (D_8018EE08 != 0)) { @@ -668,10 +669,10 @@ extern s32 gModeSelection; void func_80092500(void) { switch(gModeSelection) { - case 0: + case GRAND_PRIX: func_8009E650(0xAA, 0, 0, 0); break; - case 1: + case TIME_TRIALS: func_8009E650(0xB9, 0, 0, 0); break; } @@ -2246,7 +2247,7 @@ void func_80094C60(void) { case 13: func_8009E650(0x25, 0, 0, 2); func_8009E650(0x52, 0, 0, 6); - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { func_8009E650(0x53, 0, 0, 4); func_8009E650(0x54, 0, 0, 4); func_8009E650(0x55, 0, 0, 4); @@ -6849,7 +6850,7 @@ block_74: D_800DC51C = 1; D_8018EE08 = 1; D_800DC524 = 4; - gCCSelection = 1; + gCCSelection = CC_100; temp_v1_4 = D_800E86BC; switch (temp_v1_4) { /* switch 4 */ case 0: /* switch 4 */ @@ -6858,7 +6859,7 @@ block_74: gPlayerCountSelection1 = 1; D_8018EDF3 = 1; D_800E86A8.unk0 = 0; - gModeSelection = 0; + gModeSelection = GRAND_PRIX; break; case 1: /* switch 4 */ gCurrentCourseId = 1; @@ -6867,7 +6868,7 @@ block_74: D_8018EDF3 = 2; D_800E86A8.unk0 = 2; D_800E86A8.unk1 = 4; - gModeSelection = 2; + gModeSelection = VERSUS; phi_a2 = 2; break; case 2: /* switch 4 */ @@ -6876,7 +6877,7 @@ block_74: gPlayerCountSelection1 = 1; D_8018EDF3 = 1; D_800E86A8.unk0 = 1; - gModeSelection = 0; + gModeSelection = GRAND_PRIX; break; case 3: /* switch 4 */ gCurrentCourseId = 0xE; @@ -6886,7 +6887,7 @@ block_74: D_800E86A8.unk0 = 5; D_800E86A8.unk1 = 2; D_800E86A8.unk2 = 7; - gModeSelection = 2; + gModeSelection = VERSUS; phi_a2 = 2; break; case 4: /* switch 4 */ @@ -6895,7 +6896,7 @@ block_74: gPlayerCountSelection1 = 1; D_8018EDF3 = 1; D_800E86A8.unk0 = 7; - gModeSelection = 0; + gModeSelection = GRAND_PRIX; phi_a2 = 2; break; case 5: /* switch 4 */ @@ -6907,7 +6908,7 @@ block_74: D_800E86A8.unk1 = 1; D_800E86A8.unk2 = 6; D_800E86A8.unk3 = 3; - gModeSelection = 2; + gModeSelection = VERSUS; phi_a2 = 2; break; } @@ -6950,7 +6951,7 @@ block_74: } if (D_800E86A0 >= 0xE) { D_800DC524 = 4; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { D_8018EDFB = 1; } func_8009CE1C(phi_a0, 1, phi_a2); @@ -6962,7 +6963,7 @@ block_74: if (temp_v1_7 != 1) { if ((temp_v1_7 != 2) && (temp_v1_7 != 3)) { D_800DC524 = 4; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { D_8018EDFB = 1; } } else { @@ -6974,21 +6975,21 @@ block_74: } func_8000F124(1, 2); if ((D_800DC530 == 3) && ((temp_v1_8 = gModeSelection, (temp_v1_8 == 0)) || (temp_v1_8 == 1))) { - gModeSelection = 2; + gModeSelection = VERSUS; } temp_a0_2 = gCurrentCourseId; if ((temp_a0_2 != 0xF) && (temp_a0_2 != 0x10) && (temp_a0_2 != 0x11) && (temp_a0_2 != 0x13)) { temp_v0_8 = gModeSelection; phi_v0 = temp_v0_8; if (temp_v0_8 == 3) { - gModeSelection = 0; + gModeSelection = GRAND_PRIX; phi_v0 = 0; } if ((phi_v0 == 2) && (gPlayerCountSelection1 == 1)) { - gModeSelection = 0; + gModeSelection = GRAND_PRIX; } } else { - gModeSelection = 3; + gModeSelection = BATTTLE; if (gPlayerCountSelection1 == 1) { D_8018EDF3 = 2; D_800DC530 = 1; @@ -7002,7 +7003,7 @@ block_74: if (temp_v1_9 != 1) { if (temp_v1_9 != 2) { if (temp_v1_9 != 3) { - if (gCCSelection == 3) { + if (gCCSelection == CC_EXTRA) { gIsMirrorMode = 1; return; } @@ -7010,10 +7011,10 @@ block_74: /* Duplicate return node #115. Try simplifying control flow for better match */ return; } - gCCSelection = 3; + gCCSelection = CC_EXTRA; return; } - gCCSelection = 0; + gCCSelection = CC_50; return; } default: /* switch 2 */ @@ -10574,7 +10575,7 @@ void func_800A2D1C(void *arg0) { temp_v0 = D_80164A28; if (temp_v0 != 1) { if (temp_v0 != 2) { - if ((gModeSelection != 0) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { goto block_13; } temp_t8 = arg0->unk1C - 2; @@ -13913,7 +13914,7 @@ void func_800A8A98(void *arg0) { phi_s4 = 0; phi_s0 = &D_800E7208; do { - if ((phi_s4 == gCourseSelection) && (temp_v0_4 = D_8018EDEC, ((temp_v0_4 < 2) == 0)) && (gModeSelection != 0)) { + if ((phi_s4 == gCourseSelection) && (temp_v0_4 = D_8018EDEC, ((temp_v0_4 < 2) == 0)) && (gModeSelection != GRAND_PRIX)) { if ((temp_v0_4 == 2) || (temp_v0_4 == 4)) { phi_v0 = func_800959A0(gDisplayListHead, phi_s0->unk0 + temp_s2, phi_s0->unk2 + temp_s3, phi_s0->unk8 + temp_s2, phi_s0->unkA + temp_s3); } else { @@ -13968,7 +13969,7 @@ void func_800A8CA4(void *arg0) { gDisplayListHead = temp_v1_3 + 8; temp_v1_3->unk0 = 0xFCFFFFFF; temp_v1_3->unk4 = 0xFFFCF279; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { phi_s0 = 0; if (D_8018EDEC != 3) { do { @@ -15792,7 +15793,7 @@ void func_800AB314(void *arg0) { phi_v1 = temp_v1; phi_a1 = temp_a1; } while (temp_a1 < 4); - if (gModeSelection != 0) { + if (gModeSelection != GRAND_PRIX) { if (D_8018EDEC != 1) { arg0->unk4 = 0; arg0->unk20 = 0; @@ -16139,7 +16140,7 @@ void func_800ABC38(void *arg0) { temp_v0 = D_80164A28; if (temp_v0 != 1) { if (temp_v0 != 2) { - if ((gModeSelection != 0) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { goto block_13; } temp_v0_2 = arg0->unk10; @@ -16234,7 +16235,7 @@ void func_800ABEAC(void *arg0) { temp_v0 = D_80164A28; if (temp_v0 != 1) { if (temp_v0 != 2) { - if ((gModeSelection != 0) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { + if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { goto block_13; } temp_v0_2 = arg0->unk10; @@ -16837,7 +16838,7 @@ void func_800ACC50(void *arg0) { temp_t9 = temp_a1->unk1C + 0x20; temp_a1->unk1C = temp_t9; if (temp_t9 >= 0x100) { - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { temp_a1->unk4 = D_8018EDF4; } else { temp_a1->unk4 = D_8018EDF6; @@ -16898,7 +16899,7 @@ void func_800ACC50(void *arg0) { arg0 = phi_a1_2; func_8009DFE0(0x1E, phi_a1_2); play_sound2(0x49008016); - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { D_8018EDF4 = arg0->unk4; } else { D_8018EDF6 = arg0->unk4; diff --git a/src/code_800AF9B0.c b/src/code_800AF9B0.c index 81192d352..222fe52e5 100644 --- a/src/code_800AF9B0.c +++ b/src/code_800AF9B0.c @@ -1,5 +1,6 @@ #include #include +#include u32 func_802A7B70(u16 x); extern u32 D_8018EDB8; @@ -1932,7 +1933,7 @@ void func_800B28C8(void) { gIsMirrorMode = 0; return; } - gCCSelection = 1; + gCCSelection = CC_100; gIsMirrorMode = 0; D_800DC648 = 0; if (temp_v0 != 0) { @@ -2501,7 +2502,7 @@ block_22: return; } if ((phi_v1_2 & 0x8000) != 0) { - if (gModeSelection != 0) { + if (gModeSelection != GRAND_PRIX) { *phi_a1_2 = 2; play_sound2(0x49008001, phi_a1_2); } else { @@ -2719,7 +2720,7 @@ void func_800B3F74(u32 arg0) { break; case 3: case 13: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { gCupSelection = 4; D_800DC540 = 4; D_8018EDEC = 4; @@ -2738,7 +2739,7 @@ void func_800B3F74(u32 arg0) { } play_sound2(0x49009013); D_8018EE0A = 0; - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { gCourseSelection = 0; } phi_v0_2 = &D_8018D9C8; diff --git a/src/code_80281780.c b/src/code_80281780.c index 27dc1b188..17767063d 100644 --- a/src/code_80281780.c +++ b/src/code_80281780.c @@ -2,6 +2,7 @@ #include #include "types.h" #include "variables.h" +#include #include "code_80281780.h" @@ -91,7 +92,7 @@ void load_ending_sequence_royalraceway(void) { D_800DC530 = 0; gPrevLoadedAddress = (s32) D_8015F734; D_800DC52C = 0; - gModeSelection = 0; + gModeSelection = GRAND_PRIX; load_course(gCurrentCourseId); D_8015F730 = (s32) gPrevLoadedAddress; set_segment_base_addr(0xB, func_802AA88C(&_data_821D10SegmentRomStart, &_data_825800SegmentRomStart)); diff --git a/src/code_80281FA0.c b/src/code_80281FA0.c index 78e660ca7..6b10a18dd 100644 --- a/src/code_80281FA0.c +++ b/src/code_80281FA0.c @@ -1808,7 +1808,7 @@ block_3: temp_a2_2 = sp2E - 0x14; func_802832C4(&D_802839E0, arg0, temp_a2_2, temp_a2_2); } - if (gCCSelection == 3) { + if (gCCSelection == CC_EXTRA) { sp2C = *(&D_80286B34 + (D_800DC5E4 * 2)); } if (sp2C == D_802876D2) { diff --git a/src/code_8028DF00.c b/src/code_8028DF00.c index 39ad3a414..2f238282a 100644 --- a/src/code_8028DF00.c +++ b/src/code_8028DF00.c @@ -37,7 +37,6 @@ extern u8 *D_8015F8C4; extern u8 *D_8015F8C8; extern u8 *D_8015F8CC; -//extern u8 D_800DC5EB; extern s16 D_8018D8C0[]; extern s16 D_8016348C; extern s8 gCourseSelection; @@ -129,8 +128,6 @@ UNUSED s32 D_802BA03C; s16 D_802BA040[4]; u16 D_802BA048; -//extern s32 D_8015F8F2; - void func_8028DF00(void) { struct Controller *controllers = &gControllers[0]; s32 i; @@ -306,9 +303,9 @@ void func_8028E438(void) { D_800DC5EC->screenHeight = temp_v0->screenHeight; D_800DC5EC->screenStartX = temp_v0->screenStartX; D_800DC5EC->screenStartY = temp_v0->screenStartY; - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_80092604(); - } else if (gModeSelection == 2) { + } else if (gModeSelection == VERSUS) { func_80092604(); func_80019DF4(); } else { @@ -331,10 +328,10 @@ void func_8028E678(void) { case 0: // Unused switch? switch(gModeSelection) { - case 0: - case 2: + case GRAND_PRIX: + case VERSUS: break; - case 1: + case TIME_TRIALS: break; } D_800DC5B8 = 0; @@ -478,7 +475,7 @@ void func_8028E678(void) { if (D_802BA030 == 0) { D_8015F894 = 3; func_80092500(); - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { func_80019DE4(); } else { func_80019E58(); @@ -635,18 +632,18 @@ void func_8028EF28(void) { } - if (gModeSelection == 0 && gPlayerCountSelection1 == 2 && D_802BA048 == 0) { + if (gModeSelection == GRAND_PRIX && gPlayerCountSelection1 == 2 && D_802BA048 == 0) { D_802BA048 = 1; } if ((gPlayers[i].unk_000 & PLAYER_INVISIBLE_OR_BOMB) == 0) { D_800DC510 = 4; } - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { func_80005AE8(ply); } - if (gModeSelection == 2) { + if (gModeSelection == VERSUS) { D_802BA038 = 180; if (currentPosition == 0) { D_800DC5E8 = i; @@ -714,7 +711,7 @@ void func_8028EF28(void) { } } else if (gPlayers[i].unk_008 == 3) { func_8028EEF0(i); - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { func_80005AE8(ply); } } @@ -962,7 +959,7 @@ loop_2: temp_s0->buttonPressed = 0; func_800C9F90(1); D_80162DF0 = 1; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { temp_a0 = D_800DC4DC; if ((temp_a0->unk_000 & 0x8100) != 0) { func_80005AE8(temp_a0); @@ -989,7 +986,7 @@ block_20: phi_s3 += 0xDD8; phi_s2 = temp_s2; if (temp_s2 == 4) { - if ((gEnableDebugMode != 0) && (gModeSelection != 3)) { + if ((gEnableDebugMode != 0) && (gModeSelection != BATTTLE)) { temp_a1 = D_800DC4BC; if ((temp_a1->buttonPressed & 0x800) != 0) { lapCount->unk0 = 2; @@ -1061,7 +1058,7 @@ void func_8028FCBC(void) { switch (D_800DC510) { case 0: if (D_800DC51C == 0) { - if (gModeSelection == 0) { + if (gModeSelection == GRAND_PRIX) { func_800C8EF8(11); play_sound2(0x49008018); play_sound2(0x49008019); @@ -1107,7 +1104,7 @@ void func_8028FCBC(void) { D_800DC5B0 = 0; D_800DC5B8 = 1; func_80078F64(); - if ((gModeSelection == 1) && (D_80162DD6 == 0)) { + if ((gModeSelection == TIME_TRIALS) && (D_80162DD6 == 0)) { phi_v0_4 = 0x1; for (i = 0; i < gCurrentCourseId; i++) { phi_v0_4 <<= 1; @@ -1133,7 +1130,7 @@ void func_8028FCBC(void) { func_8028F4E8(); break; case 3: - if (gModeSelection == 3) { + if (gModeSelection == BATTTLE) { func_8028E0F0(); } else { func_8028F3F0(); @@ -1145,7 +1142,7 @@ void func_8028FCBC(void) { case 4: switch(gModeSelection) { - case 0: + case GRAND_PRIX: func_8028F4E8(); func_8028F3F0(); func_8028EF28(); @@ -1174,13 +1171,13 @@ void func_8028FCBC(void) { break; } break; - case 2: + case VERSUS: func_8028F4E8(); func_8028F3F0(); func_8028EF28(); func_8028F970(); break; - case 1: + case TIME_TRIALS: D_802BA038 = 360; if (D_8015F890 != 0) { D_800DC510 = 7; @@ -1195,7 +1192,7 @@ void func_8028FCBC(void) { D_802BA038--; } else { switch(gModeSelection) { - case 0: + case GRAND_PRIX: if (D_80150120 != 0) { func_8028E678(); } else if (D_800DC530 == 0) { @@ -1205,11 +1202,11 @@ void func_8028FCBC(void) { func_8028E438(); } break; - case 1: + case TIME_TRIALS: func_8028E678(); break; - case 2: - case 3: + case VERSUS: + case BATTTLE: func_8028E438(); break; } @@ -1408,20 +1405,18 @@ void func_802909F0(void) { Player *ply2; s32 i; s32 k; - //phi_s1 = &gPlayers; - //phi_s5 = 0; + for (i = 0; i < 7; i++) { ply = &gPlayers[i]; - //temp_v0 = phi_s1->unk0; + if ((ply->unk_000 & PLAYER_EXISTS) && (!(ply->unk_0BC & 0x80000000)) && (!(ply->unk_000 & PLAYER_INVISIBLE_OR_BOMB)) && - (!(ply->unk_0BC & 0x4000000))) { // && (temp_v0_2 < 8)) { - //phi_s0 = (temp_v0_2 * 0xDD8) + &gPlayers; + (!(ply->unk_0BC & 0x4000000))) { for (k = i + 1; k < 8; k++) { ply2 = &gPlayers[k]; - //temp_v0_3 = phi_s0->unk0; + if ((ply2->unk_000 & PLAYER_EXISTS) && (!(ply2->unk_0BC & 0x80000000)) && (!(ply2->unk_000 & PLAYER_INVISIBLE_OR_BOMB)) && diff --git a/src/code_80290C20.c b/src/code_80290C20.c index 6a29b653d..174cd6b82 100644 --- a/src/code_80290C20.c +++ b/src/code_80290C20.c @@ -1,5 +1,6 @@ #include #include +#include #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -3440,7 +3441,7 @@ block_29: D_802B87B4 = 0x3E8; D_802B87D4 = 0x71C; D_802B87D0 = 0xE38; - if ((gCCSelection != 0) && (gModeSelection != 1)) { + if ((gCCSelection != CC_50) && (gModeSelection != TIME_TRIALS)) { func_802AAA70(0x7000000); func_802AAA70(0x7000098); func_802AAA70(0x7000178); diff --git a/src/code_80296A50.c b/src/code_80296A50.c index b47a385f4..32939b262 100644 --- a/src/code_80296A50.c +++ b/src/code_80296A50.c @@ -4,6 +4,7 @@ #include "types.h" #include #include "actor_types.h" +#include extern Camera *camera1; @@ -855,7 +856,7 @@ block_9: arg0 = temp_a2_2; func_800C9060(temp_f12_2, temp_f14_2, (((temp_t7 + &gPlayers) - D_800DC4DC) / 0xDD8) & 0xFF, 0x19007018, temp_a2_2, &D_800DC4DC); phi_a2_3 = arg0; - if (gModeSelection != 0) { + if (gModeSelection != GRAND_PRIX) { D_80162DF8 = 1; } } @@ -4375,7 +4376,7 @@ void place_all_item_boxes(u32 arg0) { temp_s0 = *(&gSegmentTable + ((arg0 >> 0x18) * 4)) + (arg0 & 0xFFFFFF) + 0x80000000; phi_s0 = temp_s0; - if ((gModeSelection != 1) && (D_800DC648 != 0)) { + if ((gModeSelection != TIME_TRIALS) && (D_800DC648 != 0)) { load_giant_egg(&sp60, 0, 0, 0); temp_v1 = *temp_s0; phi_v1 = temp_v1; @@ -5386,7 +5387,7 @@ extern s32 D_80162DF8; } else { arg0 = temp_a3; func_8008DABC(temp_a3, (temp_a3 - D_800DC4DC) / 0xDD8); - if ((gModeSelection == 1) && ((arg0->unk0 & 0x1000) == 0)) { + if ((gModeSelection == TIME_TRIALS) && ((arg0->unk0 & 0x1000) == 0)) { D_80162DF8 = 1; } } @@ -6123,7 +6124,7 @@ void func_802A0450(Player *player, void *arg1) { if (((player->unk_0BC << 0) >= 0) && (temp_a0_5 = player, ((player->unk_000 & 0x100) == 0)) && (player = player, temp_a3 = player, (func_8029FB80(temp_a0_5, arg1, MIPS2C_ERROR(Read from unset register $a2)) == 1))) { player = temp_a3; func_800C98B8(arg1 + 0x18, arg1 + 0x24, 0x19009005, temp_a3); - if ((gModeSelection == 1) && ((player->unk_000 & 0x1000) == 0)) { + if ((gModeSelection == TIME_TRIALS) && ((player->unk_000 & 0x1000) == 0)) { D_80162DF8 = 1; } if ((player->unk_0BC & 0x200) != 0) { @@ -6501,7 +6502,7 @@ void func_802A14BC(f32 arg0, f32 arg1, f32 arg2) { ? sp20; f32 *temp_a0; - if (gModeSelection != 1) { + if (gModeSelection != TIME_TRIALS) { func_802B52BC(&sp20, 0, 0, 0); load_giant_egg(&sp28, 0, 0, 0); temp_a0 = &sp34; @@ -7730,7 +7731,7 @@ void func_802A3008(void *arg0) { gDisplayListHead = temp_v0_5 + 8; temp_v0_5->unk4 = -1; temp_v0_5->unk0 = 0xBB000001; - if (gModeSelection != 3) { + if (gModeSelection != BATTTLE) { func_80297340(sp48, 1.0f, temp_s1); } D_8015F8E0 = 0; diff --git a/src/code_802B0210.c b/src/code_802B0210.c index 4db0ca5cf..8b2c215f3 100644 --- a/src/code_802B0210.c +++ b/src/code_802B0210.c @@ -2380,7 +2380,7 @@ block_16: phi_v0_2 = temp_v0_2 - temp_v1_2; } arg0->unk12 = phi_v0_2; - } else if (gModeSelection == 3) { + } else if (gModeSelection == BATTTLE) { arg0->unk8 = 1000.0f; arg0->unk4 = func_802B3FD0(&gPlayers[temp_t7], arg0); if (arg0->unk4 < 0) { diff --git a/src/main.c b/src/main.c index 90051c51f..6e375fd98 100644 --- a/src/main.c +++ b/src/main.c @@ -9,6 +9,7 @@ #include "segments.h" #include "segment_symbols.h" #include "common_structs.h" +#include // Declarations (not in this file) void func_8008C214(void); @@ -172,23 +173,11 @@ s32 D_800DC52C = 0; s32 D_800DC530[2] = {0}; s32 gPlayerCountSelection1 = 2; -/** - * 0 = Mario Grand Prix - * 1 = Time Trial - * 2 = Versus - * 3 = Battle -**/ -s32 gModeSelection = 0; + +s32 gModeSelection = GRAND_PRIX; s32 D_800DC540 = 0; s32 D_800DC544 = 0; -/** - * 0 = 50CC - * 1 = 100CC - * 2 = 150CC - * 3 = Extra (a.k.a Mirror) - * 4 = Battle -**/ -s32 gCCSelection = 0; +s32 gCCSelection = CC_50; s32 gGlobalTimer = 0; UNUSED s32 D_800DC550 = 0; UNUSED s32 D_800DC554 = 0; diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index 36dbf4005..890d252b1 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -195,7 +195,7 @@ void func_800052A4(void) { void func_80005310(void) { // if time trials - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { set_staff_ghost(); @@ -208,7 +208,7 @@ void func_80005310(void) { D_80162DEC = 0; D_80162DF8 = 0; - if (gModeSelection == 1 && D_800DC52C == 0) { + if (gModeSelection == TIME_TRIALS && D_800DC52C == 0) { if (D_8015F890 == 1) { func_80004FB0(); @@ -488,7 +488,7 @@ void func_80005B18(void) { s32 temp_v0; u16 *phi_a3; - if (gModeSelection == 1) { + if (gModeSelection == TIME_TRIALS) { temp_v0 = lapCount[0]; //phi_a3 = &D_80162DD4; if ((lapCount[0] == 3) && (D_80162DDC == 0) && D_80162DF8 != 1) { @@ -548,7 +548,7 @@ void func_80005B18(void) { if (D_80162DEC > 100) { D_80162DEC = 100; } - if ((gModeSelection == 1) && (D_800DC52C == 0)) { + if ((gModeSelection == TIME_TRIALS) && (D_800DC52C == 0)) { if ((D_80162DD4 == 0) && (lapCount[4] != 3)) { func_800057DC(); //gModeSelection, &D_80162DDC, 3, &D_80162DD4); } @@ -567,7 +567,7 @@ GLOBAL_ASM("asm/non_matchings/staff_ghosts/func_80005B18.s") #endif void func_80005E6C(void) { - if ((gModeSelection == 1) && (gModeSelection == 1) && (D_800DC52C == 0)) { + if ((gModeSelection == TIME_TRIALS) && (gModeSelection == TIME_TRIALS) && (D_800DC52C == 0)) { if ((D_80162DD8 == 0) && (D_80164394 != 3)) { func_800057DC(); //3 }