From 562543f0c7658f11595f37c886861efaf76b5d5a Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 15 Mar 2011 05:44:38 +0100 Subject: working scene support in dWMMap_c. todo: a proper tool for editing/previewing --- scenegen.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 scenegen.py (limited to 'scenegen.py') diff --git a/scenegen.py b/scenegen.py new file mode 100644 index 0000000..84fccc9 --- /dev/null +++ b/scenegen.py @@ -0,0 +1,42 @@ +import struct + +class Node: + pass + +BaseNode = Node() +BaseNode.mtx = [1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0] +BaseNode.brres_key = '3D00' +BaseNode.model_name = 'GoldwoodBase' +BaseNode.lm_type = 0 + +TreeNode = Node() +TreeNode.mtx = [1.0,0.0,0.0,60.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0] +TreeNode.brres_key = '3D00' +TreeNode.model_name = 'RedTree' +TreeNode.lm_type = 1 + + + +nodes = {} +nodes['Base'] = BaseNode +nodes['Tr00'] = TreeNode + +header = struct.pack('>4sI', b'MScn', len(nodes)) +entrydata = b'' +stringtable = b'' +currentoffset = 8 + (0x40 * len(nodes)) + +for key,node in nodes.items(): + #nodekey, brreskey, lmtype, nameoffset, matrix + + entrydata += struct.pack('>4s4sII', key.encode('Shift-JIS'), node.brres_key.encode('Shift-JIS'), node.lm_type, currentoffset) + for f in node.mtx: + entrydata += struct.pack('>f', f) + + stringtable += node.model_name.encode('Shift-JIS') + stringtable += b'\0' + currentoffset += len(node.model_name) + 1 + + +open('scenedata.bin', 'wb').write(header + entrydata + stringtable) + -- cgit v1.2.3