pop de
ret
-
+
+ ; cpu controllerd unit update
+unit_demo_1_cpu_update:
+ push de
+ ld hl, act_oam_flags
+ add hl, de
+ ld a, [hl]
+ or a, OAM_DMG_PAL
+ ld [hl], a
+ pop de
+
+ push de
+ call unit_handle_cpu_inputs
+ pop de
+
+ push de
+ call unit_scroll_center
+ pop de
+ ret
+
+unit_handle_cpu_inputs:
+ ; pick where to go
+ call roll_d16
+ and a, 3 ; 0-3
+ ; 0 == left
+ cp a, 0
+ call z, unit_try_move_left
+
+ ; 1 == right
+ cp a, 1
+ call z, unit_try_move_right
+
+ ; 2 == up
+ cp a, 2
+ call z, unit_try_move_up
+
+ ; 3 == down
+ cp a, 3
+ call z, unit_try_move_down
+
+ ld bc, st_unit_delay_to_active
+ ret
+
; inputs
; de: actor
act_inventory_empty
act_equipment_empty
act_effects_empty
- act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_idle
+ act_st_def NULL, NULL, st_unit_demo_1_cpu_update, st_unit_idle
act_def_draw unit_draw, 0x84, 0
act_rt_def
st_unit_demo_1_update:
st_def 0x00, unit_demo_1_update, st_unit_demo_1_update
+st_unit_demo_1_cpu_update:
+ st_def 0x00, unit_demo_1_cpu_update, st_unit_demo_1_cpu_update
+
st_unit_idle:
st_def 0x00, unit_idle, st_unit_idle