summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp27
-rw-r--r--src/being/being.h3
2 files changed, 28 insertions, 2 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();
}
diff --git a/src/being/being.h b/src/being/being.h
index bf389c324..a32a11487 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -957,7 +957,8 @@ class Being notfinal : public ActorSprite,
BeingInfo *mInfo;
AnimatedSprite *mEmotionSprite;
- AnimatedSprite* mAnimationEffect;
+ AnimatedSprite *mAnimationEffect;
+ AnimatedSprite *mTeamBadge;
std::string mSpriteAction;
std::string mName; /**< Name of character */