diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-17 16:46:06 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-06-17 16:46:06 +0200 |
commit | 914d3de7c324cb1ec456892702689718352a7842 (patch) | |
tree | eb05c251adb6f012a40f3d7de4eb42ab854b7d94 /src/simpleanimation.cpp | |
parent | faf0a45d6b8b85acd2836cf5e8e7f7c5b161931d (diff) | |
download | mana-914d3de7c324cb1ec456892702689718352a7842.tar.gz mana-914d3de7c324cb1ec456892702689718352a7842.tar.bz2 mana-914d3de7c324cb1ec456892702689718352a7842.tar.xz mana-914d3de7c324cb1ec456892702689718352a7842.zip |
First pass on removing tile hard coded values.
Every files has been checked against the hard coded
32 values except the map.cpp file.
I also added convenience functions in the Game class,
centralized the default item icon size, and removed two
unused defines in being.cpp.
Diffstat (limited to 'src/simpleanimation.cpp')
-rw-r--r-- | src/simpleanimation.cpp | 13 |
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")) { |