From: Lukas Krickl Date: Sun, 14 Dec 2025 07:21:19 +0000 (+0100) Subject: map: map transitioon loads now fixes player position X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=3e23183ddd29168a39f1498ebcdcda62973321a3;p=gbrg%2F.git map: map transitioon loads now fixes player position map transitions now use the correct map for flag reads. --- diff --git a/src/levels.s b/src/levels.s index efa692a..45c803b 100644 --- a/src/levels.s +++ b/src/levels.s @@ -23,3 +23,7 @@ l1_exits: dw l1 dw l1 dw l1 + +l2: + mapdef 0, map_r_nop, 0, l1_exits, bank8000, bank8800, bank8C00, bank9000, tile_id_table +#include "spawn.inc" diff --git a/src/map.s b/src/map.s index a636569..11f48ba 100644 --- a/src/map.s +++ b/src/map.s @@ -39,9 +39,6 @@ map_load: call vblank_wait call enableinterrupts - call player_init - call ui_init - ret ; loads all map related data that @@ -436,12 +433,7 @@ map_full_draw: ; 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 + ld a, [de] ; read flags and a, MAP_F_DO_FULL_REDRAW ret z @@ -451,6 +443,11 @@ map_try_full_reload: ; map transition routines ; gets the down exit and sets transition state map_get_exit_down_and_set_load: + ; fix player position + ld hl, player+act_pos_y + xor a, a + ld [hl], a + ld hl, map_exit_down ld a, [hl+] ld d, [hl] @@ -459,7 +456,7 @@ map_get_exit_down_and_set_load: ; this call does not return ; if a full load is needed call map_try_full_reload - + ld hl, update_map_load_down call game_set_state ret diff --git a/src/update.s b/src/update.s index 51ae3a5..35cfdbc 100644 --- a/src/update.s +++ b/src/update.s @@ -84,4 +84,7 @@ game_init: ld [ROBP1], a ld [shadow_robp1], a + call player_init + call ui_init + ret