diff options
Diffstat (limited to 'src/render/particlesystem.cc')
-rw-r--r-- | src/render/particlesystem.cc | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/render/particlesystem.cc b/src/render/particlesystem.cc index ff9c720..920d77c 100644 --- a/src/render/particlesystem.cc +++ b/src/render/particlesystem.cc @@ -4,6 +4,7 @@ the terms of the GNU General Public License version 2 */ +#include "render/gl.h" #include "render/particlesystem.h" namespace render { @@ -121,23 +122,45 @@ void ParticleSystem::draw(const float seconds) math::Axis current_axis(entity() ? entity()->axis() * axis() : axis()); for (Ejectors::iterator it = ejectors().begin(); it != ejectors().end(); ++it) { - + + ParticleEjector *ejector = (*it); + if (entity()) { bool ejector_active = true; + if (entity()->type() == core::Entity::Controlable) { + const core::EntityControlable *controlable = static_cast<const core::EntityControlable *>(entity()); - if ((*it)->thrust()) { - // thrust activated - const core::EntityControlable *controlable = static_cast<const core::EntityControlable *>(entity()); - if ( controlable->thrust() == 0.0f ) { - ejector_active = false; + if (ejector->impulse() || ejector->thrust()) { + ejector_active = false; + + switch (controlable->state()) { + case core::Entity::Impulse: + case core::Entity::ImpulseInitiate: + if (ejector->impulse() || ejector->thrust()) { + ejector_active = true; + } + break; + + case core::Entity::Normal: + if (ejector->thrust()) { + if (controlable->thrust() > 0.0f) { + ejector_active = true; + } + } + break; + + default: + ejector_active = false; + break; } - (*it)->enable(ejector_active); + ejector->enable(ejector_active); } } } - (*it)->frame(seconds, current_location, current_axis); + (*it)->frame(seconds, current_location, current_axis * ejector->axis()); + } } |