Prev: BEA7 Up: Map Next: BED6
BEAF: 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 04 lower.
TestNearObject BEAF PUSH BC Stash BC.
BEB0 LD BC,$0000 Set BC to 0000.
BEB3 LD L,C Set the y and z speeds to 00.
BEB4 LD H,C
BEB5 CALL TestOverlapInX Call TestOverlapInX.
BEB8 JR NC,TestNearObject_Done Jump to TestNearObject_Done if they do not overlap along x.
BEBA CALL TestOverlapInY Call TestOverlapInY.
BEBD JR NC,TestNearObject_Done Jump to TestNearObject_Done if they do not overlap along y.
BEBF LD A,(IX+$03) Fetch the height of the player.
BEC2 SUB $04 Subtract 04.
BEC4 LD (IX+$03),A Set the new height.
BEC7 CALL TestOverlapInZ Call TestOverlapInZ.
BECA PUSH AF Stash the result.
BECB LD A,(IX+$03) Fetch the height of the player.
BECE ADD A,$04 Add 04.
BED0 LD (IX+$03),A Set the old height.
BED3 POP AF Restore the result from the stack.
TestNearObject_Done BED4 POP BC Restore BC from the stack.
BED5 RET Return.
Prev: BEA7 Up: Map Next: BED6