From: Lukas Krickl Date: Sun, 10 Aug 2025 09:24:25 +0000 (+0200) Subject: player: disabled rendering while door animation is playing X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=951dcbc0be838fc8188df8e90a8b6c61b318391d;p=gbrg%2F.git player: disabled rendering while door animation is playing --- diff --git a/src/objanim.s b/src/objanim.s index ffd3b80..acd2e8b 100644 --- a/src/objanim.s +++ b/src/objanim.s @@ -60,6 +60,11 @@ objanim_door_open: or a, GPF_PAUSE_UPDATE ld [gameplay_flags], a + ; prevent player from drawing + ld de, player_unit + ld bc, unit_nop_draw + call unit_set_draw + ret ; state function for door opening animation @@ -130,12 +135,18 @@ objanim_door_open_fn: ldnull bc ret @timer_done: - ld bc, st_null ; unset pause object update ld a, [gameplay_flags] and a, ~GPF_PAUSE_UPDATE & 0xFF ld [gameplay_flags], a + + ; restore player draw call + ld de, player_unit + ld bc, player_draw + call unit_set_draw + + ld bc, st_null ret #undefine TMP_X #undefine TMP_Y diff --git a/src/player.s b/src/player.s index 00e4e44..463963f 100644 --- a/src/player.s +++ b/src/player.s @@ -70,15 +70,16 @@ unit_player_update: ; and skip inputs ; load next state in case this ret is hit pop af - ldnull bc - ret nz + jr nz, @early_ret REL push de call unit_handle_inputs pop de - ret +@early_ret: + ldnull bc + ret ; removes the door tile the player is currently ; standing on @@ -260,6 +261,7 @@ map_exit_relative_adjust: pop_all ret +#define player_draw unit_draw unit_player: st_def 0x00, unit_player_init, st_unit_idle @@ -267,7 +269,7 @@ unit_player: act_stat_def1 1, 1, 1, 1 act_stat_def2 1, 1, 90, 1 act_st_def NULL, NULL, st_unit_player_update, st_unit_idle - act_def_meta unit_draw, 0x8C, OAM_FPRIO, NULL + act_def_meta player_draw, 0x8C, OAM_FPRIO, NULL st_unit_player_update: st_def 0x00, unit_player_update, st_unit_player_update diff --git a/src/unit.s b/src/unit.s index 8148011..ffe8d6f 100644 --- a/src/unit.s +++ b/src/unit.s @@ -143,7 +143,7 @@ unit_generic_draw_adjust_subtile: pop hl ; hl = obj ld b, a ; b = rt_sub_tile value cp a, 0 - ; if this value is 0 we are not movin + ; if this value is 0 we are not moving jp z, @done ld a, [de] ; load timer @@ -198,6 +198,11 @@ unit_generic_draw_adjust_subtile: add a, $1 sub a, $2 #endmacro + + ; performs no drawing +unit_nop_draw: + ldnull bc + ret ; draws any unit ; inputs: @@ -753,6 +758,20 @@ unit_get_inventory: ; a: equipment length unit_get_equipment: ret + + ; sets a draw routine for a unit + ; inputs: + ; de: unit + ; bc: draw routine +unit_set_draw: + ld hl, act_draw + add hl, de + ; hl = draw ptr + ld a, c + ld [hl+], a + ld a, b + ld [hl], a + ret st_unit_idle: st_def 0x00, unit_idle, st_unit_idle