summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/tmx_converter.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tools/tmx_converter.py b/tools/tmx_converter.py
index 009a1145..379a4f34 100755
--- a/tools/tmx_converter.py
+++ b/tools/tmx_converter.py
@@ -92,6 +92,8 @@ class Warp(Object):
'dest_map',
'dest_x',
'dest_y',
+ 'dest_tile_x',
+ 'dest_tile_y',
) + other_warp_fields
class ContentHandler(xml.sax.ContentHandler):
@@ -264,12 +266,22 @@ class ContentHandler(xml.sax.ContentHandler):
])
)
elif isinstance(obj, Warp):
+ nx = hasattr(obj, 'dest_tile_x')
+ ny = hasattr(obj, 'dest_tile_y')
+ ox = hasattr(obj, 'dest_x')
+ oy = hasattr(obj, 'dest_y')
+ assert nx == ny != ox == oy, 'Error: mixed coordinate properties exist.'
+
+ if ox:
+ obj.dest_tile_x = obj.dest_x / 32;
+ obj.dest_tile_y = obj.dest_y / 32;
+
self.warps.write(
SEPARATOR.join([
'%s.gat,%d,%d' % (self.base, obj.x, obj.y),
'warp',
obj.name,
- '%d,%d,%s.gat,%d,%d\n' % (obj.w, obj.h, obj.dest_map, obj.dest_x / 32, obj.dest_y / 32),
+ '%d,%d,%s.gat,%d,%d\n' % (obj.w, obj.h, obj.dest_map, obj.dest_tile_x, obj.dest_tile_y),
])
)