summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-05-23 21:22:43 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-05-23 21:22:43 +0000
commit1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41 (patch)
tree93ee24ab1b77f3bc0b57143ab2643ea7e38f951c
parentc61786006bf7694f532c77d038fc2cfd8a44b551 (diff)
downloadmana-client-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.gz
mana-client-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.bz2
mana-client-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.tar.xz
mana-client-1ddb44f5caf3e0bc93b7d19cc6e227b10e4b4c41.zip
Made text splash effects fade out.
-rw-r--r--ChangeLog5
-rw-r--r--src/particle.cpp6
-rw-r--r--src/textparticle.cpp17
3 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c8d15263..cc850807 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,11 @@
data/graphics/gui/target-cursor-red-m.png,
data/graphics/gui/target-cursor-red-l.png: Replaced target cursor
graphics with higher quality ones by Pauan.
+ * src/particle.cpp: Made bouncing particles immune against death by
+ ground contact and removed a nonsensical debugging log message. Made
+ text splash effects fade out.
+ * src/textparticle.cpp: Implemented fading in and out for text
+ particles.
2007-05-20 Eugenio Favalli <elvenprogrammer@gmail.com>
diff --git a/src/particle.cpp b/src/particle.cpp
index bb28c873..579bbfc1 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -146,7 +146,6 @@ Particle::update()
{
if (mInvDieDistance > 0.0f && invHypotenuse > mInvDieDistance)
{
- logger->log("killed");
mAlive = false;
}
float accFactor = invHypotenuse * mAcceleration;
@@ -179,7 +178,8 @@ Particle::update()
if (mPosZ > PARTICLE_SKY || mPosZ < 0.0f)
{
- if (mBounce && fabs(mVectorZ) > mGravity * 2) {
+ if (mBounce > 0.0f)
+ {
mPosZ *= -mBounce;
mVectorX *= mBounce;
mVectorY *= mBounce;
@@ -326,6 +326,8 @@ Particle::addTextSplashEffect(std::string text, gcn::Font *font, gcn::Color colo
);
newParticle->setGravity(0.1f);
newParticle->setBounce(0.5f);
+ newParticle->setLifetime(200);
+ newParticle->setFadeOut(100);
mChildParticles.push_back(newParticle);
diff --git a/src/textparticle.cpp b/src/textparticle.cpp
index e7a0926b..2a2c50e8 100644
--- a/src/textparticle.cpp
+++ b/src/textparticle.cpp
@@ -42,7 +42,22 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const
int screenX = (int)mPosX + offsetX;
int screenY = (int)mPosY - int(mPosZ) + offsetY;
+ int alpha = 255;
+
+ if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut)
+ {
+ alpha *= mLifetimeLeft;
+ alpha /= mFadeOut;
+ };
+
+ if (mLifetimePast < mFadeIn)
+ {
+ alpha *= mLifetimePast;
+ alpha /= mFadeIn;
+ }
+
graphics->setFont(mTextFont);
- graphics->setColor(mTextColor);
+ graphics->setColor(gcn::Color (mTextColor.r, mTextColor.g, mTextColor.b,
+ alpha));
graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER);
}