made calls to ui bar draw simpler
authorLukas Krickl <lukas@krickl.dev>
Fri, 4 Oct 2024 18:40:45 +0000 (20:40 +0200)
committerLukas Krickl <lukas@krickl.dev>
Fri, 4 Oct 2024 18:40:45 +0000 (20:40 +0200)
src/ui.s

index ab79eedc5753c46eec543e74fa1e4a473d45e568..76b28d49f143210a9bfb7127a5c6d3748e173bf2 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -59,6 +59,14 @@ ui_draw_hp_bar:
   ; directly jump without a return
   jp ui_draw_bar
 
+  ; sets up for darwing mp bar 
+ui_draw_mp_bar:
+  ld hl, SCRN0_UI+SCRN_W+11
+  ld de, player + player_mp
+
+  ; directly jump without a return
+  jp ui_draw_bar 
+
   ; update the UI 
   ; this should only be called 
   ; during blanking 
@@ -70,23 +78,12 @@ ui_draw:
 
   ; check redraw hp flag
   and a, UI_REDRAW_HP 
-  call nz, ui_draw_bar
+  call nz, ui_draw_hp_bar
 
   ; check if we should draw mp bar
   ld a, [ui_flags]
   and a, UI_REDRAW_HP 
-  jr z, @no_mp_draw REL
-  
-  ; draw mp UI 
-  ld hl, SCRN0_UI+SCRN_W+11
-  ld a, THP_BAR_START ; the bar
-
-  ld [hl+], a
-  inc a
-  ld [hl+], a
-  inc a
-  ld [hl+], a
-@no_mp_draw:
+  call nz, ui_draw_mp_bar 
 
   ; set flags to 0 
   xor a, a