; $1: dec/inc instruction
; $2: collision mask for tile
; de: actor
+ ; returns:
+ ; unit_test_collision_cf_flags: 0 if not collided with a tile
+ ; FLAGS if collided
#macro unit_test_collision
; perform tile collision check
push de
$1
push bc
call map_get_tile
+ ; set flags result
+ ld [unit_test_collision_cf_flags], a
and a, $2
pop bc
pop de
ret nz
+ ; set to 0 if we did not collide
+ xor a, a
+ ld [unit_test_collision_cf_flags], a
+
push de
call unit_collides_with_any_other
+ ; TODO: write collided unit here as well
and a, $2
pop de
ret nz
; status text buffer
status_text: .adv 32
+
+ ; stores the last collision flag result
+ ; that was performed by a test collision call
+unit_test_collision_cf_flags: .adv 1
; self modifying code
; the vblank interrupt jumps here