From: Lukas Krickl Date: Thu, 1 Jan 2026 11:45:58 +0000 (+0100) Subject: maps: Added near center wall drawing X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=5c20db41f6ec6d0211a61aa4c62fa9416710b892;p=gbrg%2F.git maps: Added near center wall drawing --- diff --git a/makefile b/makefile index 07c59ef..37e45fb 100644 --- a/makefile +++ b/makefile @@ -28,5 +28,10 @@ maps: ./tools/tmx2map.py assets/maps/near_right_door.tmx 1 > maps/near_right_door.inc ./tools/tmx2map.py assets/maps/far_left_door.tmx 1 > maps/far_left_door.inc ./tools/tmx2map.py assets/maps/far_right_door.tmx 1 > maps/far_right_door.inc + ./tools/tmx2map.py assets/maps/far_center_door.tmx 1 > maps/far_center_door.inc ./tools/tmx2map.py assets/maps/far_center_wall.tmx 1 > maps/far_center_wall.inc + + ./tools/tmx2map.py assets/maps/near_center_wall_left.tmx 1 > maps/near_center_wall_left.inc + ./tools/tmx2map.py assets/maps/near_center_wall_middle.tmx 1 > maps/near_center_wall_middle.inc + ./tools/tmx2map.py assets/maps/near_center_wall_right.tmx 1 > maps/near_center_wall_right.inc diff --git a/maps/near_center_wall_left.inc b/maps/near_center_wall_left.inc new file mode 100644 index 0000000..e880587 --- /dev/null +++ b/maps/near_center_wall_left.inc @@ -0,0 +1,4 @@ +; this map was generated by tmx2map.py + +.db 0x15, 0x21, 0x21, 0x21, 0x10, 0x12, 0x12, 0x12, 0x10, 0x12, 0x12, 0x12, 0x10, 0x12, 0x12, 0x12, 0x25, 0x22, 0x22, 0x22 + diff --git a/maps/near_center_wall_middle.inc b/maps/near_center_wall_middle.inc new file mode 100644 index 0000000..930e93a --- /dev/null +++ b/maps/near_center_wall_middle.inc @@ -0,0 +1,4 @@ +; this map was generated by tmx2map.py + +.db 0x21, 0x21, 0x21, 0x21, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x22, 0x22, 0x22, 0x22 + diff --git a/maps/near_center_wall_right.inc b/maps/near_center_wall_right.inc new file mode 100644 index 0000000..3ad38ca --- /dev/null +++ b/maps/near_center_wall_right.inc @@ -0,0 +1,4 @@ +; this map was generated by tmx2map.py + +.db 0x21, 0x21, 0x21, 0x16, 0x12, 0x12, 0x12, 0x20, 0x12, 0x12, 0x12, 0x20, 0x12, 0x12, 0x12, 0x20, 0x22, 0x22, 0x22, 0x26 + diff --git a/src/map.s b/src/map.s index 443518a..3c81ec1 100644 --- a/src/map.s +++ b/src/map.s @@ -411,6 +411,13 @@ map_full_draw_ceiling: ld d, 0x12 ; set ceiling tile for 4 rows jp memset + + ; draws floor tiles +map_full_draw_floor: + ld hl, render_buffer + RENDER_BUF_W * 4 + ld bc, RENDER_BUF_W * 10 + ld d, 0x27 + jp memset ; gets a tile based on a positon ; and a marching vector @@ -477,13 +484,13 @@ map_full_draw_far_center: jr z, @no_door REL @door: - ld hl, render_buffer + RENDER_BUF_W * 5 + 8 + ld hl, render_buffer + RENDER_BUF_W * 4 + 8 ld de, far_center_door ld bc, RENDER_BUF_W - 4 ld a, 3 jp tiles_block_copy @no_door: - ld hl, render_buffer + RENDER_BUF_W * 5 + 8 + ld hl, render_buffer + RENDER_BUF_W * 4 + 8 ld de, far_center_wall ld bc, RENDER_BUF_W - 4 ld a, 3 @@ -500,15 +507,35 @@ map_full_draw_near_center: call map_get_tile ; hl = tile ld de, t_flags0 + add hl, de ; get forward direction flag - add hl, de ld b, [hl] ld a, [dir_tf_forward] + and a, b - ret z ; do nothing if there is an opening + ret nz ; do nothing if there is an opening @no_door: + ; draw near center wall left, right and center + ld hl, render_buffer + RENDER_BUF_W * 4 + 4 + ld de, near_center_wall_left + ld bc, RENDER_BUF_W - 4 + ld a, 5 + call tiles_block_copy + + ld hl, render_buffer + RENDER_BUF_W * 4 + 8 + ld de, near_center_wall_middle + ld bc, RENDER_BUF_W - 4 + ld a, 5 + call tiles_block_copy + + ld hl, render_buffer + RENDER_BUF_W * 4 + 12 + ld de, near_center_wall_right + ld bc, RENDER_BUF_W - 4 + ld a, 5 + call tiles_block_copy + ret @@ -530,6 +557,7 @@ map_full_draw: ; 2) draw back to front call map_full_draw_ceiling + call map_full_draw_floor ; either draw a wall or a door ahead call map_full_draw_far_center diff --git a/src/tiles.s b/src/tiles.s index fd39a37..d4abb58 100644 --- a/src/tiles.s +++ b/src/tiles.s @@ -35,6 +35,18 @@ far_center_door: far_center_wall: #include "far_center_wall.inc" + ; 4x5 tiles +near_center_wall_left: +#include "near_center_wall_left.inc" + + ; 4x5 tiles +near_center_wall_middle: +#include "near_center_wall_middle.inc" + + ; 4x5 tiles +near_center_wall_right: +#include "near_center_wall_right.inc" + ; copies a row of tiles ; from a linear buffer into a new block ; blocks must be 4 tiles wide diff --git a/tools/tmx2map.py b/tools/tmx2map.py index 2a6a05d..4b1c9c6 100755 --- a/tools/tmx2map.py +++ b/tools/tmx2map.py @@ -45,11 +45,8 @@ def convert(src): for child in root: if child.tag == "layer": name = child.attrib['name'] - if name == 'bg': - for data in child: - print_bg_data(data.text) - elif name == 'doors': - pass + for data in child: + print_bg_data(data.text) convert(src)