summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/exporter.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/exporter.py b/src/exporter.py
index f6798c7..b1afaaa 100644
--- a/src/exporter.py
+++ b/src/exporter.py
@@ -421,7 +421,11 @@ class KPMapExporter:
except ValueError:
convertedWorldID = ord(world.worldID) - ord('A') + 10
- data += struct.pack('>BBBB BBBB BBBB BBBB BBBB BBBB hbb BBB B',
+ parseCrap = world.titleScreenID.split('-')
+ tsW = int(parseCrap[0])
+ tsL = int(parseCrap[1])
+
+ data += struct.pack('>BBBB BBBB BBBB BBBB BBBB BBBB hbb BBB BB BBB',
fst1[0],fst1[1],fst1[2],fst1[3],
fst2[0],fst2[1],fst2[2],fst2[3],
fsh1[0],fsh1[1],fsh1[2],fsh1[3],
@@ -431,7 +435,8 @@ class KPMapExporter:
htf[0],htf[1],htf[2],
world.uniqueKey, world.musicTrackID,
convertedWorldID,
- 0
+ tsW - 1, tsL - 1,
+ 0, 0, 0
)
# now that we're almost done... pack the strings
@@ -468,7 +473,10 @@ class KPMapExporter:
struct.pack_into('>ii', data, tsInfoOffsetInHeader, len(tilesets), len(data))
for setname in tilesets:
offsets[('tileset', setname)] = len(data)
- data += self._buildGXTexObjRGB5A3(896, 448, offsets[setname])
+ if 'RGBA8' in setname:
+ data += self._buildGXTexObjRGBA8(896, 448, offsets[setname])
+ else:
+ data += self._buildGXTexObjRGB5A3(896, 448, offsets[setname])
for tex in textures:
offsets[tex] = len(data)
@@ -550,6 +558,18 @@ class KPMapExporter:
0x0202
)
+ def _buildGXTexObjRGBA8(self, width, height, imgOffset):
+ # Format: RGBA8 (6)
+ # Wrap: CLAMP (0)
+ return struct.pack('>IIIIIIIHH',
+ 0x90, 0,
+ (0x600000 | ((height - 1) << 10) | (width - 1)),
+ 0x10000000 + imgOffset, # (imgptr >> 5)
+ 0, 0, 0,
+ (((width + 3) / 4) * ((height + 3) / 4)) & 0x7FFF,
+ 0x0202
+ )
+
def _packSectorData(self, sectors):
rowStruct = struct.Struct('>16h')