summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resources/mapreader.cpp12
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");