; inputs:
; de: unit
unit_switch_to_idle:
+ ld hl, act_st_idle
+ add hl, de ; hl = st_idle ptr
+ ld a, [hl+]
+ ld c, a
+ ld a, [hl]
+ ld b, a
ret
; finds a unit with a higher initiative value
; skips any ACT_T_NULL types
; inputs:
; de: unit
+ ; uses:
+ ; unit_next_best_init: as a temporary buffer
unit_next:
+ xor a, a
+ ld [unit_next_best_init], a
+
+ ld hl, p0_units
+ ld b, UNITS_MAX * PLAYERS
+
+ ; same as unit_next:
+ ; inputs:
+ ; de: unit
+ ; hl: unit table
+ ; b: unit count
+@unit_next_loop:
+
+ dec b
+ jr nz, @unit_next_loop REL
+
ret
+
unit_demo_1:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_update
act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 5, 2, 2, 0
game_mode: .adv st_size
+; current best init found in units_next
+unit_next_best_init: .adv 1
+
; actors
; actors are state machines
; they get updated once a frame