diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-25 23:56:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-25 23:56:55 +0300 |
commit | 7cf334f49fe9157aabeef8eb1e69e115749d1b8f (patch) | |
tree | 7b5bb97a0b3079bf7e1aa6dcf277f8989952f98d /src/gui | |
parent | e0ad1f9076f322f18b54c4f1e0894a9cdd52937c (diff) | |
download | plus-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.gz plus-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.bz2 plus-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.tar.xz plus-7cf334f49fe9157aabeef8eb1e69e115749d1b8f.zip |
If player poisoned, hightlight his life bar in social window with special color.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/theme.cpp | 1 | ||||
-rw-r--r-- | src/gui/theme.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 15 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.cpp | 1 |
4 files changed, 12 insertions, 6 deletions
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()); } } |