cv_fading to disable music fading entirely

This commit is contained in:
James R authored and Galactice committed 2022-11-08 10:43:36 -05:00
1 parent 459d73ad86
commit 200aaabf48
5 files changed
+102

No files matched your search

+11
View File
@@ -998,6 +998,17 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_soundtest);
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
CV_RegisterVar(&cv_respawnfademusicout);
CV_RegisterVar(&cv_respawnfademusicback);
CV_RegisterVar(&cv_resetspecialmusic);
CV_RegisterVar(&cv_resume);
CV_RegisterVar(&cv_fading);
// ingame object placing
COM_AddCommand("objectplace", Command_ObjectPlace_f);
COM_AddCommand("writethings", Command_Writethings_f);
+35
View File
@@ -531,6 +531,14 @@ consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_c
consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, 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_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};
consvar_t cv_fading = {"fading", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
#if MAXPLAYERS > 16
#error "please update player_name table using the new value for MAXPLAYERS"
#endif
@@ -2689,6 +2697,9 @@ void G_PlayerReborn(INT32 player)
tic_t grieftime;
UINT8 griefstrikes;
boolean fade;
boolean playing;
score = players[player].score;
marescore = players[player].marescore;
lives = players[player].lives;
@@ -2864,7 +2875,31 @@ void G_PlayerReborn(INT32 player)
}
}
/* I'm putting this here because lol */
fade = ( cv_fading.value && P_IsLocalPlayer(p) );
if (fade)
{
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 (fade)
{
/* mid-way fading out, fade back up */
if (playing)
S_FadeMusic(100, cv_respawnfademusicback.value);
}
if (songcredit)
S_ShowMusicCredit();
+11
View File
@@ -124,6 +124,17 @@ extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_xdeadzone4,cv_ydeadzone4;
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
extern consvar_t cv_invincmusicfade;
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;
extern consvar_t cv_fading;
typedef enum
{
AXISNONE = 0,
+17
View File
@@ -2347,6 +2347,23 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
}
target->player->playerstate = PST_DEAD;
if (cv_fading.value && P_IsLocalPlayer(target->player))
{
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,
+28
View File
@@ -2156,6 +2156,34 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume)
}
}
void
S_SetRestoreMusicFadeInCvar (consvar_t *cv)
{
music_refade_cv = cv;
}
int
S_GetRestoreMusicFadeIn (void)
{
if (music_refade_cv && cv_fading.value)
return music_refade_cv->value;
else
return 0;
}
void
S_SetMusicUsage (int type)
{
music_usage = type;
I_UpdateSongLagConditions();
}
int
S_MusicUsage (void)
{
return music_usage;
}
/// ------------------------
/// Music Fading
/// ------------------------