summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d3181c32a..cc88d8f6e 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2039,14 +2039,28 @@ void Being::drawHpBar(Graphics *graphics, int maxHP, int hp, int damage,
int dx = static_cast<int>(static_cast<float>(width) / p);
+ if (!damage || (!hp && maxHP == damage))
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color1));
+
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, dx, height));
+ return;
+ }
+ else if (width - dx <= 0)
+ {
+ graphics->setColor(userPalette->getColorWithAlpha(color2));
+
+ graphics->fillRectangle(gcn::Rectangle(
+ x, y, width, height));
+ return;
+ }
+
graphics->setColor(userPalette->getColorWithAlpha(color1));
graphics->fillRectangle(gcn::Rectangle(
x, y, dx, height));
- if (width - dx <= 0)
- return;
-
graphics->setColor(userPalette->getColorWithAlpha(color2));
graphics->fillRectangle(gcn::Rectangle(