map: Added map settings load call to allow loading maps for partial redraws
authorLukas Krickl <lukas@krickl.dev>
Fri, 12 Dec 2025 08:47:26 +0000 (09:47 +0100)
committerLukas Krickl <lukas@krickl.dev>
Fri, 12 Dec 2025 08:47:26 +0000 (09:47 +0100)
src/map.s

index b88153f43b6363ac5bfaddc241a8cd89d747f328..d487c6aea957df4accee7f90123c8947022106b3 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -10,7 +10,7 @@ map_globals_init:
        ld [map_vram_tl+1], a
        ret
 
-       ; loads a map 
+       ; loads a map and performs a full redraw
        ; including the required tileset
        ; sets current page to 0
        ; draws page 0 to the screen
@@ -18,26 +18,20 @@ map_globals_init:
        ; inputs:
        ;               de: map ptr
 map_load:
+       ; reset scroll
+       xor a, a
+       ld [scroll_y], a
+       ld [scroll_x], a
+       
        call disableinterrupts
        call next_vblank_wait
        call lcd_off
 
-       ld a, e 
-       ld [map], a
-       ld a, d
-       ld [map+1], a
+       call map_settings_load
        
        push de
        call map_tile_banks_load
        pop de
-       push de
-       call map_tiles_load
-       pop de
-
-       ; TODO: 
-       ; load actors
-       ; encounter table
-       ; exit table
        
        call map_full_draw
 
@@ -50,6 +44,29 @@ map_load:
 
        ret
        
+       ; loads all map related data that 
+       ; does not require blanking.
+       ; this call can be used for non-blanking redraws
+       ;       inputs:
+       ;               de: map ptr
+       ;       returns:
+       ;               de: map ptr
+map_settings_load:
+       ld a, e 
+       ld [map], a
+       ld a, d
+       ld [map+1], a
+
+       push de
+       call map_tiles_load
+       pop de
+
+       ; TODO: 
+       ; load actors
+       ; encounter table
+       ; exit table
+       ret
+       
        ; loads a tileset
        ; into the tile buffer
        ; inputs: