From 3b500add73b3d71f1d7928a5269cc2bda1c2f194 Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 23 Aug 2024 15:29:36 +0200 Subject: [PATCH] cleanup birdmusic crap again music_resync_powerups_only literally didnt do shit lol removed some other unused crap changed some conditions to better check for stuff etc idk i just rather remove this whole thing at this point but oh well --- src/g_game.c | 5 ++--- src/i_sound.h | 1 - src/m_menu.c | 1 - src/p_inter.c | 4 ++-- src/p_spec.c | 4 +++- src/p_user.c | 14 +++++--------- src/s_sound.c | 22 ++++------------------ src/s_sound.h | 9 --------- src/sdl/mixer_sound.c | 21 ++++++--------------- src/sdl/sdl_sound.c | 1 - 10 files changed, 22 insertions(+), 60 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index c15216a91..0025782ed 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2705,8 +2705,7 @@ void G_PlayerReborn(INT32 player) } /* I'm putting this here because lol */ - - fade = (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(p)); + fade = (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(p)); if (fade) { @@ -2716,7 +2715,7 @@ void G_PlayerReborn(INT32 player) Fade it in with the same call to avoid max volume for a few milliseconds (?). */ - if (! playing) + if (!playing) S_SetRestoreMusicFadeInCvar(&cv_respawnfademusicback); } diff --git a/src/i_sound.h b/src/i_sound.h index d0542cfb5..925be7596 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -159,7 +159,6 @@ boolean I_SetSongPosition(UINT32 position); UINT32 I_GetSongPosition(void); void I_UpdateSongLagThreshold (void); -void I_UpdateSongLagConditions (void); /// ------------------------ // MUSIC PLAYBACK diff --git a/src/m_menu.c b/src/m_menu.c index b7829fe31..5dee26366 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2437,7 +2437,6 @@ 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_inter.c b/src/p_inter.c index d22f99112..5ffaf6dba 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1737,7 +1737,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } target->player->playerstate = PST_DEAD; - if (cv_fading.value && cv_birdmusic.value && P_IsLocalPlayer(target->player)) + if (cv_birdmusic.value && cv_fading.value && P_IsLocalPlayer(target->player)) { if (netgame || multiplayer) ms = cv_respawntime.value * 1000; @@ -1748,7 +1748,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) 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) + if ((ms - cv_respawnfademusicout.value) < 500) S_FadeMusic(0, cv_respawnfademusicout.value); else S_FadeOutStopMusic(cv_respawnfademusicout.value); diff --git a/src/p_spec.c b/src/p_spec.c index 82372fc90..97ad38015 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2179,7 +2179,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) mapmusflags |= MUSIC_FORCERESET; mapmusposition = position; - mapmusresume = 0; + + if (cv_birdmusic.value) + mapmusresume = 0; S_ChangeMusicEx(mapmusname, mapmusflags, !(line->flags & ML_EFFECT4), position, !(line->flags & ML_EFFECT2) ? prefadems : 0, diff --git a/src/p_user.c b/src/p_user.c index 63c63b448..599312475 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -593,6 +593,7 @@ void P_PlayLivesJingle(player_t *player) void P_PlayRinglossSound(mobj_t *source, mobj_t *damager) { sfxenum_t key = P_RandomKey(2); + if (cv_kartvoices.value) { if (cv_karthitemdialog.value && source != damager && damager && damager->player && P_IsLocalPlayer(damager->player)) @@ -815,17 +816,13 @@ void P_RestoreMusic(player_t *player) if (wantedmus == 2 && cv_growmusic.value == 1) { S_ChangeMusicInternal("kgrow", true); - - if (cv_birdmusic.value) - S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); + S_SetRestoreMusicFadeInCvar(&cv_growmusicfade); } // Item - Invincibility else if (wantedmus == 1 && cv_supermusic.value == 1) { S_ChangeMusicInternal("kinvnc", true); - - if (cv_birdmusic.value) - S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); + S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade); } else { @@ -842,13 +839,12 @@ void P_RestoreMusic(player_t *player) else position = mapmusposition; - S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, - S_GetRestoreMusicFadeIn()); + S_ChangeMusicEx(mapmusname, mapmusflags, true, position, 0, S_GetRestoreMusicFadeIn()); S_ClearRestoreMusicFadeInCvar(); } else S_ChangeMusicEx(mapmusname, mapmusflags, true, mapmusposition, 0, 0); - + mapmusresume = 0; } } diff --git a/src/s_sound.c b/src/s_sound.c index 0bc76bce2..f3450b6f4 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -109,8 +109,6 @@ static CV_PossibleValue_t music_resync_threshold_cons_t[] = { }; 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_UpdateSongLagConditions, 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}; consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -289,7 +287,6 @@ 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); @@ -1308,7 +1305,6 @@ static void *music_data; static UINT16 music_flags; static boolean music_looping; static consvar_t *music_refade_cv; -static int music_usage; static char queue_name[7]; static UINT16 queue_flags; @@ -1928,7 +1924,6 @@ static void S_UnloadMusic(void) music_looping = false; music_refade_cv = 0; - music_usage = 0; } static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) @@ -1936,8 +1931,7 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms) if (S_MusicDisabled()) return false; - if (cv_birdmusic.value) - I_UpdateSongLagConditions(); + I_UpdateSongLagThreshold(); if ((!fadeinms && !I_PlaySong(looping)) || (fadeinms && !I_FadeInPlaySong(fadeinms, looping))) @@ -2132,6 +2126,9 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) void S_SetRestoreMusicFadeInCvar (consvar_t *cv) { + if (!cv_birdmusic.value) + return; + music_refade_cv = cv; } @@ -2143,17 +2140,6 @@ int S_GetRestoreMusicFadeIn (void) return 0; } -void S_SetMusicUsage (int type) -{ - music_usage = type; - I_UpdateSongLagConditions(); -} - -int S_MusicUsage (void) -{ - return music_usage; -} - /// ------------------------ /// Music Fading /// ------------------------ diff --git a/src/s_sound.h b/src/s_sound.h index 538e8713e..8787ea5e5 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -55,7 +55,6 @@ 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; @@ -218,11 +217,6 @@ UINT32 S_GetMusicPosition(void); // Music Playback // -enum -{ - MUS_SPECIAL = 1,/* powerups--invincibility, grow */ -}; - // Start music track, arbitrary, given its name, and set whether looping // note: music flags 12 bits for tracknum (gme, other formats with more than one track) // 13-15 aren't used yet @@ -238,9 +232,6 @@ void S_SetRestoreMusicFadeInCvar (consvar_t *cvar); S_SetRestoreMusicFadeInCvar(0) int S_GetRestoreMusicFadeIn (void); -void S_SetMusicUsage (int type); -int S_MusicUsage (void); - // Stops the music. void S_StopMusic(void); diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 806c77e47..12abb7c65 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -93,8 +93,6 @@ static UINT16 SAMPLERATE = 44100; /// ------------------------ UINT8 sound_started = false; - -static UINT32 stutter_threshold_user; static UINT32 stutter_threshold; static Mix_Music *music; @@ -626,9 +624,10 @@ static void count_music_bytes(int chan, void *stream, int len, void *udata) if (!music || I_SongType() == MU_GME || I_SongType() == MU_MOD || I_SongType() == MU_MID) return; + music_bytes += len; - if ((gamestate == GS_LEVEL) && (cv_birdmusic.value)) + if (cv_birdmusic.value && gamestate == GS_LEVEL) Countstutter(len); } @@ -1042,20 +1041,12 @@ UINT32 I_GetSongPosition(void) // 8M: 1 | 8S: 2 | 16M: 2 | 16S: 4 } -void -I_UpdateSongLagThreshold (void) +void I_UpdateSongLagThreshold (void) { - stutter_threshold_user = cv_music_resync_threshold.value/1000.0*(4*44100); - I_UpdateSongLagConditions(); -} + if (!cv_birdmusic.value) + return; -void -I_UpdateSongLagConditions (void) -{ - if (! cv_music_resync_powerups_only.value || S_MusicUsage() == MUS_SPECIAL) - stutter_threshold = stutter_threshold_user; - else - stutter_threshold = 0; + stutter_threshold = cv_music_resync_threshold.value/1000.0*(4*44100); } /// ------------------------ diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 503e7205a..33714f32a 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1410,7 +1410,6 @@ UINT32 I_GetSongPosition(void) } void I_UpdateSongLagThreshold (void) {} -void I_UpdateSongLagConditions (void) {} /// ------------------------ // MUSIC PLAYBACK