From 173d780ab7e5adaeec7b2abbc63048d979e747ff Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 5 Jun 2018 02:41:55 -0400 Subject: [PATCH] P_RestoreMusic restores level exit music as well Splitscreen fix --- src/k_kart.c | 2 +- src/p_spec.c | 6 +++--- src/p_user.c | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d6eea110..06f32a9e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4271,7 +4271,7 @@ static void K_DrawKartPositionNum(INT32 num) break; } } - else if (stplyr->laps+1 == cv_numlaps.value || stplyr->exiting) // Check for the final lap, or won + else if (stplyr->laps+1 >= cv_numlaps.value || stplyr->exiting) // Check for the final lap, or won { // Alternate frame every three frames switch (leveltime % 9) diff --git a/src/p_spec.c b/src/p_spec.c index 18314c2e..7883a2ca 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4210,7 +4210,9 @@ DoneSection2: if (P_IsLocalPlayer(player)) { // SRB2kart 200117 - if (!splitscreen) + if (splitscreen) + S_ChangeMusicInternal("karwin", true); + else { if (player->kartstuff[k_position] == 1) S_ChangeMusicInternal("karwin", true); @@ -4219,8 +4221,6 @@ DoneSection2: else S_ChangeMusicInternal("karok", true); } - else - S_ChangeMusicInternal("karok", true); } if (player->kartstuff[k_position] == 1) diff --git a/src/p_user.c b/src/p_user.c index 691ecee7..80da049f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1165,7 +1165,21 @@ void P_RestoreMusic(player_t *player) S_SpeedMusic(1.0f); // SRB2kart - We have some different powers than vanilla, some of which tweak the music. - if (!player->exiting) + if (splitscreen != 0 && (players[consoleplayer].exiting + || players[secondarydisplayplayer].exiting + || players[thirddisplayplayer].exiting + || players[fourthdisplayplayer].exiting)) + S_ChangeMusicInternal("karwin", true); + else if (splitscreen == 0 && player->exiting) + { + if (player->kartstuff[k_position] == 1) + S_ChangeMusicInternal("karwin", true); + else if (K_IsPlayerLosing(player)) + S_ChangeMusicInternal("karlos", true); + else + S_ChangeMusicInternal("karok", true); + } + else { // Item - Mega Mushroom if (player->kartstuff[k_growshrinktimer] > 1 && player->playerstate == PST_LIVE) @@ -1176,7 +1190,7 @@ void P_RestoreMusic(player_t *player) else if (leveltime > 157) { // Event - Final Lap - if (player->laps == (UINT8)(cv_numlaps.value - 1)) + if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1)) S_SpeedMusic(1.2f); S_ChangeMusic(mapmusname, mapmusflags, true); } @@ -10129,3 +10143,4 @@ void P_PlayerAfterThink(player_t *player) K_KartPlayerAfterThink(player); } +