3 AM Moment: The death fades now only apply to local players

This commit is contained in:
James R 2019-11-29 03:24:10 -08:00
parent 15e8291903
commit 80c7cc3c87
3 changed files with 35 additions and 26 deletions

View file

@ -2755,18 +2755,7 @@ void G_PlayerReborn(INT32 player)
} }
} }
if (S_MusicPlaying()) P_RestoreMusic(p);
{
P_RestoreMusic(p);
/* mid-way fading out, fade back up */
S_FadeMusic(100, cv_respawnfademusicback.value);
}
else
{
/* this could be considered a hack, but I like it ...kinda */
S_SetRestoreMusicFadeInCvar(&cv_respawnfademusicback);
P_RestoreMusic(p);
}
if (songcredit) if (songcredit)
S_ShowMusicCredit(); S_ShowMusicCredit();

View file

@ -2331,19 +2331,22 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
} }
target->player->playerstate = PST_DEAD; target->player->playerstate = PST_DEAD;
if (netgame || multiplayer) if (P_IsLocalPlayer(target->player))
ms = cv_respawntime.value * 1000; {
else if (netgame || multiplayer)
ms = 1000; ms = cv_respawntime.value * 1000;
else
ms = 1000;
/* /*
If the time spent with the music paused is less than half If the time spent with the music paused is less than half
a second, continue playing the song (just mute it). a second, continue playing the song (just mute it).
*/ */
if (( ms - cv_respawnfademusicout.value ) < 500) if (( ms - cv_respawnfademusicout.value ) < 500)
S_FadeMusic(0, cv_respawnfademusicout.value); S_FadeMusic(0, cv_respawnfademusicout.value);
else else
S_FadeOutStopMusic(cv_respawnfademusicout.value); S_FadeOutStopMusic(cv_respawnfademusicout.value);
}
if (target->player == &players[consoleplayer]) if (target->player == &players[consoleplayer])
{ {

View file

@ -1189,6 +1189,8 @@ 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;
@ -1269,10 +1271,25 @@ void P_RestoreMusic(player_t *player)
else else
position = mapmusposition; position = mapmusposition;
S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, playing = S_MusicPlaying();
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);
} }
} }
} }