summaryrefslogtreecommitdiff
path: root/src/particle
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle')
-rw-r--r--src/particle/particle.cpp50
-rw-r--r--src/particle/particle.h4
-rw-r--r--src/particle/particleemitter.cpp52
-rw-r--r--src/particle/textparticle.cpp2
4 files changed, 54 insertions, 54 deletions
diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp
index 70c9a367c..1427ffae0 100644
--- a/src/particle/particle.cpp
+++ b/src/particle/particle.cpp
@@ -40,7 +40,7 @@
#include "debug.h"
-static const float SIN45 = 0.707106781f;
+static const float SIN45 = 0.707106781F;
class Graphics;
class Image;
@@ -50,11 +50,11 @@ int Particle::maxCount = 0;
int Particle::fastPhysics = 0;
int Particle::emitterSkip = 1;
bool Particle::enabled = true;
-const float Particle::PARTICLE_SKY = 800.0f;
+const float Particle::PARTICLE_SKY = 800.0F;
Particle::Particle(Map *const map) :
Actor(),
- mAlpha(1.0f),
+ mAlpha(1.0F),
mLifetimeLeft(-1),
mLifetimePast(0),
mFadeOut(0),
@@ -64,11 +64,11 @@ Particle::Particle(Map *const map) :
mChildEmitters(),
mChildParticles(),
mDeathEffect(),
- mGravity(0.0f),
- mBounce(0.0f),
- mAcceleration(0.0f),
- mInvDieDistance(-1.0f),
- mMomentum(1.0f),
+ mGravity(0.0F),
+ mBounce(0.0F),
+ mAcceleration(0.0F),
+ mInvDieDistance(-1.0F),
+ mMomentum(1.0F),
mTarget(nullptr),
mRandomness(0),
mDeathEffectConditions(0x00),
@@ -117,10 +117,10 @@ bool Particle::update()
if (mAlive == ALIVE)
{
// calculate particle movement
- if (mMomentum != 1.0f)
+ if (mMomentum != 1.0F)
mVelocity *= mMomentum;
- if (mTarget && mAcceleration != 0.0f)
+ if (mTarget && mAcceleration != 0.0F)
{
Vector dist = mPos - mTarget->mPos;
dist.x *= SIN45;
@@ -139,19 +139,19 @@ bool Particle::update()
break;
}
- invHypotenuse = 2.0f / (static_cast<float>(fabs(dist.x))
+ invHypotenuse = 2.0F / (static_cast<float>(fabs(dist.x))
+ static_cast<float>(fabs(dist.y))
+ static_cast<float>(fabs(dist.z)));
break;
default:
- invHypotenuse = 1.0f / static_cast<float>(sqrt(
+ invHypotenuse = 1.0F / static_cast<float>(sqrt(
dist.x * dist.x + dist.y * dist.y + dist.z * dist.z));
break;
}
if (invHypotenuse)
{
- if (mInvDieDistance > 0.0f && invHypotenuse > mInvDieDistance)
+ if (mInvDieDistance > 0.0F && invHypotenuse > mInvDieDistance)
mAlive = DEAD_IMPACT;
const float accFactor = invHypotenuse * mAcceleration;
mVelocity -= dist * accFactor;
@@ -161,11 +161,11 @@ bool Particle::update()
if (mRandomness > 0)
{
mVelocity.x += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0f;
+ % mRandomness)) / 1000.0F;
mVelocity.y += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0f;
+ % mRandomness)) / 1000.0F;
mVelocity.z += static_cast<float>((rand() % mRandomness - rand()
- % mRandomness)) / 1000.0f;
+ % mRandomness)) / 1000.0F;
}
mVelocity.z -= mGravity;
@@ -181,9 +181,9 @@ bool Particle::update()
mLifetimePast++;
- if (mPos.z < 0.0f)
+ if (mPos.z < 0.0F)
{
- if (mBounce > 0.0f)
+ if (mBounce > 0.0F)
{
mPos.z *= -mBounce;
mVelocity *= mBounce;
@@ -419,12 +419,12 @@ Particle *Particle::addTextSplashEffect(const std::string &text,
mMap, text, color, font, outline);
newParticle->moveTo(static_cast<float>(x), static_cast<float>(y));
newParticle->setVelocity(
- static_cast<float>((rand() % 100) - 50) / 200.0f, // X
- static_cast<float>((rand() % 100) - 50) / 200.0f, // Y
- (static_cast<float>((rand() % 100)) / 200.0f) + 4.0f); // Z
+ static_cast<float>((rand() % 100) - 50) / 200.0F, // X
+ static_cast<float>((rand() % 100) - 50) / 200.0F, // Y
+ (static_cast<float>((rand() % 100)) / 200.0F) + 4.0F); // Z
- newParticle->setGravity(0.1f);
- newParticle->setBounce(0.5f);
+ newParticle->setGravity(0.1F);
+ newParticle->setBounce(0.5F);
newParticle->setLifetime(200);
newParticle->setFadeOut(100);
@@ -442,8 +442,8 @@ Particle *Particle::addTextRiseFadeOutEffect(const std::string &text,
Particle *const newParticle = new TextParticle(
mMap, text, color, font, outline);
newParticle->moveTo(static_cast<float>(x), static_cast<float>(y));
- newParticle->setVelocity(0.0f, 0.0f, 0.5f);
- newParticle->setGravity(0.0015f);
+ newParticle->setVelocity(0.0F, 0.0F, 0.5F);
+ newParticle->setGravity(0.0015F);
newParticle->setLifetime(300);
newParticle->setFadeOut(100);
newParticle->setFadeIn(0);
diff --git a/src/particle/particle.h b/src/particle/particle.h
index dd89e717e..7c891dd86 100644
--- a/src/particle/particle.h
+++ b/src/particle/particle.h
@@ -246,7 +246,7 @@ class Particle : public Actor
* particle has been set using setDestination.
*/
void setDieDistance(const float dist)
- { mInvDieDistance = 1.0f / dist; }
+ { mInvDieDistance = 1.0F / dist; }
/**
* Changes the size of the emitters so that the effect fills a
@@ -284,7 +284,7 @@ class Particle : public Actor
{ return 1; }
virtual float getAlpha() const
- { return 1.0f; }
+ { return 1.0F; }
virtual void setAlpha(const float alpha A_UNUSED) override
{ }
diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp
index 9e273e4a1..74aec293a 100644
--- a/src/particle/particleemitter.cpp
+++ b/src/particle/particleemitter.cpp
@@ -36,8 +36,8 @@
#include "debug.h"
-static const float SIN45 = 0.707106781f;
-static const float DEG_RAD_FACTOR = 0.017453293f;
+static const float SIN45 = 0.707106781F;
+static const float DEG_RAD_FACTOR = 0.017453293F;
typedef std::vector<ImageSet*>::const_iterator ImageSetVectorCIter;
typedef std::list<ParticleEmitter>::const_iterator ParticleEmitterListCIter;
@@ -54,24 +54,24 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
mParticleFollow(false)
{
// Initializing default values
- mParticlePosX.set(0.0f);
- mParticlePosY.set(0.0f);
- mParticlePosZ.set(0.0f);
- mParticleAngleHorizontal.set(0.0f);
- mParticleAngleVertical.set(0.0f);
- mParticlePower.set(0.0f);
- mParticleGravity.set(0.0f);
+ mParticlePosX.set(0.0F);
+ mParticlePosY.set(0.0F);
+ mParticlePosZ.set(0.0F);
+ mParticleAngleHorizontal.set(0.0F);
+ mParticleAngleVertical.set(0.0F);
+ mParticlePower.set(0.0F);
+ mParticleGravity.set(0.0F);
mParticleRandomness.set(0);
- mParticleBounce.set(0.0f);
- mParticleAcceleration.set(0.0f);
- mParticleDieDistance.set(-1.0f);
- mParticleMomentum.set(1.0f);
+ mParticleBounce.set(0.0F);
+ mParticleAcceleration.set(0.0F);
+ mParticleDieDistance.set(-1.0F);
+ mParticleMomentum.set(1.0F);
mParticleLifetime.set(-1);
mParticleFadeOut.set(0);
mParticleFadeIn.set(0);
mOutput.set(1);
mOutputPause.set(0);
- mParticleAlpha.set(1.0f);
+ mParticleAlpha.set(1.0F);
for_each_xml_child_node(propertyNode, emitterNode)
{
@@ -82,18 +82,18 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
if (name == "position-x")
{
- mParticlePosX = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticlePosX = readParticleEmitterProp(propertyNode, 0.0F);
}
else if (name == "position-y")
{
- mParticlePosY = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticlePosY = readParticleEmitterProp(propertyNode, 0.0F);
mParticlePosY.minVal *= SIN45;
mParticlePosY.maxVal *= SIN45;
mParticlePosY.changeAmplitude *= SIN45;
}
else if (name == "position-z")
{
- mParticlePosZ = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticlePosZ = readParticleEmitterProp(propertyNode, 0.0F);
mParticlePosZ.minVal *= SIN45;
mParticlePosZ.maxVal *= SIN45;
mParticlePosZ.changeAmplitude *= SIN45;
@@ -144,7 +144,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
else if (name == "horizontal-angle")
{
mParticleAngleHorizontal =
- readParticleEmitterProp(propertyNode, 0.0f);
+ readParticleEmitterProp(propertyNode, 0.0F);
mParticleAngleHorizontal.minVal
+= static_cast<float>(rotation);
mParticleAngleHorizontal.minVal *= DEG_RAD_FACTOR;
@@ -156,18 +156,18 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
else if (name == "vertical-angle")
{
mParticleAngleVertical =
- readParticleEmitterProp(propertyNode, 0.0f);
+ readParticleEmitterProp(propertyNode, 0.0F);
mParticleAngleVertical.minVal *= DEG_RAD_FACTOR;
mParticleAngleVertical.maxVal *= DEG_RAD_FACTOR;
mParticleAngleVertical.changeAmplitude *= DEG_RAD_FACTOR;
}
else if (name == "power")
{
- mParticlePower = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticlePower = readParticleEmitterProp(propertyNode, 0.0F);
}
else if (name == "gravity")
{
- mParticleGravity = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticleGravity = readParticleEmitterProp(propertyNode, 0.0F);
}
else if (name == "randomnes"
|| name == "randomness") // legacy bug
@@ -176,7 +176,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
}
else if (name == "bounce")
{
- mParticleBounce = readParticleEmitterProp(propertyNode, 0.0f);
+ mParticleBounce = readParticleEmitterProp(propertyNode, 0.0F);
}
else if (name == "lifetime")
{
@@ -196,17 +196,17 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
else if (name == "acceleration")
{
mParticleAcceleration = readParticleEmitterProp(
- propertyNode, 0.0f);
+ propertyNode, 0.0F);
}
else if (name == "die-distance")
{
mParticleDieDistance = readParticleEmitterProp(
- propertyNode, 0.0f);
+ propertyNode, 0.0F);
}
else if (name == "momentum")
{
mParticleMomentum = readParticleEmitterProp(
- propertyNode, 1.0f);
+ propertyNode, 1.0F);
}
else if (name == "fade-out")
{
@@ -218,7 +218,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtr emitterNode,
}
else if (name == "alpha")
{
- mParticleAlpha = readParticleEmitterProp(propertyNode, 1.0f);
+ mParticleAlpha = readParticleEmitterProp(propertyNode, 1.0F);
}
else if (name == "follow-parent")
{
diff --git a/src/particle/textparticle.cpp b/src/particle/textparticle.cpp
index ecab98068..35bef33d5 100644
--- a/src/particle/textparticle.cpp
+++ b/src/particle/textparticle.cpp
@@ -60,7 +60,7 @@ bool TextParticle::draw(Graphics *const graphics,
const int screenY = static_cast<int>(mPos.y) - static_cast<int>(mPos.z)
+ offsetY;
- float alpha = mAlpha * 255.0f;
+ float alpha = mAlpha * 255.0F;
if (mFadeOut && mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
{