From 2961f95b7b4835a51e361d46019cfa761309120f Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 4 Oct 2024 17:46:28 +0200 Subject: [PATCH] ui: the mp/hp icons do not get redrawn when the bar changes --- src/ui.s | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/ui.s b/src/ui.s index 00c4030..6479c6a 100644 --- a/src/ui.s +++ b/src/ui.s @@ -1,5 +1,6 @@ #define THP_ICON 0x33 #define TMP_ICON 0x37 +#define THP_BAR_START 0x34 ; sets up static parts of the UI ; all other parts are drawin by ui_draw @@ -18,19 +19,27 @@ ui_init: ; darw mp and hp on first frame ld a, UI_REDRAW_HP | UI_REDRAW_MP ld [ui_flags], a + + ; hp icon + ld hl, SCRN0_UI+SCRN_W + ld a, THP_ICON + ld [hl], a + + ; mp icon + ld a, TMP_ICON + ld hl, SCRN0_UI+SCRN_W+10 + ld [hl], a ret ; draws a UI bar ; inputs: ; hl: screen location - ; [de]: amount of bars to draw + ; [de]: ptr to hp/mp where hp/mp max is [de+1] ui_draw_bar: - ld a, THP_ICON - ld [hl+], a - inc a + ld a, THP_BAR_START ld [hl+], a inc a ld [hl+], a @@ -48,7 +57,7 @@ ui_draw: jr z, @skip REL ; draw hp UI - ld hl, SCRN0_UI+SCRN_W + ld hl, SCRN0_UI+SCRN_W+1 ; player hp ptr ld de, player + player_hp ; check redraw hp flag @@ -61,11 +70,8 @@ ui_draw: jr z, @no_mp_draw REL ; draw mp UI - ld a, TMP_ICON - ld hl, SCRN0_UI+SCRN_W+10 - ld [hl+], a - - ld a, THP_ICON+1 ; the bar + ld hl, SCRN0_UI+SCRN_W+11 + ld a, THP_BAR_START ; the bar ld [hl+], a inc a -- 2.30.2