summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-03-12 22:42:42 +0100
committerIra Rice <irarice@gmail.com>2009-03-12 21:53:00 -0600
commitf0d5e3da15a308fcc962590330e7d8e39e8874b9 (patch)
treea0e7f61b1f6a2f2aee20549c9ac55a123ba3ccba /src/being.cpp
parent5207b4cbb462cfa962a6f566897a6affd92eef94 (diff)
downloadmana-f0d5e3da15a308fcc962590330e7d8e39e8874b9.tar.gz
mana-f0d5e3da15a308fcc962590330e7d8e39e8874b9.tar.bz2
mana-f0d5e3da15a308fcc962590330e7d8e39e8874b9.tar.xz
mana-f0d5e3da15a308fcc962590330e7d8e39e8874b9.zip
Make use of the new available colors
This patch lets all being derivatives use the palette to set their name's colors. Text Particle Effects all respect the new settings. Some widgets were updated to use the colors.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 64972912..3a772fbd 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -47,6 +47,7 @@
#include "resources/resourcemanager.h"
#include "gui/gui.h"
+#include "gui/palette.h"
#include "gui/speechbubble.h"
#include "utils/dtor.h"
@@ -91,7 +92,7 @@ Being::Being(int id, int job, Map *map):
mSpeechBubble = new SpeechBubble();
mSpeech = "";
- mNameColor = 0x202020;
+ mNameColor = &guiPalette->getColor(Palette::CHAT);
mText = 0;
}
@@ -192,17 +193,14 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
gcn::Font *font;
std::string damage = amount ? toString(amount) : type == FLEE ?
"dodge" : "miss";
-
- int red, green, blue;
+ const gcn::Color* color;
font = gui->getInfoParticleFont();
// Selecting the right color
if (type == CRITICAL || type == FLEE)
{
- red = 255;
- green = 128;
- blue = 0;
+ color = &guiPalette->getColor(Palette::HIT_CRITICAL);
}
else if (!amount)
{
@@ -210,39 +208,31 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
{
// This is intended to be the wrong direction to visually
// differentiate between hits and misses
- red = 0;
- green = 100;
- blue = 255;
+ color = &guiPalette->getColor(Palette::HIT_MONSTER_PLAYER);
}
else
{
- red = 255;
- green = 255;
- blue = 0;
- }
- }
+ color = &guiPalette->getColor(Palette::MISS);
+ }
+ }
else if (getType() == MONSTER)
{
- red = 0;
- green = 100;
- blue = 255;
+ color = &guiPalette->getColor(Palette::HIT_PLAYER_MONSTER);
}
else
{
- red = 255;
- green = 50;
- blue = 50;
+ color = &guiPalette->getColor(Palette::HIT_MONSTER_PLAYER);
}
if (amount > 0 && type == CRITICAL)
{
- particleEngine->addTextSplashEffect("crit!", red, green, blue, font,
- mPx + 16, mPy + 16, true);
+ particleEngine->addTextSplashEffect("crit!", mPx + 16, mPy + 16,
+ color, font, true);
}
// Show damage number
- particleEngine->addTextSplashEffect(damage, red, green, blue, font,
- mPx + 16, mPy + 16, true);
+ particleEngine->addTextSplashEffect(damage, mPx + 16, mPy + 16,
+ color, font, true);
}
void Being::handleAttack(Being *victim, int damage, AttackType type)
@@ -503,7 +493,8 @@ void Being::drawSpeech(int offsetX, int offsetY)
delete mText;
mText = new Text(mSpeech, mPx + X_SPEECH_OFFSET, mPy - Y_SPEECH_OFFSET,
- gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
+ gcn::Graphics::CENTER,
+ &guiPalette->getColor(Palette::PARTICLE));
}
else if (speech == NO_SPEECH)
{