diff options
author | Jared Adams <jaxad0127@gmail.com> | 2011-05-30 11:13:31 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2011-05-30 12:35:08 -0600 |
commit | 0248b2f58c783f21b7e68a20deadc0a3f942c869 (patch) | |
tree | fb9487625c282f59325f0585f08e2efd0683cd39 /src/actorsprite.cpp | |
parent | b69c0511206d68a61fd08042d1c122c9fac22202 (diff) | |
download | mana-0248b2f58c783f21b7e68a20deadc0a3f942c869.tar.gz mana-0248b2f58c783f21b7e68a20deadc0a3f942c869.tar.bz2 mana-0248b2f58c783f21b7e68a20deadc0a3f942c869.tar.xz mana-0248b2f58c783f21b7e68a20deadc0a3f942c869.zip |
Remove some uneeded offsetting
Also fix position of being names.
Reviewed-by: Bertram
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); |