diff --git a/src/menu.c b/src/menu.c index 22ad7ff1..c6fc615a 100644 --- a/src/menu.c +++ b/src/menu.c @@ -3802,28 +3802,26 @@ void randomise_ai_racer_slots(s32 arg0) { GLOBAL_ASM("asm/non_matchings/menu/randomise_ai_racer_slots.s") #endif -#ifdef NON_EQUIVALENT s32 menu_character_select_loop(s32 updateRate) { s32 i; s32 phi_a0; s32 phi_t3; s8 activePlayers[4]; + s32 j; draw_character_select_text(updateRate); func_8008C168(updateRate); func_8008E4EC(); for (i = 0; i < 4; i++) { - if (1 == D_801263DC[i]) { + if (D_801263DC[i] == 1) { D_801263DC[i] = 2; } } gIgnorePlayerInput = 0; if (gMenuDelay == 0) { - // Issue: this loop unrolls weirdly. - for (i = 0; i < 4; i++) { - activePlayers[i] = gActivePlayersArray[i]; - } + // THIS MUST BE ON ONE LINE! + for (i = 0; i < 4; i++) { activePlayers[i] = gActivePlayersArray[i]; } func_8008B358(); if (gNumberOfReadyPlayers == gNumberOfActivePlayers) { func_8008B4C8(); // Cancel/Confirm selected character? @@ -3833,7 +3831,7 @@ s32 menu_character_select_loop(s32 updateRate) { return 0; // This return needs to be here. } else if (gMenuDelay > 0) { gMenuDelay += updateRate; - if (gMenuDelay >= 0x1F) { + if (gMenuDelay >= 31) { phi_t3 = 0; if (D_800DFFD0 == 0) { phi_t3++; @@ -3843,14 +3841,14 @@ s32 menu_character_select_loop(s32 updateRate) { } func_8008C128(); - // Regalloc issue: gActivePlayersArray and phi_a0 need to switch registers. phi_a0 = 0; - for (i = 0; i < 4; i++) { - if (gActivePlayersArray[i]) { - gCharacterIdSlots[phi_a0] = (*D_801263CC)[gPlayersCharacterArray[i]].unkC; + for (j = 0; j < 4; j++) { + if (gActivePlayersArray[j]) { + gCharacterIdSlots[phi_a0] = (*D_801263CC)[gPlayersCharacterArray[j]].unkC; phi_a0++; } } + randomise_ai_racer_slots(phi_a0); assign_player_ids(gActivePlayersArray); @@ -3872,7 +3870,7 @@ s32 menu_character_select_loop(s32 updateRate) { } } else if (gMenuDelay < 0) { gMenuDelay -= updateRate; - if (gMenuDelay < -0x1E) { + if (gMenuDelay < -30) { func_80000B28(); func_8008C128(); gNumberOfActivePlayers = 1; @@ -3881,9 +3879,6 @@ s32 menu_character_select_loop(s32 updateRate) { } return 0; } -#else -GLOBAL_ASM("asm/non_matchings/menu/menu_character_select_loop.s") -#endif void func_8008BFE8(s32 arg0, s8 *arg1, s32 arg2, u16 arg3, u16 arg4) { s32 someBool; @@ -4061,7 +4056,7 @@ s32 menu_game_select_loop(s32 arg0) { s32 playerYDir; s32 charSelectScene; - func_8008C168(); + func_8008C168(arg0); D_801263BC = (D_801263BC + arg0) & 0x3F; diff --git a/src/menu.h b/src/menu.h index ca495d75..a0499d08 100644 --- a/src/menu.h +++ b/src/menu.h @@ -798,6 +798,6 @@ void menu_track_select_init(void); void menu_trophy_race_rankings_init(void); void func_8009E3D0(void); s32 func_800C3564(void); -void func_8008C168(void); +void func_8008C168(s32); #endif