From 86f666f90322f5d39aa5d0f0ad973e1df8f744d3 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Sun, 14 Dec 2008 04:47:18 +0100 Subject: Some systactical sugar for 864e33 --- src/particle.cpp | 19 ++++++------------- src/particleemitter.cpp | 8 +++----- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/particle.cpp b/src/particle.cpp index adc4aa5b..f73bd222 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -247,11 +247,7 @@ void Particle::moveBy(Vector change) void Particle::moveTo(float x, float y) { - Vector pos; - pos.x = x; - pos.y = y; - pos.z = mPos.z; - moveTo(pos); + moveTo(Vector(x, y, mPos.z)); } Particle* Particle::addEffect(const std::string &particleEffectFile, @@ -301,16 +297,13 @@ Particle* Particle::addEffect(const std::string &particleEffectFile, // Read and set the basic properties of the particle float offsetX = XML::getFloatProperty(effectChildNode, "position-x", 0); float offsetY = XML::getFloatProperty(effectChildNode, "position-y", 0); - float offsetZ = XML::getFloatProperty(effectChildNode, "position-z", 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); - Vector position; - position.x = mPos.x + (float)pixelX + offsetX; - position.y = mPos.y + (float)pixelY + offsetY; - position.z = mPos.z + offsetZ; - int lifetime = XML::getProperty(effectChildNode, "lifetime", -1); - - newParticle->moveTo(position); newParticle->setLifetime(lifetime); // Look for additional emitters for this particle diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index d1ba92ca..2a4e4c8a 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -361,11 +361,9 @@ ParticleEmitter::createParticles(int tick) newParticle = new Particle(mMap); } - Vector position; - position.x = mParticlePosX.value(tick); - position.y = mParticlePosY.value(tick); - position.z = mParticlePosZ.value(tick); - + Vector position(mParticlePosX.value(tick), + mParticlePosY.value(tick), + mParticlePosZ.value(tick)); newParticle->moveTo(position); float angleH = mParticleAngleHorizontal.value(tick); -- cgit v1.2.3-70-g09d2