summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-16 20:59:21 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-16 20:59:21 +0300
commit558ef7174653df9d435e818bf16130443b0dd5be (patch)
treed829bf585fdb416d3a70659241e0565c49b817db
parent7752e90c8208a5ebb192f44d85174c2937fbcef8 (diff)
downloadmv-558ef7174653df9d435e818bf16130443b0dd5be.tar.gz
mv-558ef7174653df9d435e818bf16130443b0dd5be.tar.bz2
mv-558ef7174653df9d435e818bf16130443b0dd5be.tar.xz
mv-558ef7174653df9d435e818bf16130443b0dd5be.zip
Add particle type into particles.
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/enums/particle/particletype.h36
-rw-r--r--src/particle/animationparticle.cpp2
-rw-r--r--src/particle/imageparticle.cpp2
-rw-r--r--src/particle/particle.cpp1
-rw-r--r--src/particle/particle.h4
-rw-r--r--src/particle/rotationalparticle.cpp2
-rw-r--r--src/particle/textparticle.cpp1
9 files changed, 50 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2431c7584..fa1239794 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1090,6 +1090,7 @@ SET(SRCS
render/rendererslistsdl2.h
enums/particle/alivestatus.h
enums/particle/particlechangefunc.h
+ enums/particle/particletype.h
enums/render/rendertype.h
particle/particle.cpp
particle/particle.h
diff --git a/src/Makefile.am b/src/Makefile.am
index e97b6ea85..ee7fdd151 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -583,6 +583,7 @@ SRC += events/actionevent.h \
render/rendererslistsdl2.h \
enums/particle/alivestatus.h \
enums/particle/particlechangefunc.h \
+ enums/particle/particletype.h \
enums/render/blitmode.h \
enums/render/rendertype.h \
being/playerignorestrategy.h \
diff --git a/src/enums/particle/particletype.h b/src/enums/particle/particletype.h
new file mode 100644
index 000000000..0506cf570
--- /dev/null
+++ b/src/enums/particle/particletype.h
@@ -0,0 +1,36 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2016 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_PARTICLETYPE_H
+#define ENUMS_PARTICLE_PARTICLETYPE_H
+
+#include "enums/simpletypes/enumdefines.h"
+
+enumStart(ParticleType)
+{
+ Normal = 0,
+ Animation = 1,
+ Image = 2,
+ Rotational = 3,
+ Text = 4
+}
+enumEnd(ParticleType);
+
+#endif // ENUMS_PARTICLE_PARTICLETYPE_H
diff --git a/src/particle/animationparticle.cpp b/src/particle/animationparticle.cpp
index 55ce3824b..43623aee9 100644
--- a/src/particle/animationparticle.cpp
+++ b/src/particle/animationparticle.cpp
@@ -32,6 +32,7 @@ AnimationParticle::AnimationParticle(Animation *restrict const animation) :
ImageParticle(nullptr),
mAnimation(new SimpleAnimation(animation))
{
+ mType = ParticleType::Animation;
}
AnimationParticle::AnimationParticle(XmlNodePtrConst animationNode,
@@ -39,6 +40,7 @@ AnimationParticle::AnimationParticle(XmlNodePtrConst animationNode,
ImageParticle(nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
{
+ mType = ParticleType::Animation;
}
AnimationParticle::~AnimationParticle()
diff --git a/src/particle/imageparticle.cpp b/src/particle/imageparticle.cpp
index 5a67886c0..e58a9e887 100644
--- a/src/particle/imageparticle.cpp
+++ b/src/particle/imageparticle.cpp
@@ -34,6 +34,8 @@ ImageParticle::ImageParticle(Image *restrict const image) :
Particle(),
mImage(image)
{
+ mType = ParticleType::Image;
+
if (mImage)
{
mImage->incRef();
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index c00593470..48edee676 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -55,6 +55,7 @@ Particle::Particle() :
mFadeIn(0),
mVelocity(),
mAlive(AliveStatus::ALIVE),
+ mType(ParticleType::Normal),
mChildEmitters(),
mChildParticles(),
mDeathEffect(),
diff --git a/src/particle/particle.h b/src/particle/particle.h
index e5e61361a..f76557e11 100644
--- a/src/particle/particle.h
+++ b/src/particle/particle.h
@@ -26,6 +26,7 @@
#include "being/actor.h"
#include "enums/particle/alivestatus.h"
+#include "enums/particle/particletype.h"
#include "particle/particleengine.h"
@@ -260,6 +261,9 @@ class Particle notfinal : public Actor
// Is the particle supposed to be drawn and updated?
AliveStatusT mAlive;
+
+ ParticleType mType;
+
private:
// List of child emitters.
Emitters mChildEmitters;
diff --git a/src/particle/rotationalparticle.cpp b/src/particle/rotationalparticle.cpp
index 945517fba..1fa9f93b9 100644
--- a/src/particle/rotationalparticle.cpp
+++ b/src/particle/rotationalparticle.cpp
@@ -35,6 +35,7 @@ RotationalParticle::RotationalParticle(Animation *restrict const animation) :
ImageParticle(nullptr),
mAnimation(new SimpleAnimation(animation))
{
+ mType = ParticleType::Rotational;
}
RotationalParticle::RotationalParticle(const XmlNodePtr animationNode,
@@ -43,6 +44,7 @@ RotationalParticle::RotationalParticle(const XmlNodePtr animationNode,
ImageParticle(nullptr),
mAnimation(new SimpleAnimation(animationNode, dyePalettes))
{
+ mType = ParticleType::Rotational;
}
RotationalParticle::~RotationalParticle()
diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp
index 9acfb4110..d41dcef2b 100644
--- a/src/particle/textparticle.cpp
+++ b/src/particle/textparticle.cpp
@@ -41,6 +41,7 @@ TextParticle::TextParticle(const std::string &restrict text,
mTextWidth(mTextFont ? mTextFont->getWidth(mText) / 2 : 1),
mOutline(outline)
{
+ mType = ParticleType::Text;
}
void TextParticle::draw(Graphics *restrict const graphics,