map: Added flags1 to tiles
authorLukas Krickl <lukas@krickl.dev>
Mon, 29 Dec 2025 05:11:39 +0000 (06:11 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 29 Dec 2025 05:11:39 +0000 (06:11 +0100)
Fixed a bug that caused the tile loader to break when the tile struct is
modified.

src/actor.s
src/defs.s
src/map.s

index 8e13476cd041e0c89f00ab21f76fd847da9bace5..cd9d76c3d27ed38374363757996b1b76c3dc3eca 100644 (file)
@@ -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
index a0e455fe949429fb3e2e29b73681a903ddba7ae0..3e29dc8156d391dbe1f9a9261b23332b1d2b5f07 100644 (file)
 .de TT_EMPTY, 1
 .de TT_WALL, 1
 
-       ; tile flags
+       ; tile flags0
 .se 1
        ; SOUTH EXIT
 .de TF_SE, 1
 
        ; 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
index 6a10cb26a232f1c5f4bdc287b739dbf62ae83454..bbb19301b86a785ad7d38948ec5cad43f1de3a88 100644 (file)
--- 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