From: Lukas Krickl Date: Fri, 1 Aug 2025 15:58:10 +0000 (+0200) Subject: mapgen: actors are now spawned based on the current floor instead of the map header X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=96a6f2fba2d9506c5ab198945dd9ccb3f14cdb6d;p=gbrg%2F.git mapgen: actors are now spawned based on the current floor instead of the map header --- diff --git a/src/actortables.s b/src/actortables.s index ee73654..c528f78 100644 --- a/src/actortables.s +++ b/src/actortables.s @@ -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 diff --git a/src/mapgen.s b/src/mapgen.s index b64cc77..cb580b7 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -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+]