; back
.db 1, 0
; left
- .db 0, 1
- ; right
.db 0, -1
+ ; right
+ .db 0, 1
_dir_vectors_south:
; forward
; back
.db -1, 0
; left
- .db 0, -1
- ; right
.db 0, 1
+ ; right
+ .db 0, -1
_dir_tf_south:
; forward
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
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
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
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