diff options
author | Treeki <treeki@gmail.com> | 2012-09-28 03:10:31 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-28 03:10:31 +0200 |
commit | 940fec2a51a7dee50c4f6ae898dca8881108617b (patch) | |
tree | 4e8639c1b194c2e0fc75e8a158577159af75ac6d | |
parent | 166fc64dbea79897cc702770ca33a8e1c57a124f (diff) | |
download | koopatlas-940fec2a51a7dee50c4f6ae898dca8881108617b.tar.gz koopatlas-940fec2a51a7dee50c4f6ae898dca8881108617b.zip |
world def format updated
Diffstat (limited to '')
-rw-r--r-- | src/exporter.py | 13 | ||||
-rw-r--r-- | src/mapdata.py | 3 | ||||
-rw-r--r-- | src/worldeditor.py | 53 |
3 files changed, 41 insertions, 28 deletions
diff --git a/src/exporter.py b/src/exporter.py index ce87a12..23484c3 100644 --- a/src/exporter.py +++ b/src/exporter.py @@ -367,7 +367,7 @@ class KPMapExporter: data += zero32 # isNew data += zero32 # Extra pointer - elif node.worldDefID: + elif node.worldDefID != None: # i i i b b b b: node type, isNew, Extra pointer, world def ID, padding data += struct.pack('>iiibbbb', 4, 0, 0, node.worldDefID, 0, 0, 0) @@ -416,7 +416,12 @@ class KPMapExporter: ht1,ht2 = world.hudTextColours htf = world.hudHintTransform - data += struct.pack('>BBBB BBBB BBBB BBBB BBBB BBBB hhh BB', + try: + convertedWorldID = int(world.worldID) + except ValueError: + convertedWorldID = ord(world.worldID) - ord('A') + 10 + + data += struct.pack('>BBBB BBBB BBBB BBBB BBBB BBBB Bbb BBB 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], @@ -424,7 +429,9 @@ class KPMapExporter: 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 + world.uniqueKey, world.musicTrackID, + convertedWorldID, + 0, 0 ) # now that we're almost done... pack the strings diff --git a/src/mapdata.py b/src/mapdata.py index 5bfe9d5..e2a8a0d 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -549,11 +549,12 @@ class KPPathLayer(KPLayer): @mapfile.dumpable('world_definition') class KPWorldDef(object): - __dump_attribs__ = ('uniqueKey', 'name', 'fsHintColours', 'fsTextColours', 'hudHintTransform', 'hudTextColours', 'musicTrackID') + __dump_attribs__ = ('uniqueKey', 'name', 'worldID', 'fsHintColours', 'fsTextColours', 'hudHintTransform', 'hudTextColours', 'musicTrackID') def __init__(self): self.uniqueKey = -1 self.name = 'Untitled World' + self.worldID = '0' self.fsHintColours = ((0,0,0,255),(0,0,0,255)) self.fsTextColours = ((255,255,255,255),(255,255,255,255)) diff --git a/src/worldeditor.py b/src/worldeditor.py index 35e42a6..0993f35 100644 --- a/src/worldeditor.py +++ b/src/worldeditor.py @@ -16,7 +16,7 @@ def colourFromNiceStr(thing): return None class KPWorldTableModel(QtCore.QAbstractTableModel): - FIELDS = ('Name', 'Track ID', + FIELDS = ('Name', 'World ID', 'Track ID', 'FS Text 1', 'FS Text 2', 'FS Hint 1', 'FS Hint 2', 'HUD Text 1', 'HUD Text 2', @@ -55,23 +55,25 @@ class KPWorldTableModel(QtCore.QAbstractTableModel): if col == 0: return entry.name elif col == 1: + return entry.worldID + elif col == 2: return entry.musicTrackID - elif col == 2 or col == 3: - return editableColourStr(entry.fsTextColours[col - 2]) - elif col == 4 or col == 5: - return editableColourStr(entry.fsHintColours[col - 4]) - elif col == 6 or col == 7: - return editableColourStr(entry.hudTextColours[col - 6]) - elif col >= 8 and col <= 10: - return entry.hudHintTransform[col - 8] + elif col == 3 or col == 4: + return editableColourStr(entry.fsTextColours[col - 3]) + elif col == 5 or col == 6: + return editableColourStr(entry.fsHintColours[col - 5]) + elif col == 7 or col == 8: + return editableColourStr(entry.hudTextColours[col - 7]) + elif col >= 9 and col <= 11: + return entry.hudHintTransform[col - 9] if role == Qt.DecorationRole: - if col == 2 or col == 3: - return QtGui.QColor(*entry.fsTextColours[col - 2]) - elif col == 4 or col == 5: - return QtGui.QColor(*entry.fsHintColours[col - 4]) - elif col == 6 or col == 7: - return QtGui.QColor(*entry.hudTextColours[col - 6]) + if col == 3 or col == 4: + return QtGui.QColor(*entry.fsTextColours[col - 3]) + elif col == 5 or col == 6: + return QtGui.QColor(*entry.fsHintColours[col - 5]) + elif col == 7 or col == 8: + return QtGui.QColor(*entry.hudTextColours[col - 7]) return QtCore.QVariant() @@ -90,31 +92,34 @@ class KPWorldTableModel(QtCore.QAbstractTableModel): entry.name = str(value.toString()) success = True elif col == 1: + entry.worldID = str(value.toString()) + success = True + elif col == 2: v,ok = value.toInt() if ok: entry.musicTrackID = v success = True - elif col >= 2 and col <= 7: + elif col >= 3 and col <= 8: newCol = colourFromNiceStr(str(value.toString())) if newCol: success = True - if col == 2: + if col == 3: entry.fsTextColours = (newCol, entry.fsTextColours[1]) - elif col == 3: - entry.fsTextColours = (entry.fsTextColours[0], newCol) elif col == 4: - entry.fsHintColours = (newCol, entry.fsHintColours[1]) + entry.fsTextColours = (entry.fsTextColours[0], newCol) elif col == 5: - entry.fsHintColours = (entry.fsHintColours[0], newCol) + entry.fsHintColours = (newCol, entry.fsHintColours[1]) elif col == 6: - entry.hudTextColours = (newCol, entry.hudTextColours[1]) + entry.fsHintColours = (entry.fsHintColours[0], newCol) elif col == 7: + entry.hudTextColours = (newCol, entry.hudTextColours[1]) + elif col == 8: entry.hudTextColours = (entry.hudTextColours[0], newCol) - elif col >= 8 and col <= 10: + elif col >= 9 and col <= 11: v,ok = value.toInt() if ok: new = list(entry.hudHintTransform) - new[col - 8] = v + new[col - 9] = v entry.hudHintTransform = new success = True |