ui: Added basic mp display
authorLukas Krickl <lukas@krickl.dev>
Sat, 6 Sep 2025 03:57:21 +0000 (05:57 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sat, 6 Sep 2025 03:57:21 +0000 (05:57 +0200)
src/stats.s
src/strings.s
src/ui.s

index fbf89d20c018f8c1db001cd572f20b39e5da3bf0..4909cf8cb1cb04d0399958eab2fa2b649d4a42e6 100644 (file)
@@ -90,6 +90,8 @@ stat_calc_hp_max:
        ;       returns:
        ;               a: mp max
 stat_calc_mp_max:
+       ; TODO calculate properly
+       ld a, 255
        ret
        
        ; calculates physical damage of 
index 453ecae814ce5c8e14dfb410fbb453eabee36c20..545f1fd51c5c1c92d8bef51209befaf3e62ac6fd 100644 (file)
@@ -59,6 +59,10 @@ STR_HP:
 .str "HP "
 .db 0
 
+STR_MP:
+.str "MP "
+.db 0
+
 STR_ATTACK_DIRECTION:
 .str "attack direction?"
 .db 0
index e5b4db9af7cf9d81c66da6f78195571a2baa5175..f62ad26adf40a3c17cf105293b5ae41dc4e126a9 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -19,6 +19,7 @@ ui_init:
   call memset
 
   call ui_redraw_hp
+       call ui_redraw_mp
 
   call ui_request_redraw
   ret
@@ -58,6 +59,31 @@ ui_redraw_hp:
 
   ret
        
+       ; updates MP UI
+ui_redraw_mp:
+       ld hl, STR_MP
+       ld de, UI_STATUS_LINE+64
+       call puts
+
+       push de
+       ld de, player_unit
+       call stat_calc_mp
+       pop de
+
+       call putn
+
+       ; print /
+       ld hl, STR_SLASH
+       call puts
+
+       ; print max mp
+       push de
+       ld de, player_unit
+       call stat_calc_mp_max
+       pop de
+       call putn
+       ret
+       
        ; clears the status line 
        ; and requests a UI redraw
 ui_status_line_clear: