Fix smoke particles to not hardcode rate

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7330 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-01-08 01:49:10 +00:00
parent ffc6fd299c
commit 8a3b74a951
2 changed files with 21 additions and 16 deletions

View File

@ -10,8 +10,8 @@
<material file="smoke.png" />
<!-- Amount of particles emitted per second -->
<rate min="5"
max="10" />
<rate min="100"
max="250" />
<!-- Minimal and maximal lifetime of a particle, in milliseconds. -->
<lifetime min="300"

View File

@ -1555,7 +1555,6 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
if (m_terrain_particles)
{
float f = 0.0f;
const Material* material = getMaterial();
if (material != NULL)
@ -1567,9 +1566,10 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
{
m_terrain_particles->setParticleType(pk);
if (fabsf(m_controls.m_steer) > 0.8 && isOnGround()) f = 250.0f;
m_terrain_particles->setCreationRate((m_skidding-1)*f);
if (fabsf(m_controls.m_steer) > 0.8 && isOnGround())
{
float rate = m_skidding - 1;
m_terrain_particles->setCreationRate(pk->getMinRate() + rate*(pk->getMaxRate() - pk->getMinRate()));
m_wheel_toggle = 1 - m_wheel_toggle;
const btWheelInfo &wi = getVehicle()->getWheelInfo(2 + m_wheel_toggle);
@ -1581,6 +1581,11 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
c.getZ() + 0.06f));
}
else
{
m_terrain_particles->setCreationRate(0.0f);
}
}
else
{
m_terrain_particles->setCreationRate(0);
}