summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-06-27 23:26:01 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-06-27 23:26:01 +0000
commit9836222a00028cc9a3aea9bb4c316a00b59ea33a (patch)
tree7df484183ac25a2d3ad9a39a86d370218b44ee58
parent8eed193e36111b3421a51d611c2d2d5d04b1fa09 (diff)
downloadmana-client-9836222a00028cc9a3aea9bb4c316a00b59ea33a.tar.gz
mana-client-9836222a00028cc9a3aea9bb4c316a00b59ea33a.tar.bz2
mana-client-9836222a00028cc9a3aea9bb4c316a00b59ea33a.tar.xz
mana-client-9836222a00028cc9a3aea9bb4c316a00b59ea33a.zip
Corrected some perspective issues of the particle engine and fixed a crash caused by particles with child emitters that have an image than isn't used elsewhere. Added a particle effect at the spawn point in Tulimshar (we should have at least one particle effect that demonstrates acceleration and particles with emitters)
-rw-r--r--ChangeLog10
-rw-r--r--src/particle.cpp8
-rw-r--r--src/particleemitter.cpp12
3 files changed, 20 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 05a642b6..f1130a9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,12 @@
-2007-06-21 Philipp Sehmisch <tmw@crushnet.org>
+2007-06-29 Philipp Sehmisch <tmw@crushnet.org>
+
+ * src/particle.cpp, src/particleemitter.cpp: Corrected some perspective
+ issues of the particle engine and fixed a crash caused by particles
+ with child emitters that have an image than isn't used elsewhere.
+ * data/maps/new-3-1.tmx.gz: Added a particle effect at the spawn point
+ in Tulimshar.
+
+2007-06-21 Philipp Sehmisch <tmw@crushnet.org>
* data/monsters.xml, data/graphics/sprites/monster-logmonster.png,
data/graphics/sprites/monster-logmonster.xml: Added logmonster by
diff --git a/src/particle.cpp b/src/particle.cpp
index 509c20ee..805da102 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -39,6 +39,8 @@
#include "utils/fastsqrt.h"
#include "utils/xml.h"
+#define SIN45 0.707106781f
+
class Graphics;
class Image;
@@ -122,7 +124,7 @@ Particle::update()
if (mTarget && mAcceleration != 0.0f)
{
- float distX = mPosX - mTarget->getPosX();
+ float distX = (mPosX - mTarget->getPosX()) * SIN45;
float distY = mPosY - mTarget->getPosY();
float distZ = mPosZ - mTarget->getPosZ();
float invHypotenuse;
@@ -167,8 +169,8 @@ Particle::update()
// Update position
mPosX += mVectorX;
- mPosY += mVectorY;
- mPosZ += mVectorZ;
+ mPosY += mVectorY * SIN45;
+ mPosZ += mVectorZ * SIN45;
// Update other stuff
if (mLifetimeLeft > 0)
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index 2387c652..5b5e86b9 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -76,10 +76,14 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
{
mParticlePosY = readMinMax(propertyNode, 0.0f);
+ mParticlePosY.minVal *= SIN45;
+ mParticlePosY.maxVal *= SIN45;
}
else if (name == "position-z")
{
mParticlePosZ = readMinMax(propertyNode, 0.0f);
+ mParticlePosZ.minVal *= SIN45;
+ mParticlePosZ.maxVal *= SIN45;
}
else if (name == "image")
{
@@ -236,10 +240,6 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
ParticleEmitter::~ParticleEmitter()
{
- if (mParticleImage)
- {
- mParticleImage->decRef();
- }
}
@@ -294,8 +294,8 @@ ParticleEmitter::createParticles()
float power = mParticlePower.value();
newParticle->setVector(
cos(angleH) * cos(angleV) * power,
- sin(angleH) * cos(angleV) * SIN45 * power,
- sin(angleV) * SIN45 * power
+ sin(angleH) * cos(angleV) * power,
+ sin(angleV) * power
);
newParticle->setRandomnes(mParticleRandomnes.value());