Let invincibility and grow music fades work again

This commit is contained in:
James R 2019-11-29 16:17:09 -08:00
parent 3ae147b01b
commit d99d1994da
2 changed files with 28 additions and 19 deletions

View file

@ -2596,6 +2596,9 @@ void G_PlayerReborn(INT32 player)
INT32 respawnflip; INT32 respawnflip;
boolean songcredit = false; boolean songcredit = false;
boolean local;
boolean playing;
score = players[player].score; score = players[player].score;
marescore = players[player].marescore; marescore = players[player].marescore;
lives = players[player].lives; 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); P_RestoreMusic(p);
if (local)
{
/* mid-way fading out, fade back up */
if (playing)
S_FadeMusic(100, cv_respawnfademusicback.value);
}
if (songcredit) if (songcredit)
S_ShowMusicCredit(); S_ShowMusicCredit();

View file

@ -1189,8 +1189,6 @@ boolean P_EndingMusic(player_t *player)
void P_RestoreMusic(player_t *player) void P_RestoreMusic(player_t *player)
{ {
UINT32 position; UINT32 position;
boolean playing;
int fadein;
if (!P_IsLocalPlayer(player)) // Only applies to a local player if (!P_IsLocalPlayer(player)) // Only applies to a local player
return; return;
@ -1271,25 +1269,10 @@ void P_RestoreMusic(player_t *player)
else else
position = mapmusposition; position = mapmusposition;
playing = S_MusicPlaying(); S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0,
S_GetRestoreMusicFadeIn());
/*
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_ClearRestoreMusicFadeInCvar(); S_ClearRestoreMusicFadeInCvar();
mapmusresume = 0; mapmusresume = 0;
/* mid-way fading out, fade back up */
if (playing)
S_FadeMusic(100, cv_respawnfademusicback.value);
} }
} }
} }