diff options
author | Treeki <treeki@gmail.com> | 2012-07-24 15:55:58 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-07-24 15:55:58 +0200 |
commit | 1a7f17d93189ae9981ff286d67c9b0406e99ce96 (patch) | |
tree | 8c686c8fe1503146dcd54d00e2bb8eabc8f36919 /src | |
parent | 4a9608453a6010979e3c99edabeaf2061edd8c49 (diff) | |
download | koopatlas-1a7f17d93189ae9981ff286d67c9b0406e99ce96.tar.gz koopatlas-1a7f17d93189ae9981ff286d67c9b0406e99ce96.zip |
preparing for exporting
Diffstat (limited to '')
-rw-r--r-- | src/exporter.py | 11 | ||||
-rw-r--r-- | src/unlock.py | 2 |
2 files changed, 11 insertions, 2 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]) diff --git a/src/unlock.py b/src/unlock.py index 16063ca..dfeaa33 100644 --- a/src/unlock.py +++ b/src/unlock.py @@ -8,7 +8,7 @@ class UnlockParseError(ValueError): pass def parseUnlockText(text): - return _parseUnlockBit(text) + return _parseUnlockBit(text.lower()) def _parseUnlockBit(text): # blank criterion |