summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/exporter.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/exporter.py b/src/exporter.py
index 0c24d50..27e775a 100644
--- a/src/exporter.py
+++ b/src/exporter.py
@@ -22,8 +22,8 @@ def RGB5A3Encode(tex):
sspack = shortstruct.pack_into
offset = 0
- for ytile in xrange(0, padW, 4):
- for xtile in xrange(0, padH, 4):
+ for ytile in xrange(0, padH, 4):
+ for xtile in xrange(0, padW, 4):
for ypixel in xrange(ytile, ytile + 4):
for xpixel in xrange(xtile, xtile + 4):
@@ -89,7 +89,7 @@ class KPMapExporter:
sectorY = worldY / 16
destY = worldY % 16
- destRow = rawSectors[sectorY]
+ destRow = rawSectors[sectorY - sectorTop]
for srcX in xrange(layerWidth):
worldX = srcX + layerX
@@ -99,10 +99,10 @@ class KPMapExporter:
tile = srcRow[srcX]
if tile == -1: continue
- destSector = destRow[sectorX]
+ destSector = destRow[sectorX - sectorLeft]
if destSector is None:
destSector = [[-1 for j in xrange(16)] for i in xrange(16)]
- destRow[sectorX] = destSector
+ destRow[sectorX - sectorLeft] = destSector
destSector[destY][destX] = tile
@@ -396,7 +396,7 @@ class KPMapExporter:
imageData = []
- struct.pack_into('>ii', data, 8, len(textures), len(data))
+ struct.pack_into('>ii', data, 8, len(tilesets), len(data))
for setname in tilesets:
offsets[('tileset', setname)] = len(data)
data += self._buildGXTexObjRGB5A3(1024, 512, offsets[setname])