diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-31 21:28:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-31 21:28:31 +0300 |
commit | 627e8fbd919f346e4e45ef192b516faf8b11d4ac (patch) | |
tree | a6214ee06461547116ee66d26a49cd0c07595d5f /src/particle | |
parent | dd22711fd400dc1d55c54b18bd37dd5d7630b966 (diff) | |
download | manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.gz manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.bz2 manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.xz manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.zip |
Move particle alivestatus into enums directory.
Diffstat (limited to 'src/particle')
-rw-r--r-- | src/particle/imageparticle.cpp | 2 | ||||
-rw-r--r-- | src/particle/particle.cpp | 35 | ||||
-rw-r--r-- | src/particle/particle.h | 18 | ||||
-rw-r--r-- | src/particle/particleemitter.cpp | 10 |
4 files changed, 31 insertions, 34 deletions
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp index 484bf53ae..c5084b87f 100644 --- a/src/particle/imageparticle.cpp +++ b/src/particle/imageparticle.cpp @@ -72,7 +72,7 @@ void ImageParticle::draw(Graphics *restrict const graphics, const int offsetY) const restrict2 { FUNC_BLOCK("ImageParticle::draw", 1) - if (mAlive != ALIVE || !mImage) + if (mAlive != AliveStatus::ALIVE || !mImage) return; const int screenX = static_cast<int>(mPos.x) diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index efde2e35e..b215e50c8 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -61,7 +61,7 @@ Particle::Particle() : mFadeOut(0), mFadeIn(0), mVelocity(), - mAlive(ALIVE), + mAlive(AliveStatus::ALIVE), mChildEmitters(), mChildParticles(), mDeathEffect(), @@ -109,12 +109,12 @@ bool Particle::update() restrict2 if (!mMap) return false; - if (mLifetimeLeft == 0 && mAlive == ALIVE) - mAlive = DEAD_TIMEOUT; + if (mLifetimeLeft == 0 && mAlive == AliveStatus::ALIVE) + mAlive = AliveStatus::DEAD_TIMEOUT; const Vector oldPos = mPos; - if (mAlive == ALIVE) + if (mAlive == AliveStatus::ALIVE) { // calculate particle movement if (mMomentum != 1.0F) @@ -152,7 +152,7 @@ bool Particle::update() restrict2 if (invHypotenuse) { if (mInvDieDistance > 0.0F && invHypotenuse > mInvDieDistance) - mAlive = DEAD_IMPACT; + mAlive = AliveStatus::DEAD_IMPACT; const float accFactor = invHypotenuse * mAcceleration; mVelocity -= dist * accFactor; } @@ -191,12 +191,12 @@ bool Particle::update() restrict2 } else { - mAlive = DEAD_FLOOR; + mAlive = AliveStatus::DEAD_FLOOR; } } else if (mPos.z > PARTICLE_SKY) { - mAlive = DEAD_SKY; + mAlive = AliveStatus::DEAD_SKY; } // Update child emitters @@ -220,7 +220,8 @@ bool Particle::update() restrict2 } // create death effect when the particle died - if (mAlive != ALIVE && mAlive != DEAD_LONG_AGO) + if (mAlive != AliveStatus::ALIVE && + mAlive != AliveStatus::DEAD_LONG_AGO) { if ((static_cast<unsigned int>(mAlive) & mDeathEffectConditions) > 0x00 && !mDeathEffect.empty()) @@ -230,7 +231,7 @@ bool Particle::update() restrict2 if (deathEffect) deathEffect->moveBy(mPos); } - mAlive = DEAD_LONG_AGO; + mAlive = AliveStatus::DEAD_LONG_AGO; } const Vector change = mPos - oldPos; @@ -256,8 +257,12 @@ bool Particle::update() restrict2 p = mChildParticles.erase(p); } } - if (mAlive != ALIVE && mChildParticles.empty() && mAutoDelete) + if (mAlive != AliveStatus::ALIVE && + mChildParticles.empty() && + mAutoDelete) + { return false; + } return true; } @@ -398,27 +403,27 @@ Particle *Particle::addEffect(const std::string &restrict particleEffectFile, if (XML::getBoolProperty(emitterNode, "on-floor", true)) { deathEffectConditions += static_cast<signed char>( - Particle::DEAD_FLOOR); + AliveStatus::DEAD_FLOOR); } if (XML::getBoolProperty(emitterNode, "on-sky", true)) { deathEffectConditions += static_cast<signed char>( - Particle::DEAD_SKY); + AliveStatus::DEAD_SKY); } if (XML::getBoolProperty(emitterNode, "on-other", false)) { deathEffectConditions += static_cast<signed char>( - Particle::DEAD_OTHER); + AliveStatus::DEAD_OTHER); } if (XML::getBoolProperty(emitterNode, "on-impact", true)) { deathEffectConditions += static_cast<signed char>( - Particle::DEAD_IMPACT); + AliveStatus::DEAD_IMPACT); } if (XML::getBoolProperty(emitterNode, "on-timeout", true)) { deathEffectConditions += static_cast<signed char>( - Particle::DEAD_TIMEOUT); + AliveStatus::DEAD_TIMEOUT); } newParticle->setDeathEffect( deathEffect, deathEffectConditions); diff --git a/src/particle/particle.h b/src/particle/particle.h index 00f5f6313..f23b5e263 100644 --- a/src/particle/particle.h +++ b/src/particle/particle.h @@ -25,6 +25,8 @@ #include "being/actor.h" +#include "enums/particle/alivestatus.h" + #include "localconsts.h" class Color; @@ -45,16 +47,6 @@ typedef Emitters::const_iterator EmitterConstIterator; class Particle notfinal : public Actor { public: - enum AliveStatus - { - ALIVE = 0, - DEAD_TIMEOUT = 1, - DEAD_FLOOR = 2, - DEAD_SKY = 4, - DEAD_IMPACT = 8, - DEAD_OTHER = 16, - DEAD_LONG_AGO = 128 - }; static const float PARTICLE_SKY; // Maximum Z position of particles static int fastPhysics; // Mode of squareroot calculation static int particleCount; // Current number of particles @@ -249,7 +241,7 @@ class Particle notfinal : public Actor { mAllowSizeAdjust = adjust; } bool isAlive() const restrict2 A_WARN_UNUSED - { return mAlive == ALIVE; } + { return mAlive == AliveStatus::ALIVE; } void prepareToDie() restrict2; @@ -263,7 +255,7 @@ class Particle notfinal : public Actor * Manually marks the particle for deletion. */ void kill() restrict2 - { mAlive = DEAD_OTHER; mAutoDelete = true; } + { mAlive = AliveStatus::DEAD_OTHER; mAutoDelete = true; } /** * After calling this function the particle will only request @@ -306,7 +298,7 @@ class Particle notfinal : public Actor Vector mVelocity; // Is the particle supposed to be drawn and updated? - AliveStatus mAlive; + AliveStatusT mAlive; private: // List of child emitters. Emitters mChildEmitters; diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp index b0c5f7e9c..b8ae200ce 100644 --- a/src/particle/particleemitter.cpp +++ b/src/particle/particleemitter.cpp @@ -325,27 +325,27 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, if (XML::getBoolProperty(propertyNode, "on-floor", true)) { mDeathEffectConditions += static_cast<signed char>( - Particle::DEAD_FLOOR); + AliveStatus::DEAD_FLOOR); } if (XML::getBoolProperty(propertyNode, "on-sky", true)) { mDeathEffectConditions += static_cast<signed char>( - Particle::DEAD_SKY); + AliveStatus::DEAD_SKY); } if (XML::getBoolProperty(propertyNode, "on-other", false)) { mDeathEffectConditions += static_cast<signed char>( - Particle::DEAD_OTHER); + AliveStatus::DEAD_OTHER); } if (XML::getBoolProperty(propertyNode, "on-impact", true)) { mDeathEffectConditions += static_cast<signed char>( - Particle::DEAD_IMPACT); + AliveStatus::DEAD_IMPACT); } if (XML::getBoolProperty(propertyNode, "on-timeout", true)) { mDeathEffectConditions += static_cast<signed char>( - Particle::DEAD_TIMEOUT); + AliveStatus::DEAD_TIMEOUT); } } } |