mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Merge branch 'credits-music-tidy' into 'master'
Credits music tidy See merge request KartKrew/Kart!2160
This commit is contained in:
commit
fea4b0bd2a
4 changed files with 9 additions and 21 deletions
|
|
@ -63,10 +63,7 @@ public:
|
||||||
// the fade gain, even if it would clamp anyway.
|
// the fade gain, even if it would clamp anyway.
|
||||||
for (std::size_t i = 0; i < generated; i++)
|
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_)) /
|
buffer[total_written + i] *= current_fade_gain(i);
|
||||||
static_cast<double>(gain_samples_target_);
|
|
||||||
const float fade_gain = (gain_target_ - gain_) * std::clamp(alpha, 0.f, 1.f) + gain_;
|
|
||||||
buffer[total_written + i] *= fade_gain;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gain_samples_ = std::min(gain_samples_ + generated, gain_samples_target_);
|
gain_samples_ = std::min(gain_samples_ + generated, gain_samples_target_);
|
||||||
|
|
@ -255,7 +252,7 @@ public:
|
||||||
return std::nullopt;
|
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)
|
void fade_from_to(float from, float to, float seconds)
|
||||||
{
|
{
|
||||||
|
|
@ -300,6 +297,13 @@ private:
|
||||||
bool fading_ {false};
|
bool fading_ {false};
|
||||||
uint64_t gain_samples_ {0};
|
uint64_t gain_samples_ {0};
|
||||||
uint64_t gain_samples_target_ {1};
|
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<double>(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.
|
// The special member functions MUST be declared in this unit, where Impl is complete.
|
||||||
|
|
|
||||||
|
|
@ -997,10 +997,6 @@ UINT16 finaleemeralds = 0;
|
||||||
|
|
||||||
void F_StartGameEvaluation(void)
|
void F_StartGameEvaluation(void)
|
||||||
{
|
{
|
||||||
Music_SetFadeOut("credits", 250);
|
|
||||||
Music_DelayEnd("credits", TICRATE/4);
|
|
||||||
Music_Tick(); // it needs to fade out right now
|
|
||||||
|
|
||||||
S_StopMusicCredit();
|
S_StopMusicCredit();
|
||||||
|
|
||||||
// Credits option in extras menu
|
// Credits option in extras menu
|
||||||
|
|
|
||||||
|
|
@ -369,10 +369,6 @@ static void F_InitCreditsSlide(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (slide->type == CRED_TYPE_KARTKREW)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the console hud just to avoid anything getting in the way.
|
// Clear the console hud just to avoid anything getting in the way.
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
|
|
@ -413,7 +409,6 @@ void F_StartCredits(void)
|
||||||
Music_StopAll();
|
Music_StopAll();
|
||||||
S_StopSounds();
|
S_StopSounds();
|
||||||
|
|
||||||
Music_SetFadeOut("credits", 0);
|
|
||||||
F_NewCreditsMusic("_creds", false);
|
F_NewCreditsMusic("_creds", false);
|
||||||
|
|
||||||
F_CreditsReset();
|
F_CreditsReset();
|
||||||
|
|
@ -1225,8 +1220,3 @@ void F_CreditDrawer(void)
|
||||||
star.y += FixedMul(star.vel_y, renderdeltatics);
|
star.y += FixedMul(star.vel_y, renderdeltatics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean F_CreditsRunning(void)
|
|
||||||
{
|
|
||||||
return gamestate == GS_CREDITS || demo.attract == DEMO_ATTRACT_CREDITS;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,6 @@ void F_CreditTicker(void);
|
||||||
|
|
||||||
void F_CreditDrawer(void);
|
void F_CreditDrawer(void);
|
||||||
|
|
||||||
boolean F_CreditsRunning(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue