diff options
-rw-r--r-- | data/graphics/gui/CMakeLists.txt | 3 | ||||
-rw-r--r-- | data/graphics/gui/Makefile.am | 3 | ||||
-rw-r--r-- | data/graphics/gui/hits_blue.png | bin | 884 -> 0 bytes | |||
-rw-r--r-- | data/graphics/gui/hits_red.png | bin | 813 -> 0 bytes | |||
-rw-r--r-- | data/graphics/gui/hits_yellow.png | bin | 907 -> 0 bytes | |||
-rw-r--r-- | src/being.cpp | 46 | ||||
-rw-r--r-- | src/gui/gui.cpp | 24 | ||||
-rw-r--r-- | src/gui/gui.h | 11 | ||||
-rw-r--r-- | src/localplayer.cpp | 6 |
9 files changed, 45 insertions, 48 deletions
diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index c5961f7a..a562b8f1 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -9,9 +9,6 @@ SET (FILES deepbox.png default.png gui.xml - hits_blue.png - hits_red.png - hits_yellow.png hscroll_left_default.png hscroll_left_highlight.png hscroll_left_pressed.png diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 921469a1..f2b62698 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -12,9 +12,6 @@ gui_DATA = \ deepbox.png \ default.png \ gui.xml \ - hits_blue.png \ - hits_red.png \ - hits_yellow.png \ hscroll_left_default.png \ hscroll_left_highlight.png \ hscroll_left_pressed.png \ diff --git a/data/graphics/gui/hits_blue.png b/data/graphics/gui/hits_blue.png Binary files differdeleted file mode 100644 index cfb04ab8..00000000 --- a/data/graphics/gui/hits_blue.png +++ /dev/null diff --git a/data/graphics/gui/hits_red.png b/data/graphics/gui/hits_red.png Binary files differdeleted file mode 100644 index 150f1c1e..00000000 --- a/data/graphics/gui/hits_red.png +++ /dev/null diff --git a/data/graphics/gui/hits_yellow.png b/data/graphics/gui/hits_yellow.png Binary files differdeleted file mode 100644 index 6975dfd5..00000000 --- a/data/graphics/gui/hits_yellow.png +++ /dev/null diff --git a/src/being.cpp b/src/being.cpp index 3f34948e..cebf6d1c 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -226,20 +226,36 @@ void Being::takeDamage(int amount) gcn::Font *font; std::string damage = amount ? toString(amount) : "miss"; + int red, green, blue; + + font = gui->getInfoParticleFont(); + // Selecting the right color if (damage == "miss") - font = hitYellowFont; + { + red = 255; + green = 255; + blue = 0; + } else { if (getType() == MONSTER) - font = hitBlueFont; + { + red = 0; + green = 100; + blue = 255; + } else - font = hitRedFont; + { + red = 255; + green = 50; + blue = 50; + } } // Show damage number - particleEngine->addTextSplashEffect(damage, 255, 255, 255, font, - mPx + 16, mPy + 16); + particleEngine->addTextSplashEffect(damage, red, green, blue, font, + mPx + 16, mPy + 16, true); } void Being::showCrit() @@ -247,15 +263,27 @@ void Being::showCrit() gcn::Font *font; std::string text = "crit!"; + int red, green, blue; + + font = gui->getInfoParticleFont(); + // Selecting the right color if (getType() == MONSTER) - font = hitBlueFont; + { + red = 0; + green = 100; + blue = 255; + } else - font = hitRedFont; + { + red = 255; + green = 50; + blue = 50; + } // Show crit notice - particleEngine->addTextSplashEffect(text, 255, 255, 255, font, - mPx + 16, mPy + 16); + particleEngine->addTextSplashEffect(text, red, green, blue, font, + mPx + 16, mPy + 16, true); } void Being::handleAttack(Being *victim, int damage) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ed85fa8f..85a33218 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -113,7 +113,7 @@ Gui::Gui(Graphics *graphics): { const int fontSize = (int)config.getValue("fontSize", 11); mGuiFont = new TrueTypeFont(path, fontSize); - mInfoParicleFont = new TrueTypeFont(path, fontSize, 1); + mInfoParticleFont = new TrueTypeFont(path, fontSize, 1); } catch (gcn::Exception e) { @@ -136,22 +136,6 @@ Gui::Gui(Graphics *graphics): gcn::Widget::setGlobalFont(mGuiFont); - // Load hits' colorful fonts - try - { - hitRedFont = new gcn::ImageFont("graphics/gui/hits_red.png", - "0123456789crit! "); - hitBlueFont = new gcn::ImageFont("graphics/gui/hits_blue.png", - "0123456789crit! "); - hitYellowFont = new gcn::ImageFont("graphics/gui/hits_yellow.png", - "0123456789misxp "); - } - catch (gcn::Exception e) - { - logger->error(std::string("Unable to load colored hits' fonts: ") - + e.getMessage()); - } - // Initialize mouse cursor and listen for changes to the option setUseCustomCursor(config.getValue("customcursor", 1) == 1); mConfigListener = new GuiConfigListener(this); @@ -169,16 +153,12 @@ Gui::~Gui() config.removeListener("customcursor", mConfigListener); delete mConfigListener; - // Fonts used in showing hits - delete hitRedFont; - delete hitBlueFont; - delete hitYellowFont; - if (mMouseCursors) mMouseCursors->decRef(); delete mGuiFont; delete boldFont; + delete mInfoParticleFont; delete viewport; delete getTop(); diff --git a/src/gui/gui.h b/src/gui/gui.h index e19a0a87..295bc595 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -82,7 +82,7 @@ class Gui : public gcn::Gui * you picked up, etc. */ gcn::Font* getInfoParticleFont() const - { return mInfoParicleFont; } + { return mInfoParticleFont; } /** * Sets whether a custom cursor should be rendered. @@ -115,7 +115,7 @@ class Gui : public gcn::Gui private: GuiConfigListener *mConfigListener; gcn::Font *mGuiFont; /**< The global GUI font */ - gcn::Font *mInfoParicleFont; /**< Font for Info Paricles*/ + gcn::Font *mInfoParticleFont; /**< Font for Info Paricles*/ bool mCustomCursor; /**< Show custom cursor */ ImageSet *mMouseCursors; /**< Mouse cursor images */ float mMouseCursorAlpha; @@ -127,13 +127,6 @@ extern Gui *gui; /**< The GUI system */ extern SDLInput *guiInput; /**< GUI input */ /** - * Fonts used in showing hits - */ -extern gcn::Font *hitRedFont; -extern gcn::Font *hitBlueFont; -extern gcn::Font *hitYellowFont; - -/** * Bolded text font */ extern gcn::Font *boldFont; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index cbc2ec7a..9bf5d990 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -583,8 +583,10 @@ void LocalPlayer::setXp(int xp) const std::string text = toString(xp - mXp) + " xp"; // Show XP number - particleEngine->addTextRiseFadeOutEffect(text, hitYellowFont, - mPx + 16, mPy - 16); + particleEngine->addTextRiseFadeOutEffect(text, + gui->getInfoParticleFont(), + mPx + 16, mPy - 16, + 255, 255, 0, true); } mXp = xp; } |