From: Lukas Krickl Date: Thu, 21 Aug 2025 10:33:48 +0000 (+0200) Subject: mapgen: if a player spawns on a door the door tile is now removed X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=3abfcd6d252ca76e2909c25d3487528bc98a1531;p=gbrg%2F.git mapgen: if a player spawns on a door the door tile is now removed --- 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