summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-04-11 08:08:21 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-04-11 08:08:21 +0000
commit222f8a034707e8f57dc0e4795462af610a911d75 (patch)
treeb3d326477ff6da6718110c0becafb51bd8c0430f /src/being.cpp
parentac6ed9c03198156e7ebeefc18f2ba04073d5acb8 (diff)
downloadmana-client-222f8a034707e8f57dc0e4795462af610a911d75.tar.gz
mana-client-222f8a034707e8f57dc0e4795462af610a911d75.tar.bz2
mana-client-222f8a034707e8f57dc0e4795462af610a911d75.tar.xz
mana-client-222f8a034707e8f57dc0e4795462af610a911d75.zip
Now damage and speech times are fps independent
and if they're displayed is checked in logic I also centered the speech above the player
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/being.cpp b/src/being.cpp
index c4ca63b6..d2bf85d5 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -122,7 +122,7 @@ void sort() {
Being::Being():
speech_time(0),
- damage(""), damage_time(0), damage_y(0.0),
+ damage(""), damage_time(0),
id(0), job(0),
x(0), y(0), destX(0), destY(0), direction(0),
type(0), action(0), frame(0),
@@ -132,7 +132,8 @@ Being::Being():
emotion(0), emotion_time(0),
text_x(0), text_y(0),
hair_style(1), hair_color(1),
- weapon(0)
+ weapon(0),
+ showSpeech(false), showDamage(false)
{
strcpy(name, "");
}
@@ -165,14 +166,15 @@ void Being::setHairStyle(int style)
void Being::setSpeech(const std::string &text, int time)
{
speech = text;
- speech_time = time;
+ speech_time = tick_time;
+ showSpeech = true;
}
void Being::setDamage(const std::string &text, int time)
{
damage = text;
- damage_time = time;
- damage_y = 0;
+ damage_time = tick_time;
+ showDamage = true;
}
void Being::setName(char *text)
@@ -224,7 +226,7 @@ void Being::nextStep()
void Being::drawSpeech(Graphics *graphics)
{
// Draw speech above this being
- if (speech_time > 0) {
+ if (showSpeech) {
//if (being->speech_color == makecol(255, 255, 255)) {
// guiGraphics->drawText(being->speech,
// being->text_x + 16, being->text_y - 60,
@@ -232,24 +234,14 @@ void Being::drawSpeech(Graphics *graphics)
//}
//else {
graphics->drawText(speech,
- text_x + 60, text_y - 60,
+ text_x + 20, text_y - 60,
gcn::Graphics::CENTER);
//}
}
- if (damage_time > 0.0) {
+ if (showDamage) {
graphics->drawText(damage,
- text_x + 60, text_y - 60 - (int)damage_y,
+ text_x + 60,
+ text_y - 60 - get_elapsed_time(damage_time) / 100,
gcn::Graphics::CENTER);
- damage_y += 0.5;
- }
-}
-
-void Being::tick()
-{
- if (speech_time > 0) {
- speech_time--;
- }
- if (damage_time > 0) {
- damage_time--;
}
}