From f5c41235018fbc793199c0e7c34b52b04fde6828 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 18 Feb 2012 17:17:51 +0100 Subject: exporter fixes --- src/exporter.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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]) -- cgit v1.2.3