summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-01 16:15:31 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-01 16:15:31 +0300
commit7abf9198788c8ec476c6099faf7ebd25be372655 (patch)
tree52629718dc762bfd772e3304c98f155869bcd574 /src
parent7afb9df4a8fdecc0d6b93a7dbd7044e0f6a358f3 (diff)
downloadplus-7abf9198788c8ec476c6099faf7ebd25be372655.tar.gz
plus-7abf9198788c8ec476c6099faf7ebd25be372655.tar.bz2
plus-7abf9198788c8ec476c6099faf7ebd25be372655.tar.xz
plus-7abf9198788c8ec476c6099faf7ebd25be372655.zip
Show enabled status effects in player popups.
Diffstat (limited to 'src')
-rw-r--r--src/being/actorsprite.h3
-rw-r--r--src/gui/popups/beingpopup.cpp53
-rw-r--r--src/gui/popups/beingpopup.h1
-rw-r--r--src/statuseffect.cpp3
-rw-r--r--src/statuseffect.h4
5 files changed, 60 insertions, 4 deletions
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 76a4a53fc..7d86742d8 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -185,6 +185,9 @@ class ActorSprite notfinal : public CompoundSprite, public Actor
bool isTrickDead() const A_WARN_UNUSED
{ return mTrickDead; }
+ const std::set<int> &getStatusEffects() const A_WARN_UNUSED
+ { return mStatusEffects; }
+
protected:
/**
* Notify self that the stun mode has been updated. Invoked by
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index d1f7b1e17..97a786e41 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -21,6 +21,8 @@
#include "gui/popups/beingpopup.h"
+#include "statuseffect.h"
+
#include "being/being.h"
#include "being/homunculusinfo.h"
#include "being/petinfo.h"
@@ -51,7 +53,8 @@ BeingPopup::BeingPopup() :
mBeingComment(new Label(this, "A")),
mBeingBuyBoard(new Label(this, "A")),
mBeingSellBoard(new Label(this, "A")),
- mBeingRoom(new Label(this, "A"))
+ mBeingRoom(new Label(this, "A")),
+ mBeingEffects(new Label(this, "A"))
{
// Being Name
mBeingName->setFont(boldFont);
@@ -69,6 +72,7 @@ BeingPopup::BeingPopup() :
mBeingSellBoard->setPosition(0, 4 * fontHeight);
mBeingComment->setPosition(0, 5 * fontHeight);
mBeingRoom->setPosition(0, 6 * fontHeight);
+ mBeingEffects->setPosition(0, 7 * fontHeight);
mBeingParty->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP),
getThemeColor(ThemeColorId::POPUP_OUTLINE));
@@ -84,6 +88,8 @@ BeingPopup::BeingPopup() :
getThemeColor(ThemeColorId::POPUP_OUTLINE));
mBeingRoom->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP),
getThemeColor(ThemeColorId::POPUP_OUTLINE));
+ mBeingEffects->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP),
+ getThemeColor(ThemeColorId::POPUP_OUTLINE));
}
BeingPopup::~BeingPopup()
@@ -101,6 +107,7 @@ void BeingPopup::postInit()
add(mBeingBuyBoard);
add(mBeingSellBoard);
add(mBeingRoom);
+ add(mBeingEffects);
}
void BeingPopup::show(const int x, const int y, Being *const b)
@@ -118,6 +125,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
Label *label5 = mBeingSellBoard;
Label *label6 = mBeingComment;
Label *label7 = mBeingRoom;
+ Label *label8 = mBeingEffects;
b->updateComment();
@@ -155,6 +163,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label5->setCaption("");
label6->setCaption("");
label7->setCaption("");
+ label8->setCaption("");
#ifdef EATHENA_SUPPORT
const ActorTypeT type = b->getType();
@@ -176,6 +185,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label5 = nullptr;
label6 = nullptr;
label7 = nullptr;
+ label8 = nullptr;
}
}
else if (type == ActorType::Homunculus)
@@ -196,6 +206,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label5 = nullptr;
label6 = nullptr;
label7 = nullptr;
+ label8 = nullptr;
}
}
else
@@ -210,6 +221,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label8 = label7;
label7 = label6;
label6 = label5;
label5 = label4;
@@ -228,6 +240,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label8 = label7;
label7 = label6;
label6 = label5;
label5 = label4;
@@ -245,6 +258,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label8 = label7;
label7 = label6;
label6 = label5;
label5 = label4;
@@ -263,6 +277,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
else
#endif
{
+ label8 = label7;
label7 = label6;
label6 = label5;
label5 = label4;
@@ -280,6 +295,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
else
#endif
{
+ label8 = label7;
label7 = label6;
label6 = label5;
label5 = nullptr;
@@ -294,21 +310,46 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label8 = label7;
label7 = label6;
label6 = nullptr;
}
+
+ const std::set<int> &effects = b->getStatusEffects();
+ if (!effects.empty())
+ {
+ std::string effectsStr;
+ FOR_EACH (std::set<int>::const_iterator, it, effects)
+ {
+ StatusEffect *const effect = StatusEffect::getStatusEffect(
+ *it, Enable_true);
+ if (!effectsStr.empty())
+ effectsStr.append(", ");
+ effectsStr.append(effect->getName());
+ }
+ // TRANSLATORS: being popup label
+ label7->setCaption(strprintf(_("Effects: %s"),
+ effectsStr.c_str()));
+ label7->adjustSize();
+ }
+ else
+ {
+ label8 = label7;
+ label7 = nullptr;
+ }
+
#ifdef EATHENA_SUPPORT
const ChatObject *const chat = b->getChat();
if (chat)
{
// TRANSLATORS: being popup label
- label7->setCaption(strprintf(_("Chat room: %s"),
+ label8->setCaption(strprintf(_("Chat room: %s"),
chat->title.c_str()));
- label7->adjustSize();
+ label8->adjustSize();
}
else
{
- label7 = nullptr;
+ label8 = nullptr;
}
#endif
}
@@ -328,6 +369,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
minWidth = label6->getWidth();
if (label7 && label7->getWidth() > minWidth)
minWidth = label7->getWidth();
+ if (label8 && label8->getWidth() > minWidth)
+ minWidth = label8->getWidth();
const int height1 = getFont()->getHeight();
int height = height1;
@@ -345,6 +388,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
height += height1;
if (label7)
height += height1;
+ if (label8)
+ height += height1;
setContentSize(minWidth, height);
position(x, y);
diff --git a/src/gui/popups/beingpopup.h b/src/gui/popups/beingpopup.h
index c6f2a4a40..11e5865ed 100644
--- a/src/gui/popups/beingpopup.h
+++ b/src/gui/popups/beingpopup.h
@@ -65,6 +65,7 @@ class BeingPopup final : public Popup
Label *mBeingBuyBoard A_NONNULLPOINTER;
Label *mBeingSellBoard A_NONNULLPOINTER;
Label *mBeingRoom A_NONNULLPOINTER;
+ Label *mBeingEffects A_NONNULLPOINTER;
};
extern BeingPopup *beingPopup;
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 365887a90..eed1a307b 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -45,6 +45,7 @@ StatusEffect::StatusEffect() :
mParticleEffect(),
mIcon(),
mAction(),
+ mName(),
mPersistentParticleEffect(false),
mIsPoison(false),
mIsCart(false),
@@ -199,6 +200,7 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
if (!endEffect)
endEffect = new StatusEffect;
+ startEffect->mName = name;
startEffect->mIsPoison =
(name == paths.getStringValue("poisonEffectName"));
startEffect->mIsCart =
@@ -219,6 +221,7 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
startEffect->mPersistentParticleEffect = (XML::getProperty(
node, "persistent-particle-effect", "no")) != "no";
+ endEffect->mName = startEffect->mName;
endEffect->mIsPoison = startEffect->mIsPoison;
endEffect->mIsCart = startEffect->mIsCart;
endEffect->mIsRiding = startEffect->mIsRiding;
diff --git a/src/statuseffect.h b/src/statuseffect.h
index cb9641074..136e4c7fe 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -69,6 +69,9 @@ class StatusEffect final
*/
std::string getAction() const A_WARN_UNUSED;
+ std::string getName() const A_WARN_UNUSED
+ { return mName; }
+
/**
* Determines whether the particle effect should be restarted when the
* being changes maps
@@ -134,6 +137,7 @@ class StatusEffect final
std::string mParticleEffect;
std::string mIcon;
std::string mAction;
+ std::string mName;
bool mPersistentParticleEffect;
bool mIsPoison;
bool mIsCart;