unit: working on input handling
authorLukas Krickl <lukas@krickl.dev>
Mon, 12 May 2025 08:10:20 +0000 (10:10 +0200)
committerLukas Krickl <lukas@krickl.dev>
Mon, 12 May 2025 08:10:20 +0000 (10:10 +0200)
src/unit.s

index 06e8565824213cf9cbf0ec85bce4956717fe175b..29b298fefa681ca1f5c8865fddaf254081f40f76 100644 (file)
@@ -44,22 +44,31 @@ units_update:
 unit_demo_1_init:
   ldnull bc
   ret
-
+  
+  ; inputs
+  ;   de: actor
 unit_demo_1_update:
   ; TODO: call with correct values 
   ldnull hl
   ld a, 1 ; hard-coded action remaining 
+  push de
   call unit_handle_inputs
+  pop de
 
+  ; inputs
+  ;   de: actor
 unit_demo_1_draw:
   ld b, 0x84 ; tile 
   ld c, 0x00 ; flags
+  push de
   call unit_generic_draw
+  pop de
   ldnull bc
   ret
 
   ; draws any unit
   ; inputs:
+  ;  de: actor
   ;   b: tile
   ;   c: flags
 unit_generic_draw:
@@ -105,9 +114,17 @@ unit_generic_draw:
 
   ; generic unit input handler
   ; inputs:
+  ;   de: actor
   ;   hl: action table 
   ;    a: remaining moves
 unit_handle_inputs:
+  input_held BTNUP
+  jr z, @notup REL
+
+    ; call unit_try_abort_move_up
+    ; call scroll_center
+@notup:
+
   ldnull bc
   ret