diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-13 19:14:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-13 19:14:04 +0300 |
commit | 6ca3e7e52584261f9d43de1a68c09f20a762cac1 (patch) | |
tree | 09b6cf71e5b3679955f1b6e0833659c6d59ceea5 /src/being/being.cpp | |
parent | 8a8ef403f70b43458f90b6192ce8cedcf2c9a209 (diff) | |
download | manaverse-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.gz manaverse-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.bz2 manaverse-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.xz manaverse-6ca3e7e52584261f9d43de1a68c09f20a762cac1.zip |
Move cursor drawing function from ActorSprite into Being.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index b37db6c62..80561eabf 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2859,7 +2859,7 @@ void Being::drawPlayer(Graphics *restrict const graphics, py + mHorseInfo->downOffsetY); } - ActorSprite::draw1(graphics, px, py); + drawBeingCursor(graphics, px, py); drawSpriteAt(graphics, px, py); for_each_horses(mUpHorseSprites) @@ -2871,16 +2871,38 @@ void Being::drawPlayer(Graphics *restrict const graphics, } else { - ActorSprite::draw1(graphics, px, py); + drawBeingCursor(graphics, px, py); drawSpriteAt(graphics, px, py); } #else - ActorSprite::draw1(graphics, px, py); + drawBeingCursor(graphics, px, py); drawSpriteAt(graphics, px, py); #endif } } +void Being::drawBeingCursor(Graphics *const graphics, + const int offsetX, + const int offsetY) const +{ + if (mUsedTargetCursor) + { + mUsedTargetCursor->update(tick_time * MILLISECONDS_IN_A_TICK); + if (!mInfo) + { + mUsedTargetCursor->draw(graphics, + offsetX - mCursorPaddingX, + offsetY - mCursorPaddingY); + } + else + { + mUsedTargetCursor->draw(graphics, + offsetX + mInfo->getTargetOffsetX() - mCursorPaddingX, + offsetY + mInfo->getTargetOffsetY() - mCursorPaddingY); + } + } +} + void Being::drawOther(Graphics *restrict const graphics, const int offsetX, const int offsetY) const restrict2 @@ -2889,7 +2911,7 @@ void Being::drawOther(Graphics *restrict const graphics, const int px = mPixelX - mapTileSize / 2 + offsetX; // getActorY() + offsetY; const int py = mPixelY - mapTileSize + offsetY; - ActorSprite::draw1(graphics, px, py); + drawBeingCursor(graphics, px, py); drawSpriteAt(graphics, px, py); } |