Prev: B791 Up: Map Next: B866
B7E0: Shorten dZ against the other objects
Used by the routine at ADJ_FOR_OUT_OF_BOUNDS.
ADJ_DU_FOR_OBJ_INTERSECT for Z, done before U and V so it tests the object where it stands: an object has to overlap in U and in V to be above or below it. Stopping sets bit 2 of +$0C, whether the move was up or down, and harm passes as in U.
Pentagram does more here than Knight Lore. Bit 7 of +$17 is set on the obstacle when the mover is the player's legs or graphic 91 (MARK_STOOD_ON), and on the mover when the obstacle is the player's legs (graphics 32-39): the update routines LIFT, BOBBER and CRUMBLING_BLOCK read it (the lift and the bobbing head, measured in staged rooms). An obstacle of graphic 140-143 carries the mover along (CONVEYOR_PUSH). The obstacle gets bit 3 of its +$0D, something has met it in Z, as in Knight Lore. And a mover with bit 2 of +$07 gives its intended dZ to the obstacle and, wherever its own dU or dV is zero, takes on the obstacle's, so standing on something that moves carries it along (measured in the simulator: a mover with bit 2 falling on a block moving 3 in U and -1 in V took on both, and the block took the mover's -2 in Z).
Input
IX the moving object
H dZ
C dU, zero here
L dV, zero here
Output
H dZ, shortened
ADJ_DZ_FOR_OBJ_INTERSECT B7E0 LD IY,OBJECTS IY = the first record; 54 of them
B7E4 LD B,$36
ADJ_DZ_FOR_OBJ_INTERSECT_0 B7E6 CALL IS_OBJECT_NOT_IGNORED empty, or marked to be ignored
B7E9 JR Z,DZ_OBJ_NEXT
B7EB CALL DO_OBJS_INTERSECT_ON_U not overlapping in U, or not in V
B7EE JR NC,DZ_OBJ_NEXT
B7F0 CALL DO_OBJS_INTERSECT_ON_V
B7F3 JR NC,DZ_OBJ_NEXT
DZ_OBJ_HIT_TEST B7F5 CALL DO_OBJS_INTERSECT_ON_Z no overlap in Z after the move: the next object
B7F8 JR NC,DZ_OBJ_NEXT
B7FA SET 2,(IX+$0C) stopped in Z
B7FE CALL MARK_STOOD_ON the player or graphic 91 has met the obstacle
B801 LD A,(IY+$00) the obstacle is the player's legs: mark the mover
B804 CP $20
B806 JR C,ADJ_DZ_FOR_OBJ_INTERSECT_1
B808 CP $28
B80A JR NC,ADJ_DZ_FOR_OBJ_INTERSECT_1
B80C SET 7,(IX+$17)
ADJ_DZ_FOR_OBJ_INTERSECT_1 B810 CP $8C graphics 140-143 carry the mover
B812 JR C,ADJ_DZ_FOR_OBJ_INTERSECT_2
B814 CP $90
B816 CALL C,CONVEYOR_PUSH
ADJ_DZ_FOR_OBJ_INTERSECT_2 B819 LD A,(IX+$0D) harm passes both ways, as in U
B81C RRCA
B81D AND $40
B81F OR (IY+$0D)
B822 LD (IY+$0D),A
B825 RLCA
B826 AND $40
B828 OR (IX+$0D)
B82B LD (IX+$0D),A
B82E SET 3,(IY+$0D) the obstacle has been met in Z
B832 BIT 2,(IX+$07) not a mover that can be carried
B836 JR Z,ADJ_DZ_FOR_OBJ_INTERSECT_4
B838 LD A,(IX+$0B) the obstacle takes our dZ
B83B LD (IY+$0B),A
B83E LD A,(IX+$09) no dU of our own: ride with the obstacle's
B841 AND A
B842 JR NZ,ADJ_DZ_FOR_OBJ_INTERSECT_3
B844 LD A,(IY+$09)
B847 LD (IX+$09),A
ADJ_DZ_FOR_OBJ_INTERSECT_3 B84A LD A,(IX+$0A) no dV of our own: ride with the obstacle's
B84D AND A
B84E JR NZ,ADJ_DZ_FOR_OBJ_INTERSECT_4
B850 LD A,(IY+$0A)
B853 LD (IX+$0A),A
ADJ_DZ_FOR_OBJ_INTERSECT_4 B856 LD A,H a unit shorter; none left, done; else the same object again
B857 CALL SHORTEN_DELTA
B85A LD H,A
B85B RET Z
B85C JR DZ_OBJ_HIT_TEST
DZ_OBJ_NEXT B85E LD DE,$0020 the next of 54
B861 ADD IY,DE
B863 DJNZ ADJ_DZ_FOR_OBJ_INTERSECT_0
B865 RET
Prev: B791 Up: Map Next: B866