From eaa8c87c821da06a438aae20780d2d06b7a8beac Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 29 Dec 2025 06:11:39 +0100 Subject: [PATCH] map: Added flags1 to tiles Fixed a bug that caused the tile loader to break when the tile struct is modified. --- src/actor.s | 2 +- src/defs.s | 13 ++++++++++--- src/map.s | 10 ++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/actor.s b/src/actor.s index 8e13476..cd9d76c 100644 --- a/src/actor.s +++ b/src/actor.s @@ -485,7 +485,7 @@ act_can_move: push de call map_get_tile ; hl = tile - ld de, t_flags + ld de, t_flags0 add hl, de ld a, [hl] ld b, a ; b = tile flags diff --git a/src/defs.s b/src/defs.s index a0e455f..3e29dc8 100644 --- a/src/defs.s +++ b/src/defs.s @@ -107,7 +107,7 @@ .de TT_EMPTY, 1 .de TT_WALL, 1 - ; tile flags + ; tile flags0 .se 1 ; SOUTH EXIT .de TF_SE, 1 @@ -120,8 +120,15 @@ ; tile struct .se 0 -.de t_type, 1 -.de t_flags, 1 +.de t_type, 1 + ; flags0: exit and lock related flags + ; the lower 4 bits are exit directions + ; the upper 4 bits indicate if the exit is locked + ; locked doors may be forced open by attacking, + ; lockpicked or opened with a key +.de t_flags0, 1 + ; flags1: tile type related flags (e.g. lava) +.de t_flags1, 1 ; actor currently ; standing on tile (ptr) .de t_act, 2 diff --git a/src/map.s b/src/map.s index 6a10cb2..bbb1930 100644 --- a/src/map.s +++ b/src/map.s @@ -92,7 +92,7 @@ map_tiles_load: ; hl = first tile to load ; hl = first tile in buffer - ld de, tiles+t_flags ; load flags + ld de, tiles+t_flags0 ; load flags ld bc, MAP_TILES ; loop counter @load_loop: @@ -101,13 +101,7 @@ map_tiles_load: ld [de], a ; write flags ; next tile - inc de - inc de - inc de - inc de - inc de - inc de - inc de +.rep i, t_size, 1, inc de ; loop counter-- dec bc -- 2.30.2