From: Lukas Krickl Date: Sat, 13 Dec 2025 05:10:10 +0000 (+0100) Subject: map loader: wip added full redraw flag X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=b75e692c854a9fb8049ec3756b6babce7bc04411;p=gbrg%2F.git map loader: wip added full redraw flag --- diff --git a/src/defs.s b/src/defs.s index aa9f937..32bced2 100644 --- a/src/defs.s +++ b/src/defs.s @@ -55,7 +55,7 @@ ; map flags .se 1 -.de MAP_F_HOSTILE, 1 +.de MAP_F_DO_FULL_REDRAW, 1 ; map header struct .se 0 diff --git a/src/levels.s b/src/levels.s index 9a6394c..a857078 100644 --- a/src/levels.s +++ b/src/levels.s @@ -15,5 +15,5 @@ ; where each tile has values and its current state. The map can be drawn from this. l1: - mapdef 0, map_r_nop, 0, 0, bank8000, bank8800, bank8C00, bank9000, tile_id_table + mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, 0, 0, bank8000, bank8800, bank8C00, bank9000, tile_id_table #include "spawn.inc" diff --git a/src/map.s b/src/map.s index d487c6a..20dfd57 100644 --- a/src/map.s +++ b/src/map.s @@ -383,10 +383,38 @@ map_full_draw: map_full_draw_inc_b ret + + ; checks the current map + ; if the fully reload flag is set + ; it will do a full redraw + ; otherwise this routine just returns + ; if a full redraw is requested this routine + ; pops the previous caller's return from the stack + ; and jumps to a full load + ; inputs: + ; de: new map ptr +map_try_full_reload: + ld hl, map + ld a, [hl+] + ld h, [hl] + ld l, a ; hl = map + + ld a, [hl] ; read flags + and a, MAP_F_DO_FULL_REDRAW + ret z + + BREAK + ret ; map transition routines ; gets the down exit and sets transition state map_get_exit_down_and_set_load: + ld hl, map_exit_down + ld a, [hl+] + ld d, [hl] + ld e, a ; de = new map + call map_try_full_reload + ld hl, update_map_load_down call game_set_state ret diff --git a/src/wram.s b/src/wram.s index 8f47d3c..e276a3e 100644 --- a/src/wram.s +++ b/src/wram.s @@ -90,6 +90,20 @@ map: .adv 2 ; where the map should be drawn map_vram_tl: .adv 2 map_tmp_tile_id_table: .adv 2 + ; exit table + ; an exit table always has 4 entries + ; exits usually transition using a scroll + ; unless the current map has the full reload flag + ; set in which case the map fades out and full reloads + ; the scene + ; 0: eixt up + ; 1: exit down + ; 2: exit left + ; 3: exit right +map_exit_up: .adv 2 +map_exit_down: .adv 2 +map_exit_left: .adv 2 +map_exit_right: .adv 2 ; ptr to current tile to be updated tiles: .adv t_size * MAP_TILES