summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-05 22:56:42 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-05 22:56:42 +0200
commit1c49a83df05dbf6837687e1bfc5b142a680144ed (patch)
tree5e1ae2d371ca8ec6aa5caa95cf8e4bee00f726ee /src/gui
parent6941cbc58099ee54ba326382eaf4de805d933e0e (diff)
downloadmanaverse-1c49a83df05dbf6837687e1bfc5b142a680144ed.tar.gz
manaverse-1c49a83df05dbf6837687e1bfc5b142a680144ed.tar.bz2
manaverse-1c49a83df05dbf6837687e1bfc5b142a680144ed.tar.xz
manaverse-1c49a83df05dbf6837687e1bfc5b142a680144ed.zip
Add hp bar to local player.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/setup_colors.cpp2
-rw-r--r--src/gui/setup_other.cpp17
-rw-r--r--src/gui/setup_other.h3
-rw-r--r--src/gui/userpalette.cpp5
-rw-r--r--src/gui/userpalette.h2
5 files changed, 28 insertions, 1 deletions
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 76510a283..68d517cae 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -302,6 +302,8 @@ void Setup_Colors::valueChanged(const gcn::SelectionEvent &event _UNUSED_)
case UserPalette::ROAD_POINT:
case UserPalette::MONSTER_HP:
case UserPalette::MONSTER_HP2:
+ case UserPalette::PLAYER_HP:
+ case UserPalette::PLAYER_HP2:
mGradDelayLabel->setCaption(_("Alpha:"));
mGradDelayText->setRange(0, 255);
mGradDelaySlider->setScale(0, 255);
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index 54ec1c65d..5a2b77a81 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -63,6 +63,7 @@
#define ACTION_WARP_PARTICLE "warp particle"
#define ACTION_AUTO_SHOP "auto shop"
#define ACTION_SHOW_MOB_HP "show mob hp"
+#define ACTION_SHOW_OWN_HP "show own hp"
Setup_Other::Setup_Other():
mShowMonstersTakedDamage(config.getBoolValue("showMonstersTakedDamage")),
@@ -87,7 +88,8 @@ Setup_Other::Setup_Other():
mQuickStats(config.getBoolValue("quickStats")),
mWarpParticle(config.getBoolValue("warpParticle")),
mAutoShop(config.getBoolValue("autoShop")),
- mShowMobHP(config.getBoolValue("showMobHP"))
+ mShowMobHP(config.getBoolValue("showMobHP")),
+ mShowOwnHP(config.getBoolValue("showOwnHP"))
{
setName(_("Misc"));
@@ -178,6 +180,10 @@ Setup_Other::Setup_Other():
mShowMobHP,
this, ACTION_SHOW_MOB_HP);
+ mShowOwnHPCheckBox = new CheckBox(_("Show own hp bar"),
+ mShowOwnHP,
+ this, ACTION_SHOW_OWN_HP);
+
// Do the layout
LayoutHelper h(this);
ContainerPlacer place = h.getPlacer(0, 0);
@@ -192,6 +198,7 @@ Setup_Other::Setup_Other():
place(12, 4, mWarpParticleCheckBox, 10);
place(12, 5, mAutoShopCheckBox, 10);
place(12, 6, mShowMobHPCheckBox, 10);
+ place(12, 7, mShowOwnHPCheckBox, 10);
place(0, 3, mFloorItemsHighlightCheckBox, 12);
place(0, 4, mHighlightAttackRangeCheckBox, 12);
place(0, 5, mHighlightMonsterAttackRangeCheckBox, 12);
@@ -320,6 +327,10 @@ void Setup_Other::action(const gcn::ActionEvent &event)
{
mShowMobHP = mShowMobHPCheckBox->isSelected();
}
+ else if (event.getId() == ACTION_SHOW_OWN_HP)
+ {
+ mShowOwnHP = mShowOwnHPCheckBox->isSelected();
+ }
}
void Setup_Other::cancel()
@@ -389,6 +400,9 @@ void Setup_Other::cancel()
mShowMobHP = config.getBoolValue("showMobHP");
mShowMobHPCheckBox->setSelected(mShowMobHP);
+
+ mShowOwnHP = config.getBoolValue("showOwnHP");
+ mShowOwnHPCheckBox->setSelected(mShowOwnHP);
}
void Setup_Other::apply()
@@ -416,6 +430,7 @@ void Setup_Other::apply()
config.setValue("warpParticle", mWarpParticle);
config.setValue("autoShop", mAutoShop);
config.setValue("showMobHP", mShowMobHP);
+ config.setValue("showOwnHP", mShowOwnHP);
logger->setDebugLog(mDebugLog);
}
diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h
index b20401be5..6a092e93f 100644
--- a/src/gui/setup_other.h
+++ b/src/gui/setup_other.h
@@ -119,6 +119,9 @@ class Setup_Other : public SetupTab, public gcn::ActionListener
gcn::CheckBox *mShowMobHPCheckBox;
bool mShowMobHP;
+ gcn::CheckBox *mShowOwnHPCheckBox;
+ bool mShowOwnHP;
+
EditDialog *mEditDialog;
};
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index 03e5c1eed..46f1b72b3 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -52,6 +52,8 @@ const std::string ColorTypeNames[] =
"ColorParticle",
"ColorPickupInfo",
"ColorExpInfo",
+ "ColorPlayerHp",
+ "ColorPlayerHp2",
"ColorHitPlayerMonster",
"ColorHitMonsterPlayer",
"ColorHitPlayerPlayer",
@@ -124,6 +126,9 @@ UserPalette::UserPalette():
addColor(PARTICLE, 0xffffff, STATIC, _("Particle Effects"));
addColor(PICKUP_INFO, 0x28dc28, STATIC, _("Pickup Notification"));
addColor(EXP_INFO, 0xffff00, STATIC, _("Exp Notification"));
+ addColor(PLAYER_HP, 0x00ff00, STATIC, _("Player HP bar"), 50);
+ addColor(PLAYER_HP2, 0xff0000, STATIC,
+ _("Player HP bar (second color)"), 50);
addColor(HIT_PLAYER_MONSTER, 0x0064ff, STATIC, _("Player Hits Monster"));
addColor(HIT_MONSTER_PLAYER, 0xff3232, STATIC, _("Monster Hits Player"));
addColor(HIT_PLAYER_PLAYER, 0xff5050, STATIC,
diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h
index 057d47113..db2463e20 100644
--- a/src/gui/userpalette.h
+++ b/src/gui/userpalette.h
@@ -53,6 +53,8 @@ class UserPalette : public Palette, public gcn::ListModel
PARTICLE,
PICKUP_INFO,
EXP_INFO,
+ PLAYER_HP,
+ PLAYER_HP2,
HIT_PLAYER_MONSTER,
HIT_MONSTER_PLAYER,
HIT_PLAYER_PLAYER,