From: Lukas Krickl Date: Tue, 21 Oct 2025 14:54:45 +0000 (+0200) Subject: ui: wip hp draw X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=26281c989a3a33dcbc4a6e8f7847be26fbfc1fdb;p=gbrg%2F.git ui: wip hp draw --- diff --git a/src/ui.s b/src/ui.s index 6003c44..4d69e14 100644 --- a/src/ui.s +++ b/src/ui.s @@ -45,9 +45,27 @@ ui_draw_player_hp: ; hl: address to draw to ; b: current hp ui_draw_hp: + ld a, b + cp a, 4 + jr c, @skip_full REL + +@full_loop: ld a, UI_TILE_HP_4 ld [hl+], a + ld a, b + sub a, 4 + ld b, a + jp c, @done ; no more hp to draw + jr @full_loop REL + +@skip_full: + + ld a, UI_TILE_HP_1 + sub a, b + ld [hl+], a + +@done: ret ; draws boss hp