diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 16 | ||||
-rw-r--r-- | src/beingmanager.cpp | 3 | ||||
-rw-r--r-- | src/localplayer.cpp | 9 | ||||
-rw-r--r-- | src/text.cpp | 13 | ||||
-rw-r--r-- | src/text.h | 6 |
5 files changed, 38 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp index fd3561ae..0e09126d 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -122,11 +122,14 @@ Being::Being(int id, Type type, int subtype, Map *map): Being::~Being() { + config.removeListener("visiblenames", this); + delete mSpeechBubble; delete mDispName; delete mText; - - config.removeListener("visiblenames", this); + mSpeechBubble = 0; + mDispName = 0; + mText = 0; } void Being::setSubtype(Uint16 subtype) @@ -1004,8 +1007,15 @@ void Being::showName() } } + gcn::Font *font = 0; + if (player_node && player_node->getTarget() == this + && getType() != MONSTER) + { + font = boldFont; + } + mDispName = new FlashText(mDisplayName, getPixelX(), getPixelY(), - gcn::Graphics::CENTER, mNameColor); + gcn::Graphics::CENTER, mNameColor, font); updateCoords(); } diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index a92e3faf..79591ce6 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -182,7 +182,10 @@ void BeingManager::logic() void BeingManager::clear() { if (player_node) + { + player_node->setTarget(0); mBeings.remove(player_node); + } delete_all(mBeings); mBeings.clear(); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 40592f59..7bf339c6 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -736,14 +736,23 @@ void LocalPlayer::setTarget(Being *target) mTargetTime = -1; } + Being *oldTarget = 0; if (mTarget) + { mTarget->untarget(); + oldTarget = mTarget; + } if (mTarget && mTarget->getType() == ActorSprite::MONSTER) mTarget->setShowName(false); mTarget = target; + if (oldTarget) + oldTarget->updateName(); + if (mTarget) + mTarget->updateName(); + if (target && target->getType() == ActorSprite::MONSTER) target->setShowName(true); } diff --git a/src/text.cpp b/src/text.cpp index f6c71dba..9f970872 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -41,12 +41,17 @@ Image *Text::mBubbleArrow; Text::Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color* color, bool isSpeech) : + const gcn::Color* color, bool isSpeech, + gcn::Font *font) : mText(text), mColor(color), - mFont(gui->getFont()), mIsSpeech(isSpeech) { + if (!font) + mFont = gui->getFont(); + else + mFont = font; + if (textManager == 0) { textManager = new TextManager; @@ -145,8 +150,8 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff) FlashText::FlashText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color *color) : - Text(text, x, y, alignment, color), + const gcn::Color *color, gcn::Font *font) : + Text(text, x, y, alignment, color, false, font), mTime(0) { } @@ -40,7 +40,8 @@ class Text */ Text(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color *color, bool isSpeech = false); + const gcn::Color *color, bool isSpeech = false, + gcn::Font *font = 0); /** * Destructor. The text is removed from the screen. @@ -84,7 +85,8 @@ class FlashText : public Text public: FlashText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, - const gcn::Color* color); + const gcn::Color* color, + gcn::Font *font = 0); /** * Remove the text from the screen |