summaryrefslogtreecommitdiff
path: root/scenegen.py
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-03-15 05:44:38 +0100
committerTreeki <treeki@gmail.com>2011-03-15 05:44:38 +0100
commit562543f0c7658f11595f37c886861efaf76b5d5a (patch)
tree3ff106b802bd37cbf5af8bcc6943d2aeeddc5d3e /scenegen.py
parent4b440c0ac3040267be036e536c3e1ad69a5ef49d (diff)
downloadkamek-562543f0c7658f11595f37c886861efaf76b5d5a.tar.gz
kamek-562543f0c7658f11595f37c886861efaf76b5d5a.zip
working scene support in dWMMap_c. todo: a proper tool for editing/previewing
Diffstat (limited to '')
-rw-r--r--scenegen.py42
1 files changed, 42 insertions, 0 deletions
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)
+