Prev: B742 Up: Map Next: B7E0
B791: Shorten dV against the other objects
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
ADJ_DU_FOR_OBJ_INTERSECT for V: an object has to overlap in U, after the accepted dU, and in Z to be in the way. Stopping sets bit 1 of +$0C; harm passes the same way, and a pushable obstacle takes on the mover's dV.
Input
IX the moving object
L dV
C dU as accepted
H dZ as accepted
Output
L dV, shortened
ADJ_DV_FOR_OBJ_INTERSECT B791 LD IY,OBJECTS IY = the first record; 54 of them
B795 LD B,$36
ADJ_DV_FOR_OBJ_INTERSECT_0 B797 CALL IS_OBJECT_NOT_IGNORED empty, or marked to be ignored
B79A JR Z,DV_OBJ_NEXT
B79C CALL DO_OBJS_INTERSECT_ON_U not overlapping in U, or not in Z
B79F JR NC,DV_OBJ_NEXT
B7A1 CALL DO_OBJS_INTERSECT_ON_Z
B7A4 JR NC,DV_OBJ_NEXT
DV_OBJ_HIT_TEST B7A6 CALL DO_OBJS_INTERSECT_ON_V no overlap in V after the move: the next object
B7A9 JR NC,DV_OBJ_NEXT
B7AB SET 1,(IX+$0C) stopped in V
B7AF LD A,(IX+$0D) harm passes both ways, as in U
B7B2 RRCA
B7B3 AND $40
B7B5 OR (IY+$0D)
B7B8 LD (IY+$0D),A
B7BB RLCA
B7BC AND $40
B7BE OR (IX+$0D)
B7C1 LD (IX+$0D),A
B7C4 BIT 2,(IY+$07) a pushable obstacle takes on our dV
B7C8 JR Z,ADJ_DV_FOR_OBJ_INTERSECT_1
B7CA LD A,(IX+$0A)
B7CD LD (IY+$0A),A
ADJ_DV_FOR_OBJ_INTERSECT_1 B7D0 LD A,L a unit shorter; none left, done; else the same object again
B7D1 CALL SHORTEN_DELTA
B7D4 LD L,A
B7D5 RET Z
B7D6 JR DV_OBJ_HIT_TEST
DV_OBJ_NEXT B7D8 LD DE,$0020 the next of 54
B7DB ADD IY,DE
B7DD DJNZ ADJ_DV_FOR_OBJ_INTERSECT_0
B7DF RET
Prev: B742 Up: Map Next: B7E0