diff options
Diffstat (limited to 'src/actorsprite.cpp')
-rw-r--r-- | src/actorsprite.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index b4b56451..68b92a1f 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -22,6 +22,7 @@ #include "client.h" #include "event.h" +#include "game.h" #include "imagesprite.h" #include "localplayer.h" #include "log.h" @@ -67,11 +68,8 @@ ActorSprite::~ActorSprite() bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const { - // TODO: Eventually, we probably should fix all sprite offsets so that - // these translations aren't necessary anymore. The sprites know - // best where their base point should be. - const int px = getPixelX() + offsetX - 16; - const int py = getPixelY() + offsetY - 16; + int px = getPixelX() + offsetX; + int py = getPixelY() + offsetY; if (mUsedTargetCursor) { @@ -80,6 +78,12 @@ bool ActorSprite::draw(Graphics *graphics, int offsetX, int offsetY) const mUsedTargetCursor->draw(graphics, px, py); } + Map *map = Game::instance() ? Game::instance()->getCurrentMap() : 0; + if (map) + { + py += map->getTileHeight() / 2; + } + return drawSpriteAt(graphics, px, py); } @@ -450,8 +454,8 @@ void ActorSprite::loadTargetCursor(const std::string &filename, for (unsigned int i = 0; i < currentImageSet->size(); ++i) { anim->addFrame(currentImageSet->get(i), 75, - (16 - (currentImageSet->getWidth() / 2)), - (16 - (currentImageSet->getHeight() / 2))); + -(currentImageSet->getWidth() / 2), + -(currentImageSet->getHeight() / 2)); } SimpleAnimation *currentCursor = new SimpleAnimation(anim); |