summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-13 19:33:51 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-13 19:53:11 +0300
commit1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30 (patch)
treebd0c292da513a5e076217a378d0c820ca2d09724 /src/being
parent6ca3e7e52584261f9d43de1a68c09f20a762cac1 (diff)
downloadplus-1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30.tar.gz
plus-1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30.tar.bz2
plus-1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30.tar.xz
plus-1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30.zip
Split drawSpriteAt into drawPlayerSpriteAt and drawOtherSpriteAt.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/being.cpp54
-rw-r--r--src/being/being.h12
2 files changed, 39 insertions, 27 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 80561eabf..45b971399 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2860,7 +2860,7 @@ void Being::drawPlayer(Graphics *restrict const graphics,
}
drawBeingCursor(graphics, px, py);
- drawSpriteAt(graphics, px, py);
+ drawPlayerSpriteAt(graphics, px, py);
for_each_horses(mUpHorseSprites)
{
@@ -2872,11 +2872,11 @@ void Being::drawPlayer(Graphics *restrict const graphics,
else
{
drawBeingCursor(graphics, px, py);
- drawSpriteAt(graphics, px, py);
+ drawPlayerSpriteAt(graphics, px, py);
}
#else
drawBeingCursor(graphics, px, py);
- drawSpriteAt(graphics, px, py);
+ drawPlayerSpriteAt(graphics, px, py);
#endif
}
}
@@ -2912,7 +2912,7 @@ void Being::drawOther(Graphics *restrict const graphics,
// getActorY() + offsetY;
const int py = mPixelY - mapTileSize + offsetY;
drawBeingCursor(graphics, px, py);
- drawSpriteAt(graphics, px, py);
+ drawOtherSpriteAt(graphics, px, py);
}
void Being::draw(Graphics *restrict const graphics,
@@ -2991,9 +2991,33 @@ void Being::drawBasic(Graphics *restrict const graphics,
CompoundSprite::draw(graphics, x, y);
}
-void Being::drawSpriteAt(Graphics *restrict const graphics,
- const int x,
- const int y) const restrict2
+void Being::drawPlayerSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2
+{
+ CompoundSprite::draw(graphics, x, y);
+
+ if (mShowOwnHP &&
+ mInfo &&
+ localPlayer == this &&
+ mAction != BeingAction::DEAD)
+ {
+ drawHpBar(graphics,
+ PlayerInfo::getAttribute(Attributes::MAX_HP),
+ PlayerInfo::getAttribute(Attributes::HP),
+ 0,
+ UserColorId::PLAYER_HP,
+ UserColorId::PLAYER_HP2,
+ x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
+ y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
+ 2 * 50,
+ 4);
+ }
+}
+
+void Being::drawOtherSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2
{
if (mHighlightMapPortals &&
mMap &&
@@ -3066,22 +3090,6 @@ void Being::drawSpriteAt(Graphics *restrict const graphics,
2 * 50,
4);
}
- if (mShowOwnHP &&
- mInfo &&
- localPlayer == this &&
- mAction != BeingAction::DEAD)
- {
- drawHpBar(graphics,
- PlayerInfo::getAttribute(Attributes::MAX_HP),
- PlayerInfo::getAttribute(Attributes::HP),
- 0,
- UserColorId::PLAYER_HP,
- UserColorId::PLAYER_HP2,
- x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
- y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
- 2 * 50,
- 4);
- }
}
void Being::drawHpBar(Graphics *restrict const graphics,
diff --git a/src/being/being.h b/src/being/being.h
index 0b1797c38..dbdb58acb 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -645,10 +645,6 @@ class Being notfinal : public ActorSprite,
const int x,
const int y) const restrict2 A_NONNULL(2);
- void drawSpriteAt(Graphics *restrict const graphics,
- const int x,
- const int y) const restrict2 A_NONNULL(2);
-
void setMoveTime() restrict2 noexcept
{ mMoveTime = cur_time; }
@@ -997,6 +993,14 @@ class Being notfinal : public ActorSprite,
void serverRemove() restrict2 noexcept;
protected:
+ void drawPlayerSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2 A_NONNULL(2);
+
+ void drawOtherSpriteAt(Graphics *restrict const graphics,
+ const int x,
+ const int y) const restrict2 A_NONNULL(2);
+
/**
* Updates name's location.
*/