; a = CF_COLLISION if collision occured
; sets act_rt_collided_with
unit_collides_with_any_other:
+#define scratch_loop_i scratch
ld hl, p0_units
ld a, UNITS_MAX ; loop counter
@loop:
+ ld [scratch_loop_i], a
push de ; save current actor on stack
push bc
+ ; skip act type == 0
+ push de
+ push hl
+ ld de, act_type
+ add hl, de ; hl = actor type
+ ; skip if type is 0
+ ld a, [hl]
+ cp a, 0
+ pop hl
+ pop de
+ jr z, @skip REL
+
; check if actor is current actor
ld a, h
cp a, d
@skip:
ld de, act_size
add hl, de ; move to next actor
+
+ ld a, [scratch_loop_i]
dec a
pop bc
; and set the CF_COLLISION flag
ld a, CF_COLLISION
ret
+#undefine scratch_loop_i
; moves a unit up
; moves are aborted