From 6603adac2856d0c7f743cc6ce72afe677a8bf7fd Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 2 Jan 2026 07:21:16 +0100 Subject: [PATCH] map: Added far wall rendering --- src/map.s | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 6 deletions(-) diff --git a/src/map.s b/src/map.s index 397ea38..4fcb633 100644 --- a/src/map.s +++ b/src/map.s @@ -288,9 +288,9 @@ _dir_vectors_north: ; back .db 1, 0 ; left - .db 0, 1 - ; right .db 0, -1 + ; right + .db 0, 1 _dir_vectors_south: ; forward @@ -298,9 +298,9 @@ _dir_vectors_south: ; back .db -1, 0 ; left - .db 0, -1 - ; right .db 0, 1 + ; right + .db 0, -1 _dir_tf_south: ; forward @@ -682,7 +682,9 @@ map_full_draw_far_left: ld de, far_left_door ld bc, RENDER_BUF_W - 4 ld a, 5 - jp tiles_block_copy + call tiles_block_copy + + jp map_full_draw_far_left_wall @no_door: ld hl, render_buffer + RENDER_BUF_W * 4 + 4 ld de, far_left_wall @@ -691,6 +693,41 @@ map_full_draw_far_left: jp tiles_block_copy + ; draws a far left wall if + ; the far left tile has a forward wall + ; otherwise does nothing +map_full_draw_far_left_wall: + ; get left tile + ld de, player + map_load_march_vec dir_vector_left + ; load the march vec, but or it with the forward vec + ld a, [dir_vector_forward] + or a, d + ld d, a + ld a, [dir_vector_forward+1] + or a, e + ld e, a ; d/e = forward + left vector + + ld a, 1 + call map_get_tile_march + ; hl = tile to the left + ld de, t_flags0 + add hl, de + + ld b, [hl] + ld a, [dir_tf_forward] + and a, b + ret nz ; bail if door + + ld hl, render_buffer + RENDER_BUF_W * 4 + 4 + ld de, far_center_left_wall + ld bc, RENDER_BUF_W-4 + ld a, 4 + call tiles_block_copy + + ret + + ; draws far right wall or door map_full_draw_far_right: _map_full_draw_load_far_tile @@ -709,7 +746,9 @@ map_full_draw_far_right: ld de, far_right_door ld bc, RENDER_BUF_W - 4 ld a, 5 - jp tiles_block_copy + call tiles_block_copy + + jp map_full_draw_far_right_wall @no_door: ld hl, render_buffer + RENDER_BUF_W * 4 + 12 ld de, far_right_wall @@ -717,6 +756,41 @@ map_full_draw_far_right: ld a, 5 jp tiles_block_copy + + ; draws a far right wall if + ; the far right tile has a forward wall + ; otherwise does nothing +map_full_draw_far_right_wall: + ; get right tile + ld de, player + map_load_march_vec dir_vector_right + ; load the march vec, but or it with the forward vec + ld a, [dir_vector_forward] + or a, d + ld d, a + ld a, [dir_vector_forward+1] + or a, e + ld e, a ; d/e = forward + left vector + + ld a, 1 + call map_get_tile_march + ; hl = tile to the left + ld de, t_flags0 + add hl, de + + ld b, [hl] + ld a, [dir_tf_forward] + and a, b + ret nz ; bail if door + + ld hl, render_buffer + RENDER_BUF_W * 4 + 12 + ld de, far_center_right_wall + ld bc, RENDER_BUF_W-4 + ld a, 4 + call tiles_block_copy + + ret + ; draws a full map copy into the current map view buffer ; based on the current location the player is facing -- 2.30.2