From 73d4611c036b57549fa33aabfadb8ec528ad2d45 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Sun, 24 Aug 2008 18:52:00 +0000 Subject: Added new particle emitter property "output-pause" which allows to define a fixed (or random) interval between two outputs. --- ChangeLog | 6 ++++++ src/particleemitter.cpp | 16 +++++++++++++++- src/particleemitter.h | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 21d6ddd4..ba35af26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-24 Philipp Sehmisch + + * src/particleemitter.cpp, src/particleemitter.h: Added new particle + emitter property "output-pause" which allows to define a fixed (or random) + interval between two outputs. + 2008-08-06 Bjørn Lindeijer * src/gui/window.cpp: Make sure only to save the window state when a 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 newParticles; + if (mOutputPauseLeft > 0) + { + mOutputPauseLeft--; + return newParticles; + } + mOutputPauseLeft = mOutputPause.value(); + for (int i = mOutput.value(); i > 0; i--) { // Limit maximum particles diff --git a/src/particleemitter.h b/src/particleemitter.h index 2f45608d..c1365163 100644 --- a/src/particleemitter.h +++ b/src/particleemitter.h @@ -119,6 +119,8 @@ class ParticleEmitter Map *mMap; /**< Map the particles are spawned on */ MinMax mOutput; /**< Number of particles spawned per update */ + MinMax mOutputSkip; /**< Pause in frames between two spawns */ + int mOutputSkipPause; /* * Graphical representation of the particle -- cgit v1.2.3-70-g09d2