Prev: B702 Up: Map Next: B74D
B712: Does this object overlap any other?
Used by the routine at TAKE_OR_LEAVE.
Tests IX against all 56 records with the tests on each axis at DO_OBJS_INTERSECT_ON_U, DO_OBJS_INTERSECT_ON_V and DO_OBJS_INTERSECT_ON_Z, with no offset on any axis. Empty records are skipped, and so is any with bit 1 of its flags set (IS_OBJECT_NOT_IGNORED) -- which is how IX avoids finding itself: it sets its own bit 1 for the duration. Used by TAKE_OR_LEAVE, to see whether what he puts down has room. Knight Lore's do_any_objs_intersect and Pentagram's DO_ANY_OBJS_INTERSECT.
Input
IX the object
Output
F carry set if another object's box overlaps IX's where it stands
IY the one it overlaps, when carry is set
DO_ANY_OBJS_INTERSECT B712 PUSH BC save the registers; IY walks all 56 records
B713 PUSH DE
B714 PUSH HL
B715 PUSH IY
B717 LD IY,OBJECTS
B71B LD B,$38
B71D LD C,$00 no offset on U, V or Z; and IX out of its own way
B71F LD L,C
B720 LD H,C
B721 SET 1,(IX+$07)
DO_ANY_OBJS_INTERSECT_0 B725 CALL IS_OBJECT_NOT_IGNORED empty, or out of collisions: next
B728 JR Z,DO_ANY_OBJS_INTERSECT_2
B72A CALL DO_OBJS_INTERSECT_ON_U overlapping in U, V and Z: found, with carry set
B72D JR NC,DO_ANY_OBJS_INTERSECT_2
B72F CALL DO_OBJS_INTERSECT_ON_V
B732 JR NC,DO_ANY_OBJS_INTERSECT_2
B734 CALL DO_OBJS_INTERSECT_ON_Z
B737 JR NC,DO_ANY_OBJS_INTERSECT_2
DO_ANY_OBJS_INTERSECT_1 B739 POP IY put the registers back and IX's bit 1 clear; the carry is kept
B73B POP HL
B73C POP DE
B73D POP BC
B73E RES 1,(IX+$07)
B742 RET
DO_ANY_OBJS_INTERSECT_2 B743 LD DE,$0020 next record; none: clear carry
B746 ADD IY,DE
B748 DJNZ DO_ANY_OBJS_INTERSECT_0
B74A AND A
B74B JR DO_ANY_OBJS_INTERSECT_1
The exit clears IX's bit 1 whatever it was before.
Prev: B702 Up: Map Next: B74D