summaryrefslogtreecommitdiff
path: root/src/particle
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 /src/particle
parent7752e90c8208a5ebb192f44d85174c2937fbcef8 (diff)
downloadplus-558ef7174653df9d435e818bf16130443b0dd5be.tar.gz
plus-558ef7174653df9d435e818bf16130443b0dd5be.tar.bz2
plus-558ef7174653df9d435e818bf16130443b0dd5be.tar.xz
plus-558ef7174653df9d435e818bf16130443b0dd5be.zip
Add particle type into particles.
Diffstat (limited to 'src/particle')
-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
6 files changed, 12 insertions, 0 deletions
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,