summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-21 14:15:43 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-21 14:15:43 +0300
commite2a97fe7991d05a721be8070f70cbfbd7c169698 (patch)
tree763ddca35111acc2caccb3578645e91374df8631 /src
parentb5a9c89e9d4d8b21bceda9cf2507dc7f6b726c91 (diff)
downloadplus-e2a97fe7991d05a721be8070f70cbfbd7c169698.tar.gz
plus-e2a97fe7991d05a721be8070f70cbfbd7c169698.tar.bz2
plus-e2a97fe7991d05a721be8070f70cbfbd7c169698.tar.xz
plus-e2a97fe7991d05a721be8070f70cbfbd7c169698.zip
Add settings for monster hp bar offset.
New attributes: hpBarOffsetX, hpBarOffsetY Example: <monster id="0" name="Piou" targetCursor="small" walkType="fly" hpBarOffsetX="30">
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp10
-rw-r--r--src/resources/beingcommon.cpp3
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h14
4 files changed, 26 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp
index fc0f9a9c3..1ed1700f4 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2167,14 +2167,18 @@ bool Being::drawSpriteAt(Graphics *const graphics,
drawHpBar(graphics, maxHP, mHP, mDamageTaken,
UserPalette::MONSTER_HP, UserPalette::MONSTER_HP2,
- x - 50 + 16, y + 32 - 6, 2 * 50, 4);
+ x - 50 + 16 + mInfo->getHpBarOffsetX(),
+ y + 32 - 6 + mInfo->getHpBarOffsetY(),
+ 2 * 50, 4);
}
- if (mShowOwnHP && player_node == this && mAction != DEAD)
+ if (mShowOwnHP && mInfo && player_node == this && mAction != DEAD)
{
drawHpBar(graphics, PlayerInfo::getAttribute(PlayerInfo::MAX_HP),
PlayerInfo::getAttribute(PlayerInfo::HP), 0,
UserPalette::PLAYER_HP, UserPalette::PLAYER_HP2,
- x - 50 + 16, y + 32 - 6, 2 * 50, 4);
+ x - 50 + 16 + mInfo->getHpBarOffsetX(),
+ y + 32 - 6 + mInfo->getHpBarOffsetY(),
+ 2 * 50, 4);
}
return res;
}
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp
index fc58dbbc7..66c5586ee 100644
--- a/src/resources/beingcommon.cpp
+++ b/src/resources/beingcommon.cpp
@@ -41,4 +41,7 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info, XmlNodePtr node,
info->setNameOffsetX(XML::getProperty(node, "nameOffsetX", 0));
info->setNameOffsetY(XML::getProperty(node, "nameOffsetY", 0));
info->setSortOffsetY(XML::getProperty(node, "sortOffsetY", 0));
+
+ info->setHpBarOffsetX(XML::getProperty(node, "hpBarOffsetX", 0));
+ info->setHpBarOffsetY(XML::getProperty(node, "hpBarOffsetY", 0));
}
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index bd45ec9ed..1d316df5e 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -51,6 +51,8 @@ BeingInfo::BeingInfo() :
mTargetOffsetY(0),
mNameOffsetX(0),
mNameOffsetY(0),
+ mHpBarOffsetX(0),
+ mHpBarOffsetY(0),
mMaxHP(0),
mSortOffsetY(0),
mDeadSortOffsetY(31),
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index c90e3296e..5b2b7b87c 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -172,6 +172,18 @@ class BeingInfo final
int getNameOffsetY() const A_WARN_UNUSED
{ return mNameOffsetY; }
+ void setHpBarOffsetX(const int n)
+ { mHpBarOffsetX = n; }
+
+ int getHpBarOffsetX() const A_WARN_UNUSED
+ { return mHpBarOffsetX; }
+
+ void setHpBarOffsetY(const int n)
+ { mHpBarOffsetY = n; }
+
+ int getHpBarOffsetY() const A_WARN_UNUSED
+ { return mHpBarOffsetY; }
+
void setMaxHP(const int n)
{ mMaxHP = n; }
@@ -242,6 +254,8 @@ class BeingInfo final
int mTargetOffsetY;
int mNameOffsetX;
int mNameOffsetY;
+ int mHpBarOffsetX;
+ int mHpBarOffsetY;
int mMaxHP;
int mSortOffsetY;
int mDeadSortOffsetY;