action: Added delay to active after picking an attack direction
authorLukas Krickl <lukas@krickl.dev>
Sun, 17 Aug 2025 12:54:42 +0000 (14:54 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 17 Aug 2025 12:54:42 +0000 (14:54 +0200)
src/action.s
src/defs.s
src/strings.s
src/ui.s

index c16c81d4da83b82f7b2f66512f7d2110e7c90b22..4ac3b491eb1d5e6f5f70189f395646cd126014d7 100644 (file)
@@ -120,7 +120,8 @@ unit_action_pick_direction:
        ;       returns:
        ;               bc: next action
 unit_action_attack:
-       jp unit_switch_to_active
+       call ui_status_line_clear
+       ld bc, st_unit_delay_to_active_template
        ret
 
        ; default attack state
index 723d9e7f712679892c3cf39c5a8b2cc171b26a9f..bf8d2d658a8d30149e55a7d8072bdaa24a9fd30c 100644 (file)
 
 #define DISTANCE_BGTA 1
 #define DISTANCE_AGTB 0
-
+       
+       ; alias for directions
+.def int DIRUP = BTNUP
+.def int DIRDOWN = BTNDOWN
+.def int DIRLEFT = BTNLEFT
+.def int DIRRIGHT = BTNRIGHT
index 830996d251190e242956e9fbb961fc36d37c7011..8fc0da3c770d6dc36082842627bcfafb877e9b8f 100644 (file)
@@ -54,6 +54,10 @@ STR_DELETE:
 
 STR_ATTACK_DIRECTION:
 .str "attack direction?"
+.db 0
+
+STR_STATUS_CLEAR:
+.str "                 "
 .db 0
 
   ; print a 0-terminated string to the screen 
index 617a60862aa8f7998450c3a80ab10616d2497b54..8805fe5826b4bfcd83a2133c70d6064b312edf2e 100644 (file)
--- a/src/ui.s
+++ b/src/ui.s
@@ -25,9 +25,15 @@ ui_redraw_hp:
   ld hl, STR_TEST
   ld de, shadow_ui + 34
   call puts
-
   ret
-
+       
+       ; clears the status line 
+       ; and requests a UI redraw
+ui_status_line_clear:
+       ld hl, STR_STATUS_CLEAR
+       ld de, UI_STATUS_LINE
+       call puts
+       jp ui_request_redraw
 
   ; requests a redraw
   ; this will set up redraw_bg