summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 82c163c6..21844f01 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -176,7 +176,8 @@ bool Particle::update()
mVelocity *= mBounce;
mVelocity.z = -mVelocity.z;
}
- else {
+ else
+ {
mAlive = false;
}
}
@@ -184,16 +185,12 @@ bool Particle::update()
// Update child emitters
if ((mLifetimePast-1)%Particle::emitterSkip == 0)
{
- for ( EmitterIterator e = mChildEmitters.begin();
- e != mChildEmitters.end();
- e++
- )
+ for (EmitterIterator e = mChildEmitters.begin();
+ e != mChildEmitters.end(); e++)
{
Particles newParticles = (*e)->createParticles(mLifetimePast);
- for ( ParticleIterator p = newParticles.begin();
- p != newParticles.end();
- p++
- )
+ for (ParticleIterator p = newParticles.begin();
+ p != newParticles.end(); p++)
{
(*p)->moveBy(mPos);
mChildParticles.push_back (*p);
@@ -218,7 +215,9 @@ bool Particle::update()
if ((*p)->update())
{
p++;
- } else {
+ }
+ else
+ {
delete (*p);
p = mChildParticles.erase(p);
}
@@ -236,8 +235,7 @@ void Particle::moveBy(const Vector &change)
{
mPos += change;
for (ParticleIterator p = mChildParticles.begin();
- p != mChildParticles.end();
- p++)
+ p != mChildParticles.end(); p++)
{
if ((*p)->doesFollow())
{
@@ -278,20 +276,21 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
xmlNodePtr node;
// Animation
- if ((node = XML::findFirstChildByName(
- effectChildNode, "animation"))) {
+ if ((node = XML::findFirstChildByName(effectChildNode, "animation")))
+ {
newParticle = new AnimationParticle(mMap, node);
}
// Image
- else if ((node = XML::findFirstChildByName(
- effectChildNode, "image"))) {
+ else if ((node = XML::findFirstChildByName(effectChildNode, "image")))
+ {
Image *img= resman->getImage((const char*)
node->xmlChildrenNode->content);
newParticle = new ImageParticle(mMap, img);
}
// Other
- else {
+ else
+ {
newParticle = new Particle(mMap);
}
@@ -314,7 +313,8 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
continue;
ParticleEmitter *newEmitter;
- newEmitter = new ParticleEmitter(emitterNode, newParticle, mMap, rotation);
+ newEmitter = new ParticleEmitter(emitterNode, newParticle, mMap,
+ rotation);
newParticle->addEmitter(newEmitter);
}
@@ -325,7 +325,8 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
}
Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y,
- const gcn::Color *color, gcn::Font *font, bool outline)
+ const gcn::Color *color,
+ gcn::Font *font, bool outline)
{
Particle *newParticle = new TextParticle(mMap, text, color, font, outline);
newParticle->moveTo(x, y);
@@ -343,7 +344,10 @@ Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y,
}
Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
- int x, int y, const gcn::Color *color, gcn::Font *font, bool outline){
+ int x, int y,
+ const gcn::Color *color,
+ gcn::Font *font, bool outline)
+{
Particle *newParticle = new TextParticle(mMap, text, color, font, outline);
newParticle->moveTo(x, y);
newParticle->setVelocity(0.0f, 0.0f, 0.5f);