summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-27 02:37:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-27 14:04:19 +0300
commitc5092e2ce5cd6edecde4339d4d2436d4585b60a6 (patch)
tree08a5bfaf289b55f44b6538408a81299a68855282 /src/being/being.cpp
parent94eb2cb314e2629a659245554106ffe5e48f4d62 (diff)
downloadManaVerse-c5092e2ce5cd6edecde4339d4d2436d4585b60a6.tar.gz
ManaVerse-c5092e2ce5cd6edecde4339d4d2436d4585b60a6.tar.bz2
ManaVerse-c5092e2ce5cd6edecde4339d4d2436d4585b60a6.tar.xz
ManaVerse-c5092e2ce5cd6edecde4339d4d2436d4585b60a6.zip
Draw team badge if set.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 746cc729b..62b35b386 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -132,6 +132,7 @@ Being::Being(const BeingId id,
mInfo(BeingInfo::unknown),
mEmotionSprite(nullptr),
mAnimationEffect(nullptr),
+ mTeamBadge(nullptr),
mSpriteAction(SpriteAction::STAND),
mName(),
mRaceName(),
@@ -1828,7 +1829,8 @@ void Being::petLogic()
}
}
-void Being::drawEmotion(Graphics *const graphics, const int offsetX,
+void Being::drawEmotion(Graphics *const graphics,
+ const int offsetX,
const int offsetY) const
{
const int px = getPixelX() - offsetX - mapTileSize / 2;
@@ -1837,6 +1839,20 @@ void Being::drawEmotion(Graphics *const graphics, const int offsetX,
mEmotionSprite->draw(graphics, px, py);
if (mAnimationEffect)
mAnimationEffect->draw(graphics, px, py);
+ if (mTeamBadge)
+ {
+ if (mDispName && gui)
+ {
+ Font *const font = gui->getFont();
+ mTeamBadge->draw(graphics,
+ mDispName->getX() - offsetX + mDispName->getWidth(),
+ mDispName->getY() - offsetY - font->getHeight());
+ }
+ else
+ {
+ mTeamBadge->draw(graphics, px, py);
+ }
+ }
}
void Being::drawSpeech(const int offsetX, const int offsetY)
@@ -3674,6 +3690,15 @@ void Being::setTeamId(const uint16_t teamId)
{
if (mTeamId != teamId)
{
+ delete2(mTeamBadge);
+ if (teamId)
+ {
+ mTeamBadge = AnimatedSprite::load(
+ strprintf("%steam%d.xml",
+ paths.getStringValue("badges").c_str(),
+ teamId));
+ }
+
mTeamId = teamId;
updateColors();
}