summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index f021f6e5..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);
}
@@ -324,12 +324,11 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
return newParticle;
}
-Particle *Particle::addTextSplashEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font, int x, int y)
+Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y,
+ const gcn::Color *color,
+ gcn::Font *font, bool outline)
{
- Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB,
- font);
+ Particle *newParticle = new TextParticle(mMap, text, color, font, outline);
newParticle->moveTo(x, y);
newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X
((rand() % 100) - 50) / 200.0f, // Y
@@ -345,11 +344,11 @@ Particle *Particle::addTextSplashEffect(const std::string &text,
}
Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font,
- int x, int y)
+ int x, int y,
+ const gcn::Color *color,
+ gcn::Font *font, bool outline)
{
- Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, font);
+ Particle *newParticle = new TextParticle(mMap, text, color, font, outline);
newParticle->moveTo(x, y);
newParticle->setVelocity(0.0f, 0.0f, 0.5f);
newParticle->setGravity(0.0015f);