; hl: action table
; a: remaining moves
unit_handle_inputs:
+ ; push next state to the stack for now
+ ld bc, NULL
+ push bc
+
input_held BTNUP
jr z, @notup REL
call unit_try_move_up
+
+ pop bc
ld bc, st_unit_delay_to_active
- ret
+ push bc
@notup:
input_held BTNDOWN
jr z, @notdown REL
call unit_try_move_down
+
+ pop bc
ld bc, st_unit_delay_to_active
- ret
+ push bc
@notdown:
input_held BTNLEFT
jr z, @notleft REL
call unit_try_move_left
+
+ pop bc
ld bc, st_unit_delay_to_active
- ret
+ push bc
@notleft:
input_held BTNRIGHT
jr z, @notright REL
call unit_try_move_right
+
+ pop bc
ld bc, st_unit_delay_to_active
- ret
+ push bc
@notright:
-
- ldnull bc
+
+ pop bc
ret
; performs a generic collision test