diff options
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/being.cpp b/src/being.cpp index b3cb9906..d4f68fac 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -62,7 +62,6 @@ Being::Being(Uint32 id, Uint16 job, Map *map): mSex(2), mSpeechTime(0), mDamageTime(0), - mShowSpeech(false), mShowDamage(false), mPx(0), mPy(0), mSprites(VECTOREND_SPRITE, NULL), mEquipmentSpriteIDs(VECTOREND_SPRITE, 0) @@ -134,16 +133,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 @@ -297,17 +294,13 @@ Being::nextStep() void Being::logic() { - // 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 * 32 + getXOffset(); @@ -365,7 +358,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)); @@ -373,7 +366,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") @@ -390,13 +383,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 |