map: Fixed tile march for far wall/door rendering
authorLukas Krickl <lukas@krickl.dev>
Thu, 1 Jan 2026 07:45:21 +0000 (08:45 +0100)
committerLukas Krickl <lukas@krickl.dev>
Thu, 1 Jan 2026 07:45:21 +0000 (08:45 +0100)
src/map.s

index 29827a4069af73ab6a755a6752bdb5117b8bed52..443518a2a1395c926258ea6abf3a1556fc26901f 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -462,13 +462,15 @@ map_get_tile_march:
        ; either draws a wall or an open space 
        ; depending on the door state
 map_full_draw_far_center:
+       ld de, player
        map_load_march_vec dir_vector_forward
        ld a, 1 
-       ld de, player
        call map_get_tile_march
        ; hl = tile ahead
        ld de, t_flags0
        add hl, de
+
+       ; load forward direction bit
        ld b, [hl]
        ld a, [dir_tf_forward]
        and a, b ; mask out forward door bit
@@ -481,12 +483,34 @@ map_full_draw_far_center:
        ld a, 3
        jp tiles_block_copy
 @no_door:
-       
        ld hl, render_buffer  + RENDER_BUF_W * 5 + 8
        ld de, far_center_wall
        ld bc, RENDER_BUF_W - 4
        ld a, 3
        jp tiles_block_copy
+
+       
+       ; draws a near wall or doo
+map_full_draw_near_center:
+       ; near is just the current tile, no need for march load
+       ld a, [player+act_pos_y]
+       ld b, a
+       ld a, [player+act_pos_x]
+       ld c, a
+       call map_get_tile
+       ; hl = tile
+       ld de, t_flags0
+
+       ; get forward direction flag
+       add hl, de
+       ld b, [hl]
+       ld a, [dir_tf_forward]
+
+       ret z ; do nothing if there is an opening
+
+@no_door:
+       ret
+
        
        ; draws a full map copy into the current map view buffer
        ; based on the current location the player is facing
@@ -510,6 +534,9 @@ map_full_draw:
        ; either draw a wall or a door ahead
        call map_full_draw_far_center
 
+       ; draw near wall or door
+       call map_full_draw_near_center
+
 
 @done:
        call minimap_full_draw