diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-06 21:40:50 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-06 21:40:50 +0000 |
commit | 0b709da73d0657fd3754f8bf1f871ca76cd2c95b (patch) | |
tree | bfe0e1c0645e238f0849996beb940eca5d37a076 | |
parent | b8bd8233525d03a575323eaf2933edcc347be860 (diff) | |
download | mana-0b709da73d0657fd3754f8bf1f871ca76cd2c95b.tar.gz mana-0b709da73d0657fd3754f8bf1f871ca76cd2c95b.tar.bz2 mana-0b709da73d0657fd3754f8bf1f871ca76cd2c95b.tar.xz mana-0b709da73d0657fd3754f8bf1f871ca76cd2c95b.zip |
Changed map reader code to allow for pixel offsets, based on TMW's trunk
client change.
-rw-r--r-- | src/resources/mapreader.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index ab3b0cae..c24c3690 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -233,6 +233,12 @@ MapReader::readMap(xmlNodePtr node, const std::string &path) } else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup")) { + // The object group offset is applied to each object individually + const int tileOffsetX = XML::getProperty(childNode, "x", 0); + const int tileOffsetY = XML::getProperty(childNode, "y", 0); + const int offsetX = tileOffsetX * tw; + const int offsetY = tileOffsetY * th; + for_each_xml_child_node(objectNode, childNode) { if (xmlStrEqual(objectNode->name, BAD_CAST "object")) @@ -260,7 +266,7 @@ MapReader::readMap(xmlNodePtr node, const std::string &path) continue; } - map->addParticleEffect(objName, objX, objY); + map->addParticleEffect(objName, objX + offsetX, objY + offsetY); } else { @@ -310,8 +316,8 @@ void MapReader::readLayer(xmlNodePtr node, Map *map) // Layers are not necessarily the same size as the map const int w = XML::getProperty(node, "width", map->getWidth()); const int h = XML::getProperty(node, "height", map->getHeight()); - const int offsetX = XML::getProperty(node, "xoffset", 0); - const int offsetY = XML::getProperty(node, "yoffset", 0); + const int offsetX = XML::getProperty(node, "x", 0); + const int offsetY = XML::getProperty(node, "y", 0); const std::string name = XML::getProperty(node, "name", ""); const bool isFringeLayer = (name.substr(0,6) == "Fringe"); |