ui: wip hp draw
authorLukas Krickl <lukas@krickl.dev>
Tue, 21 Oct 2025 14:54:45 +0000 (16:54 +0200)
committerLukas Krickl <lukas@krickl.dev>
Tue, 21 Oct 2025 14:54:45 +0000 (16:54 +0200)
src/ui.s

index 6003c442aa5df51c998569bbf92bd83a774032c1..4d69e1422286469ab0f94de4a310529e3a0b35e9 100644 (file)
--- 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