From: Lukas Krickl Date: Sat, 6 Sep 2025 03:57:21 +0000 (+0200) Subject: ui: Added basic mp display X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=7d579763ec8ca3d1c7bf065dfded775b56c134f7;p=gbrg%2F.git ui: Added basic mp display --- diff --git a/src/stats.s b/src/stats.s index fbf89d2..4909cf8 100644 --- a/src/stats.s +++ b/src/stats.s @@ -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 diff --git a/src/strings.s b/src/strings.s index 453ecae..545f1fd 100644 --- a/src/strings.s +++ b/src/strings.s @@ -59,6 +59,10 @@ STR_HP: .str "HP " .db 0 +STR_MP: +.str "MP " +.db 0 + STR_ATTACK_DIRECTION: .str "attack direction?" .db 0 diff --git a/src/ui.s b/src/ui.s index e5b4db9..f62ad26 100644 --- 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: