Prev: BF0D Up: Map Next: BF56
BF1B: Does this object overlap any other?
Used by the routines at QUEST_INTO_ROOM, TAKE_OR_LEAVE and SKY_DROP.
Tests IX against all 54 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 there is room above the player's head, by QUEST_INTO_ROOM as it puts the quest's things in a room, and by SKY_DROP as something falls from the sky. As Knight Lore'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 BF1B PUSH BC save the registers; IY walks all 54 records
BF1C PUSH DE
BF1D PUSH HL
BF1E PUSH IY
BF20 LD IY,OBJECTS
BF24 LD B,$36
BF26 LD C,$00 no offset on U, V or Z; and IX out of its own way
BF28 LD L,C
BF29 LD H,C
BF2A SET 1,(IX+$07)
DO_ANY_OBJS_INTERSECT_0 BF2E CALL IS_OBJECT_NOT_IGNORED empty, or out of collisions: next
BF31 JR Z,DO_ANY_OBJS_INTERSECT_2
BF33 CALL DO_OBJS_INTERSECT_ON_U overlapping in U, V and Z: found, with carry set
BF36 JR NC,DO_ANY_OBJS_INTERSECT_2
BF38 CALL DO_OBJS_INTERSECT_ON_V
BF3B JR NC,DO_ANY_OBJS_INTERSECT_2
BF3D CALL DO_OBJS_INTERSECT_ON_Z
BF40 JR NC,DO_ANY_OBJS_INTERSECT_2
DO_ANY_OBJS_INTERSECT_1 BF42 POP IY put the registers back and IX's bit 1 clear; the carry is kept
BF44 POP HL
BF45 POP DE
BF46 POP BC
BF47 RES 1,(IX+$07)
BF4B RET
DO_ANY_OBJS_INTERSECT_2 BF4C LD DE,$0020 next record; none: clear carry
BF4F ADD IY,DE
BF51 DJNZ DO_ANY_OBJS_INTERSECT_0
BF53 AND A
BF54 JR DO_ANY_OBJS_INTERSECT_1
The exit clears IX's bit 1 whatever it was before, as Knight Lore's does.
Prev: BF0D Up: Map Next: BF56