mapgen: actors are now spawned based on the current floor instead of the map header
authorLukas Krickl <lukas@krickl.dev>
Fri, 1 Aug 2025 15:58:10 +0000 (17:58 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 1 Aug 2025 15:58:10 +0000 (17:58 +0200)
src/actortables.s
src/mapgen.s

index ee73654e9a3d6c849ce32aed6e10d1ebfb316265..c528f78b9ed32c80acd7fe2f6707b89ad75a57f7 100644 (file)
@@ -8,6 +8,7 @@
 ;   to use as a template use the actors but move the position
 ;   as needed and setting act_loot_table_dat.
 
+floor_1_actor_table:
 map_c_actor_table:
 .db 7 ; size
 dw unit_demo_2
@@ -29,4 +30,6 @@ dw unit_demo_warrior
 dw unit_demo_warrior
 dw unit_demo_warrior
 
-
+; actor tables for each floor
+floor_actor_tables:
+dw floor_1_actor_table
index b64cc77a344bba0d4de0a8460398e3318da900e9..cb580b7ae527703f662ca96f0cdc8748a1ff08d1 100644 (file)
@@ -394,7 +394,7 @@ mapgen_fix_door_adjacent_to_collider:
        ret
 
        ; places actors from a valid actor table
-       ; in the current map's header. This will overwrite the 
+       ; from the current floor value. This will overwrite the 
        ; header loaded by map_load. Preserves player entry.
        ; the length of the actor table must be maskable
        ; inputs:
@@ -407,16 +407,14 @@ mapgen_place_actors:
        ld d, 0
        call memset
 
-       ; load map ptr
-       ld a, [map_header]
-       ld l, a
-       ld a, [map_header+1]
-       ld h, a
 
-       ; now load the actor table template into hl
-       ld de, map_actor_table_ptr 
+       ; load floor actor tables
+       ld hl, floor_actor_tables
+       ld d, 0
+       ld a, [floor]
+       ld e, a
        add hl, de
-       ; hl = actor table ptr
+       ; hl = floor actor table ptr
 
        ; load actor table ptr
        ld a, [hl+]