From 1c59d2d1999a6dfe3fcc31518c76d27d34fd9b30 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Mar 2016 19:33:51 +0300 Subject: Split drawSpriteAt into drawPlayerSpriteAt and drawOtherSpriteAt. --- src/being/being.cpp | 54 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'src/being/being.cpp') 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, -- cgit v1.2.3-70-g09d2