From 1d7b4c4640635c809feca83e76b1aa62109c0707 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Mon, 2 Mar 2009 19:10:40 -0700 Subject: Added particle attacks back on to the players. However, instead of being constant, particle attacks are now weapon specific, so that different weapons can have different attacks. Signed-off-by: Ira Rice --- src/player.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/player.cpp') diff --git a/src/player.cpp b/src/player.cpp index 4d5ef171..16f810ad 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -22,6 +22,7 @@ #include "animatedsprite.h" #include "game.h" +#include "particle.h" #include "player.h" #include "text.h" @@ -91,7 +92,10 @@ void Player::logic() break; case ATTACK: + int rotation = 0; + std::string particleEffect = ""; int frames = 4; + if (mEquippedWeapon && mEquippedWeapon->getAttackType() == ACTION_ATTACK_BOW) { @@ -100,6 +104,26 @@ void Player::logic() mFrame = (get_elapsed_time(mWalkTime) * frames) / mAttackSpeed; + //attack particle effect + if (mEquippedWeapon) + particleEffect = mEquippedWeapon->getParticleEffect(); + + if (!particleEffect.empty() && mParticleEffects) + { + switch (mDirection) + { + case DOWN: rotation = 0; break; + case LEFT: rotation = 90; break; + case UP: rotation = 180; break; + case RIGHT: rotation = 270; break; + default: break; + } + Particle *p; + p = particleEngine->addEffect("graphics/particles/" + + particleEffect, 0, 0, rotation); + controlParticle(p); + } + if (mFrame >= frames) nextStep(); -- cgit v1.2.3-60-g2f50 From a79d05b01d4a2dc639e6d3a5b7ddd508e64d3511 Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Mon, 2 Mar 2009 19:16:27 -0700 Subject: Cut down on constant streaming of attacks. Attacks from players now only occur on each swing action. Signed-off-by: Ira Rice --- src/localplayer.cpp | 2 +- src/player.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/player.cpp') diff --git a/src/localplayer.cpp b/src/localplayer.cpp index bcf3fb15..2607b460 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -138,7 +138,7 @@ void LocalPlayer::logic() if (mEquippedWeapon) particleEffect = mEquippedWeapon->getParticleEffect(); - if (!particleEffect.empty() && mParticleEffects) + if (!particleEffect.empty() && mParticleEffects && mFrame == 1) { switch (mDirection) { diff --git a/src/player.cpp b/src/player.cpp index 16f810ad..61e91613 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -108,7 +108,7 @@ void Player::logic() if (mEquippedWeapon) particleEffect = mEquippedWeapon->getParticleEffect(); - if (!particleEffect.empty() && mParticleEffects) + if (!particleEffect.empty() && mParticleEffects && mFrame == 1) { switch (mDirection) { -- cgit v1.2.3-60-g2f50 From 3b1fbbe072e4da86be4c8f8f22655d04565379d2 Mon Sep 17 00:00:00 2001 From: Majin Sniper Date: Thu, 12 Mar 2009 22:42:42 +0100 Subject: 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. --- src/being.cpp | 37 ++++++++++++++----------------------- src/being.h | 2 +- src/gui/gui.cpp | 5 ----- src/gui/listbox.cpp | 2 +- src/gui/shoplistbox.cpp | 2 +- src/gui/speechbubble.cpp | 5 +++-- src/gui/speechbubble.h | 4 +++- src/gui/table.cpp | 2 ++ src/gui/textbox.cpp | 5 +++-- src/gui/textbox.h | 15 +++++++++++++++ src/gui/widgets/dropdown.cpp | 16 ++++++---------- src/gui/widgets/textpreview.cpp | 2 ++ src/localplayer.cpp | 19 ++++++++++--------- src/monster.cpp | 7 +++++-- src/npc.cpp | 6 ++++-- src/particle.cpp | 17 +++++------------ src/particle.h | 14 ++++++-------- src/player.cpp | 13 +++++++++---- src/text.cpp | 6 +++--- src/text.h | 6 +++--- src/textparticle.cpp | 11 +++-------- src/textparticle.h | 7 +++---- 22 files changed, 102 insertions(+), 101 deletions(-) (limited to 'src/player.cpp') diff --git a/src/being.cpp b/src/being.cpp index 60fb8d13..66273710 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -45,6 +45,7 @@ #include "resources/resourcemanager.h" #include "gui/gui.h" +#include "gui/palette.h" #include "gui/speechbubble.h" #include "utils/dtor.h" @@ -101,7 +102,7 @@ Being::Being(int id, int job, Map *map): mSpeechBubble = new SpeechBubble; mSpeech = ""; - mNameColor = 0x202020; + mNameColor = &guiPalette->getColor(Palette::CHAT); mText = 0; } @@ -202,17 +203,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) { @@ -220,33 +218,25 @@ 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); } // 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); if (amount > 0) { @@ -531,7 +521,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) { diff --git a/src/being.h b/src/being.h index b9b57a0d..ec6f1c44 100644 --- a/src/being.h +++ b/src/being.h @@ -510,7 +510,7 @@ class Being : public Sprite Uint16 mStunMode; /**< Stun mode; zero if not stunned */ std::set mStatusEffects; /**< set of active status effects */ - gcn::Color mNameColor; + const gcn::Color* mNameColor; std::vector mSprites; std::vector mSpriteIDs; diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e14642dd..4081eeac 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -46,11 +46,6 @@ Gui *gui = 0; Viewport *viewport = 0; /**< Viewport on the map. */ SDLInput *guiInput = 0; -/* -// Fonts used in showing hits -gcn::Font *hitRedFont = 0; -gcn::Font *hitBlueFont = 0; -gcn::Font *hitYellowFont = 0;*/ // Bolded font gcn::Font *boldFont = 0; diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 23d43066..7ba84ee7 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -56,7 +56,7 @@ void ListBox::draw(gcn::Graphics *graphics) getWidth(), fontHeight)); // Draw the list elements - graphics->setColor(gcn::Color(0, 0, 0, 255)); + graphics->setColor(guiPalette->getColor(Palette::TEXT)); for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += fontHeight) { diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 19c8a7b4..aa42c294 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -78,7 +78,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) { gcn::Color temp; const gcn::Color* backgroundColor = - &guiPalette->getColor(Palette::BACKGROUND, alpha); + &guiPalette->getColor(Palette::BACKGROUND, alpha); if (mShopItems && mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck) diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index 9ee91166..5f05971d 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -45,6 +45,7 @@ SpeechBubble::SpeechBubble(): mSpeechBox = new TextBox; mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); + mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT)); mSpeechArea = new ScrollArea(mSpeechBox); @@ -60,11 +61,11 @@ SpeechBubble::SpeechBubble(): setLocationRelativeTo(getParent()); } -void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color) +void SpeechBubble::setCaption(const std::string &name, const gcn::Color *color) { mCaption->setCaption(name); mCaption->adjustSize(); - mCaption->setForegroundColor(color); + mCaption->setForegroundColor(*color); } void SpeechBubble::setText(std::string text, bool showName) diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h index 573e61f0..34e00722 100644 --- a/src/gui/speechbubble.h +++ b/src/gui/speechbubble.h @@ -22,6 +22,7 @@ #ifndef SPEECHBUBBLE_H #define SPEECHBUBBLE_H +#include "palette.h" #include "window.h" class ScrollArea; @@ -33,7 +34,8 @@ class SpeechBubble : public Window SpeechBubble(); void setCaption(const std::string &name, - const gcn::Color &color = 0x000000); + const gcn::Color *color = + &guiPalette->getColor(Palette::TEXT)); void setText(std::string text, bool showName = true); void setLocation(int x, int y); unsigned int getNumRows(); diff --git a/src/gui/table.cpp b/src/gui/table.cpp index ece470b1..5fc96dbd 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -338,6 +338,8 @@ void GuiTable::draw(gcn::Graphics* graphics) { graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT, (int)(mAlpha * 127.0f))); + graphics->fillRectangle(gcn::Rectangle(0, y_offset, + x_offset, height)); } y_offset += height; diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index a4024de3..10f727e3 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -23,10 +23,11 @@ #include +#include "palette.h" #include "textbox.h" -TextBox::TextBox(): - gcn::TextBox() +TextBox::TextBox() : + gcn::TextBox(), mTextColor(&guiPalette->getColor(Palette::TEXT)) { setOpaque(false); setFrameSize(0); diff --git a/src/gui/textbox.h b/src/gui/textbox.h index 10a81fc0..5884e11c 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.h @@ -39,6 +39,11 @@ class TextBox : public gcn::TextBox */ TextBox(); + inline void setTextColor(const gcn::Color* color) + { + mTextColor = color; + } + /** * Sets the text after wrapping it to the current width of the widget. */ @@ -49,8 +54,18 @@ class TextBox : public gcn::TextBox */ int getMinWidth() { return mMinWidth; } + /** + * Draws the text. + */ + inline void draw(gcn::Graphics *graphics) + { + setForegroundColor(*mTextColor); + gcn::TextBox::draw(graphics); + } + private: int mMinWidth; + const gcn::Color* mTextColor; }; #endif diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 022da0f0..b736591c 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -139,24 +139,20 @@ void DropDown::draw(gcn::Graphics* graphics) } } -// bool valid; const int alpha = (int)(mAlpha * 255.0f); gcn::Color faceColor = getBaseColor(); faceColor.a = alpha; - gcn::Color highlightColor = guiPalette->getColor(Palette::HIGHLIGHT, alpha); + const gcn::Color* highlightColor = &guiPalette->getColor(Palette::HIGHLIGHT, + alpha); gcn::Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; if (mOpaque) { - gcn::Color col = getBackgroundColor(); - col.a = alpha; - graphics->setColor(col); + graphics->setColor(guiPalette->getColor(Palette::BACKGROUND, alpha)); graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), h)); - col = getForegroundColor(); - col.a = alpha; - graphics->setColor(col); + graphics->setColor(guiPalette->getColor(Palette::TEXT, alpha)); } graphics->setFont(getFont()); @@ -168,7 +164,7 @@ void DropDown::draw(gcn::Graphics* graphics) if (isFocused()) { - graphics->setColor(highlightColor); + graphics->setColor(*highlightColor); graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h)); } @@ -180,7 +176,7 @@ void DropDown::draw(gcn::Graphics* graphics) // Draw two lines separating the ListBox with selected // element view. - graphics->setColor(highlightColor); + graphics->setColor(*highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); graphics->drawLine(0, h + 1, getWidth(), h + 1); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 28d7fd35..4fcaa4a7 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include + #include "textpreview.h" #include "../gui.h" diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 296bc28c..30ff9c35 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -38,6 +38,7 @@ #include "gui/gui.h" #include "gui/ministatus.h" +#include "gui/palette.h" #include "gui/storagewindow.h" #include "net/messageout.h" @@ -212,7 +213,9 @@ void LocalPlayer::logic() void LocalPlayer::setGM() { mIsGM = !mIsGM; - mNameColor = mIsGM ? 0x009000: 0x202020; + mNameColor = mIsGM ? + &guiPalette->getColor(Palette::GM) : + &guiPalette->getColor(Palette::PLAYER); setName(getName()); config.setValue(getName() + "GMassert", mIsGM); } @@ -614,10 +617,9 @@ void LocalPlayer::setXp(int xp) const std::string text = toString(xp - mXp) + " xp"; // Show XP number - particleEngine->addTextRiseFadeOutEffect(text, - gui->getInfoParticleFont(), - mPx + 16, mPy - 16, - 255, 255, 0, true); + particleEngine->addTextRiseFadeOutEffect(text, mPx + 16, mPy - 16, + &guiPalette->getColor(Palette::EXP_INFO), + gui->getInfoParticleFont(), true); } mXp = xp; } @@ -627,10 +629,9 @@ void LocalPlayer::pickedUp(std::string item) if (mMap) { // Show pickup notification - particleEngine->addTextRiseFadeOutEffect(item, - gui->getInfoParticleFont (), - mPx + 16, mPy - 16, - 40, 220, 40, true); + particleEngine->addTextRiseFadeOutEffect(item, mPx + 16, mPy - 16, + &guiPalette->getColor(Palette::PICKUP_INFO), + gui->getInfoParticleFont (), true); } } diff --git a/src/monster.cpp b/src/monster.cpp index 89d0953d..7dc08238 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -27,6 +27,8 @@ #include "sound.h" #include "text.h" +#include "gui/palette.h" + #include "resources/monsterdb.h" #include "resources/monsterinfo.h" @@ -71,7 +73,7 @@ Monster::Monster(int id, Uint16 job, Map *map): } } - mNameColor = 0xff2020; + mNameColor = &guiPalette->getColor(Palette::MONSTER); } Monster::~Monster() @@ -195,7 +197,8 @@ void Monster::showName(bool show) { mText = new Text(getInfo().getName(), mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET - getHeight(), - gcn::Graphics::CENTER, gcn::Color(255, 64, 64)); + gcn::Graphics::CENTER, + &guiPalette->getColor(Palette::MONSTER)); } else { diff --git a/src/npc.cpp b/src/npc.cpp index 5a4f9507..630316e0 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -26,6 +26,7 @@ #include "text.h" #include "gui/npc_text.h" +#include "gui/palette.h" #include "net/messageout.h" #include "net/protocol.h" @@ -71,7 +72,7 @@ NPC::NPC(int id, Uint16 job, Map *map, Network *network): } mName = 0; - mNameColor = 0x21bbbb; + mNameColor = &guiPalette->getColor(Palette::NPC); } NPC::~NPC() @@ -85,7 +86,8 @@ void NPC::setName(const std::string &name) delete mName; mName = new Text(displayName, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, - gcn::Graphics::CENTER, gcn::Color(200, 200, 255)); + gcn::Graphics::CENTER, + &guiPalette->getColor(Palette::NPC)); Being::setName(displayName + " (NPC)"); } diff --git a/src/particle.cpp b/src/particle.cpp index 6dc45a08..82c163c6 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -324,12 +324,10 @@ Particle *Particle::addEffect(const std::string &particleEffectFile, return newParticle; } -Particle *Particle::addTextSplashEffect(const std::string &text, - int colorR, int colorG, int colorB, - gcn::Font *font, int x, int y, bool outline) +Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y, + const gcn::Color *color, gcn::Font *font, bool outline) { - Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, - font, outline); + Particle *newParticle = new TextParticle(mMap, text, color, font, outline); newParticle->moveTo(x, y); newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X ((rand() % 100) - 50) / 200.0f, // Y @@ -345,13 +343,8 @@ Particle *Particle::addTextSplashEffect(const std::string &text, } Particle *Particle::addTextRiseFadeOutEffect(const std::string &text, - gcn::Font *font, - int x, int y, - int colorR, int colorG, - int colorB, bool outline) -{ - Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, - font, outline); + int x, int y, const gcn::Color *color, gcn::Font *font, bool outline){ + Particle *newParticle = new TextParticle(mMap, text, color, font, outline); newParticle->moveTo(x, y); newParticle->setVelocity(0.0f, 0.0f, 0.5f); newParticle->setGravity(0.0015f); diff --git a/src/particle.h b/src/particle.h index b4c80194..3584c4fc 100644 --- a/src/particle.h +++ b/src/particle.h @@ -105,19 +105,17 @@ class Particle : public Sprite /** * Creates a standalone text particle. */ - Particle *addTextSplashEffect(const std::string &text, - int colorR, int colorG, int colorB, - gcn::Font *font, int x, int y, - bool outline = false); + Particle *addTextSplashEffect(const std::string &text, int x, int y, + const gcn::Color *color, gcn::Font *font, + bool outline = false); /** * Creates a standalone text particle. */ Particle *addTextRiseFadeOutEffect(const std::string &text, - gcn::Font *font, - int x, int y, int colorR = 255, - int colorG = 255, int colorB = 255, - bool outline = false); + int x, int y, const gcn::Color *color, gcn::Font *font, + bool outline = false); + /** * Adds an emitter to the particle. */ diff --git a/src/player.cpp b/src/player.cpp index e1928280..8668ac58 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -21,10 +21,13 @@ #include "animatedsprite.h" #include "game.h" +#include "localplayer.h" #include "particle.h" #include "player.h" #include "text.h" +#include "gui/palette.h" + #include "resources/colordb.h" #include "resources/itemdb.h" @@ -50,17 +53,19 @@ void Player::setName(const std::string &name) { if (mIsGM) { - mNameColor = 0x009000; + mNameColor = &guiPalette->getColor(Palette::GM); mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, gcn::Graphics::CENTER, - gcn::Color(0, 255, 0)); + &guiPalette->getColor(Palette::GM)); } else { - mNameColor = 0x202020; + mNameColor = &guiPalette->getColor(Palette::PLAYER); mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, gcn::Graphics::CENTER, - gcn::Color(255, 255, 255)); + (this == player_node) ? + &guiPalette->getColor(Palette::SELF) : + &guiPalette->getColor(Palette::PC)); } Being::setName(name); } diff --git a/src/text.cpp b/src/text.cpp index 5a912d17..b0be25bf 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -39,7 +39,7 @@ Image *Text::mBubbleArrow; Text::Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - gcn::Color color, bool isSpeech) : + const gcn::Color* color, bool isSpeech) : mText(text), mColor(color), mIsSpeech(isSpeech) @@ -133,12 +133,12 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) TextRenderer::renderText(graphics, mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT, - &mColor, boldFont, !mIsSpeech, true); + mColor, boldFont, !mIsSpeech, true); } FlashText::FlashText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - gcn::Color color) : + const gcn::Color *color) : Text(text, x, y, alignment, color), mTime(0) { diff --git a/src/text.h b/src/text.h index 6e121da7..a96096cc 100644 --- a/src/text.h +++ b/src/text.h @@ -40,7 +40,7 @@ class Text */ Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - gcn::Color color, bool isSpeech = false); + const gcn::Color *color, bool isSpeech = false); /** * Destructor. The text is removed from the screen. @@ -65,7 +65,7 @@ class Text int mXOffset; /**< The offset of mX from the desired x. */ static int mInstances; /**< Instances of text. */ std::string mText; /**< The text to display. */ - gcn::Color mColor; /**< The color of the text. */ + const gcn::Color *mColor; /**< The color of the text. */ bool mIsSpeech; /**< Is this text a speech bubble? */ protected: @@ -78,7 +78,7 @@ class FlashText : public Text public: FlashText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - gcn::Color color); + const gcn::Color* color); /** * Remove the text from the screen diff --git a/src/textparticle.cpp b/src/textparticle.cpp index ed8609e9..792b6bea 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -21,21 +21,17 @@ #include -#include - #include "textparticle.h" #include "gui/textrenderer.h" TextParticle::TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, + const gcn::Color* color, gcn::Font *font, bool outline): Particle(map), mText(text), mTextFont(font), - mColorR(colorR), - mColorG(colorG), - mColorB(colorB), + mColor(color), mOutline(outline) { } @@ -64,6 +60,5 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const TextRenderer::renderText(graphics, mText, screenX, screenY, gcn::Graphics::CENTER, - &gcn::Color(mColorR, mColorG, mColorB), mTextFont, mOutline, false, - (int)alpha); + mColor, mTextFont, mOutline, false, (int)alpha); } diff --git a/src/textparticle.h b/src/textparticle.h index d72df138..8b7d3e01 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -32,7 +32,7 @@ class TextParticle : public Particle * Constructor. */ TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, + const gcn::Color* color, gcn::Font *font, bool outline = false); /** @@ -47,9 +47,8 @@ class TextParticle : public Particle private: std::string mText; /**< Text of the particle. */ gcn::Font *mTextFont; /**< Font used for drawing the text. */ - int mColorR, mColorG, mColorB; /**< Color used for drawing the text. */ - bool mOutline; /**< Make the text readable - draw it the way - a Text is usually drawn: with outline */ + const gcn::Color* mColor; /**< Color used for drawing the text. */ + bool mOutline; /**< Make the text better readable */ }; #endif -- cgit v1.2.3-60-g2f50 From f0d5e3da15a308fcc962590330e7d8e39e8874b9 Mon Sep 17 00:00:00 2001 From: Majin Sniper Date: Thu, 12 Mar 2009 22:42:42 +0100 Subject: 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. --- src/being.cpp | 41 ++++++++++++++++------------------------- src/being.h | 2 +- src/gui/listbox.cpp | 2 +- src/gui/shoplistbox.cpp | 2 +- src/gui/speechbubble.cpp | 5 +++-- src/gui/speechbubble.h | 4 +++- src/gui/textbox.cpp | 5 +++-- src/gui/textbox.h | 15 +++++++++++++++ src/gui/widgets/dropdown.cpp | 16 ++++++---------- src/localplayer.cpp | 19 ++++++++++--------- src/monster.cpp | 7 +++++-- src/npc.cpp | 6 ++++-- src/particle.cpp | 17 +++++------------ src/particle.h | 14 ++++++-------- src/player.cpp | 13 +++++++++---- src/text.cpp | 10 ++++++---- src/text.h | 8 +++++--- src/textparticle.cpp | 11 +++-------- src/textparticle.h | 7 +++---- 19 files changed, 105 insertions(+), 99 deletions(-) (limited to 'src/player.cpp') 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) { diff --git a/src/being.h b/src/being.h index 4b30b6c5..689eda02 100644 --- a/src/being.h +++ b/src/being.h @@ -428,7 +428,7 @@ class Being : public Sprite Gender mGender; int mPx, mPy; /**< Pixel coordinates */ - gcn::Color mNameColor; + const gcn::Color* mNameColor; std::vector mSprites; std::vector mSpriteIDs; diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index e53a1652..71e92eaf 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -57,7 +57,7 @@ void ListBox::draw(gcn::Graphics *graphics) getWidth(), fontHeight)); // Draw the list elements - graphics->setColor(gcn::Color(0, 0, 0, 255)); + graphics->setColor(guiPalette->getColor(Palette::TEXT)); for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += fontHeight) { diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 74209122..5c55069f 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -79,7 +79,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) { gcn::Color temp; const gcn::Color* backgroundColor = - &guiPalette->getColor(Palette::BACKGROUND, alpha); + &guiPalette->getColor(Palette::BACKGROUND, alpha); if (mShopItems && mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck) diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index d342328e..cb1724c8 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -46,6 +46,7 @@ SpeechBubble::SpeechBubble(): mSpeechBox = new TextBox(); mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); + mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT)); mSpeechArea = new ScrollArea(mSpeechBox); @@ -61,11 +62,11 @@ SpeechBubble::SpeechBubble(): setLocationRelativeTo(getParent()); } -void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color) +void SpeechBubble::setCaption(const std::string &name, const gcn::Color *color) { mCaption->setCaption(name); mCaption->adjustSize(); - mCaption->setForegroundColor(color); + mCaption->setForegroundColor(*color); } void SpeechBubble::setText(std::string text, bool showName) diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h index a1a597c1..d356dac1 100644 --- a/src/gui/speechbubble.h +++ b/src/gui/speechbubble.h @@ -23,6 +23,7 @@ #ifndef SPEECHBUBBLE_H #define SPEECHBUBBLE_H +#include "palette.h" #include "popup.h" class ScrollArea; @@ -34,7 +35,8 @@ class SpeechBubble : public Popup SpeechBubble(); void setCaption(const std::string &name, - const gcn::Color &color = 0x000000); + const gcn::Color *color = + &guiPalette->getColor(Palette::TEXT)); void setText(std::string text, bool showName = true); void setLocation(int x, int y); unsigned int getNumRows(); diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 589986cd..51a8efc6 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -24,10 +24,11 @@ #include +#include "palette.h" #include "textbox.h" -TextBox::TextBox(): - gcn::TextBox() +TextBox::TextBox() : + gcn::TextBox(), mTextColor(&guiPalette->getColor(Palette::TEXT)) { setOpaque(false); setFrameSize(0); diff --git a/src/gui/textbox.h b/src/gui/textbox.h index 33ea42f9..20f4ebe2 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.h @@ -40,6 +40,11 @@ class TextBox : public gcn::TextBox */ TextBox(); + inline void setTextColor(const gcn::Color* color) + { + mTextColor = color; + } + /** * Sets the text after wrapping it to the current width of the widget. */ @@ -50,8 +55,18 @@ class TextBox : public gcn::TextBox */ int getMinWidth() { return mMinWidth; } + /** + * Draws the text. + */ + inline void draw(gcn::Graphics *graphics) + { + setForegroundColor(*mTextColor); + gcn::TextBox::draw(graphics); + } + private: int mMinWidth; + const gcn::Color* mTextColor; }; #endif diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 076a167f..0015beed 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -140,24 +140,20 @@ void DropDown::draw(gcn::Graphics* graphics) } } -// bool valid; const int alpha = (int)(mAlpha * 255.0f); gcn::Color faceColor = getBaseColor(); faceColor.a = alpha; - gcn::Color highlightColor = guiPalette->getColor(Palette::HIGHLIGHT, alpha); + const gcn::Color* highlightColor = &guiPalette->getColor(Palette::HIGHLIGHT, + alpha); gcn::Color shadowColor = faceColor - 0x303030; shadowColor.a = alpha; if (mOpaque) { - gcn::Color col = getBackgroundColor(); - col.a = alpha; - graphics->setColor(col); + graphics->setColor(guiPalette->getColor(Palette::BACKGROUND, alpha)); graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), h)); - col = getForegroundColor(); - col.a = alpha; - graphics->setColor(col); + graphics->setColor(guiPalette->getColor(Palette::TEXT, alpha)); } graphics->setFont(getFont()); @@ -169,7 +165,7 @@ void DropDown::draw(gcn::Graphics* graphics) if (isFocused()) { - graphics->setColor(highlightColor); + graphics->setColor(*highlightColor); graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h)); } @@ -181,7 +177,7 @@ void DropDown::draw(gcn::Graphics* graphics) // Draw two lines separating the ListBox with selected // element view. - graphics->setColor(highlightColor); + graphics->setColor(*highlightColor); graphics->drawLine(0, h, getWidth(), h); graphics->setColor(shadowColor); graphics->drawLine(0, h + 1, getWidth(), h + 1); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index d6acc48f..f72aa59a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -37,6 +37,7 @@ #include "text.h" #include "gui/gui.h" +#include "gui/palette.h" #include "gui/storagewindow.h" #include "net/messageout.h" @@ -201,7 +202,9 @@ void LocalPlayer::logic() void LocalPlayer::setGM() { mIsGM = !mIsGM; - mNameColor = mIsGM ? 0x009000: 0x202020; + mNameColor = mIsGM ? + &guiPalette->getColor(Palette::GM) : + &guiPalette->getColor(Palette::PLAYER); setName(getName()); config.setValue(getName() + "GMassert", mIsGM); } @@ -608,10 +611,9 @@ void LocalPlayer::setXp(int xp) const std::string text = toString(xp - mXp) + " xp"; // Show XP number - particleEngine->addTextRiseFadeOutEffect(text, - gui->getInfoParticleFont(), - mPx + 16, mPy - 16, - 255, 255, 0, true); + particleEngine->addTextRiseFadeOutEffect(text, mPx + 16, mPy - 16, + &guiPalette->getColor(Palette::EXP_INFO), + gui->getInfoParticleFont(), true); } mXp = xp; } @@ -621,10 +623,9 @@ void LocalPlayer::pickedUp(std::string item) if (mMap) { // Show pickup notification - particleEngine->addTextRiseFadeOutEffect(item, - gui->getInfoParticleFont (), - mPx + 16, mPy - 16, - 40, 220, 40, true); + particleEngine->addTextRiseFadeOutEffect(item, mPx + 16, mPy - 16, + &guiPalette->getColor(Palette::PICKUP_INFO), + gui->getInfoParticleFont (), true); } } diff --git a/src/monster.cpp b/src/monster.cpp index 45d2fbeb..f71457df 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -28,6 +28,8 @@ #include "sound.h" #include "text.h" +#include "gui/palette.h" + #include "resources/monsterdb.h" #include "resources/monsterinfo.h" @@ -72,7 +74,7 @@ Monster::Monster(int id, Uint16 job, Map *map): } } - mNameColor = 0xff2020; + mNameColor = &guiPalette->getColor(Palette::MONSTER); } Monster::~Monster() @@ -196,7 +198,8 @@ void Monster::showName(bool show) { mText = new Text(getInfo().getName(), mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET - getHeight(), - gcn::Graphics::CENTER, gcn::Color(255, 32, 32)); + gcn::Graphics::CENTER, + &guiPalette->getColor(Palette::MONSTER)); } else { diff --git a/src/npc.cpp b/src/npc.cpp index c9250415..a6d60dbb 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -27,6 +27,7 @@ #include "text.h" #include "gui/npc_text.h" +#include "gui/palette.h" #include "net/messageout.h" #include "net/protocol.h" @@ -72,7 +73,7 @@ NPC::NPC(int id, Uint16 job, Map *map, Network *network): } mName = 0; - mNameColor = 0x21bbbb; + mNameColor = &guiPalette->getColor(Palette::NPC); } NPC::~NPC() @@ -86,7 +87,8 @@ void NPC::setName(const std::string &name) delete mName; mName = new Text(displayName, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, - gcn::Graphics::CENTER, gcn::Color(200, 200, 255)); + gcn::Graphics::CENTER, + &guiPalette->getColor(Palette::NPC)); Being::setName(displayName + " (NPC)"); } diff --git a/src/particle.cpp b/src/particle.cpp index 8bc764ba..e56435ed 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -325,12 +325,10 @@ Particle* Particle::addEffect(const std::string &particleEffectFile, return newParticle; } -Particle *Particle::addTextSplashEffect(const std::string &text, - int colorR, int colorG, int colorB, - gcn::Font *font, int x, int y, bool outline) +Particle *Particle::addTextSplashEffect(const std::string &text, int x, int y, + const gcn::Color *color, gcn::Font *font, bool outline) { - Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, - font, outline); + Particle *newParticle = new TextParticle(mMap, text, color, font, outline); newParticle->moveTo(x, y); newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X ((rand() % 100) - 50) / 200.0f, // Y @@ -346,13 +344,8 @@ Particle *Particle::addTextSplashEffect(const std::string &text, } Particle *Particle::addTextRiseFadeOutEffect(const std::string &text, - gcn::Font *font, - int x, int y, - int colorR, int colorG, - int colorB, bool outline) -{ - Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, - font, outline); + int x, int y, const gcn::Color *color, gcn::Font *font, bool outline){ + Particle *newParticle = new TextParticle(mMap, text, color, font, outline); newParticle->moveTo(x, y); newParticle->setVelocity(0.0f, 0.0f, 0.5f); newParticle->setGravity(0.0015f); diff --git a/src/particle.h b/src/particle.h index f03f081d..76beb8d1 100644 --- a/src/particle.h +++ b/src/particle.h @@ -106,19 +106,17 @@ class Particle : public Sprite /** * Creates a standalone text particle. */ - Particle *addTextSplashEffect(const std::string &text, - int colorR, int colorG, int colorB, - gcn::Font *font, int x, int y, - bool outline = false); + Particle *addTextSplashEffect(const std::string &text, int x, int y, + const gcn::Color *color, gcn::Font *font, + bool outline = false); /** * Creates a standalone text particle. */ Particle *addTextRiseFadeOutEffect(const std::string &text, - gcn::Font *font, - int x, int y, int colorR = 255, - int colorG = 255, int colorB = 255, - bool outline = false); + int x, int y, const gcn::Color *color, gcn::Font *font, + bool outline = false); + /** * Adds an emitter to the particle. */ diff --git a/src/player.cpp b/src/player.cpp index 61e91613..b289c3e5 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -22,10 +22,13 @@ #include "animatedsprite.h" #include "game.h" +#include "localplayer.h" #include "particle.h" #include "player.h" #include "text.h" +#include "gui/palette.h" + #include "resources/colordb.h" #include "resources/itemdb.h" @@ -51,17 +54,19 @@ void Player::setName(const std::string &name) { if (mIsGM) { - mNameColor = 0x009000; + mNameColor = &guiPalette->getColor(Palette::GM); mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, gcn::Graphics::CENTER, - gcn::Color(0, 255, 0)); + &guiPalette->getColor(Palette::GM)); } else { - mNameColor = 0x202020; + mNameColor = &guiPalette->getColor(Palette::PLAYER); mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, gcn::Graphics::CENTER, - gcn::Color(255, 255, 255)); + (this == player_node) ? + &guiPalette->getColor(Palette::SELF) : + &guiPalette->getColor(Palette::PC)); } Being::setName(name); } diff --git a/src/text.cpp b/src/text.cpp index 2d96152b..420eeb8b 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -32,8 +32,9 @@ int Text::mInstances = 0; Text::Text(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Color color) : - mText(text), mColor(color) + gcn::Graphics::Alignment alignment, const gcn::Color* color) : + mText(text), + mColor(color) { if (textManager == 0) { @@ -80,11 +81,12 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) TextRenderer::renderText(graphics, mText, mX - xOff, mY - yOff, gcn::Graphics::LEFT, - &mColor, boldFont, true, true); + mColor, boldFont, true); } FlashText::FlashText(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Color color) : + gcn::Graphics::Alignment alignment, + const gcn::Color *color) : Text(text, x, y, alignment, color), mTime(0) { diff --git a/src/text.h b/src/text.h index 0b53dd48..cf0aac48 100644 --- a/src/text.h +++ b/src/text.h @@ -39,7 +39,8 @@ class Text * Constructor creates a text object to display on the screen. */ Text(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Color color); + gcn::Graphics::Alignment alignment, + const gcn::Color *color); /** * Destructor. The text is removed from the screen. @@ -64,14 +65,15 @@ class Text int mXOffset; /**< The offset of mX from the desired x. */ static int mInstances; /**< Instances of text. */ std::string mText; /**< The text to display. */ - gcn::Color mColor; /**< The color of the text. */ + const gcn::Color *mColor; /**< The color of the text. */ }; class FlashText : public Text { public: FlashText(const std::string &text, int x, int y, - gcn::Graphics::Alignment alignment, gcn::Color color); + gcn::Graphics::Alignment alignment, + const gcn::Color* color); /** * Remove the text from the screen diff --git a/src/textparticle.cpp b/src/textparticle.cpp index a065eadd..865c6764 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -22,21 +22,17 @@ #include -#include - #include "textparticle.h" #include "gui/textrenderer.h" TextParticle::TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, + const gcn::Color* color, gcn::Font *font, bool outline): Particle(map), mText(text), mTextFont(font), - mColorR(colorR), - mColorG(colorG), - mColorB(colorB), + mColor(color), mOutline(outline) { } @@ -65,6 +61,5 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const TextRenderer::renderText(graphics, mText, screenX, screenY, gcn::Graphics::CENTER, - &gcn::Color(mColorR, mColorG, mColorB), mTextFont, mOutline, false, - (int) alpha); + mColor, mTextFont, mOutline, false, (int) alpha); } diff --git a/src/textparticle.h b/src/textparticle.h index 26b92a50..1a49b5ef 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -33,7 +33,7 @@ class TextParticle : public Particle * Constructor. */ TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, + const gcn::Color* color, gcn::Font *font, bool outline = false); /** @@ -48,9 +48,8 @@ class TextParticle : public Particle private: std::string mText; /**< Text of the particle. */ gcn::Font *mTextFont; /**< Font used for drawing the text. */ - int mColorR, mColorG, mColorB; /**< Color used for drawing the text. */ - bool mOutline; /**< Make the text readable - draw it the way - a Text is usually drawn: with outline */ + const gcn::Color* mColor; /**< Color used for drawing the text. */ + bool mOutline; /**< Make the text better readable */ }; #endif -- cgit v1.2.3-60-g2f50 From 9df0ea3ab0faeb3e9fce71dccb76624d7737798f Mon Sep 17 00:00:00 2001 From: Ira Rice Date: Thu, 12 Mar 2009 23:59:28 -0600 Subject: Fixed an incorrect palette reference, as well as a break that was introduced from the palette code. TODO: Cancel is effectively broken, and broken badly in the Colors setup pane. Fix this. Signed-off-by: Ira Rice --- src/gui/speechbubble.cpp | 5 +++++ src/player.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/player.cpp') diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index cb1724c8..944bae42 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -25,10 +25,13 @@ #include #include "gui.h" +#include "palette.h" #include "scrollarea.h" #include "speechbubble.h" #include "textbox.h" +#include "../graphics.h" + #include "../utils/gettext.h" SpeechBubble::SpeechBubble(): @@ -74,6 +77,8 @@ void SpeechBubble::setText(std::string text, bool showName) if ((text == mText) && (mCaption->getWidth() <= mSpeechBox->getMinWidth())) return; + graphics->setColor(guiPalette->getColor(Palette::TEXT)); + int width = mCaption->getWidth(); mSpeechBox->setTextWrapped(text, 130 > width ? 130 : width); diff --git a/src/player.cpp b/src/player.cpp index b289c3e5..ba4ed1ff 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -57,7 +57,7 @@ void Player::setName(const std::string &name) mNameColor = &guiPalette->getColor(Palette::GM); mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET, gcn::Graphics::CENTER, - &guiPalette->getColor(Palette::GM)); + &guiPalette->getColor(Palette::GM_NAME)); } else { -- cgit v1.2.3-60-g2f50