From b6a84c1646204332adc148b3c2ca36047ace765d Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 12 Oct 2024 19:39:52 +0200 Subject: [PATCH] readd music_resync_powerups_only --- src/m_menu.c | 1 + src/p_spec.c | 4 +--- src/s_sound.c | 2 ++ src/s_sound.h | 1 + src/sdl/mixer_sound.c | 4 +++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 2bfb3e1f1..62a303d7e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2577,6 +2577,7 @@ static menuitem_t OP_AdvancedBirdMenu[] = {IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40}, {IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60}, + {IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70}, }; static const char* OP_AdvancedBirdTooltips[] = diff --git a/src/p_spec.c b/src/p_spec.c index 2a4e13d55..81d5ad8b4 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2179,9 +2179,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mapmusflags |= MUSIC_FORCERESET; mapmusposition = position; - - if (cv_birdmusic.value) - mapmusresume = 0; + mapmusresume = 0; S_ChangeMusicEx(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4), position, !(line->flags & ML_EFFECT2) ? prefadems : 0, diff --git a/src/s_sound.c b/src/s_sound.c index ec5ebf00d..9496ea4e9 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -107,6 +107,7 @@ static CV_PossibleValue_t music_resync_threshold_cons_t[] = { {0} }; consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL}; 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}; @@ -281,6 +282,7 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_pausemusic); CV_RegisterVar(&cv_music_resync_threshold); + CV_RegisterVar(&cv_music_resync_powerups_only); CV_RegisterVar(&cv_invincmusicfade); CV_RegisterVar(&cv_growmusicfade); diff --git a/src/s_sound.h b/src/s_sound.h index 6f4d03f09..899d0e043 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -54,6 +54,7 @@ extern consvar_t cv_amigatype; //bird music stuff extern consvar_t cv_music_resync_threshold; +extern consvar_t cv_music_resync_powerups_only; extern consvar_t cv_invincmusicfade; extern consvar_t cv_growmusicfade; diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 12abb7c65..2fb3dc621 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -93,6 +93,8 @@ static UINT16 SAMPLERATE = 44100; /// ------------------------ UINT8 sound_started = false; + +static UINT32 stutter_threshold_user; static UINT32 stutter_threshold; static Mix_Music *music; @@ -1046,7 +1048,7 @@ void I_UpdateSongLagThreshold (void) if (!cv_birdmusic.value) return; - stutter_threshold = cv_music_resync_threshold.value/1000.0*(4*44100); + stutter_threshold = cv_music_resync_powerups_only.value ? 0 : (cv_music_resync_threshold.value/1000.0*(4*44100)); } /// ------------------------