diff --git a/data/splash.xml b/data/splash.xml index 5300fe8de..131377133 100644 --- a/data/splash.xml +++ b/data/splash.xml @@ -14,8 +14,8 @@ max="1200" /> - + + diff --git a/src/graphics/particle_emitter.cpp b/src/graphics/particle_emitter.cpp index 261a353f5..67bb72735 100644 --- a/src/graphics/particle_emitter.cpp +++ b/src/graphics/particle_emitter.cpp @@ -209,4 +209,12 @@ void ParticleEmitter::setParticleType(const ParticleKind* type) type->getFadeoutTime()); m_node->addAffector(af); af->drop(); + + if (type->getGravityStrength() != 0) + { + scene::IParticleGravityAffector *gaf = m_node->createGravityAffector(core::vector3df(00.0f, type->getGravityStrength(), 0.0f), + type->getForceLostToGravityTime()); + m_node->addAffector(gaf); + gaf->drop(); + } } diff --git a/src/graphics/particle_kind.cpp b/src/graphics/particle_kind.cpp index 5b6bf8918..61cf949d3 100644 --- a/src/graphics/particle_kind.cpp +++ b/src/graphics/particle_kind.cpp @@ -47,6 +47,9 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2 m_velocity_x = 0.001f; m_velocity_y = 0.001f; m_velocity_z = 0.001f; + m_gravity_strength = -0.03f; + m_force_lost_to_gravity_time = 1000; + // ----- Read XML file @@ -189,6 +192,14 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2 //std::cout << "m_fadeout_time = " << m_fadeout_time << "\n"; + // ------------------------------------------------------------------------ + const XMLNode* gravity = xml->getNode("gravity"); + if (gravity != NULL) + { + gravity->get("strength", &m_gravity_strength); + gravity->get("only-force-time", &m_force_lost_to_gravity_time); + } + // ------------------------------------------------------------------------ delete xml; diff --git a/src/graphics/particle_kind.hpp b/src/graphics/particle_kind.hpp index 0fc022303..d60ef00bf 100644 --- a/src/graphics/particle_kind.hpp +++ b/src/graphics/particle_kind.hpp @@ -71,6 +71,12 @@ private: video::SColor m_min_start_color; video::SColor m_max_start_color; + /** Strength of gravity, not sure what the units are. Make it 0 to disable */ + float m_gravity_strength; + + /** Time it takes for gravity to completely replace the emission force */ + int m_force_lost_to_gravity_time; + /** For box emitters only */ float m_box_x, m_box_y, m_box_z; @@ -112,6 +118,13 @@ public: float getVelocityX () const { return m_velocity_x; } float getVelocityY () const { return m_velocity_y; } float getVelocityZ () const { return m_velocity_z; } + + /** Get the strength of gravity, not sure what the units are. Will be 0 if disabled. */ + float getGravityStrength() const { return m_gravity_strength; } + + /** Get the time it takes for gravity to completely replace the emission force. Meaningless if gravity is disabled. */ + int getForceLostToGravityTime() const { return m_force_lost_to_gravity_time; } + }; #endif diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index f51b50de6..ce5122207 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -1656,7 +1656,11 @@ void Kart::updateGraphics(const Vec3& offset_xyz, } else { - if (m_camera != NULL) m_camera->setFallMode(false); + if (m_camera != NULL && m_camera->getMode() == Camera::CM_FALLING) + { + m_camera->setFallMode(false); + } + m_water_splash_system->setCreationRate(0); } }