From: Lukas Krickl Date: Fri, 12 Dec 2025 06:57:43 +0000 (+0100) Subject: map: wip map transitons X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=c5f9e8218e5c94abc2caaae5cb41b9747b6a17df;p=gbrg%2F.git map: wip map transitons --- diff --git a/maps/spawn.inc b/maps/spawn.inc index c0186aa..438f048 100644 --- a/maps/spawn.inc +++ b/maps/spawn.inc @@ -1,14 +1,14 @@ ; this map was generated by tmx2map.py .db 0x1, 0x2, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5 -.db 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5 +.db 0x5, 0x0, 0x0, 0x5, 0x5, 0x5, 0x5, 0x5 .db 0x5, 0x1, 0x2, 0x5, 0x3, 0x4, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x5 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 -.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 +.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3 .db 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 @@ -27,11 +27,11 @@ .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1 .db 0x5, 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -.db 0x0, 0x0, 0x0, 0x3, 0x2, 0x0, 0x0, 0x0 +.db 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5 -.db 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 -.db 0x0, 0x0, 0x0, 0x5, 0x5, 0x5, 0x5, 0x5 -.db 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5 +.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 +.db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 +.db 0x0, 0x0, 0x0, 0x0, 0x5, 0x5, 0x5, 0x5 .db 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5, 0x5 +.db 0x5, 0x5, 0x0, 0x0, 0x5, 0x5, 0x5, 0x5 diff --git a/src/map.s b/src/map.s index b4d47d9..b88153f 100644 --- a/src/map.s +++ b/src/map.s @@ -366,10 +366,16 @@ map_full_draw: map_full_draw_inc_b ret + + ; map transition routines + ; gets the down exit and sets transition state +map_get_exit_down_and_set_load: + ld hl, update_map_load_down + call game_set_state + ret ; nop map rotuine map_r_nop: ret - diff --git a/src/player.s b/src/player.s index 62836a7..dcacc09 100644 --- a/src/player.s +++ b/src/player.s @@ -149,6 +149,8 @@ player_update: ld [player_jump_peak], a ld [player_jump_timer], a @not_down_collision: + + call player_check_map_transition_trigger ret ; moves the player @@ -158,20 +160,6 @@ player_handle_move: xor a, a ld [col_direction], a - ld b, BTNDOWN - input_held - jr z, @not_down REL - ld a, [player+act_pos_y] - cp a, 0x60 ; max value - jr z, @not_down REL - inc a - ld [player+act_pos_y], a - - ld a, [col_direction] - or a, DIRDOWN - ld [col_direction], a -@not_down: - ld b, BTNA input_held jr z, @not_up REL @@ -223,6 +211,18 @@ player_handle_move: @not_right: ret + ; tests player position to + ; see if a map transiton point was hit + ; if the position is too far off-screen + ; it will initiate a map transition +player_check_map_transition_trigger: + ; check down + ld a, [player+act_pos_y] + cp a, 0x80 ; max y value + call nc, map_get_exit_down_and_set_load + + ret + ; draws player at current location player_draw: ; flicker the cursor diff --git a/src/update.s b/src/update.s index 67fe3d6..51ae3a5 100644 --- a/src/update.s +++ b/src/update.s @@ -25,6 +25,10 @@ update_game: ret + ; game state + ; for loading a map down +update_map_load_down: + ret new_game: ld de, l1