spread particles a bit on start so that snow is there right when you start playing

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7770 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2011-02-28 02:15:01 +00:00
parent c1f0c77609
commit 04adf0bf63

View File

@@ -95,11 +95,13 @@ class HeightMapCollisionAffector : public scene::IParticleAffector
{
std::vector< std::vector<float> > m_height_map;
Track* m_track;
bool m_first_time;
public:
HeightMapCollisionAffector(Track* t) : m_height_map(t->buildHeightMap())
{
m_track = t;
m_first_time = true;
}
virtual void affect(u32 now, scene::SParticle* particlearray, u32 count)
@@ -137,12 +139,21 @@ public:
irr_driver->getVideoDriver()->draw3DBox(core::aabbox3d< f32 >(lp2, lp3), video::SColor(255,255,0,0));
*/
if (curr.pos.Y < m_height_map[i][j])
if (m_first_time)
{
//curr.color = video::SColor(255,255,0,0);
curr.endTime = curr.startTime; // destroy particle
curr.pos.Y = m_height_map[i][j] + (curr.pos.Y - m_height_map[i][j])*((rand()%500)/500.0f);
}
else
{
if (curr.pos.Y < m_height_map[i][j])
{
//curr.color = video::SColor(255,255,0,0);
curr.endTime = curr.startTime; // destroy particle
}
}
}
if (m_first_time) m_first_time = false;
}
virtual scene::E_PARTICLE_AFFECTOR_TYPE getType() const