diff options
Diffstat (limited to 'src/gui/ministatus.cpp')
-rw-r--r-- | src/gui/ministatus.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index c11ea171..cdefc391 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -28,9 +28,13 @@ #include "gui/gui.h" #include "gui/statuswindow.h" +#include "gui/theme.h" #include "gui/widgets/progressbar.h" +#include "net/net.h" +#include "net/playerhandler.h" + #include "utils/stringutils.h" extern volatile int tick_time; @@ -38,15 +42,16 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus") { - mHpBar = new ProgressBar((float) player_node->getHp() - / (float) player_node->getMaxHp(), - 100, 20, gcn::Color(0, 171, 34)); - mMpBar = new ProgressBar((float) player_node->getMaxMP() - / (float) player_node->getMaxMP(), - 100, 20, gcn::Color(26, 102, 230)); - mXpBar = new ProgressBar((float) player_node->getExp() - / player_node->getExpNeeded(), - 100, 20, gcn::Color(143, 192, 211)); + int max = player_node->getMaxHp(); + mHpBar = new ProgressBar(max ? (float) player_node->getHp() / max : 0, + 100, 20, Theme::PROG_HP); + max = player_node->getMaxMP(); + mMpBar = new ProgressBar(max ? (float) player_node->getMP() / max : 0, + 100, 20, Net::getPlayerHandler()->canUseMagic() ? + Theme::PROG_MP : Theme::PROG_NO_MP); + max = player_node->getExpNeeded(); + mXpBar = new ProgressBar(max ? (float) player_node->getExp() / max : 0, + 100, 20, Theme::PROG_EXP); mHpBar->setPosition(0, 3); mMpBar->setPosition(mHpBar->getWidth() + 3, 3); mXpBar->setPosition(mMpBar->getX() + mMpBar->getWidth() + 3, 3); |