summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-10-17 17:15:21 +0200
committerPhilipp Sehmisch <mana@crushnet.org>2010-10-17 17:15:21 +0200
commit1b21442b5eb6dcc41a585715d07c73ed3ad59a1b (patch)
treec84f226695e1d7bb7d95fcba7c9e8c30333508da /src/particleemitter.cpp
parent1f3c056323de16cbe5965e1d65a69eeab73396ce (diff)
downloadmana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.gz
mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.bz2
mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.tar.xz
mana-1b21442b5eb6dcc41a585715d07c73ed3ad59a1b.zip
Added death effects to particle engine.
Every particle can now have a death effect. This is an effect which is created when the particle dies. Which death reasons (timeout, touching floor, touching sky, reaching target or deleted by external call) trigger the effect can also be specified. This is useful for exploding projectiles and many other effects. Reviewed-by: Bertram
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index dc9931a5..b9855c10 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -320,6 +320,30 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mParticleAnimation.addTerminator();
}
} // for frameNode
+ } else if (xmlStrEqual(propertyNode->name, BAD_CAST "deatheffect"))
+ {
+ mDeathEffect = (const char*)propertyNode->xmlChildrenNode->content;
+ mDeathEffectConditions = 0x00;
+ if (XML::getBoolProperty(propertyNode, "on-floor", true))
+ {
+ mDeathEffectConditions += Particle::DEAD_FLOOR;
+ }
+ if (XML::getBoolProperty(propertyNode, "on-sky", true))
+ {
+ mDeathEffectConditions += Particle::DEAD_SKY;
+ }
+ if (XML::getBoolProperty(propertyNode, "on-other", false))
+ {
+ mDeathEffectConditions += Particle::DEAD_OTHER;
+ }
+ if (XML::getBoolProperty(propertyNode, "on-impact", true))
+ {
+ mDeathEffectConditions += Particle::DEAD_IMPACT;
+ }
+ if (XML::getBoolProperty(propertyNode, "on-timeout", true))
+ {
+ mDeathEffectConditions += Particle::DEAD_TIMEOUT;
+ }
}
}
}
@@ -469,6 +493,11 @@ std::list<Particle *> ParticleEmitter::createParticles(int tick)
newParticle->addEmitter(new ParticleEmitter(*i));
}
+ if (!mDeathEffect.empty())
+ {
+ newParticle->setDeathEffect(mDeathEffect, mDeathEffectConditions);
+ }
+
newParticles.push_back(newParticle);
}