summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2008-08-24 18:52:00 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2008-08-24 18:52:00 +0000
commit73d4611c036b57549fa33aabfadb8ec528ad2d45 (patch)
tree4523812e49842342754eebecb733de684444c010 /src/particleemitter.cpp
parent8493ae0b217435977d917976c5c1b959953b895c (diff)
downloadmana-73d4611c036b57549fa33aabfadb8ec528ad2d45.tar.gz
mana-73d4611c036b57549fa33aabfadb8ec528ad2d45.tar.bz2
mana-73d4611c036b57549fa33aabfadb8ec528ad2d45.tar.xz
mana-73d4611c036b57549fa33aabfadb8ec528ad2d45.zip
Added new particle emitter property "output-pause" which allows to define a fixed (or random) interval between two outputs.
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 631ca228..1696a134 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -39,7 +39,8 @@
#define DEG_RAD_FACTOR 0.017453293f
ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map):
- mParticleImage(0)
+ mParticleImage(0),
+ mOutputPauseLeft(0)
{
mMap = map;
mParticleTarget = target;
@@ -62,6 +63,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mParticleFadeOut.set(0);
mParticleFadeIn.set(0);
mOutput.set(1);
+ mOutputPause.set(0);
mParticleAlpha.set(1.0f);
for_each_xml_child_node(propertyNode, emitterNode)
@@ -135,6 +137,11 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mOutput = readMinMax(propertyNode, 0);
mOutput.maxVal +=1;
}
+ else if (name == "output-pause")
+ {
+ mOutputPause = readMinMax(propertyNode, 0);
+ mOutputPauseLeft = mOutputSkip.value();
+ }
else if (name == "acceleration")
{
mParticleAcceleration = readMinMax(propertyNode, 0.0f);
@@ -308,6 +315,13 @@ ParticleEmitter::createParticles()
{
std::list<Particle *> newParticles;
+ if (mOutputPauseLeft > 0)
+ {
+ mOutputPauseLeft--;
+ return newParticles;
+ }
+ mOutputPauseLeft = mOutputPause.value();
+
for (int i = mOutput.value(); i > 0; i--)
{
// Limit maximum particles