From 19de024e21e657b4cdc860015fb44306c923c50d Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 24 Mar 2024 18:09:01 -0700 Subject: [PATCH 1/3] Delete experimental code committed by accident --- src/k_credits.cpp | 9 --------- src/k_credits.h | 2 -- 2 files changed, 11 deletions(-) diff --git a/src/k_credits.cpp b/src/k_credits.cpp index dc0a6eb3a..792341f59 100644 --- a/src/k_credits.cpp +++ b/src/k_credits.cpp @@ -369,10 +369,6 @@ static void F_InitCreditsSlide(void) } } #endif - else if (slide->type == CRED_TYPE_KARTKREW) - { - - } // Clear the console hud just to avoid anything getting in the way. CON_ClearHUD(); @@ -1225,8 +1221,3 @@ void F_CreditDrawer(void) star.y += FixedMul(star.vel_y, renderdeltatics); } } - -boolean F_CreditsRunning(void) -{ - return gamestate == GS_CREDITS || demo.attract == DEMO_ATTRACT_CREDITS; -} diff --git a/src/k_credits.h b/src/k_credits.h index 165e0e608..c2836f07d 100644 --- a/src/k_credits.h +++ b/src/k_credits.h @@ -38,8 +38,6 @@ void F_CreditTicker(void); void F_CreditDrawer(void); -boolean F_CreditsRunning(void); - #ifdef __cplusplus } // extern "C" #endif From df0e256c009675b27cc0510fa179153ca693cb17 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 24 Mar 2024 18:09:20 -0700 Subject: [PATCH 2/3] Credits: remove music fade out into evaluation screen This is handled earlier by a JSON definition. --- src/f_finale.c | 4 ---- src/k_credits.cpp | 1 - 2 files changed, 5 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 7efa7de39..ad2405db5 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -984,10 +984,6 @@ UINT16 finaleemeralds = 0; void F_StartGameEvaluation(void) { - Music_SetFadeOut("credits", 250); - Music_DelayEnd("credits", TICRATE/4); - Music_Tick(); // it needs to fade out right now - S_StopMusicCredit(); // Credits option in extras menu diff --git a/src/k_credits.cpp b/src/k_credits.cpp index 792341f59..f45ee0b2c 100644 --- a/src/k_credits.cpp +++ b/src/k_credits.cpp @@ -409,7 +409,6 @@ void F_StartCredits(void) Music_StopAll(); S_StopSounds(); - Music_SetFadeOut("credits", 0); F_NewCreditsMusic("_creds", false); F_CreditsReset(); From 4fe992b19d088adf91c6dc63e8b671d7d40cead5 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 24 Mar 2024 19:05:23 -0700 Subject: [PATCH 3/3] Let I_FadeSong be used in the middle of an existing fade - Doing this so two fades can be installed at the end of the credits; 1 for normal playback speed, 2 for skip behavior - I_FadeSong can now be used to speed up or slow down an existing fade - Previously, calling I_FadeSong this way would jump to the previous target volume first, before starting a new fade - Should make no regressions --- src/audio/music_player.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/audio/music_player.cpp b/src/audio/music_player.cpp index 386dbe67d..41062f812 100644 --- a/src/audio/music_player.cpp +++ b/src/audio/music_player.cpp @@ -63,10 +63,7 @@ public: // the fade gain, even if it would clamp anyway. for (std::size_t i = 0; i < generated; i++) { - const float alpha = 1.0 - (gain_samples_target_ - std::min(gain_samples_ + i, gain_samples_target_)) / - static_cast(gain_samples_target_); - const float fade_gain = (gain_target_ - gain_) * std::clamp(alpha, 0.f, 1.f) + gain_; - buffer[total_written + i] *= fade_gain; + buffer[total_written + i] *= current_fade_gain(i); } gain_samples_ = std::min(gain_samples_ + generated, gain_samples_target_); @@ -255,7 +252,7 @@ public: return std::nullopt; } - void fade_to(float gain, float seconds) { fade_from_to(gain_target_, gain, seconds); } + void fade_to(float gain, float seconds) { fade_from_to(current_fade_gain(0), gain, seconds); } void fade_from_to(float from, float to, float seconds) { @@ -300,6 +297,13 @@ private: bool fading_ {false}; uint64_t gain_samples_ {0}; uint64_t gain_samples_target_ {1}; + + float current_fade_gain(uint64_t i) const + { + const float alpha = 1.0 - (gain_samples_target_ - std::min(gain_samples_ + i, gain_samples_target_)) / + static_cast(gain_samples_target_); + return (gain_target_ - gain_) * std::clamp(alpha, 0.f, 1.f) + gain_; + } }; // The special member functions MUST be declared in this unit, where Impl is complete.