Fixed odd engine sfx at high speed (speed wasn't capped when it

was used, resulting in a fraction becoming >1, resulting in incorrect
gear usage). See bug 3124797.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6865 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-12-06 06:07:50 +00:00
parent c4ba313e19
commit 68920bd3e3

View File

@ -1378,10 +1378,13 @@ void Kart::updatePhysics(float dt)
// ignoring the gear settings from stk_config, but providing a
// good enough brrrBRRRbrrrBRRR sound effect. Speed factor makes
// it a "staired sawtooth", so more acoustically rich.
float gears = 3.0f * fmod((float)(m_speed / max_speed), 0.333334f);
m_engine_sound->speed(0.6f +
(float)(m_speed / max_speed) * 0.35f +
gears * 0.35f);
float f = m_speed/max_speed;
// Speed at this stage is not yet capped, so it can be > 1, which
// results in odd engine sfx.
if (f>1.0f) f=1.0f;
float gears = 3.0f * fmod(f, 0.333334f);
m_engine_sound->speed(0.6f + (f +gears)* 0.35f);
}
else
{