diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-21 23:20:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-22 01:02:56 +0300 |
commit | 6dd62fd1082bad225e02312094332630b0debd07 (patch) | |
tree | 439b2b15eaee8c4a1edf229172d94e355cb544e0 /src/being.cpp | |
parent | a19ff6d060d0be8a7cb25bde5c7ad9f0b8027231 (diff) | |
download | manaverse-6dd62fd1082bad225e02312094332630b0debd07.tar.gz manaverse-6dd62fd1082bad225e02312094332630b0debd07.tar.bz2 manaverse-6dd62fd1082bad225e02312094332630b0debd07.tar.xz manaverse-6dd62fd1082bad225e02312094332630b0debd07.zip |
Show dead hp bar if monster have current damage more than counted
maximum value.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 20 |
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( |