diff options
author | Treeki <treeki@gmail.com> | 2012-09-26 05:38:44 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-26 05:38:44 +0200 |
commit | 64df3b0e7503b2da43d5448f788bb560e5a6881c (patch) | |
tree | 878c5caaebfa82e938158651c86daaa4834fd022 /src/exporter.py | |
parent | 04d6d49eed7b952f3ba61f1364e538c6e5c8d5a2 (diff) | |
download | koopatlas-64df3b0e7503b2da43d5448f788bb560e5a6881c.tar.gz koopatlas-64df3b0e7503b2da43d5448f788bb560e5a6881c.zip |
added world change nodes. I hope this works.
Diffstat (limited to '')
-rw-r--r-- | src/exporter.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/exporter.py b/src/exporter.py index ad352d3..eeca252 100644 --- a/src/exporter.py +++ b/src/exporter.py @@ -193,11 +193,12 @@ class KPMapExporter: # now that we've got that, we can pack the first part of the file version = 1 - headerSize = 0x24 + headerSize = 0x2C tsInfoOffsetInHeader = 0x10 - data = bytearray(struct.pack('>4sIIIIIIII', 'KP_m', version, len(self.layers), headerSize + len(sectorData), 0, 0, 0, headerSize, 0)) + data = bytearray(struct.pack('>4sIIIIIIIIII', 'KP_m', version, len(self.layers), headerSize + len(sectorData), 0, 0, 0, headerSize, 0, 0, len(self.map.worlds))) requiredFixUps.append((0x18, 'UnlockBytecode')) requiredFixUps.append((0x20, self.map.bgName)) + requiredFixUps.append((0x24, '_WorldDefList')) stringsToAdd.add(self.map.bgName) # list of layer pointers goes here.. or will, later @@ -395,6 +396,32 @@ class KPMapExporter: data += struct.pack('>bbbbfi', available, 0, 0, 0, path.movementSpeed, path.animation) + # align it to 4 bytes before we write the world defs + padding = ((len(data) + 4) & ~4) - len(data) + data += ('\0' * padding) + + offsets['_WorldDefList'] = len(data) + for world in self.map.worlds: + requiredFixUps.append((len(data), world.name)) + stringsToAdd.add(world.name) + data += zero32 + + fst1,fst2 = world.fsTextColours + fsh1,fsh2 = world.fsHintColours + ht1,ht2 = world.hudTextColours + htf = world.hudHintTransform + + data += struct.pack('>BBBB BBBB BBBB BBBB BBBB BBBB hhh BB', + fst1[0],fst1[1],fst1[2],fst1[3], + fst2[0],fst2[1],fst2[2],fst2[3], + fsh1[0],fsh1[1],fsh1[2],fsh1[3], + fsh2[0],fsh2[1],fsh2[2],fsh2[3], + ht1[0],ht1[1],ht1[2],ht1[3], + ht2[0],ht2[1],ht2[2],ht2[3], + htf[0],htf[1],htf[2], + world.uniqueKey, world.musicTrackID + ) + # now that we're almost done... pack the strings for string in stringsToAdd: offsets[string] = len(data) |