From 3abfcd6d252ca76e2909c25d3487528bc98a1531 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 21 Aug 2025 12:33:48 +0200 Subject: [PATCH] mapgen: if a player spawns on a door the door tile is now removed --- src/mapgen.s | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mapgen.s b/src/mapgen.s index 374a3f4..fdf3caa 100644 --- a/src/mapgen.s +++ b/src/mapgen.s @@ -223,6 +223,29 @@ mapgen_draw_doors: pop hl @no_door_right: + ; check if player is on top of a door + ; if so remove it and mark as an exit instead + ld de, player_unit + call unit_get_pos + call map_get_tile + + ld a, b + cp a, DOOR_TILE_LEFT + jr z, @door_tile REL + cp a, DOOR_TILE_RIGHT + jr z, @door_tile REL + cp a, DOOR_TILE_TOP + jr z, @door_tile REL + cp a, DOOR_TILE_BOTTOM + jr z, @door_tile REL + + ret + +@door_tile: + xor a, a + ld [hl+], a ; clear tile + ld a, CF_EXIT + ld [hl], a ret ; places actors from a valid actor table -- 2.30.2