1414#include "code_800029B0.h"
1515#include "cpu_vehicles_camera_path.h"
1616#include "menu_items.h"
17+ #include "seq_ids.h"
1718
1819s8 D_8018EF10 ;
1920UnkStruct8018EF18 D_8018EF18 [16 ];
@@ -2397,6 +2398,13 @@ void func_800C70A8(u8 playerId) {
23972398 }
23982399}
23992400
2401+ /*
2402+ Routine to tell the game which "finish" music to play depending on which mode the player is in (Grand Prix, Time Trials, etc),
2403+ whether the game is in multiplayer or not, and which position they ended up finishing in (1st, 2nd, 3rd, etc)
2404+
2405+ Contains a LOT of inlined funcs.
2406+ Modify if you dare.
2407+ */
24002408void func_800C76C0 (u8 playerId ) {
24012409 if (D_800E9EA4 [playerId ] != 0 ) {
24022410 if (D_800E9EA4 [playerId ] < 0x2BC ) {
@@ -2420,15 +2428,15 @@ void func_800C76C0(u8 playerId) {
24202428 func_800C97C4 (playerId );
24212429 D_800EA0F0 = 2 ;
24222430 func_800C9A88 (playerId );
2423- func_800CA414 ( 0x000DU , 0x0010U );
2431+ play_sequences ( SEQ_EVENT_RACE_FINISH_FIRST , SEQ_MENU_RESULTS_SCREEN_WIN );
24242432 } else if (gPlayers [playerId ].currentRank < 4 ) {
24252433 func_800C97C4 (playerId );
24262434 D_800EA0F0 = 2 ;
24272435 func_800C9A88 (playerId );
2428- func_800CA414 ( 0x000EU , 0x0010U );
2436+ play_sequences ( SEQ_EVENT_RACE_FINISH_OTHER , SEQ_MENU_RESULTS_SCREEN_WIN );
24292437 } else {
24302438 func_800C3448 (-0x3E9F9C00 );
2431- func_800CA414 ( 0x000FU , 0x0018U );
2439+ play_sequences ( SEQ_EVENT_RACE_FINISH_LOSE , SEQ_MENU_RESULTS_SCREEN_LOSE );
24322440 }
24332441 } else {
24342442 D_800EA0EC [playerId ] = 2 ;
@@ -2439,7 +2447,7 @@ void func_800C76C0(u8 playerId) {
24392447 func_800C97C4 (playerId );
24402448 D_800EA0F0 = 2 ;
24412449 func_800C9A88 (playerId );
2442- func_800CA414 ( 0x000DU , 0x0010U );
2450+ play_sequences ( SEQ_EVENT_RACE_FINISH_FIRST , SEQ_MENU_RESULTS_SCREEN_WIN );
24432451 } else if (gPlayers [playerId ].currentRank < 4 ) {
24442452 if (D_800EA104 == 0 ) {
24452453 func_800C3448 (0x100100FF );
@@ -2448,12 +2456,12 @@ void func_800C76C0(u8 playerId) {
24482456 func_800C97C4 (playerId );
24492457 D_800EA0F0 = 2 ;
24502458 func_800C9A88 (playerId );
2451- func_800CA414 ( 0x000EU , 0x0010U );
2459+ play_sequences ( SEQ_EVENT_RACE_FINISH_OTHER , SEQ_MENU_RESULTS_SCREEN_WIN );
24522460 } else if (D_800EA104 == 0 ) {
24532461 func_800C3448 (0x100100FF );
24542462 func_800C3448 (0x110100FF );
24552463 func_800C3448 (-0x3E9F9C00 );
2456- func_800CA414 ( 0x000FU , 0x0018U );
2464+ play_sequences ( SEQ_EVENT_RACE_FINISH_LOSE , SEQ_MENU_RESULTS_SCREEN_LOSE );
24572465 }
24582466 if ((D_800EA104 != 0 ) || (D_800EA0EC [playerId ] != 1 )) {
24592467 func_800C5278 (5U );
@@ -2469,9 +2477,9 @@ void func_800C76C0(u8 playerId) {
24692477 D_800EA0EC [playerId ] = 2 ;
24702478 func_800C9060 (playerId , 0x1900F103U );
24712479 if (D_801657E5 == 1 ) {
2472- func_800CA414 ( 0x000DU , 0x0010U );
2480+ play_sequences ( SEQ_EVENT_RACE_FINISH_FIRST , SEQ_MENU_RESULTS_SCREEN_WIN );
24732481 } else if (D_8018ED90 == 1 ) {
2474- func_800CA414 ( 0x000EU , 0x0010U );
2482+ play_sequences ( SEQ_EVENT_RACE_FINISH_OTHER , SEQ_MENU_RESULTS_SCREEN_WIN );
24752483 } else {
24762484 func_800C3448 (0x01640010 );
24772485 }
@@ -2486,16 +2494,16 @@ void func_800C76C0(u8 playerId) {
24862494 func_800C97C4 (playerId );
24872495 D_800EA0F0 = 2 ;
24882496 func_800C9A88 (playerId );
2489- func_800CA414 ( 0x000DU , 0x0017U );
2497+ play_sequences ( SEQ_EVENT_RACE_FINISH_FIRST , SEQ_MENU_RESULTS_SCREEN_WIN_VS );
24902498 break ;
24912499 case 2 : /* switch 1 */
24922500 if ((D_800EA104 == 0 ) && (D_800EA0EC [playerId ] == 1 )) {
24932501 func_800C3448 (0x100100FF );
24942502 func_800C3448 (0x110100FF );
24952503#ifdef VERSION_EU
2496- func_800C8EF8 ( 0x000DU );
2504+ play_sequence2 ( SEQ_EVENT_RACE_FINISH_FIRST );
24972505#else
2498- func_800CA414 ( 0x000DU , 0x0017U );
2506+ play_sequences ( SEQ_EVENT_RACE_FINISH_FIRST , SEQ_MENU_RESULTS_SCREEN_WIN_VS );
24992507#endif
25002508 D_800EA104 = 1 ;
25012509 } else if ((D_800EA104 == 1 ) && (D_800EA0EC [playerId ] == 1 )) {
@@ -2505,7 +2513,7 @@ void func_800C76C0(u8 playerId) {
25052513#endif
25062514 {
25072515 D_800EA104 = 0 ;
2508- func_800CA414 ( 0x000EU , 0x0017U );
2516+ play_sequences ( SEQ_EVENT_RACE_FINISH_OTHER , SEQ_MENU_RESULTS_SCREEN_WIN_VS );
25092517 }
25102518 D_800EA104 = 2 ;
25112519 }
@@ -2514,12 +2522,12 @@ void func_800C76C0(u8 playerId) {
25142522 if ((D_800EA104 == 0 ) && (D_800EA0EC [playerId ] == 1 )) {
25152523 func_800C3448 (0x100100FF );
25162524 func_800C3448 (0x110100FF );
2517- func_800C8EF8 ( 0x000DU );
2525+ play_sequence2 ( SEQ_EVENT_RACE_FINISH_FIRST );
25182526 D_800EA104 = 1 ;
25192527 } else if ((D_800EA104 == 1 ) && (D_800EA0EC [playerId ] == 1 )) {
25202528 if (func_800C3508 (1 ) != 0x000D ) {
25212529 D_800EA104 = 0 ;
2522- func_800C8EF8 ( 0x000EU );
2530+ play_sequence2 ( SEQ_EVENT_RACE_FINISH_OTHER );
25232531 }
25242532 D_800EA104 = 2 ;
25252533 } else if ((D_800EA104 == 2 ) && (D_800EA0EC [playerId ] == 1 )) {
@@ -2529,7 +2537,7 @@ void func_800C76C0(u8 playerId) {
25292537#endif
25302538 {
25312539 D_800EA104 = 0 ;
2532- func_800CA414 ( 0x000EU , 0x0017U );
2540+ play_sequences ( SEQ_EVENT_RACE_FINISH_OTHER , SEQ_MENU_RESULTS_SCREEN_WIN_VS );
25332541 }
25342542 D_800EA104 = 3 ;
25352543 }
@@ -2543,7 +2551,7 @@ void func_800C76C0(u8 playerId) {
25432551 func_800C3448 (0x110100FF );
25442552 func_800C5278 (5U );
25452553 func_800C9018 (playerId , SOUND_ARG_LOAD (0x01 , 0x00 , 0xF9 , 0x26 ));
2546- func_800C8EF8 ( 0x0017U );
2554+ play_sequence2 ( SEQ_MENU_RESULTS_SCREEN_WIN_VS );
25472555 D_800EA0EC [playerId ] = 2 ;
25482556 func_800C90F4 (playerId , (gPlayers [gPlayerWinningIndex ].characterId * 0x10 ) +
25492557 SOUND_ARG_LOAD (0x29 , 0x00 , 0x80 , 0x0D ));
@@ -2552,7 +2560,7 @@ void func_800C76C0(u8 playerId) {
25522560 if ((D_800EA0EC [0 ] == 1 ) && (D_800EA0EC [1 ] == 1 ) && (D_800EA0EC [2 ] == 1 )) {
25532561 func_800C5278 (5U );
25542562 func_800C9018 (playerId , SOUND_ARG_LOAD (0x01 , 0x00 , 0x80 , 0x26 ));
2555- func_800C8EF8 ( 0x0017U );
2563+ play_sequence2 ( SEQ_MENU_RESULTS_SCREEN_WIN_VS );
25562564 D_800EA0EC [playerId ] = 2 ;
25572565 func_800C90F4 (playerId , (gPlayers [gPlayerWinningIndex ].characterId * 0x10 ) +
25582566 SOUND_ARG_LOAD (0x29 , 0x00 , 0x80 , 0x0D ));
@@ -2563,7 +2571,7 @@ void func_800C76C0(u8 playerId) {
25632571 (D_800EA0EC [3 ] == 1 )) {
25642572 func_800C5278 (5U );
25652573 func_800C9018 (playerId , SOUND_ARG_LOAD (0x01 , 0x00 , 0x80 , 0x26 ));
2566- func_800C8EF8 ( 0x0017U );
2574+ play_sequence2 ( SEQ_MENU_RESULTS_SCREEN_WIN_VS );
25672575 D_800EA0EC [playerId ] = 2 ;
25682576 func_800C90F4 (playerId , (gPlayers [gPlayerWinningIndex ].characterId * 0x10 ) +
25692577 SOUND_ARG_LOAD (0x29 , 0x00 , 0x80 , 0x0D ));
@@ -2880,14 +2888,14 @@ void play_sound2(s32 soundBits) {
28802888 play_sound (soundBits , & D_800EA1C8 , 4 , & D_800EA1D4 , & D_800EA1D4 , & D_800EA1DC );
28812889}
28822890
2883- void func_800C8EAC (u16 arg0 ) {
2884- func_800C3448 (arg0 | 0x10000 );
2885- D_800EA15C = arg0 ;
2891+ void play_sequence (u16 index ) {
2892+ func_800C3448 (index | 0x0010000 );
2893+ D_800EA15C = index ;
28862894}
28872895
2888- void func_800C8EF8 (u16 arg0 ) {
2889- func_800C3448 (arg0 | 0x1010000 );
2890- D_800EA160 = arg0 ;
2896+ void play_sequence2 (u16 index ) {
2897+ func_800C3448 (index | 0x1010000 );
2898+ D_800EA160 = index ;
28912899}
28922900
28932901void func_800C8F44 (u8 arg0 ) {
@@ -3309,12 +3317,12 @@ void func_800CA388(u8 arg0) {
33093317 fade_channel_volume_scale (5 , 0 , arg0 );
33103318}
33113319
3312- void func_800CA414 (u16 arg0 , u16 arg1 ) {
3320+ void play_sequences (u16 first , u16 second ) {
33133321 if (D_800EA104 == 0 ) {
33143322 func_800C3448 (func_800C3508 (0 ) | 0x30000000 );
33153323 func_800C35E8 (0 );
3316- func_800C3448 (arg1 | 0xC1510000 );
3317- func_800C3448 (arg0 | 0x1000000 );
3324+ func_800C3448 (second | 0xC1510000 );
3325+ func_800C3448 (first | 0x01000000 );
33183326 }
33193327 D_800EA104 = 1 ;
33203328}
@@ -3326,12 +3334,12 @@ void func_800CA49C(u8 playerIndex) {
33263334 } else if (D_800EA164 != 0 ) {
33273335 func_800C3448 (0x100100FF ); // 0x19000000
33283336 func_800C3448 (0x110100FF );
3329- func_800C8EF8 ( 0xC );
3337+ play_sequence2 ( SEQ_EVENT_RACE_FINAL_LAP );
33303338 func_800C3448 (0xC1510011 );
33313339 } else {
33323340 func_800C3448 (0x100100FF ); // 0x19000000
33333341 func_800C3448 (0x110100FF );
3334- func_800C8EF8 ( 0xC );
3342+ play_sequence2 ( SEQ_EVENT_RACE_FINAL_LAP );
33353343 func_800C3448 (D_800EA15C | 0xC1500000 );
33363344 func_800C3448 (0xC130017D );
33373345 }
@@ -3355,11 +3363,11 @@ void func_800CA59C(u8 playerId) {
33553363 func_800C3448 (0xC1F00000 );
33563364 func_800C3448 (0xC1510011 );
33573365 } else {
3358- func_800C8EF8 ( 0x0011U );
3366+ play_sequence2 ( SEQ_EVENT_RACE_POWERUP_STAR );
33593367 }
33603368 } else {
33613369 if (1 ) {} // ?
3362- func_800C8EF8 ( 0x0011U );
3370+ play_sequence2 ( SEQ_EVENT_RACE_POWERUP_STAR );
33633371 }
33643372 }
33653373 D_800EA10C [playerId ] = 1 ;
@@ -3382,20 +3390,20 @@ void func_800CA730(u8 playerIndex) {
33823390 if (D_8018FC08 != 0 ) {
33833391 if (((u32 ) (gSequencePlayers [1 ].enabled )) == 0 ) {
33843392 func_800C3608 (1 , 5 );
3385- func_800C8EAC (D_800EA15C );
3393+ play_sequence (D_800EA15C );
33863394 func_800C3448 (0xB001307DU );
33873395 } else if ((func_800C3508 (1 ) == 0xC ) || (func_800C357C (0x0101000C ) == 0 )) {
33883396 func_800C3448 (0xC1F00000U );
33893397 func_800C3448 (D_800EA15C | 0xC1500000 );
33903398 func_800C3448 (0xC130017DU );
33913399 } else {
33923400 func_800C3448 (0x110100FFU );
3393- func_800C8EAC (D_800EA15C );
3401+ play_sequence (D_800EA15C );
33943402 func_800C3448 (0xB001307DU );
33953403 }
33963404 } else {
33973405 func_800C3448 (0x110100FFU );
3398- func_800C8EAC (D_800EA15C );
3406+ play_sequence (D_800EA15C );
33993407 }
34003408 }
34013409 D_800EA164 = 0 ;
@@ -3556,41 +3564,54 @@ void func_800CB134() {
35563564 D_800EA174 = 1 ;
35573565}
35583566
3559- void func_800CB14C () {
3567+ /*
3568+ Play the entire "losing" sequence for the podium ceremony.
3569+
3570+ Increments a timer value by one per frame in order to tell which part of the sequence to play at which point.
3571+ */
3572+ void begin_losing_ceremony_sequence () {
35603573 if (D_800EA174 != 0 ) {
35613574 D_800EA174 ++ ;
3575+
35623576 if (D_800EA174 == 3 ) {
3563- func_800C8EAC ( 0x001AU );
3577+ play_sequence ( SEQ_EVENT_CEREMONY_PRESENTATION_PART1 ); // Begin with Part 1 of the ceremony presentation music --- "Everything seems normal..."
35643578 func_800C3448 (0x4000007F );
35653579 }
3566- if (D_800EA174 == 0x012C ) {
3567- func_800C8EAC (0x001BU );
3580+
3581+ if (D_800EA174 == 300 ) {
3582+ play_sequence (SEQ_EVENT_CEREMONY_PRESENTATION_PART2_WIN ); // Follow up with Part 2 of the winning ceremony presentation music --- "Looks like I won...?"
35683583 func_800C3448 (0x4000007F );
3569- func_800C8EF8 ( 0x001DU );
3584+ play_sequence2 ( SEQ_EVENT_CEREMONY_PRESENTATION_PART2_LOSE ); // Once it ends, begin the LOSING ceremony presentation music, which has a few notes changed to be off-tune --- "Uh oh..."
35703585 func_800C3448 (0x41000000 );
35713586 }
3572- if (D_800EA174 == 0x0230 ) {
3587+
3588+ if (D_800EA174 == 560 ) { // (Somewhere in this code it slows down the music, changes the pitch of it and completely breaks the music)
35733589 func_800C3448 (0x40640000 );
35743590 func_800C3448 (0xB0640073 );
35753591 func_800C3448 (0x4150007F );
35763592 func_800C3448 (0xB1640073 );
35773593 }
3578- if (D_800EA174 == 0x02A8 ) {
3594+
3595+ if (D_800EA174 == 680 ) {
35793596 func_800C3448 (0x100100FF );
35803597 }
3581- if (D_800EA174 == 0x041A ) {
3598+
3599+ if (D_800EA174 == 1050 ) {
35823600 func_800C3448 (0xB1500001 );
35833601 func_800C3448 (0x51500001 );
35843602 }
3585- if (D_800EA174 == 0x046A ) {
3603+
3604+ if (D_800EA174 == 1130 ) {
35863605 func_800C3448 (0x41320000 );
35873606 }
3588- if (D_800EA174 == 0x04B0 ) {
3607+
3608+ if (D_800EA174 == 1200 ) { // (Player gets hit by the bomb-omb car; play the "explosion" sound effect and the "hurt" voice for the current character)
35893609 func_800C3448 (0x110100FF );
35903610 }
3591- if (D_800EA174 == 0x04CE ) {
3592- func_800C8EAC (0x0014U );
3593- func_800C3448 (0x4000007F );
3611+
3612+ if (D_800EA174 == 1230 ) { // Once the music is completely broken by this point, play the "No Trophy For You!" sequence --- "Aw man, I lost... :("
3613+ play_sequence (SEQ_EVENT_CEREMONY_TROPHY_LOSE );
3614+ func_800C3448 (0x4000007F ); // (Play the "losing" voice for the current character, twice)
35943615 }
35953616 }
35963617}
0 commit comments