summaryrefslogtreecommitdiff
path: root/src/particle/particle.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-16 18:05:12 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-16 18:15:50 +0300
commitac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e (patch)
tree0feb142dc738715d3216f0832f94ae4c3716fc30 /src/particle/particle.cpp
parent117c99ff5c8358624df6d176860ac64c86b6fa5f (diff)
downloadmv-ac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e.tar.gz
mv-ac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e.tar.bz2
mv-ac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e.tar.xz
mv-ac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e.zip
Split ParticleEngine from Particle class.
Diffstat (limited to 'src/particle/particle.cpp')
-rw-r--r--src/particle/particle.cpp33
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)
{