From b97478c80ae15e2d60e5a3d5bfef425f5fc3a8f0 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Tue, 30 Dec 2025 07:03:41 +0100 Subject: [PATCH] map: Added stub for tile props --- src/defs.s | 19 ++++++++++++++++++- src/levels.s | 5 ++++- src/macros.inc | 19 +++++++++++++++++-- src/map.s | 20 ++++++++++++++++++++ 4 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/defs.s b/src/defs.s index 3e29dc8..5b22335 100644 --- a/src/defs.s +++ b/src/defs.s @@ -91,7 +91,13 @@ ; 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 @@ -102,10 +108,21 @@ .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 diff --git a/src/levels.s b/src/levels.s index cc723b4..25da458 100644 --- a/src/levels.s +++ b/src/levels.s @@ -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 diff --git a/src/macros.inc b/src/macros.inc index d587a13..ed4979b 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -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 diff --git a/src/map.s b/src/map.s index bbb1930..f1a7530 100644 --- 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 -- 2.30.2