From 6dd62fd1082bad225e02312094332630b0debd07 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 21 Aug 2011 23:20:57 +0300 Subject: Show dead hp bar if monster have current damage more than counted maximum value. --- src/being.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/being.cpp') 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(static_cast(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( -- cgit v1.2.3-70-g09d2