diff options
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()); } } |