summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-29 19:56:40 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-29 19:56:40 +0300
commitaa0bda1d887709c13c64308d33087ad7fc1ac0bf (patch)
tree9037d65cecce822cd4adb4c2a4f9b3e0b47b4691 /src/being/being.cpp
parent124c8826145c5a178b4a86051cd5dbea3ebd7689 (diff)
downloadplus-aa0bda1d887709c13c64308d33087ad7fc1ac0bf.tar.gz
plus-aa0bda1d887709c13c64308d33087ad7fc1ac0bf.tar.bz2
plus-aa0bda1d887709c13c64308d33087ad7fc1ac0bf.tar.xz
plus-aa0bda1d887709c13c64308d33087ad7fc1ac0bf.zip
Add support for gm badge.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 70dcee8a1..987971a78 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -134,6 +134,7 @@ Being::Being(const BeingId id,
mInfo(BeingInfo::unknown),
mEmotionSprite(nullptr),
mAnimationEffect(nullptr),
+ mGmBadge(nullptr),
mGuildBadge(nullptr),
mPartyBadge(nullptr),
mTeamBadge(nullptr),
@@ -293,6 +294,7 @@ Being::~Being()
delete2(mText);
delete2(mEmotionSprite);
delete2(mAnimationEffect);
+ delete2(mGmBadge);
delete2(mGuildBadge);
delete2(mPartyBadge);
delete2(mTeamBadge);
@@ -1386,6 +1388,8 @@ void Being::setAction(const BeingActionT &action, const int attackId)
mEmotionSprite->play(currentAction);
if (mAnimationEffect)
mAnimationEffect->play(currentAction);
+ if (mGmBadge)
+ mGmBadge->play(currentAction);
if (mGuildBadge)
mGuildBadge->play(currentAction);
if (mPartyBadge)
@@ -1455,6 +1459,8 @@ void Being::setDirection(const uint8_t direction)
mEmotionSprite->setSpriteDirection(dir);
if (mAnimationEffect)
mAnimationEffect->setSpriteDirection(dir);
+ if (mGmBadge)
+ mGmBadge->setSpriteDirection(dir);
if (mGuildBadge)
mGuildBadge->setSpriteDirection(dir);
if (mPartyBadge)
@@ -1565,6 +1571,8 @@ void Being::logic()
if (mAnimationEffect->isTerminated())
delete2(mAnimationEffect)
}
+ if (mGmBadge)
+ mGmBadge->update(time);
if (mGuildBadge)
mGuildBadge->update(time);
if (mPartyBadge)
@@ -1905,6 +1913,11 @@ void Being::drawEmotion(Graphics *const graphics,
mTeamBadge->draw(graphics, x, y);
x += 16;
}
+ if (mGmBadge)
+ {
+ mGmBadge->draw(graphics, x, y);
+ x += 16;
+ }
if (mGuildBadge)
{
mGuildBadge->draw(graphics, x, y);
@@ -2566,9 +2579,22 @@ void Being::setGender(const GenderT gender)
void Being::setGM(const bool gm)
{
- mIsGM = gm;
-
- updateColors();
+ if (mIsGM != gm)
+ {
+ delete2(mGmBadge);
+ mIsGM = gm;
+ if (mIsGM && mShowBadges)
+ {
+ const std::string gmBadge = paths.getStringValue("gmbadge");
+ if (!gmBadge.empty())
+ {
+ mGmBadge = AnimatedSprite::load(
+ paths.getStringValue("badges") + gmBadge);
+ }
+ }
+ updateColors();
+ updateBadgesCount();
+ }
}
void Being::talkTo() const
@@ -3798,6 +3824,8 @@ void Being::updateBadgesCount()
mBadgesCount = 0;
if (mTeamBadge)
mBadgesCount ++;
+ if (mGmBadge)
+ mBadgesCount ++;
if (mGuildBadge)
mBadgesCount ++;
if (mPartyBadge)