Prev: B890 Up: Map Next: B8B7
B8A2: Do two objects overlap in U?
Boxes are centred in U and V, with +$04 and +$05 the half-sizes. They overlap in U if the distance between the centres, after the mover's dU, is less than the two half-sizes added: exactly touching is not overlapping. The distance is taken as a signed byte, so centres 128 or more apart would be misjudged; no room is that big. Also used by DO_ANY_OBJS_INTERSECT and CAN_PICK_UP.
Input
IX the moving object
IY the other object
C the mover's dU
Output
F carry set if they overlap
DO_OBJS_INTERSECT_ON_U B8A2 LD A,(IX+$04) D = the two half-sizes
B8A5 ADD A,(IY+$04)
B8A8 LD D,A
B8A9 LD A,(IX+$01) A = |U + dU - the other's U|
B8AC ADD A,C
B8AD SUB (IY+$01)
B8B0 JP P,DO_OBJS_INTERSECT_ON_U_0
B8B3 NEG
DO_OBJS_INTERSECT_ON_U_0 B8B5 SUB D carry if less than D
B8B6 RET
Prev: B890 Up: Map Next: B8B7