summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp6
-rw-r--r--src/game.cpp23
-rw-r--r--src/particle.cpp41
-rw-r--r--src/particle.h597
-rw-r--r--src/particlecontainer.cpp20
-rw-r--r--src/particlecontainer.h6
-rw-r--r--src/particleemitter.cpp11
7 files changed, 358 insertions, 346 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d98af29c..3f4c5d9c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -424,8 +424,10 @@ void Being::logic()
}
}
- //Update particle effects
- mChildParticleEffects.setPositions((float)mPx + 16.0f, (float)mPy + 32.0f);
+ // Update particle effects
+ mChildParticleEffects.moveTo((float) mPx + 16.0f,
+ (float) mPy + 32.0f);
+
}
void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
diff --git a/src/game.cpp b/src/game.cpp
index 91a58d43..0957dbe8 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -347,28 +347,33 @@ bool saveScreenshot(SDL_Surface *screenshot)
static unsigned int screenshotCount = 0;
// Search for an unused screenshot name
+ std::stringstream filenameSuffix;
std::stringstream filename;
std::fstream testExists;
bool found = false;
do {
- screenshotCount++;
- filename.str("");
+ screenshotCount++;
+ filename.str("");
+ filenameSuffix.str("");
+ filename << PHYSFS_getUserDir();
#if (defined __USE_UNIX98 || defined __FreeBSD__)
- filename << PHYSFS_getUserDir() << ".aethyra/";
+ filenameSuffix << ".aethyra/";
#elif defined __APPLE__
- filename << PHYSFS_getUserDir() << "Desktop/";
+ filenameSuffix << "Desktop/";
#endif
- filename << "Ae_Screenshot_" << screenshotCount << ".png";
- testExists.open(filename.str().c_str(), std::ios::in);
- found = !testExists.is_open();
- testExists.close();
+ filenameSuffix << "Ae_Screenshot_" << screenshotCount << ".png";
+ filename << filenameSuffix.str();
+ std::cerr << "Trying `" << filename.str() << "' from `" << filenameSuffix.str() << "'\n";
+ testExists.open(filename.str().c_str(), std::ios::in);
+ found = !testExists.is_open();
+ testExists.close();
} while (!found);
if (ImageWriter::writePNG(screenshot, filename.str()))
{
std::stringstream chatlogentry;
- chatlogentry << "Screenshot saved to " << filename.str().c_str();
+ chatlogentry << "Screenshot saved to ~/" << filenameSuffix.str().c_str();
chatWindow->chatLog(chatlogentry.str(), BY_SERVER);
return true;
}
diff --git a/src/particle.cpp b/src/particle.cpp
index fd86195c..1f067de3 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -193,7 +193,7 @@ bool Particle::update()
p++
)
{
- (*p)->moveBy(mPos.x, mPos.y, mPos.z);
+ (*p)->moveBy(mPos);
mChildParticles.push_back (*p);
}
}
@@ -230,6 +230,25 @@ bool Particle::update()
return true;
}
+void Particle::moveBy(const Vector &change)
+{
+ mPos += change;
+ for (ParticleIterator p = mChildParticles.begin();
+ p != mChildParticles.end();
+ p++)
+ {
+ if ((*p)->doesFollow())
+ {
+ (*p)->moveBy(change);
+ }
+ }
+}
+
+void Particle::moveTo(float x, float y)
+{
+ moveTo(Vector(x, y, mPos.z));
+}
+
Particle* Particle::addEffect(const std::string &particleEffectFile,
int pixelX, int pixelY, int rotation)
{
@@ -275,17 +294,15 @@ Particle* Particle::addEffect(const std::string &particleEffectFile,
}
// Read and set the basic properties of the particle
- int offsetX = XML::getProperty(effectChildNode, "position-x", 0);
- int offsetY = XML::getProperty(effectChildNode, "position-y", 0);
- int offsetZ = XML::getProperty(effectChildNode, "position-z", 0);
-
- int particleX = (int) mPos.x + pixelX + offsetX;
- int particleY = (int) mPos.y + pixelY + offsetY;
- int particleZ = (int) mPos.z + offsetZ;
+ float offsetX = XML::getFloatProperty(effectChildNode, "position-x", 0);
+ float offsetY = XML::getFloatProperty(effectChildNode, "position-y", 0);
+ float offsetZ = XML::getFloatProperty(effectChildNode, "position-z", 0);
+ Vector position (mPos.x + (float)pixelX + offsetX,
+ mPos.y + (float)pixelY + offsetY,
+ mPos.z + offsetZ);
+ newParticle->moveTo(position);
int lifetime = XML::getProperty(effectChildNode, "lifetime", -1);
-
- newParticle->setPosition(particleX, particleY, particleZ);
newParticle->setLifetime(lifetime);
// Look for additional emitters for this particle
@@ -311,7 +328,7 @@ Particle *Particle::addTextSplashEffect(const std::string &text,
{
Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB,
font);
- newParticle->setPosition(x, y, 0);
+ newParticle->moveTo(x, y);
newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X
((rand() % 100) - 50) / 200.0f, // Y
((rand() % 100) / 200.0f) + 4.0f); // Z
@@ -330,7 +347,7 @@ Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
int x, int y)
{
Particle *newParticle = new TextParticle(mMap, text, 255, 255, 255, font);
- newParticle->setPosition(x, y, 0);
+ newParticle->moveTo(x, y);
newParticle->setVelocity(0.0f, 0.0f, 0.5f);
newParticle->setGravity(0.0015f);
newParticle->setLifetime(300);
diff --git a/src/particle.h b/src/particle.h
index ab08968f..41d7df97 100644
--- a/src/particle.h
+++ b/src/particle.h
@@ -1,303 +1,296 @@
-/*
- * The Mana World
- * Copyright 2006 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _PARTICLE_H
-#define _PARTICLE_H
-
-#include <list>
-#include <string>
-
-#include <guichan/color.hpp>
-
-#include "guichanfwd.h"
-#include "sprite.h"
-#include "vector.h"
-
-class Map;
-class Particle;
-class ParticleEmitter;
-
-typedef std::list<Particle *> Particles;
-typedef Particles::iterator ParticleIterator;
-typedef std::list<ParticleEmitter *> Emitters;
-typedef Emitters::iterator EmitterIterator;
-
-/**
- * A particle spawned by a ParticleEmitter.
- */
-class Particle : public Sprite
-{
- public:
- static const float PARTICLE_SKY; /**< Maximum Z position of particles */
- static int fastPhysics; /**< Mode of squareroot calculation */
- static int particleCount; /**< Current number of particles */
- static int maxCount; /**< Maximum number of particles */
- static int emitterSkip; /**< Duration of pause between two emitter updates in ticks */
-
- /**
- * Constructor.
- *
- * @param map the map this particle will add itself to, may be NULL
- */
- Particle(Map *map);
-
- /**
- * Destructor.
- */
- ~Particle();
-
- /**
- * Deletes all child particles and emitters.
- */
- void clear();
-
- /**
- * Gives a particle the properties of an engine root particle and loads
- * the particle-related config settings.
- */
- void setupEngine();
-
- /**
- * Updates particle position, returns false when the particle should
- * be deleted.
- */
- virtual bool update();
-
- /**
- * Draws the particle image.
- */
- virtual void draw(Graphics *graphics, int offsetX, int offsetY) const;
-
- /**
- * Necessary for sorting with the other sprites.
- */
- virtual int getPixelY() const
- { return (int) (mPos.y + mPos.z) - 64; }
-
- /**
- * Sets the map the particle is on.
- */
- void setMap(Map *map);
-
- /**
- * Creates a child particle that hosts some emitters described in the
- * particleEffectFile.
- */
- Particle* addEffect(const std::string &particleEffectFile,
- int pixelX, int pixelY, int rotation = 0);
-
- /**
- * Creates a standalone text particle.
- */
- Particle *addTextSplashEffect(const std::string &text,
- int colorR, int colorG, int colorB,
- gcn::Font *font, int x, int y);
-
- /**
- * Creates a standalone text particle.
- */
- Particle *addTextRiseFadeOutEffect(const std::string &text,
- gcn::Font *font,
- int x, int y);
-
- /**
- * Adds an emitter to the particle.
- */
- void addEmitter (ParticleEmitter* emitter)
- { mChildEmitters.push_back(emitter); }
-
- /**
- * Sets the position in 3 dimensional space in pixels relative to map.
- */
- void setPosition(float x, float y, float z)
- { mPos.x = x; mPos.y = y; mPos.z = z; }
-
- /**
- * Sets the position in 2 dimensional space in pixels relative to map.
- */
- void setPosition(float x, float y)
- { mPos.x = x; mPos.y = y; }
-
- /**
- * Returns the particle position.
- */
- const Vector& getPosition() const
- { return mPos; }
-
- /**
- * Changes the particle position relative
- */
- void moveBy(float x, float y, float z)
- { mPos.x += x; mPos.y += y; mPos.z += z; }
-
- void moveChildren(Vector change);
-
- void moveBy (Vector change)
- { mPos += change; }
-
- /**
- * Sets the time in game ticks until the particle is destroyed.
- */
- void setLifetime(int lifetime)
- { mLifetimeLeft = lifetime; mLifetimePast = 0; }
-
- /**
- * Sets the age of the pixel in game ticks where the particle has
- * faded in completely.
- */
- void setFadeOut(int fadeOut)
- { mFadeOut = fadeOut; }
-
- /**
- * Sets the remaining particle lifetime where the particle starts to
- * fade out.
- */
- void setFadeIn(int fadeIn)
- { mFadeIn = fadeIn; }
-
- /**
- * Sets the alpha value of the particle
- */
- void setAlpha(float alpha)
- { mAlpha = alpha; }
-
- /**
- * Sets the sprite iterator of the particle on the current map to make
- * it easier to remove the particle from the map when it is destroyed.
- */
- void setSpriteIterator(std::list<Sprite*>::iterator spriteIterator)
- { mSpriteIterator = spriteIterator; }
-
- /**
- * Gets the sprite iterator of the particle on the current map.
- */
- std::list<Sprite*>::iterator
- getSpriteIterator() const
- { return mSpriteIterator; }
-
- /**
- * Sets the current velocity in 3 dimensional space.
- */
- void setVelocity(float x, float y, float z)
- { mVelocity.x = x; mVelocity.y = y; mVelocity.z = z; }
-
- /**
- * Sets the downward acceleration.
- */
- void setGravity(float gravity)
- { mGravity = gravity; }
-
- /**
- * Sets the ammount of random vector changes
- */
- void setRandomness(int r)
- { mRandomness = r; }
-
- /**
- * Sets the ammount of velocity particles retain after
- * hitting the ground.
- */
- void setBounce(float bouncieness)
- { mBounce = bouncieness; }
-
- /**
- * Sets the flag if the particle is supposed to be moved by its parent
- */
- void setFollow(bool follow)
- { mFollow = follow; }
-
- /**
- * Gets the flag if the particle is supposed to be moved by its parent
- */
- bool doesFollow()
- { return mFollow; }
-
- /**
- * Makes the particle move toward another particle with a
- * given acceleration and momentum
- */
- void setDestination(Particle *target, float accel, float moment)
- { mTarget = target; mAcceleration = accel; mMomentum = moment; }
-
- /**
- * Sets the distance in pixel the particle can come near the target
- * particle before it is destroyed. Does only make sense after a target
- * particle has been set using setDestination.
- */
- void setDieDistance(float dist)
- { mInvDieDistance = 1.0f / dist; }
-
- bool isAlive()
- { return mAlive; }
-
- /**
- * Determines whether the particle and its children are all dead
- */
- bool isExtinct()
- { return !isAlive() && mChildParticles.empty(); }
-
- /**
- * Manually marks the particle for deletion.
- */
- void kill()
- { mAlive = false; mAutoDelete = true; }
-
- /**
- * After calling this function the particle will only request
- * deletion when kill() is called
- */
- void disableAutoDelete()
- { mAutoDelete = false; }
-
- protected:
- bool mAlive; /**< Is the particle supposed to be drawn and updated?*/
- Vector mPos; /**< Position in pixels relative to map. */
- int mLifetimeLeft; /**< Lifetime left in game ticks*/
- int mLifetimePast; /**< Age of the particle in game ticks*/
- int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/
- int mFadeIn; /**< Age in game ticks where fading in is finished*/
- float mAlpha; /**< Opacity of the graphical representation of the particle */
-
- private:
- // generic properties
- bool mAutoDelete; /**< May the particle request its deletion by the parent particle? */
- Map *mMap; /**< Map the particle is on. */
- std::list<Sprite*>::iterator mSpriteIterator; /**< iterator of the particle on the current map */
- Emitters mChildEmitters; /**< List of child emitters. */
- Particles mChildParticles; /**< List of particles controlled by this particle */
-
- // dynamic particle
- Vector mVelocity; /**< Speed in pixels per game-tick. */
- float mGravity; /**< Downward acceleration in pixels per game-tick. */
- int mRandomness; /**< Ammount of random vector change */
- float mBounce; /**< How much the particle bounces off when hitting the ground */
- bool mFollow; /**< is this particle moved when its parent particle moves? */
-
- // follow-point particles
- Particle *mTarget; /**< The particle that attracts this particle*/
- float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick�*/
- float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/
- float mMomentum; /**< How much speed the particle retains after each game tick*/
-};
-
-extern Particle *particleEngine;
-
+/*
+ * The Mana World
+ * Copyright 2006 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _PARTICLE_H
+#define _PARTICLE_H
+
+#include <list>
+#include <string>
+
+#include <guichan/color.hpp>
+
+#include "guichanfwd.h"
+#include "sprite.h"
+#include "vector.h"
+
+class Map;
+class Particle;
+class ParticleEmitter;
+
+typedef std::list<Particle *> Particles;
+typedef Particles::iterator ParticleIterator;
+typedef std::list<ParticleEmitter *> Emitters;
+typedef Emitters::iterator EmitterIterator;
+
+/**
+ * A particle spawned by a ParticleEmitter.
+ */
+class Particle : public Sprite
+{
+ public:
+ static const float PARTICLE_SKY; /**< Maximum Z position of particles */
+ static int fastPhysics; /**< Mode of squareroot calculation */
+ static int particleCount; /**< Current number of particles */
+ static int maxCount; /**< Maximum number of particles */
+ static int emitterSkip; /**< Duration of pause between two emitter updates in ticks */
+
+ /**
+ * Constructor.
+ *
+ * @param map the map this particle will add itself to, may be NULL
+ */
+ Particle(Map *map);
+
+ /**
+ * Destructor.
+ */
+ ~Particle();
+
+ /**
+ * Deletes all child particles and emitters.
+ */
+ void clear();
+
+ /**
+ * Gives a particle the properties of an engine root particle and loads
+ * the particle-related config settings.
+ */
+ void setupEngine();
+
+ /**
+ * Updates particle position, returns false when the particle should
+ * be deleted.
+ */
+ virtual bool update();
+
+ /**
+ * Draws the particle image.
+ */
+ virtual void draw(Graphics *graphics, int offsetX, int offsetY) const;
+
+ /**
+ * Necessary for sorting with the other sprites.
+ */
+ virtual int getPixelY() const
+ { return (int) (mPos.y + mPos.z) - 64; }
+
+ /**
+ * Sets the map the particle is on.
+ */
+ void setMap(Map *map);
+
+ /**
+ * Creates a child particle that hosts some emitters described in the
+ * particleEffectFile.
+ */
+ Particle *addEffect(const std::string &particleEffectFile,
+ int pixelX, int pixelY, int rotation = 0);
+
+ /**
+ * Creates a standalone text particle.
+ */
+ Particle *addTextSplashEffect(const std::string &text,
+ int colorR, int colorG, int colorB,
+ gcn::Font *font, int x, int y);
+
+ /**
+ * Creates a standalone text particle.
+ */
+ Particle *addTextRiseFadeOutEffect(const std::string &text,
+ gcn::Font *font,
+ int x, int y);
+
+ /**
+ * Adds an emitter to the particle.
+ */
+ void addEmitter (ParticleEmitter* emitter)
+ { mChildEmitters.push_back(emitter); }
+
+ /**
+ * Sets the position in 3 dimensional space in pixels relative to map.
+ */
+ void moveTo(const Vector &pos)
+ { moveBy (pos - mPos);}
+
+ /**
+ * Sets the position in 2 dimensional space in pixels relative to map.
+ */
+ void moveTo(float x, float y);
+
+ /**
+ * Returns the particle position.
+ */
+ const Vector& getPosition() const
+ { return mPos; }
+
+ /**
+ * Changes the particle position relative
+ */
+ void moveBy (const Vector &change);
+
+ /**
+ * Sets the time in game ticks until the particle is destroyed.
+ */
+ void setLifetime(int lifetime)
+ { mLifetimeLeft = lifetime; mLifetimePast = 0; }
+
+ /**
+ * Sets the age of the pixel in game ticks where the particle has
+ * faded in completely.
+ */
+ void setFadeOut(int fadeOut)
+ { mFadeOut = fadeOut; }
+
+ /**
+ * Sets the remaining particle lifetime where the particle starts to
+ * fade out.
+ */
+ void setFadeIn(int fadeIn)
+ { mFadeIn = fadeIn; }
+
+ /**
+ * Sets the alpha value of the particle
+ */
+ void setAlpha(float alpha)
+ { mAlpha = alpha; }
+
+ /**
+ * Sets the sprite iterator of the particle on the current map to make
+ * it easier to remove the particle from the map when it is destroyed.
+ */
+ void setSpriteIterator(std::list<Sprite*>::iterator spriteIterator)
+ { mSpriteIterator = spriteIterator; }
+
+ /**
+ * Gets the sprite iterator of the particle on the current map.
+ */
+ std::list<Sprite*>::iterator
+ getSpriteIterator() const
+ { return mSpriteIterator; }
+
+ /**
+ * Sets the current velocity in 3 dimensional space.
+ */
+ void setVelocity(float x, float y, float z)
+ { mVelocity.x = x; mVelocity.y = y; mVelocity.z = z; }
+
+ /**
+ * Sets the downward acceleration.
+ */
+ void setGravity(float gravity)
+ { mGravity = gravity; }
+
+ /**
+ * Sets the ammount of random vector changes
+ */
+ void setRandomness(int r)
+ { mRandomness = r; }
+
+ /**
+ * Sets the ammount of velocity particles retain after
+ * hitting the ground.
+ */
+ void setBounce(float bouncieness)
+ { mBounce = bouncieness; }
+
+ /**
+ * Sets the flag if the particle is supposed to be moved by its parent
+ */
+ void setFollow(bool follow)
+ { mFollow = follow; }
+
+ /**
+ * Gets the flag if the particle is supposed to be moved by its parent
+ */
+ bool doesFollow()
+ { return mFollow; }
+
+ /**
+ * Makes the particle move toward another particle with a
+ * given acceleration and momentum
+ */
+ void setDestination(Particle *target, float accel, float moment)
+ { mTarget = target; mAcceleration = accel; mMomentum = moment; }
+
+ /**
+ * Sets the distance in pixel the particle can come near the target
+ * particle before it is destroyed. Does only make sense after a target
+ * particle has been set using setDestination.
+ */
+ void setDieDistance(float dist)
+ { mInvDieDistance = 1.0f / dist; }
+
+ bool isAlive()
+ { return mAlive; }
+
+ /**
+ * Determines whether the particle and its children are all dead
+ */
+ bool isExtinct()
+ { return !isAlive() && mChildParticles.empty(); }
+
+ /**
+ * Manually marks the particle for deletion.
+ */
+ void kill()
+ { mAlive = false; mAutoDelete = true; }
+
+ /**
+ * After calling this function the particle will only request
+ * deletion when kill() is called
+ */
+ void disableAutoDelete()
+ { mAutoDelete = false; }
+
+ protected:
+ bool mAlive; /**< Is the particle supposed to be drawn and updated?*/
+ Vector mPos; /**< Position in pixels relative to map. */
+ int mLifetimeLeft; /**< Lifetime left in game ticks*/
+ int mLifetimePast; /**< Age of the particle in game ticks*/
+ int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/
+ int mFadeIn; /**< Age in game ticks where fading in is finished*/
+ float mAlpha; /**< Opacity of the graphical representation of the particle */
+
+ private:
+ // generic properties
+ bool mAutoDelete; /**< May the particle request its deletion by the parent particle? */
+ Map *mMap; /**< Map the particle is on. */
+ std::list<Sprite*>::iterator mSpriteIterator; /**< iterator of the particle on the current map */
+ Emitters mChildEmitters; /**< List of child emitters. */
+ Particles mChildParticles; /**< List of particles controlled by this particle */
+
+ // dynamic particle
+ Vector mVelocity; /**< Speed in pixels per game-tick. */
+ float mGravity; /**< Downward acceleration in pixels per game-tick. */
+ int mRandomness; /**< Ammount of random vector change */
+ float mBounce; /**< How much the particle bounces off when hitting the ground */
+ bool mFollow; /**< is this particle moved when its parent particle moves? */
+
+ // follow-point particles
+ Particle *mTarget; /**< The particle that attracts this particle*/
+ float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/
+ float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/
+ float mMomentum; /**< How much speed the particle retains after each game tick*/
+};
+
+extern Particle *particleEngine;
+
#endif
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 12ef5733..fbfb1505 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -44,12 +44,10 @@ ParticleContainer::clear()
mNext->clear();
}
-
-void
-ParticleContainer::setPositions(float x, float y)
+void ParticleContainer::moveTo(float x, float y)
{
if (mNext)
- mNext->setPositions(x, y);
+ mNext->moveTo(x, y);
}
// -- particle list ----------------------------------------
@@ -91,15 +89,14 @@ ParticleList::clearLocally()
mElements.clear();
}
-void
-ParticleList::setPositions(float x, float y)
+void ParticleList::moveTo(float x, float y)
{
- ParticleContainer::setPositions(x, y);
+ ParticleContainer::moveTo(x, y);
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end();)
{
- (*it)->setPosition(x, y);
+ (*it)->moveTo(x, y);
if ((*it)->isExtinct())
{
(*it)->kill();
@@ -156,16 +153,15 @@ ParticleVector::clearLocally()
delLocally(i);
}
-void
-ParticleVector::setPositions(float x, float y)
+void ParticleVector::moveTo(float x, float y)
{
- ParticleContainer::setPositions(x, y);
+ ParticleContainer::moveTo(x, y);
for (std::vector<Particle *>::iterator it = mIndexedElements.begin();
it != mIndexedElements.end(); it++)
if (*it)
{
- (*it)->setPosition(x, y);
+ (*it)->moveTo(x, y);
if ((*it)->isExtinct())
{
diff --git a/src/particlecontainer.h b/src/particlecontainer.h
index cf002fbc..ae02326e 100644
--- a/src/particlecontainer.h
+++ b/src/particlecontainer.h
@@ -58,7 +58,7 @@ public:
/**
* Sets the positions of all elements
*/
- virtual void setPositions(float x, float y);
+ virtual void moveTo(float x, float y);
protected:
bool mDelParent; /**< Delete mNext in destructor */
@@ -88,7 +88,7 @@ public:
virtual void clearLocally();
- virtual void setPositions(float x, float y);
+ virtual void moveTo(float x, float y);
protected:
std::list<Particle *> mElements; /**< Contained particle effects */
@@ -116,7 +116,7 @@ public:
virtual void delLocally(int index);
virtual void clearLocally();
- virtual void setPositions(float x, float y);
+ virtual void moveTo(float x, float y);
protected:
std::vector<Particle *> mIndexedElements;
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 03fe4672..2a4e4c8a 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -360,12 +360,11 @@ ParticleEmitter::createParticles(int tick)
{
newParticle = new Particle(mMap);
}
-
-
- newParticle->setPosition(
- mParticlePosX.value(tick),
- mParticlePosY.value(tick),
- mParticlePosZ.value(tick));
+
+ Vector position(mParticlePosX.value(tick),
+ mParticlePosY.value(tick),
+ mParticlePosZ.value(tick));
+ newParticle->moveTo(position);
float angleH = mParticleAngleHorizontal.value(tick);
float angleV = mParticleAngleVertical.value(tick);