summaryrefslogtreecommitdiff
path: root/src/particleemitter.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-09-25 00:15:44 +0000
committerIra Rice <irarice@gmail.com>2008-09-25 00:15:44 +0000
commit489a429bea6739dfa25503b9329bd9e33bffb856 (patch)
tree8112f6fd988fdc0610329b6bc14ee3f9d5801092 /src/particleemitter.cpp
parent2dc8eadff1e67bb70b1772ecc19c9e1e2e40a5b4 (diff)
downloadmana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.gz
mana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.bz2
mana-489a429bea6739dfa25503b9329bd9e33bffb856.tar.xz
mana-489a429bea6739dfa25503b9329bd9e33bffb856.zip
Merged the Tametomo branch into trunk.
Diffstat (limited to 'src/particleemitter.cpp')
-rw-r--r--src/particleemitter.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 996e3396..3e0a3d75 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -18,7 +18,7 @@
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: particleemitter.cpp 4362 2008-06-24 12:29:33Z crush_tmw $
+ * $Id$
*/
#include "particleemitter.h"
@@ -39,6 +39,7 @@
#define DEG_RAD_FACTOR 0.017453293f
ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map):
+ mOutputPauseLeft(0),
mParticleImage(0)
{
mMap = map;
@@ -52,7 +53,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mParticleAngleVertical.set(0.0f);
mParticlePower.set(0.0f);
mParticleGravity.set(0.0f);
- mParticleRandomnes.set(0);
+ mParticleRandomness.set(0);
mParticleBounce.set(0.0f);
mParticleFollow = false;
mParticleAcceleration.set(0.0f);
@@ -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)
@@ -117,9 +119,9 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
{
mParticleGravity = readMinMax(propertyNode, 0.0f);
}
- else if (name == "randomnes")
+ else if (name == "randomnes" || name == "randomness") // legacy bug
{
- mParticleRandomnes = readMinMax(propertyNode, 0);
+ mParticleRandomness = readMinMax(propertyNode, 0);
}
else if (name == "bounce")
{
@@ -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 = mOutputPause.value();
+ }
else if (name == "acceleration")
{
mParticleAcceleration = readMinMax(propertyNode, 0.0f);
@@ -261,7 +268,7 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o)
mParticleAngleVertical = o.mParticleAngleVertical;
mParticlePower = o.mParticlePower;
mParticleGravity = o.mParticleGravity;
- mParticleRandomnes = o.mParticleRandomnes;
+ mParticleRandomness = o.mParticleRandomness;
mParticleBounce = o.mParticleBounce;
mParticleFollow = o.mParticleFollow;
mParticleTarget = o.mParticleTarget;
@@ -274,10 +281,13 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o)
mParticleAlpha = o.mParticleAlpha;
mMap = o.mMap;
mOutput = o.mOutput;
+ mOutputPause = o.mOutputPause;
mParticleImage = o.mParticleImage;
mParticleAnimation = o.mParticleAnimation;
mParticleChildEmitters = o.mParticleChildEmitters;
+ mOutputPauseLeft = 0;
+
if (mParticleImage) mParticleImage->incRef();
return *this;
@@ -308,6 +318,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
@@ -342,7 +359,7 @@ ParticleEmitter::createParticles()
sin(angleH) * cos(angleV) * power,
sin(angleV) * power);
- newParticle->setRandomnes(mParticleRandomnes.value());
+ newParticle->setRandomness(mParticleRandomness.value());
newParticle->setGravity(mParticleGravity.value());
newParticle->setBounce(mParticleBounce.value());
newParticle->setFollow(mParticleFollow);