summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index cb2faa77..f147a9f2 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -185,7 +185,8 @@ bool Particle::update()
{
mAlive = DEAD_FLOOR;
}
- } else if (mPos.z > PARTICLE_SKY)
+ }
+ else if (mPos.z > PARTICLE_SKY)
{
mAlive = DEAD_SKY;
}
@@ -431,6 +432,19 @@ void Particle::adjustEmitterSize(int w, int h)
}
}
+float Particle::getCurrentAlpha() const
+{
+ float alpha = mAlpha;
+
+ if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
+ alpha *= (float)mLifetimeLeft / (float)mFadeOut;
+
+ if (mLifetimePast < mFadeIn)
+ alpha *= (float)mLifetimePast / (float)mFadeIn;
+
+ return alpha;
+}
+
void Particle::clear()
{
delete_all(mChildEmitters);