Made ui code a bit faster
authorLukas Krickl <lukas@krickl.dev>
Fri, 4 Oct 2024 18:22:10 +0000 (20:22 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 4 Oct 2024 18:22:10 +0000 (20:22 +0200)
src/ui.s

index eb1beabf23e62da92f1d733d352f93c3d0ffaa93..ab79eedc5753c46eec543e74fa1e4a473d45e568 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -49,6 +49,16 @@ ui_draw_bar:
   ld [hl+], a
   ret
 
+  ; sets up for drawing hp bar 
+ui_draw_hp_bar:
+  ; set up ptrs 
+  ; draw hp UI
+  ld hl, SCRN0_UI+SCRN_W+1
+  ; player hp ptr
+  ld de, player + player_hp
+  ; directly jump without a return
+  jp ui_draw_bar
+
   ; update the UI 
   ; this should only be called 
   ; during blanking 
@@ -58,10 +68,6 @@ ui_draw:
   cp a, 0
   jr z, @skip REL
 
-  ; draw hp UI
-  ld hl, SCRN0_UI+SCRN_W+1
-  ; player hp ptr
-  ld de, player + player_hp
   ; check redraw hp flag
   and a, UI_REDRAW_HP 
   call nz, ui_draw_bar