summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-31 21:28:31 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-31 21:28:31 +0300
commit627e8fbd919f346e4e45ef192b516faf8b11d4ac (patch)
treea6214ee06461547116ee66d26a49cd0c07595d5f /src
parentdd22711fd400dc1d55c54b18bd37dd5d7630b966 (diff)
downloadmanaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.gz
manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.bz2
manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.tar.xz
manaverse-627e8fbd919f346e4e45ef192b516faf8b11d4ac.zip
Move particle alivestatus into enums directory.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/particle/alivestatus.h40
-rw-r--r--src/particle/imageparticle.cpp2
-rw-r--r--src/particle/particle.cpp35
-rw-r--r--src/particle/particle.h18
-rw-r--r--src/particle/particleemitter.cpp10
7 files changed, 73 insertions, 35 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 083488f3c..04eca3c0e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1066,7 +1066,7 @@ SET(SRCS
render/renderers.h
render/rendererslistsdl.h
render/rendererslistsdl2.h
- enums/render/blitmode.h
+ enums/particle/alivestatus.h
enums/render/rendertype.h
particle/particle.cpp
particle/particle.h
diff --git a/src/Makefile.am b/src/Makefile.am
index ae4b07cbc..050713de4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -563,6 +563,7 @@ SRC += events/actionevent.h \
render/renderers.h \
render/rendererslistsdl.h \
render/rendererslistsdl2.h \
+ enums/particle/alivestatus.h \
enums/render/blitmode.h \
enums/render/rendertype.h \
being/playerignorestrategy.h \
diff --git a/src/enums/particle/alivestatus.h b/src/enums/particle/alivestatus.h
new file mode 100644
index 000000000..9dca73df3
--- /dev/null
+++ b/src/enums/particle/alivestatus.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2006-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2015 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_PARTICLE_ALIVESTATUS_H
+#define ENUMS_PARTICLE_ALIVESTATUS_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(AliveStatus)
+{
+ ALIVE = 0,
+ DEAD_TIMEOUT = 1,
+ DEAD_FLOOR = 2,
+ DEAD_SKY = 4,
+ DEAD_IMPACT = 8,
+ DEAD_OTHER = 16,
+ DEAD_LONG_AGO = 128
+}
+enumEnd(AliveStatus);
+
+#endif // ENUMS_PARTICLE_ALIVESTATUS_H
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);
}
}
}