map: Added more wall templates
authorLukas Krickl <lukas@krickl.dev>
Fri, 2 Jan 2026 06:02:54 +0000 (07:02 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 2 Jan 2026 06:02:54 +0000 (07:02 +0100)
Fixed east/west direction vectors.

makefile
maps/far_center_left_wall.inc
maps/far_center_right_wall.inc
maps/near_left_center_wall.inc [new file with mode: 0644]
maps/near_right_center_wall.inc [new file with mode: 0644]
src/map.s
src/tiles.s
tiles/bank8000.inc
tiles/bank9000.inc

index 8885b66949092eb8da58d3071c58a14ebdce5422..ba4cd844447979e0e185e21f202977b58b2f1dc4 100644 (file)
--- a/makefile
+++ b/makefile
@@ -44,3 +44,6 @@ maps:
 
        ./tools/tmx2map.py assets/maps/far_center_right_wall.tmx 1 > maps/far_center_right_wall.inc 
        ./tools/tmx2map.py assets/maps/far_center_left_wall.tmx 1 > maps/far_center_left_wall.inc 
+
+       ./tools/tmx2map.py assets/maps/near_right_center_wall.tmx 1 > maps/near_right_center_wall.inc 
+       ./tools/tmx2map.py assets/maps/near_left_center_wall.tmx 1 > maps/near_left_center_wall.inc 
index 2c38372ff69f5e69507309834969b8a3105825fc..b54609373ebc9a5bb3282d9433072676235ebf9b 100644 (file)
@@ -1,4 +1,4 @@
 ; this map was generated by tmx2map.py
 
-.db 0x15, 0x21, 0x21, 0x21, 0x10, 0x12, 0x12, 0x12, 0x25, 0x22, 0x22, 0x22
+.db 0x48, 0x49, 0x4a, 0x3, 0x15, 0x21, 0x21, 0x21, 0x10, 0x12, 0x12, 0x12, 0x25, 0x22, 0x22, 0x22
 
index 600df4455ac103e90ebd17044b7597f9ca3a6ec5..e896a662e03f9f68d037f8fbeafb60b07a63d9bf 100644 (file)
@@ -1,4 +1,4 @@
 ; this map was generated by tmx2map.py
 
-.db 0x21, 0x21, 0x21, 0x16, 0x12, 0x12, 0x12, 0x20, 0x22, 0x22, 0x22, 0x26
+.db 0x4, 0x4d, 0x4e, 0x4f, 0x21, 0x21, 0x21, 0x16, 0x12, 0x12, 0x12, 0x20, 0x22, 0x22, 0x22, 0x26
 
diff --git a/maps/near_left_center_wall.inc b/maps/near_left_center_wall.inc
new file mode 100644 (file)
index 0000000..f27d958
--- /dev/null
@@ -0,0 +1,5 @@
+; this map was generated by tmx2map.py
+
+.db 0x48, 0x49, 0x4a, 0x3, 0x21, 0x21, 0x21, 0x21, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12
+.db 0x22, 0x22, 0x22, 0x22
+
diff --git a/maps/near_right_center_wall.inc b/maps/near_right_center_wall.inc
new file mode 100644 (file)
index 0000000..0bbb00e
--- /dev/null
@@ -0,0 +1,5 @@
+; this map was generated by tmx2map.py
+
+.db 0x4, 0x4d, 0x4e, 0x4f, 0x21, 0x21, 0x21, 0x21, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12
+.db 0x22, 0x22, 0x22, 0x22
+
index a474d3514adee874ceefa5176eea32da5759ef23..397ea3815c7d866141733183ba854dc3b7340ca3 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -268,9 +268,9 @@ _dir_vectors_east:
        ; back
        .db 0, -1
        ; left
-       .db 1, 0
-       ; right
        .db -1, 0
+       ; right
+       .db 1, 0
 
 _dir_vectors_west:
        ; forward
@@ -278,9 +278,9 @@ _dir_vectors_west:
        ; back
        .db 0, 1
        ; left
-       .db -1, 0
-       ; right
        .db 1, 0
+       ; right
+       .db -1, 0
 
 _dir_vectors_north:
        ; forward
@@ -570,7 +570,10 @@ map_full_draw_near_left:
        ld de, near_left_door
        ld bc, RENDER_BUF_W - 4
        ld a, 7
-       jp tiles_block_copy
+       call tiles_block_copy
+
+       ; draw a near left wall if needed
+       jp map_full_draw_near_left_wall
 @no_door:
        ld hl, render_buffer + RENDER_BUF_W * 3
        ld de, near_left_wall
@@ -578,6 +581,32 @@ map_full_draw_near_left:
        ld a, 7
        jp tiles_block_copy
 
+       ; draws a near left wall if 
+       ; the near left tile has a forward wall
+       ; otherwise does nothing
+map_full_draw_near_left_wall:
+       ; get left tile
+       ld de, player
+       map_load_march_vec dir_vector_left
+       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 * 3
+       ld de, near_center_left_wall
+       ld bc, RENDER_BUF_W-4
+       ld a, 6
+       call tiles_block_copy
+
+       ret
+
 
        ; draws near right wall or door
 map_full_draw_near_right:
@@ -597,7 +626,9 @@ map_full_draw_near_right:
        ld de, near_right_door
        ld bc, RENDER_BUF_W - 4
        ld a, 7
-       jp tiles_block_copy
+       call tiles_block_copy
+
+       jp map_full_draw_near_right_wall
 @no_door:
        ld hl, render_buffer + RENDER_BUF_W * 3 + 16
        ld de, near_right_wall
@@ -606,6 +637,33 @@ map_full_draw_near_right:
        jp tiles_block_copy
 
 
+       ; draws a near right wall if 
+       ; the near right tile has a forward wall
+       ; otherwise does nothing
+map_full_draw_near_right_wall:
+       ; get left tile
+       ld de, player
+       map_load_march_vec dir_vector_right
+       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 * 3 + 16
+       ld de, near_center_right_wall
+       ld bc, RENDER_BUF_W-4
+       ld a, 6
+       call tiles_block_copy
+
+       ret
+
+
        ; draws far left wall or door
 map_full_draw_far_left:
        _map_full_draw_load_far_tile
index de492276bda39426f828c12c8996c51eefda62c1..1a64ef0dd3d90722dd5d9a462fc7fe48352aef06 100644 (file)
@@ -63,13 +63,21 @@ far_left_wall:
 far_right_wall:
 #include "far_right_wall.inc"
 
-       ; 4x3 tiles
+       ; 4x4 tiles
 far_center_left_wall:
 #include "far_center_left_wall.inc"
 
-       ; 4x3 tiles
+       ; 4x4 tiles
 far_center_right_wall:
 #include "far_center_right_wall.inc"
+       
+       ; 4x6 tiles
+near_center_left_wall:
+#include "near_left_center_wall.inc"
+
+       ; 4x6 tiles
+near_center_right_wall:
+#include "near_right_center_wall.inc"
 
        ; copies a row of tiles
        ; from a linear buffer into a new block
index 79a60a08c7f736989e7b162e873f8f7d9c5341b1..8af81cf2d8af91db1b9df8860b1be83b248eb345 100644 (file)
 .chr 00000000
 .chr 00000000
 ; tile 72
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 33111111
+.chr 31333311
+.chr 31111133
+.chr 31111111
+.chr 31111111
+.chr 31111111
+.chr 31111111
+.chr 31111111
 ; tile 73
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 33111111
+.chr 11333111
+.chr 11111333
+.chr 11111111
+.chr 11111111
+.chr 11111111
 ; tile 74
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 31111111
+.chr 13333111
+.chr 11111333
+.chr 11111111
 ; tile 75
 .chr 00000000
 .chr 00000000
 .chr 00000000
 .chr 00000000
 ; tile 77
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111113
+.chr 11133331
+.chr 33311111
+.chr 11111111
 ; tile 78
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111133
+.chr 11133311
+.chr 33311111
+.chr 11111111
+.chr 11111111
+.chr 11111111
 ; tile 79
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111133
+.chr 11333313
+.chr 33111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
 ; tile 80
 .chr 30222222
 .chr 30222222
index 79a60a08c7f736989e7b162e873f8f7d9c5341b1..8af81cf2d8af91db1b9df8860b1be83b248eb345 100644 (file)
 .chr 00000000
 .chr 00000000
 ; tile 72
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 33111111
+.chr 31333311
+.chr 31111133
+.chr 31111111
+.chr 31111111
+.chr 31111111
+.chr 31111111
+.chr 31111111
 ; tile 73
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 33111111
+.chr 11333111
+.chr 11111333
+.chr 11111111
+.chr 11111111
+.chr 11111111
 ; tile 74
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 31111111
+.chr 13333111
+.chr 11111333
+.chr 11111111
 ; tile 75
 .chr 00000000
 .chr 00000000
 .chr 00000000
 .chr 00000000
 ; tile 77
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111111
+.chr 11111113
+.chr 11133331
+.chr 33311111
+.chr 11111111
 ; tile 78
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111111
+.chr 11111111
+.chr 11111133
+.chr 11133311
+.chr 33311111
+.chr 11111111
+.chr 11111111
+.chr 11111111
 ; tile 79
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 11111133
+.chr 11333313
+.chr 33111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
+.chr 11111113
 ; tile 80
 .chr 30222222
 .chr 30222222