Prev: 49319 Up: Map Next: 49415
49364: Test Object Can Be Picked Up
Used by the routine at HandlePickupAndDrop.
Tests if an object is one that can be picked up (of type 90 or 144 to 148) and touches the player. The player is taken to touch the object if they overlap along each axis, with the player lowered by 4 to test along z.
Input
IX Record of the object of the legs of the player
IY Record of the object to test
Output
F Carry flag set if the object can be picked up and touches the player
Return unless the object is one that can be picked up.
TestObjectCanBePickedUp 49364 LD A,(IY+0) Fetch the type of the object.
49367 CP 90 Jump to TestObjectCanBePickedUp_Overlap if it is type 90.
49369 JR Z,TestObjectCanBePickedUp_Overlap
49371 SUB 144 Take away 144 from it.
49373 CP 5 Return with the carry flag clear if it was not one of the five types 144 to 148.
49375 RET NC
Test whether the player touches the object.
TestObjectCanBePickedUp_Overlap 49376 PUSH BC Stash BC on the stack.
49377 LD BC,0 Set the distance moved along x to zero.
49380 LD L,C Set the distances moved along y and z to zero.
49381 LD H,C
49382 CALL TestOverlapInX Jump to TestObjectCanBePickedUp_Done if the objects do not overlap along x.
49385 JR NC,TestObjectCanBePickedUp_Done
49387 CALL TestOverlapInY Jump to TestObjectCanBePickedUp_Done if the objects do not overlap along y.
49390 JR NC,TestObjectCanBePickedUp_Done
49392 LD A,(IX+3) Lower the player by 4.
49395 SUB 4
49397 LD (IX+3),A
49400 CALL TestOverlapInZ Test if the objects overlap along z.
49403 PUSH AF Stash the result on the stack.
49404 LD A,(IX+3) Raise the player by 4 again.
49407 ADD A,4
49409 LD (IX+3),A
49412 POP AF Restore the result from the stack.
TestObjectCanBePickedUp_Done 49413 POP BC Restore BC from the stack.
49414 RET Return.
View the equivalent code in;
Prev: 49319 Up: Map Next: 49415