ui: Added used moves indicator to UI
authorLukas Krickl <lukas@krickl.dev>
Wed, 14 May 2025 15:27:00 +0000 (17:27 +0200)
committerLukas Krickl <lukas@krickl.dev>
Wed, 14 May 2025 15:27:00 +0000 (17:27 +0200)
src/ui.s
tiles/bank8800.inc

index 872ce05ad1983e641ce8f4b2803979f124c6433e..71474ed2dd213aaba9ee5418754e93af24165992 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -1,6 +1,7 @@
 ; draw one TILE_MOVE tile
 ; in top row for each move remaining
 #define UI_TILE_MOVE 0xC0  
+#define UI_TILE_MOVE_USED 0xC1  
 
   ; inits UI
 ui_init:
@@ -38,15 +39,29 @@ ui_draw:
   ; hl = actor 
   ld de, act_moves
   add hl, de ; hl = current moves
-  ld a, [hl] ; a = counter
+  ld a, [hl+] ; a = counter
   ld d, a ; d = counter
-  
+  ld a, [hl] ; a = moves max counter
+  sub a, d ; max - current
+  ld e, a ; e = moves max counter
+
   ; draw to screen
   ld a, UI_TILE_MOVE
   ld hl, SCRN1+1 
-@loop:
+@loop_current:
     ld [hl+], a
     dec d
-  jr nz, @loop REL
+  jr nz, @loop_current REL
 
+  ; draw used moves 
+  ld a, e ; check if e is already 0
+  cp a, 0
+  ret z ; do not draw if e is 0
+  
+  ld a, UI_TILE_MOVE_USED
+@loop_max:
+    ld [hl+], a
+    dec e
+  jr nz, @loop_max REL 
+  
   ret
index 03388e1e01da1b101136b47bbe5586bf6870999b..7372812fdfbe3cfd1c29bdd25c3e341355b32cea 100644 (file)
 .chr 00333000
 ; tile 65
 .chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
-.chr 00000000
+.chr 00033300
+.chr 00300030
+.chr 03000003
+.chr 03000003
+.chr 03000003
+.chr 00300030
+.chr 00033300
 ; tile 66
 .chr 00000000
 .chr 00000000