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 | |
parent | 8a8ef403f70b43458f90b6192ce8cedcf2c9a209 (diff) | |
download | manaplus-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.gz manaplus-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.bz2 manaplus-6ca3e7e52584261f9d43de1a68c09f20a762cac1.tar.xz manaplus-6ca3e7e52584261f9d43de1a68c09f20a762cac1.zip |
Move cursor drawing function from ActorSprite into Being.
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/actorsprite.cpp | 14 | ||||
-rw-r--r-- | src/being/actorsprite.h | 4 | ||||
-rw-r--r-- | src/being/being.cpp | 30 | ||||
-rw-r--r-- | src/being/being.h | 4 | ||||
-rw-r--r-- | src/being/flooritem.cpp | 1 |
5 files changed, 30 insertions, 23 deletions
diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index eab902537..41f7d92bd 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -103,20 +103,6 @@ ActorSprite::~ActorSprite() } } -void ActorSprite::draw1(Graphics *const graphics, - const int offsetX, - const int offsetY) const -{ - FUNC_BLOCK("ActorSprite::draw1", 1) - if (mUsedTargetCursor) - { - mUsedTargetCursor->update(tick_time * MILLISECONDS_IN_A_TICK); - mUsedTargetCursor->draw(graphics, - offsetX + getTargetOffsetX() - mCursorPaddingX, - offsetY + getTargetOffsetY() - mCursorPaddingY); - } -} - void ActorSprite::logic() { BLOCK_START("ActorSprite::logic") diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index 836403c52..68964d04d 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -69,10 +69,6 @@ class ActorSprite notfinal : public CompoundSprite, public Actor virtual ActorTypeT getType() const noexcept A_WARN_UNUSED { return ActorType::Unknown; } - void draw1(Graphics *const graphics, - const int offsetX, - const int offsetY) const A_NONNULL(2); - virtual void logic(); void setMap(Map *const map) override; 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); } diff --git a/src/being/being.h b/src/being/being.h index 7c3860220..0b1797c38 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -1106,6 +1106,10 @@ class Being notfinal : public ActorSprite, void dumpSprites() const restrict2; + void drawBeingCursor(Graphics *const graphics, + const int offsetX, + const int offsetY) const A_NONNULL(2); + const ActorTypeT mType; /** Speech Bubble components */ diff --git a/src/being/flooritem.cpp b/src/being/flooritem.cpp index 05352c40f..3dd5e3371 100644 --- a/src/being/flooritem.cpp +++ b/src/being/flooritem.cpp @@ -193,7 +193,6 @@ void FloorItem::draw(Graphics *const graphics, const int px = getActorX() + offsetX; const int py = getActorY() + offsetY; - ActorSprite::draw1(graphics, px, py); CompoundSprite::draw(graphics, px, py); if (mHighlight) |