exits: Added map table pointer loader
authorLukas Krickl <lukas@krickl.dev>
Sat, 5 Jul 2025 03:10:36 +0000 (05:10 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 5 Jul 2025 03:10:36 +0000 (05:10 +0200)
src/defs.s
src/exittables.s
src/macros.inc
src/map.s

index 6744428121ef6df2e0afabca401b1519439f362f..488a59dc80c067cf0c75c80b6b95d03baee69084 100644 (file)
 
   ; 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
 
index d63117e07db8c2a41a9710a55891bcabad7fdc40..fbea4454a9a6ad1420fbfeb3367e7e84af0a99fc 100644 (file)
@@ -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 
index 941dedc8d87b5375c39c7089fde9dc2d05038ae6..6e2ec453271d16af97a3320edb56f332b58101c5 100644 (file)
   ;   $3: goto y
   ;   $4: goto x
   ;   $5: map header pointer
-#macro exit_entry
+#macro exit_def
   .db $1
   .db $2
   .db $3
index 3fb17388870f0bac0cb3a84a16c925c27c99ba66..0b1fa3a92689687f4e10feab9c16e38657feb4fa 100644 (file)
--- 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