summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-04 02:20:38 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-04 02:20:38 +0000
commit4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac (patch)
tree0b18ed6970f8fdd6750459e6f9032e444d253580 /src/being.cpp
parente160ba567bf3d2ae915e67c12c13e213c1a32a62 (diff)
downloadmana-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.gz
mana-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.bz2
mana-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.tar.xz
mana-4eec29ac0f6a9b05562ac0fbe3d4e5d7e82deeac.zip
Merged 0.0 changes from revision 2898 to 2988 to trunk.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 68c670fd..ac003d1c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -65,7 +65,6 @@ Being::Being(Uint16 id, Uint16 job, Map *map):
mHairStyle(0), mHairColor(0),
mSpeechTime(0),
mDamageTime(0),
- mShowSpeech(false), mShowDamage(false),
mPx(0), mPy(0),
mSprites(VECTOREND_SPRITE, NULL),
mEquipmentSpriteIDs(VECTOREND_SPRITE, 0)
@@ -272,16 +271,14 @@ void
Being::setSpeech(const std::string &text, Uint32 time)
{
mSpeech = text;
- mSpeechTime = tick_time;
- mShowSpeech = true;
+ mSpeechTime = 500;
}
void
Being::setDamage(Sint16 amount, Uint32 time)
{
mDamage = amount ? toString(amount) : "miss";
- mDamageTime = tick_time;
- mShowDamage = true;
+ mDamageTime = 300;
}
void
@@ -443,17 +440,13 @@ Being::logic()
nextStep();
}
- // Determine whether speech should still be displayed
- if (get_elapsed_time(mSpeechTime) > 5000)
- {
- mShowSpeech = false;
- }
+ // Reduce the time that speech is still displayed
+ if (mSpeechTime > 0)
+ mSpeechTime--;
- // Determine whether damage should still be displayed
- if (get_elapsed_time(mDamageTime) > 3000)
- {
- mShowDamage = false;
- }
+ // Reduce the time that damage is still displayed
+ if (mDamageTime > 0)
+ mDamageTime--;
// Update pixel coordinates
mPx = mX - 16 + getXOffset();
@@ -511,7 +504,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
int py = mPy + offsetY;
// Draw speech above this being
- if (mShowSpeech)
+ if (mSpeechTime > 0)
{
graphics->setFont(speechFont);
graphics->setColor(gcn::Color(255, 255, 255));
@@ -519,7 +512,7 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
}
// Draw damage above this being
- if (mShowDamage && get_elapsed_time(mDamageTime) > 250)
+ if (mDamageTime > 0 && mDamageTime < 275)
{
// Selecting the right color
if (mDamage == "miss")
@@ -536,13 +529,13 @@ Being::drawSpeech(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
}
int textY = (getType() == MONSTER) ? 32 : 70;
- int ft = get_elapsed_time(mDamageTime) - 1500;
- float a = (ft > 0) ? 1.0 - ft / 1500.0 : 1.0;
+ int ft = 150 - mDamageTime;
+ float a = (ft > 0) ? 1.0 - ft / 150.0 : 1.0;
graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a)));
graphics->drawText(mDamage,
px + 16,
- py - textY - get_elapsed_time(mDamageTime) / 100,
+ py - textY - (300 - mDamageTime) / 10,
gcn::Graphics::CENTER);
// Reset alpha value