From af08905182495e2f20622515b56be90d5ac53b14 Mon Sep 17 00:00:00 2001 From: José Ávila Date: Sun, 3 Jul 2005 08:12:47 +0000 Subject: Adding colors to hit points --- data/graphics/gui/hits_blue.png | Bin 0 -> 586 bytes data/graphics/gui/hits_red.png | Bin 0 -> 536 bytes data/graphics/gui/hits_yellow.png | Bin 0 -> 343 bytes src/being.cpp | 25 ++++++++++++++++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 data/graphics/gui/hits_blue.png create mode 100644 data/graphics/gui/hits_red.png create mode 100644 data/graphics/gui/hits_yellow.png diff --git a/data/graphics/gui/hits_blue.png b/data/graphics/gui/hits_blue.png new file mode 100644 index 00000000..3d1491c7 Binary files /dev/null and b/data/graphics/gui/hits_blue.png differ diff --git a/data/graphics/gui/hits_red.png b/data/graphics/gui/hits_red.png new file mode 100644 index 00000000..59a55e52 Binary files /dev/null and b/data/graphics/gui/hits_red.png differ diff --git a/data/graphics/gui/hits_yellow.png b/data/graphics/gui/hits_yellow.png new file mode 100644 index 00000000..b627d58e Binary files /dev/null and b/data/graphics/gui/hits_yellow.png differ diff --git a/src/being.cpp b/src/being.cpp index 88b2b9a0..ec12976d 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -27,6 +27,7 @@ #include "net/protocol.h" #include "net/network.h" #include "resources/resourcemanager.h" +#include "gui/gui.h" Being *player_node = NULL; @@ -71,9 +72,14 @@ void remove_node(unsigned int id) { if ((*i)->id == id) { - if (autoTarget == (*i)) { + if (autoTarget == (*i)) + { autoTarget = NULL; } + if (followBeing == (*i)) + { + followBeing = NULL; + } delete (*i); beings.erase(i); return; @@ -344,10 +350,27 @@ void Being::drawSpeech(Graphics *graphics) gcn::Graphics::CENTER); } if (showDamage) { + // Selecting the right color + if (damage == "miss") + { + graphics->setFont(hitYellowFont); + } + else if (isMonster()) + { + graphics->setFont(hitBlueFont); + } + else + { + graphics->setFont(hitRedFont); + } + graphics->drawText(damage, text_x + 60, text_y - 60 - get_elapsed_time(damage_time) / 100, gcn::Graphics::CENTER); + + // Backing to default font + graphics->setFont(gui->getFont()); } if (this == autoTarget) { graphics->drawText("[TARGET]", -- cgit v1.2.3-70-g09d2