Added basic script to convert actor layers
authorLukas Krickl <lukas@krickl.dev>
Thu, 24 Oct 2024 15:45:12 +0000 (17:45 +0200)
committerLukas Krickl <lukas@krickl.dev>
Thu, 24 Oct 2024 15:45:12 +0000 (17:45 +0200)
maps/base_room.s
src/wram.s
tools/tms2map.py

index 85412dd6429f5b4b25b506b6a14b354ed2dda476..48028fdb6512f29edbdb440fe0e96d806ce55a68 100644 (file)
@@ -1,3 +1,7 @@
+base_room_actors:
+.db  8
+.db  1 , 67 , 54 , 0
+.db  1 , 55 , 40 , 0
 base_room_bg:
 .db 0x60, 0x62, 0x62, 0x64, 0x40, 0x40, 0x66, 0x62, 0x62, 0x68, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x46, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x48, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xe2, 0x4c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x6a, 0x6c, 0x4a, 0x4a, 0x42, 0x40, 0x40, 0x44, 0x4a, 0x4a, 0x6e
 base_room_flags:
index ff26def7507d9a219e91674cd7c6a2b09c66f682..b8d46f2e0ad7238b126d8fda66339df7559f5712 100644 (file)
@@ -92,6 +92,9 @@ curr_room_flags: .adv 2
 
   ; ptr to actor table of size actors_max/2
   ; populate before loading a map
+  ; layout:
+  ;   byte 0: length of actor table 
+  ;   bytes 1-n: n bytes of actor data to be copied to actor table
 curr_room_init_act: .adv 2
 
   ; drawing related flags
index a2b866f4f3e772ade28df74394f58187c778ab54..a54a63d1d83125019d77fcd1a21af58a784afa68 100755 (executable)
@@ -30,6 +30,10 @@ def print_data(data, name, layer):
             end = '\n'
         print(hex(val), end=end)
 
+def print_actor(atype, y, x, flags):
+    print(".db ", int(atype), ",", int(float(y)), ",", int(float(x)), ",", int(flags))
+
+
 def convert(src, name):
     tree = ET.parse(src)
     root = tree.getroot()
@@ -37,6 +41,19 @@ def convert(src, name):
         if child.tag == "layer":
             for data in child:
                 print_data(data.text, name, child.attrib['name'])
+        elif child.tag == "objectgroup":
+            print(name + '_actors:')
+            print(".db ", len(child) * 4)
+            for data in child:
+                flags = 0
+                atype = 0
+                for props in data:
+                    for prop in props:
+                        if prop.attrib['name'] == 'type':
+                            atype = prop.attrib['value']
+                        elif prop.attrib['name'] == 'flags':
+                            flags = prop.attrib['value']
+                print_actor(atype, data.attrib['x'], data.attrib['y'], flags)