diff options
-rw-r--r-- | src/being/being.cpp | 54 | ||||
-rw-r--r-- | src/being/being.h | 12 |
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. */ |