From: Lukas Krickl Date: Wed, 27 Aug 2025 16:31:57 +0000 (+0200) Subject: attack: Added player UI redraw to attack X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=b86a6c1d6be13d48feddb896e8977c1b93d836a2;p=gbrg%2F.git attack: Added player UI redraw to attack --- diff --git a/src/action.s b/src/action.s index 4c3787a..3670d28 100644 --- a/src/action.s +++ b/src/action.s @@ -226,6 +226,7 @@ unit_action_attack: ; returns: ; bc: new state unit_action_attack_damage_calc: + ; set flag ld a, [gameplay_flags] or a, GPF_ATTACK_ONGOING @@ -240,6 +241,7 @@ unit_action_attack_damage_calc: or a, l pop de jp z, @miss ; no unit found + push hl pop bc @@ -251,6 +253,7 @@ unit_action_attack_damage_calc: ld hl, STR_HIT_FOR call ui_draw_status_stat + call ui_redraw_player ldnull bc ret @@ -258,7 +261,6 @@ unit_action_attack_damage_calc: ld hl, STR_MISS ld de, UI_STATUS_LINE call puts - call ui_redraw_hp call ui_request_redraw ldnull bc ret diff --git a/src/ui.s b/src/ui.s index a95958a..8b9e8b5 100644 --- a/src/ui.s +++ b/src/ui.s @@ -18,7 +18,14 @@ ui_init: call ui_request_redraw ret - + + ; redraws player stats + ; preserves all +ui_redraw_player: + push_all + call ui_redraw_hp + pop_all + ret ; updates HP UI ui_redraw_hp: diff --git a/src/unit_cpu.s b/src/unit_cpu.s index a3bb9e6..fa2c33b 100644 --- a/src/unit_cpu.s +++ b/src/unit_cpu.s @@ -172,6 +172,14 @@ unit_cpu_attack_player: ; hl = rt action dat 1 ld hl, act_rt_action_dat1 add hl, de + + push af + inc hl ; rt action dat 2 + ; clear attack frame timer + xor a, a + ld [hl], a + dec hl ; back to dat 1 + pop af ; check y distance call distance