pop de ; hl = act_moves
ld a, [hl] ; current
- cp a, 1 ; if 1 request next
-
- push_all
- call z, unit_next_request
- pop_all
cp a, 0 ; if 0 exit
ret z
dec a
ld [hl], a
+ ; we need the z flag to not be set ehre
+ ; so just do something that will always unset it
+ or a, 1
ret
; centers the current scroll on the selected unit
ret
+ ; called before switching to active
+ ; this call also checks if the unit may need to
+ ; hand over control to a new unit
+ ; this is done when moves are 0
+ ; inputs:
+ ; de: unit
+unit_delay_to_active:
+ ld hl, act_moves
+ add hl, de ; hl = moves
+ ld a, [hl]
+ cp a, 0
+ call z, unit_next_request
+ ldnull bc
+ ret
+
unit_demo_1:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
unit_demo_2:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
- act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 5, 3, 3, 0
+ act_def ACT_T_DEMO_1, 0, 1, 2, 3, 0, 5, 3, 3, 0
act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_demo_1_idle
st_unit_demo_1_update:
st_def 0x00, unit_demo_1_idle, st_unit_demo_1_idle
st_unit_delay_to_active:
- st_def CURSOR_MOVE_TIMER, st_null_fn, st_unit_switch_to_active
+ st_def CURSOR_MOVE_TIMER, unit_delay_to_active, st_unit_switch_to_active
st_unit_switch_to_active:
st_def 0, unit_switch_to_active, st_unit_switch_to_active