summaryrefslogtreecommitdiff
path: root/src/exporter.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/exporter.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/exporter.py b/src/exporter.py
index 2396633..f39497f 100644
--- a/src/exporter.py
+++ b/src/exporter.py
@@ -191,7 +191,8 @@ class KPMapExporter:
sectorData = self._packSectorData(sectors)
# now that we've got that, we can pack the first part of the file
- data = bytearray(struct.pack('>IIII', len(self.layers), 16 + len(sectorData), 0, 0))
+ data = bytearray(struct.pack('>IIIII', len(self.layers), 20 + len(sectorData), 0, 0, 0))
+ requiredFixUps.append((16, 'UnlockBytecode'))
# list of layer pointers goes here.. or will, later
data += sectorData
@@ -420,6 +421,14 @@ class KPMapExporter:
for piece in imageData:
data += piece
+ # at the end comes the unlock bytecode
+ offsets['UnlockBytecode'] = len(data)
+ unlockBytecode = ''
+ # note: subtract 1 from the world and level number when saving
+ # note: also limit world to 1-10 in the parser
+ # note: enforce maximum term limit (64)
+ # note: block recursion too much
+
# to finish up, correct every offset
for offset, target in requiredFixUps:
u32.pack_into(data, offset, offsets[target])