From d99d1994da2e898dea753c0093883f5d34fbe325 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 29 Nov 2019 16:17:09 -0800 Subject: [PATCH] Let invincibility and grow music fades work again --- src/g_game.c | 26 ++++++++++++++++++++++++++ src/p_user.c | 21 ++------------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index f5aab99a9..0a62b27f9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2596,6 +2596,9 @@ void G_PlayerReborn(INT32 player) INT32 respawnflip; boolean songcredit = false; + boolean local; + boolean playing; + score = players[player].score; marescore = players[player].marescore; lives = players[player].lives; @@ -2755,8 +2758,31 @@ void G_PlayerReborn(INT32 player) } } + /* I'm putting this here because lol */ + + local = P_IsLocalPlayer(p); + + if (local) + { + playing = S_MusicPlaying(); + + /* + Fade it in with the same call to avoid + max volume for a few milliseconds (?). + */ + if (! playing) + S_SetRestoreMusicFadeInCvar(&cv_respawnfademusicback); + } + P_RestoreMusic(p); + if (local) + { + /* mid-way fading out, fade back up */ + if (playing) + S_FadeMusic(100, cv_respawnfademusicback.value); + } + if (songcredit) S_ShowMusicCredit(); diff --git a/src/p_user.c b/src/p_user.c index 80f206d7c..5fee0ac9b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1189,8 +1189,6 @@ boolean P_EndingMusic(player_t *player) void P_RestoreMusic(player_t *player) { UINT32 position; - boolean playing; - int fadein; if (!P_IsLocalPlayer(player)) // Only applies to a local player return; @@ -1271,25 +1269,10 @@ void P_RestoreMusic(player_t *player) else position = mapmusposition; - playing = S_MusicPlaying(); - - /* - So if the music isn't playing, it's - most likely because we were dead. - */ - if (! playing) - fadein = cv_respawnfademusicback.value; - - if (playing || ! fadein) - fadein = S_GetRestoreMusicFadeIn(); - - S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, fadein); + S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, + S_GetRestoreMusicFadeIn()); S_ClearRestoreMusicFadeInCvar(); mapmusresume = 0; - - /* mid-way fading out, fade back up */ - if (playing) - S_FadeMusic(100, cv_respawnfademusicback.value); } } }