summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-25 23:56:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-25 23:56:55 +0300
commit7cf334f49fe9157aabeef8eb1e69e115749d1b8f (patch)
tree7b5bb97a0b3079bf7e1aa6dcf277f8989952f98d
parente0ad1f9076f322f18b54c4f1e0894a9cdd52937c (diff)
downloadmv-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.gz
mv-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.bz2
mv-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.xz
mv-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.zip
If player poisoned, hightlight his life bar in social window with special color.
-rw-r--r--data/graphics/gui/colors.xml1
-rw-r--r--data/themes/blacknblack/colors.xml1
-rw-r--r--data/themes/blackwood/colors.xml1
-rw-r--r--data/themes/enchilado/colors.xml1
-rw-r--r--data/themes/golden-delicious/colors.xml5
-rw-r--r--data/themes/jewelry/colors.xml1
-rw-r--r--data/themes/mana/colors.xml1
-rw-r--r--data/themes/pink/colors.xml1
-rw-r--r--data/themes/unity/colors.xml1
-rw-r--r--data/themes/wood/colors.xml1
-rw-r--r--src/avatar.cpp37
-rw-r--r--src/avatar.h7
-rw-r--r--src/being/actorsprite.cpp11
-rw-r--r--src/being/actorsprite.h11
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/theme.cpp1
-rw-r--r--src/gui/theme.h1
-rw-r--r--src/gui/widgets/avatarlistbox.cpp15
-rw-r--r--src/gui/windows/socialwindow.cpp1
-rw-r--r--src/statuseffect.cpp13
-rw-r--r--src/statuseffect.h3
21 files changed, 79 insertions, 36 deletions
diff --git a/data/graphics/gui/colors.xml b/data/graphics/gui/colors.xml
index 92b8cc756..f876629a1 100644
--- a/data/graphics/gui/colors.xml
+++ b/data/graphics/gui/colors.xml
@@ -124,6 +124,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/blacknblack/colors.xml b/data/themes/blacknblack/colors.xml
index 429a46a66..3cdf14382 100644
--- a/data/themes/blacknblack/colors.xml
+++ b/data/themes/blacknblack/colors.xml
@@ -125,6 +125,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/blackwood/colors.xml b/data/themes/blackwood/colors.xml
index 30cddd93d..10783b846 100644
--- a/data/themes/blackwood/colors.xml
+++ b/data/themes/blackwood/colors.xml
@@ -124,6 +124,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/enchilado/colors.xml b/data/themes/enchilado/colors.xml
index ed0b47824..e2ee35822 100644
--- a/data/themes/enchilado/colors.xml
+++ b/data/themes/enchilado/colors.xml
@@ -125,6 +125,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/golden-delicious/colors.xml b/data/themes/golden-delicious/colors.xml
index 258498f05..67129f420 100644
--- a/data/themes/golden-delicious/colors.xml
+++ b/data/themes/golden-delicious/colors.xml
@@ -358,14 +358,11 @@
<color id="STATUSBAR_OFF" color="#ffff00" />
</palette>
-<!-- DEFAULT progressbar is obsolete! This would be removed from
-future versions of theme, it only left here to keep compatibility
-with older versions for some time -->
- <progressbar id="DEFAULT" color="#266091" />
<progressbar id="UPDATE" color="#165081" />
<progressbar id="STATUS" color="#888808" />
<progressbar id="MONEY" color="#606060" />
<progressbar id="HP" color="#D00000,C09800,779000,008710" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1250b0" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#6080a0" />
diff --git a/data/themes/jewelry/colors.xml b/data/themes/jewelry/colors.xml
index 2721d6d2d..616d57db6 100644
--- a/data/themes/jewelry/colors.xml
+++ b/data/themes/jewelry/colors.xml
@@ -406,6 +406,7 @@
</palette>
<progressbar id="HP" color="#b80000" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/mana/colors.xml b/data/themes/mana/colors.xml
index 7bc5afcec..9a56ee44e 100644
--- a/data/themes/mana/colors.xml
+++ b/data/themes/mana/colors.xml
@@ -125,6 +125,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/pink/colors.xml b/data/themes/pink/colors.xml
index f9b1dc441..f720bb8fc 100644
--- a/data/themes/pink/colors.xml
+++ b/data/themes/pink/colors.xml
@@ -125,6 +125,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/unity/colors.xml b/data/themes/unity/colors.xml
index 552bce4bf..942f19d77 100644
--- a/data/themes/unity/colors.xml
+++ b/data/themes/unity/colors.xml
@@ -124,6 +124,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/data/themes/wood/colors.xml b/data/themes/wood/colors.xml
index 9f3915ab5..f3059f820 100644
--- a/data/themes/wood/colors.xml
+++ b/data/themes/wood/colors.xml
@@ -125,6 +125,7 @@
</palette>
<progressbar id="HP" color="#ff0000,e28000,c38948,0f6a20" />
+ <progressbar id="HP_POISON" color="#ffff00,70ff00,50ff00,30ff00" />
<progressbar id="MP" color="#1a66e6" />
<progressbar id="NO_MP" color="#646464" />
<progressbar id="EXP" color="#8fc0d3" />
diff --git a/src/avatar.cpp b/src/avatar.cpp
index 4c936ba7f..3e685f008 100644
--- a/src/avatar.cpp
+++ b/src/avatar.cpp
@@ -27,24 +27,25 @@
#include "debug.h"
Avatar::Avatar(const std::string &name):
- mId(0),
- mCharId(0),
- mName(name),
- mOriginalName(name),
- mHp(0),
- mMaxHp(0),
- mDamageHp(0),
- mLevel(1),
- mMap(),
- mX(-1),
- mY(-1),
- mType(AVATAR_PLAYER),
- mExp(0),
- mGender(GENDER_UNSPECIFIED),
- mRace(-1),
- mIp(),
- mOnline(false),
- mDisplayBold(false)
+ mId(0),
+ mCharId(0),
+ mName(name),
+ mOriginalName(name),
+ mHp(0),
+ mMaxHp(0),
+ mDamageHp(0),
+ mLevel(1),
+ mMap(),
+ mX(-1),
+ mY(-1),
+ mType(AVATAR_PLAYER),
+ mExp(0),
+ mGender(GENDER_UNSPECIFIED),
+ mRace(-1),
+ mIp(),
+ mOnline(false),
+ mDisplayBold(false),
+ mPoison(false)
{
}
diff --git a/src/avatar.h b/src/avatar.h
index 9804b318e..03050a06f 100644
--- a/src/avatar.h
+++ b/src/avatar.h
@@ -172,6 +172,12 @@ public:
void setIp(std::string ip)
{ mIp = ip; }
+ bool getPoison() const A_WARN_UNUSED
+ { return mPoison; }
+
+ void setPoison(const bool b)
+ { mPoison = b; }
+
protected:
int mId;
int mCharId;
@@ -191,6 +197,7 @@ protected:
std::string mIp;
bool mOnline;
bool mDisplayBold;
+ bool mPoison;
};
#endif // AVATAR_H
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp
index bbb016525..9c1eeddc7 100644
--- a/src/being/actorsprite.cpp
+++ b/src/being/actorsprite.cpp
@@ -57,7 +57,8 @@ ActorSprite::ActorSprite(const int id) :
mActorSpriteListeners(),
mCursorPaddingX(0),
mCursorPaddingY(0),
- mMustResetParticles(false)
+ mMustResetParticles(false),
+ mPoison(false)
{
}
@@ -197,7 +198,13 @@ void ActorSprite::updateStunMode(const int oldMode, const int newMode)
void ActorSprite::updateStatusEffect(const int index, const bool newStatus)
{
- handleStatusEffect(StatusEffect::getStatusEffect(index, newStatus), index);
+ StatusEffect *const effect = StatusEffect::getStatusEffect(
+ index, newStatus);
+ if (!effect)
+ return;
+ if (effect->isPoison() && getType() == PLAYER)
+ setPoison(newStatus);
+ handleStatusEffect(effect, index);
}
void ActorSprite::handleStatusEffect(StatusEffect *const effect,
diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h
index 444232ddd..76e90182d 100644
--- a/src/being/actorsprite.h
+++ b/src/being/actorsprite.h
@@ -179,12 +179,18 @@ public:
*/
void removeActorSpriteListener(ActorSpriteListener *const listener);
- int getActorX() const
+ int getActorX() const A_WARN_UNUSED
{ return getPixelX() - mapTileSize / 2; }
- int getActorY() const
+ int getActorY() const A_WARN_UNUSED
{ return getPixelY() - mapTileSize; }
+ void setPoison(const bool b)
+ { mPoison = b; }
+
+ bool getPoison() const A_WARN_UNUSED
+ { return mPoison; }
+
protected:
/**
* Notify self that the stun mode has been updated. Invoked by
@@ -244,6 +250,7 @@ private:
/** Reset particle status effects on next redraw? */
bool mMustResetParticles;
+ bool mPoison;
};
#endif // BEING_ACTORSPRITE_H
diff --git a/src/defaults.cpp b/src/defaults.cpp
index d5f907696..9ec23540f 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -535,6 +535,7 @@ DefaultsData* getPathsDefaults()
AddDEF("deadMessagesFile", "deadmessages.xml");
AddDEF("deadMessagesPatchFile", "deadmessages_patch.xml");
AddDEF("deadMessagesPatchDir", "deadmessages.d");
+ AddDEF("poisonEffectName", "poison");
return configData;
}
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index d281b81d8..b208ce960 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -1031,6 +1031,7 @@ static int readProgressType(const std::string &type)
static const std::string colors[Theme::THEME_PROG_END] =
{
"HP",
+ "HP_POISON",
"MP",
"NO_MP",
"EXP",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index 8bc40fe00..023918cf0 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -435,6 +435,7 @@ class Theme final : public Palette,
enum ProgressPalette
{
PROG_HP = 0,
+ PROG_HP_POISON,
PROG_MP,
PROG_NO_MP,
PROG_EXP,
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 5ce74bfca..9411c2249 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -154,14 +154,16 @@ void AvatarListBox::draw(Graphics *graphics)
text = strprintf("%s %d/%d", a->getComplexName().c_str(),
a->getHp(), a->getMaxHp());
}
- if (parent && a->getMaxHp())
+ const bool isPoison = a->getPoison();
+ if (a->getMaxHp() && (isPoison || parent))
{
+ const int themeColor = (isPoison
+ ? Theme::PROG_HP_POISON : Theme::PROG_HP);
Color color = Theme::getProgressColor(
- Theme::PROG_HP, static_cast<float>(a->getHp())
- / static_cast<float>(a->getMaxHp()));
+ themeColor, static_cast<float>(a->getHp())
+ / static_cast<float>(a->getMaxHp()));
color.a = 80;
graphics->setColor(color);
-
graphics->fillRectangle(Rect(mPadding, y + mPadding,
parent->getWidth() * a->getHp() / a->getMaxHp()
- 2 * mPadding, fontHeight));
@@ -182,8 +184,9 @@ void AvatarListBox::draw(Graphics *graphics)
if (parent)
{
- Color color = Theme::getProgressColor(Theme::PROG_HP, 1);
-
+ const int themeColor = (a->getPoison()
+ ? Theme::PROG_HP_POISON : Theme::PROG_HP);
+ Color color = Theme::getProgressColor(themeColor, 1);
color.a = 80;
graphics->setColor(color);
graphics->fillRectangle(Rect(mPadding, y + mPadding,
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 8e6becca1..520184364 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -568,6 +568,7 @@ public:
avatar->setLevel(being->getLevel());
avatar->setGender(being->getGender());
avatar->setIp(being->getIp());
+ avatar->setPoison(being->getPoison());
}
}
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 647c6dd99..fd9f60851 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -47,7 +47,8 @@ StatusEffect::StatusEffect() :
mParticleEffect(),
mIcon(),
mAction(),
- mPersistentParticleEffect(false)
+ mPersistentParticleEffect(false),
+ mIsPoison(false)
{
}
@@ -153,9 +154,9 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
{
if (xmlNameEqual(node, "include"))
{
- const std::string name = XML::getProperty(node, "name", "");
- if (!name.empty())
- loadXmlFile(name);
+ const std::string incName = XML::getProperty(node, "name", "");
+ if (!incName.empty())
+ loadXmlFile(incName);
continue;
}
@@ -181,11 +182,14 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
{
StatusEffect *startEffect = (*the_map)[1][index];
StatusEffect *endEffect = (*the_map)[0][index];
+ const std::string name = XML::getProperty(node, "name", "");
if (!startEffect)
startEffect = new StatusEffect;
if (!endEffect)
endEffect = new StatusEffect;
+ startEffect->mIsPoison =
+ (name == paths.getStringValue("poisonEffectName"));
startEffect->mMessage = XML::getProperty(
node, "start-message", "");
startEffect->mSFXEffect = XML::getProperty(
@@ -198,6 +202,7 @@ void StatusEffect::loadXmlFile(const std::string &fileName)
startEffect->mPersistentParticleEffect = (XML::getProperty(
node, "persistent-particle-effect", "no")) != "no";
+ endEffect->mIsPoison = startEffect->mIsPoison;
endEffect->mMessage = XML::getProperty(node, "end-message", "");
endEffect->mSFXEffect = XML::getProperty(node, "end-audio", "");
endEffect->mParticleEffect = XML::getProperty(
diff --git a/src/statuseffect.h b/src/statuseffect.h
index 8bb164820..e30d9d1bd 100644
--- a/src/statuseffect.h
+++ b/src/statuseffect.h
@@ -73,6 +73,8 @@ public:
bool particleEffectIsPersistent() const A_WARN_UNUSED
{ return mPersistentParticleEffect; }
+ bool isPoison() const A_WARN_UNUSED
+ { return mIsPoison; }
/**
* Retrieves a status effect.
@@ -118,6 +120,7 @@ private:
std::string mIcon;
std::string mAction;
bool mPersistentParticleEffect;
+ bool mIsPoison;
};
#endif // STATUSEFFECT_H