From b6336b117b94d315410975df37829ecc6b629d42 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 12 Dec 2025 09:47:26 +0100 Subject: [PATCH] map: Added map settings load call to allow loading maps for partial redraws --- src/map.s | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/src/map.s b/src/map.s index b88153f..d487c6a 100644 --- 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: -- 2.30.2