summaryrefslogtreecommitdiff
path: root/scenegen.py
diff options
context:
space:
mode:
Diffstat (limited to 'scenegen.py')
-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)
+