From 3a2207dba61b43cdf62ea76bc558477f08ee7d37 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 12 May 2025 10:10:20 +0200 Subject: [PATCH] unit: working on input handling --- src/unit.s | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/unit.s b/src/unit.s index 06e8565..29b298f 100644 --- a/src/unit.s +++ b/src/unit.s @@ -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 -- 2.30.2