Death fades music

Cvars are respawnfademusicout and respawnfademusicback. Both measure
milliseconds.
This commit is contained in:
James R 2019-11-29 02:55:45 -08:00
parent 911dd57334
commit 7023ccc239
4 changed files with 37 additions and 1 deletions

View file

@ -988,6 +988,9 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
CV_RegisterVar(&cv_respawnfademusicout);
CV_RegisterVar(&cv_respawnfademusicback);
CV_RegisterVar(&cv_resume);
// ingame object placing

View file

@ -533,6 +533,9 @@ consvar_t cv_deadzone4 = {"joy4_deadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_con
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicback = {"respawnfademusicback", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_resume = {"resume", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16
@ -2751,7 +2754,19 @@ void G_PlayerReborn(INT32 player)
}
}
P_RestoreMusic(p);
if (S_MusicPlaying())
{
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)
S_ShowMusicCredit();

View file

@ -121,6 +121,9 @@ extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_gu
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
extern consvar_t cv_respawnfademusicout;
extern consvar_t cv_respawnfademusicback;
extern consvar_t cv_resume;
typedef enum

View file

@ -2116,6 +2116,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{
mobjtype_t item;
mobj_t *mo;
int ms;
//if (inflictor && (inflictor->type == MT_SHELL || inflictor->type == MT_FIREBALL))
// P_SetTarget(&target->tracer, inflictor);
@ -2330,6 +2331,20 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
}
target->player->playerstate = PST_DEAD;
if (netgame || multiplayer)
ms = cv_respawntime.value * 1000;
else
ms = 1000;
/*
If the time spent with the music paused is less than half
a second, continue playing the song (just mute it).
*/
if (( ms - cv_respawnfademusicout.value ) < 500)
S_FadeMusic(0, cv_respawnfademusicout.value);
else
S_FadeOutStopMusic(cv_respawnfademusicout.value);
if (target->player == &players[consoleplayer])
{
// don't die in auto map,