summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-10-17 00:47:38 +0200
committerStefan Dombrowski <stefan@uni-bonn.de>2010-10-17 00:50:51 +0200
commit02a014605d19d0d38c14cafa462a2539d63950df (patch)
treeac831646a8e10f8972f6f3e2ed7cc7acfa7607c8 /src/particle.cpp
parent9824ccf5946c86df1cf497b797c5f3da5d481d28 (diff)
downloadmana-02a014605d19d0d38c14cafa462a2539d63950df.tar.gz
mana-02a014605d19d0d38c14cafa462a2539d63950df.tar.bz2
mana-02a014605d19d0d38c14cafa462a2539d63950df.tar.xz
mana-02a014605d19d0d38c14cafa462a2539d63950df.zip
Fixed wrong alpha calculation of text particles
This resolves: http://bugs.manasource.org/view.php?id=51 Reviewed-by: Bertram
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 84161c9f..0c4a7d7e 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -393,6 +393,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::setMap(Map *map)
{
mMap = map;