diff options
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r-- | src/particle/particle.cpp | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 4e583d0ab..8f0cb1e41 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -41,20 +41,11 @@ #include "debug.h" -Particle *particleEngine = nullptr; - static const float SIN45 = 0.707106781F; class Graphics; class Image; -int Particle::particleCount = 0; -int Particle::maxCount = 0; -int Particle::fastPhysics = 0; -int Particle::emitterSkip = 1; -bool Particle::enabled = true; -const float Particle::PARTICLE_SKY = 800.0F; - Particle::Particle() : Actor(), mAlpha(1.0F), @@ -79,26 +70,14 @@ Particle::Particle() : mAllowSizeAdjust(false), mFollow(false) { - Particle::particleCount++; + ParticleEngine::particleCount++; } Particle::~Particle() { // Delete child emitters and child particles clear(); - Particle::particleCount--; -} - -void Particle::setupEngine() restrict2 -{ - Particle::maxCount = config.getIntValue("particleMaxCount"); - Particle::fastPhysics = config.getIntValue("particleFastPhysics"); - Particle::emitterSkip = config.getIntValue("particleEmitterSkip") + 1; - if (!Particle::emitterSkip) - Particle::emitterSkip = 1; - Particle::enabled = config.getBoolValue("particleeffects"); - disableAutoDelete(); - logger->log1("Particle engine set up"); + ParticleEngine::particleCount--; } void Particle::draw(Graphics *restrict const, @@ -123,7 +102,7 @@ void Particle::updateSelf() restrict2 dist.x *= SIN45; float invHypotenuse; - switch (Particle::fastPhysics) + switch (ParticleEngine::fastPhysics) { case 1: invHypotenuse = fastInvSqrt( @@ -191,14 +170,14 @@ void Particle::updateSelf() restrict2 mAlive = AliveStatus::DEAD_FLOOR; } } - else if (mPos.z > PARTICLE_SKY) + else if (mPos.z > ParticleEngine::PARTICLE_SKY) { mAlive = AliveStatus::DEAD_SKY; } // Update child emitters - if (Particle::emitterSkip && (mLifetimePast - 1) - % Particle::emitterSkip == 0) + if (ParticleEngine::emitterSkip && + (mLifetimePast - 1) % ParticleEngine::emitterSkip == 0) { FOR_EACH (EmitterConstIterator, e, mChildEmitters) { |