From 8c8e641b2ce47daa2f824a87b27d63bfeb609098 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 5 Sep 2015 17:31:32 +0300 Subject: Add inactive being badge. --- data/graphics/badges/CMakeLists.txt | 2 ++ data/graphics/badges/Makefile.am | 2 ++ data/graphics/badges/inactive.png | Bin 0 -> 177 bytes data/graphics/badges/inactive.xml | 15 +++++++++++++++ src/being/being.cpp | 20 +++++++++++++++++++- src/being/being.h | 2 ++ src/defaults.cpp | 1 + 7 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 data/graphics/badges/inactive.png create mode 100644 data/graphics/badges/inactive.xml diff --git a/data/graphics/badges/CMakeLists.txt b/data/graphics/badges/CMakeLists.txt index 22110ba93..52334e660 100644 --- a/data/graphics/badges/CMakeLists.txt +++ b/data/graphics/badges/CMakeLists.txt @@ -1,6 +1,8 @@ SET(FILES gm.png gm.xml + inactive.png + inactive.xml shop.png shop.xml team1.png diff --git a/data/graphics/badges/Makefile.am b/data/graphics/badges/Makefile.am index 4e8b57e04..3a05e7a7f 100644 --- a/data/graphics/badges/Makefile.am +++ b/data/graphics/badges/Makefile.am @@ -3,6 +3,8 @@ badgesdir = $(pkgdatadir)/data/graphics/badges badges_DATA = \ gm.png \ gm.xml \ + inactive.png \ + inactive.xml \ shop.png \ shop.xml \ team1.png \ diff --git a/data/graphics/badges/inactive.png b/data/graphics/badges/inactive.png new file mode 100644 index 000000000..3f8b333c6 Binary files /dev/null and b/data/graphics/badges/inactive.png differ diff --git a/data/graphics/badges/inactive.xml b/data/graphics/badges/inactive.xml new file mode 100644 index 000000000..e2a730989 --- /dev/null +++ b/data/graphics/badges/inactive.xml @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/src/being/being.cpp b/src/being/being.cpp index 1980436d5..63be12ebe 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2107,7 +2107,7 @@ std::string Being::getGenderSign() const // TRANSLATORS: this away status writed in player nick str.append(_("A")); } - else if (mInactive) + else if (mInactive && !mShowBadges) { // TRANSLATORS: this inactive status writed in player nick str.append(_("I")); @@ -2518,6 +2518,7 @@ bool Being::updateFromCache() } showShopBadge(mShop); + showInactiveBadge(mInactive); updateAwayEffect(); if (mType == ActorType::Player || mTeamId) updateColors(); @@ -3370,6 +3371,7 @@ void Being::setState(const uint8_t state) mInactive = inactive; updateAwayEffect(); showShopBadge(mShop); + showInactiveBadge(mInactive); if (needUpdate) { @@ -3883,6 +3885,7 @@ void Being::showBadges(const bool show) showPartyBadge(show); showNameBadge(show); showShopBadge(show); + showInactiveBadge(show); } void Being::showPartyBadge(const bool show) @@ -3925,6 +3928,21 @@ void Being::showShopBadge(const bool show) updateBadgesCount(); } +void Being::showInactiveBadge(const bool show) +{ + delete2(mBadges[BadgeIndex::Inactive]); + if (show && mShop && mShowBadges) + { + const std::string badge = paths.getStringValue("inactivebadge"); + if (!badge.empty()) + { + mBadges[BadgeIndex::Inactive] = AnimatedSprite::load( + paths.getStringValue("badges") + badge); + } + } + updateBadgesCount(); +} + void Being::updateBadgesCount() { mBadgesCount = 0; diff --git a/src/being/being.h b/src/being/being.h index 656eb21fb..47a904479 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -944,6 +944,8 @@ class Being notfinal : public ActorSprite, void showShopBadge(const bool show); + void showInactiveBadge(const bool show); + void showBadges(const bool show); uint16_t getTeamId() const diff --git a/src/defaults.cpp b/src/defaults.cpp index 2d3b24410..83c53c129 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -608,6 +608,7 @@ DefaultsData* getPathsDefaults() AddDEF("team3badge", "team3.xml"); AddDEF("gmbadge", "gm.xml"); AddDEF("shopbadge", "shop.xml"); + AddDEF("inactivebadge", "inactive.xml"); return configData; } -- cgit v1.2.3-70-g09d2