From 32dbe0e8672ea14fc6e6c1a31b074b823c56e82f Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sat, 5 Jul 2025 05:10:36 +0200 Subject: [PATCH] exits: Added map table pointer loader --- src/defs.s | 10 +++++----- src/exittables.s | 4 ++-- src/macros.inc | 2 +- src/map.s | 20 ++++++++++++++++++++ 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/defs.s b/src/defs.s index 6744428..488a59d 100644 --- a/src/defs.s +++ b/src/defs.s @@ -300,15 +300,15 @@ ; map exit table entry struct .se 0 -.de map_exit_flags, 1 +.de exit_flags, 1 ; if this is != 0 ; the exit will only trigger ; if the input specified is pressed -.de map_exit_required_input, 1 -.de map_exit_goto_y, 1 -.de map_exit_goto_x, 1 +.de exit_required_input, 1 +.de exit_goto_y, 1 +.de exit_goto_x, 1 ; pointer to new map struct -.de map_exit_to, 2 +.de exit_to, 2 ; special text commands diff --git a/src/exittables.s b/src/exittables.s index d63117e..fbea445 100644 --- a/src/exittables.s +++ b/src/exittables.s @@ -1,3 +1,3 @@ default_map_exit_table: -exit_entry 0, 0, 0, 0, default_map_header -exit_entry 0, 0, 0, 0, default_map_header +exit_def 0, 0, 0, 0, default_map_header +exit_def 0, 0, 0, 0, default_map_header diff --git a/src/macros.inc b/src/macros.inc index 941dedc..6e2ec45 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -282,7 +282,7 @@ ; $3: goto y ; $4: goto x ; $5: map header pointer -#macro exit_entry +#macro exit_def .db $1 .db $2 .db $3 diff --git a/src/map.s b/src/map.s index 3fb1738..0b1fa3a 100644 --- a/src/map.s +++ b/src/map.s @@ -23,7 +23,13 @@ map_load: call map_actors_load pop hl + push hl call map_tile_banks_load + pop hl + + push hl + call map_load_exit_table + pop hl call map_draw_all @@ -301,6 +307,20 @@ map_tile_banks_load: ld d, a call tiles_load_bank9000 + ret + + ; loads the exit table + ; inputs: + ; hl: map ptr +map_load_exit_table: + ld de, map_exit_table_ptr + add hl, de ; hl = exit table + + ld a, [hl+] + ld [map_exit_table], a + ld a, [hl] + ld [map_exit_table+1], a + ret ; draws all cells currently loaded to the screen -- 2.30.2