summaryrefslogtreecommitdiff
path: root/src/resources/spritedef.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-03 20:44:04 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-03 20:44:04 +0300
commitf2bf0b4459f4d2595688ca374feed5b756959b28 (patch)
tree9a7ccc520102793884e390f785fa821f30755062 /src/resources/spritedef.cpp
parent51975cd8624fff3b20aa3b7b1932555e32786561 (diff)
downloadmanaplus-f2bf0b4459f4d2595688ca374feed5b756959b28.tar.gz
manaplus-f2bf0b4459f4d2595688ca374feed5b756959b28.tar.bz2
manaplus-f2bf0b4459f4d2595688ca374feed5b756959b28.tar.xz
manaplus-f2bf0b4459f4d2595688ca374feed5b756959b28.zip
Add default offsets in imageset tag for all animations.
Diffstat (limited to 'src/resources/spritedef.cpp')
-rw-r--r--src/resources/spritedef.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index b3b473cd7..db1c3d0c3 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -152,6 +152,8 @@ void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes)
return;
}
+ imageSet->setOffsetX(XML::getProperty(node, "offsetX", 0));
+ imageSet->setOffsetY(XML::getProperty(node, "offsetY", 0));
mImageSets[name] = imageSet;
}
@@ -219,8 +221,10 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode,
for_each_xml_child_node(frameNode, animationNode)
{
const int delay = XML::getProperty(frameNode, "delay", 0);
- int offsetX = XML::getProperty(frameNode, "offsetX", 0);
- int offsetY = XML::getProperty(frameNode, "offsetY", 0);
+ int offsetX = XML::getProperty(frameNode, "offsetX",
+ imageSet->getOffsetX());
+ int offsetY = XML::getProperty(frameNode, "offsetY",
+ imageSet->getOffsetY());
offsetY -= imageSet->getHeight() - 32;
offsetX -= imageSet->getWidth() / 2 - 16;