Prev: 49175 Up: Map Next: 49364
49319: Pick Up Object
Used by the routine at HandlePickupAndDrop.
Picks up an object, which is put in the first place of the inventory (until it is moved along to the second place), and removed from the room. The object is changed into the marker that makes DrawObject erase it. If the carried objects are all in use, the oldest one is dropped where the other one was.
Input
IY Record of the object that is being picked up
Copy the object into the first place of the inventory.
PickUpObject 49319 LD HL,42786 Start at the first place of the inventory, ObjectsCarried.
49322 LD A,(IY+0) Set the type of the object in the inventory.
49325 LD (HL),A
49326 INC HL Move on to the flags.
49327 LD A,(IY+7) Set the flags of the object.
49330 LD (HL),A
49331 INC HL Move on to the address of the object in the store.
49332 LD E,(IY+16) Fetch the address of the object in the store.
49335 LD D,(IY+17)
49338 XOR A Write zero to the store, to say that the object is no longer in the room.
49339 LD (DE),A
49340 LD (HL),E Set the address in the inventory.
49341 INC HL
49342 LD (HL),D
Erase the object from the room.
49343 CALL SetWipeAndDrawFlagsForObject Call SetWipeAndDrawFlagsForObject to mark the object to be drawn.
49346 LD (IY+0),1 Change the object to the type that makes it be erased.
Drop the oldest carried object if the inventory is full.
49350 LD HL,42798 Take the oldest carried object, ObjectsCarried_Oldest.
49353 LD A,(HL) Fetch the type of it.
49354 INC HL
49355 AND A Jump to DropObject_MoveAlong to move the objects along if it is not in use.
49356 JR Z,DropObject_MoveAlong
49358 LD (IY+0),A Make it the type of the object that is picked up, so that it is dropped here.
49361 PUSH HL Stash the address of the flags of the carried object on the stack.
49362 JR DropObject_SetUp Jump to DropObject_SetUp to set up the dropped object.
Prev: 49175 Up: Map Next: 49364