Prev: C535 Up: Map Next: C5BE
C5A9: 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 C5A9 LD A,(IX+$04) D = the two half-sizes
C5AC ADD A,(IY+$04)
C5AF LD D,A
C5B0 LD A,(IX+$01) A = |U + dU - the other's U|
C5B3 ADD A,C
C5B4 SUB (IY+$01)
C5B7 JP P,DO_OBJS_INTERSECT_ON_U_0
C5BA NEG
DO_OBJS_INTERSECT_ON_U_0 C5BC SUB D Carry if less than D
C5BD RET
Prev: C535 Up: Map Next: C5BE