; than the previous actor
ld de, act_init
add hl, de
- ld a, [hl]
- ld d, a ; b = init of new actor
ld a, [unit_next_best_init]
+ cp a, 0 ; if prev best is 0 proceed anyway
+ ld d, a ; d = previous best init
+ ld a, [hl] ; a = init of new actor
+ jr z, @first_hit REL ; on first match
+
; check if this init value is better
; if not proceed
cp a, d
- jr nc, @skip REL ; d > a?
-
+ jr c, @skip REL ; d > a?
+@first_hit:
; otherwise store new init value and hl
pop hl
push hl
unit_demo_1:
st_def 0x00, unit_demo_1_init, st_unit_demo_1_idle
- act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 5, 2, 2, 0
+ act_def ACT_T_DEMO_1, 0, 1, 2, 3, 4, 6, 2, 2, 0
act_st_def NULL, NULL, st_unit_demo_1_update, st_unit_demo_1_idle