Prev: 48807 Up: Map Next: 48854
48815: Test Near Object
Used by the routine at HandleExtraLife.
Tests whether the player is standing on, or next to, the object.
Input
IX The address of the player
IY The address of the object
Output
F Carry flag set if the objects overlap
Test x and y with no movement, then z with the player 4 lower.
TestNearObject 48815 PUSH BC Stash BC.
48816 LD BC,0 Set BC to 0000.
48819 LD L,C Set the y and z speeds to 0.
48820 LD H,C
48821 CALL TestOverlapInX Call TestOverlapInX.
48824 JR NC,TestNearObject_Done Jump to TestNearObject_Done if they do not overlap along x.
48826 CALL TestOverlapInY Call TestOverlapInY.
48829 JR NC,TestNearObject_Done Jump to TestNearObject_Done if they do not overlap along y.
48831 LD A,(IX+3) Fetch the height of the player.
48834 SUB 4 Subtract 4.
48836 LD (IX+3),A Set the new height.
48839 CALL TestOverlapInZ Call TestOverlapInZ.
48842 PUSH AF Stash the result.
48843 LD A,(IX+3) Fetch the height of the player.
48846 ADD A,4 Add 4.
48848 LD (IX+3),A Set the old height.
48851 POP AF Restore the result from the stack.
TestNearObject_Done 48852 POP BC Restore BC from the stack.
48853 RET Return.
Prev: 48807 Up: Map Next: 48854