Reset Invincibility (and Grow) music to the start if stacked

Toggleable via the resetspecialmusic cvar.
This commit is contained in:
James R 2019-11-29 17:38:55 -08:00
parent dd1715aa15
commit 7e0aa16e70
6 changed files with 19 additions and 4 deletions

View file

@ -991,6 +991,8 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_respawnfademusicout);
CV_RegisterVar(&cv_respawnfademusicback);
CV_RegisterVar(&cv_resetspecialmusic);
CV_RegisterVar(&cv_resume);
// ingame object placing

View file

@ -536,6 +536,8 @@ consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, 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_resetspecialmusic = {"resetspecialmusic", "Yes", CV_SAVE, CV_YesNo, 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

View file

@ -124,6 +124,8 @@ extern consvar_t cv_growmusicfade;
extern consvar_t cv_respawnfademusicout;
extern consvar_t cv_respawnfademusicback;
extern consvar_t cv_resetspecialmusic;
extern consvar_t cv_resume;
typedef enum

View file

@ -1247,15 +1247,13 @@ void P_RestoreMusic(player_t *player)
// Item - Grow
if (wantedmus == 2)
{
S_ChangeMusicInternal("kgrow", true);
S_SetMusicUsage(MUS_SPECIAL);
S_ChangeMusicSpecial("kgrow");
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetMusicUsage(MUS_SPECIAL);
S_ChangeMusicSpecial("kinvnc");
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else

View file

@ -2075,6 +2075,15 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
}
}
void
S_ChangeMusicSpecial (const char *mmusic)
{
if (cv_resetspecialmusic.value)
S_ChangeMusic(mmusic, MUSIC_FORCERESET, true);
else
S_ChangeMusicInternal(mmusic, true);
}
void S_StopMusic(void)
{
if (!I_SongPlaying()

View file

@ -192,6 +192,8 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32
#define S_ChangeMusicInternal(a,b) S_ChangeMusicEx(a,0,b,0,0,0)
#define S_ChangeMusic(a,b,c) S_ChangeMusicEx(a,b,c,0,0,0)
void S_ChangeMusicSpecial (const char *mmusic);
void S_SetRestoreMusicFadeInCvar (consvar_t *cvar);
#define S_ClearRestoreMusicFadeInCvar() \
S_SetRestoreMusicFadeInCvar(0)