map: Added stub for tile props
authorLukas Krickl <lukas@krickl.dev>
Tue, 30 Dec 2025 06:03:41 +0000 (07:03 +0100)
committerLukas Krickl <lukas@krickl.dev>
Tue, 30 Dec 2025 06:03:41 +0000 (07:03 +0100)
src/defs.s
src/levels.s
src/macros.inc
src/map.s

index 3e29dc8156d391dbe1f9a9261b23332b1d2b5f07..5b22335e716708a0bc8c10609ca61e7b759c32fc 100644 (file)
        ; ptr to map routine
 .de map_routine, 2
        ; ptr to actor table for this map
+       ; acto tables are terminated with a 0 type actor
 .de map_acts, 2
+       ; ptr to tile props
+       ; tile props are modifiers that are applied to tiles after 
+       ; the load takes place
+       ; the map_tp list is terminated by a 0 type
+.de map_tile_props, 2
   ; pointers to tile banks to be loaded 
   ; maps to map property tile_bank0, tile_bank1, tile_bank2, tile_bank3
   ; note that tile_bank1 and tile_bank2 are 128 bytes each
 .de map_tiles, MAP_W * MAP_H
 .de map_size, 0
 
+       ; map tile props struct
+.se 0
+.de map_tp_type, 1
+.de map_tp_y, 1
+.de map_tp_x, 1
+.de map_tp_flags0, 1
+.de map_tp_flags1, 1
+.de map_tp_p0, 1
+.de map_tp_size, 0
+
        ; tile type enum
 .se 0
 .de TT_EMPTY, 1
-.de TT_WALL, 1
+.de TT_OPEN, 1
+.de TT_LOCKED, 1
 
        ; tile flags0
 .se 1
index cc723b4a8a432af6730b6af4831cf3716a025fbc..25da458b914cdd76f1b698fe733b37d98e9f6012 100644 (file)
@@ -9,7 +9,7 @@
        ; where each tile has values and its current state. The map can be drawn from this.
 
 l1:
-       mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, l1_acts, tile_banks_default 
+       mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, l1_acts, l1_tile_props, tile_banks_default 
 #include "l1.inc"
        
        ; l1 actor table
@@ -18,6 +18,9 @@ l1_acts:
        actdef ACT_T_BAT, 0, 0, 2, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
        .db 0 ; terminate
        
+l1_tile_props:
+       maptpdef TT_LOCKED, 1, 0, 0, 0, 0
+       .db 0 ; terminate
 
 tile_banks_default:
        dw bank8000
index d587a13e426437ae28b6c68b6a3eca2033305408..ed4979bfea01fe0a77ecd059f6eb383c00b5b01f 100644 (file)
@@ -155,12 +155,27 @@ $1:
        ;               $1: flags
        ;               $2: map routine
        ;               $3: actors
-       ;               $4: tile bank table
+       ;               $4: map tile props
+       ;               $5: tile bank table
 #macro mapdef
        .db $1
        dw $2
        dw $3
        dw $4
+       dw $5
+#endmacro
+
+       ; define a map tile prop entry
+       ; inputs:
+       ;               $1: type
+       ;               $2: y
+       ;               $3: x
+       ;               $4: flags0
+       ;               $5: flags1
+       ;               $6: p0
+#macro maptpdef
+       .db $1
+       .db $2
 #endmacro
        
        ; define a tile
@@ -169,7 +184,7 @@ $1:
        ;               $2: flags
        ;               $3: p0
 #macro tiledef
-       .db $1, $2 
+       .db $1, $2, 0 
        ; t_actor
        .db 0, 0
        ; t_prop
index bbb19301b86a785ad7d38948ec5cad43f1de3a88..f1a75307a68570149e5ae67c60b952803b549aaf 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -63,6 +63,17 @@ map_settings_load:
        ld h, [hl]
        ld l, a
        call act_table_load
+
+       pop de
+       
+       ; load tile props
+       ld hl, map_tile_props
+       add hl, de
+       ld a, [hl+]
+       ld h, [hl]
+       ld l, a
+       call map_load_tile_props
+       push de
        
        ; init the player
        ld de, player
@@ -71,6 +82,15 @@ map_settings_load:
        pop de
        ret
        
+       ; applies tile props to a map
+       ; requires tiles to be loaded
+       ; applies tile props to all tiles until 
+       ; type 0 is read
+       ; inputs:
+       ;               hl: tile prop ptr
+map_load_tile_props:
+       ret
+       
        ; loads a tile buffer
        ; tile buffers from maped only contain tile flags 
        ; into the tile buffer