summaryrefslogtreecommitdiff
path: root/src/simpleanimation.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-22 18:58:47 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-06-22 18:58:47 +0200
commit852ff45c35c422b5264487669934b392a8657465 (patch)
tree380751fae34a7dcd7b31bd84e303b9086eb17485 /src/simpleanimation.cpp
parent2a11c6c5d874d661dcb7f016183c3c3e64e65f3c (diff)
parentec3c689c64922baf4a9f99bc6e9345e0a80403e8 (diff)
downloadmana-client-852ff45c35c422b5264487669934b392a8657465.tar.gz
mana-client-852ff45c35c422b5264487669934b392a8657465.tar.bz2
mana-client-852ff45c35c422b5264487669934b392a8657465.tar.xz
mana-client-852ff45c35c422b5264487669934b392a8657465.zip
Merge branch 'master' of gitorious.org:~bertram/mana/mana-any-square-tile-size
Diffstat (limited to 'src/simpleanimation.cpp')
-rw-r--r--src/simpleanimation.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index 7ef433ea..24a17ce7 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -21,6 +21,7 @@
#include "simpleanimation.h"
+#include "game.h"
#include "graphics.h"
#include "log.h"
@@ -132,15 +133,19 @@ void SimpleAnimation::initializeAnimation(xmlNodePtr animationNode)
return;
// Get animation frames
- for ( xmlNodePtr frameNode = animationNode->xmlChildrenNode;
- frameNode;
+ for (xmlNodePtr frameNode = animationNode->xmlChildrenNode; frameNode;
frameNode = frameNode->next)
{
int delay = XML::getProperty(frameNode, "delay", 0);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
- offsetY -= imageset->getHeight() - 32;
- offsetX -= imageset->getWidth() / 2 - 16;
+ Game *game = Game::instance();
+ if (game)
+ {
+ offsetX -= imageset->getWidth() / 2
+ - game->getCurrentTileWidth() / 2;
+ offsetY -= imageset->getHeight() - game->getCurrentTileHeight();
+ }
if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{