Prev: 37621 Up: Map Next: 37708
37670: Pick Up Item
Used by the routine at HandlerPickupItem.
Puts an item in the first slot of the inventory (see Inventory_Slot1) and takes it off the screen. A slot is the address of the entity (two bytes), the sprite ID and the attribute.
Input
IX The item entity
PickUpItem 37670 LD HL,24112 Point HL at the first inventory slot at Inventory_Slot1.
37673 PUSH IX Copy IX into DE, as the address of the item.
37675 POP DE
37676 LD (HL),E Write the low byte of the address of the item to the first slot.
37677 INC HL Move on to the next byte.
37678 LD (HL),D Write the high byte of the address of the item to the first slot.
37679 INC HL Move on to the next byte.
37680 LD A,(IX+0) Fetch the sprite ID of the item.
37683 LD (HL),A Write the sprite ID of the item to the first slot.
37684 INC HL Move on to the next byte.
37685 LD A,(IX+5) Fetch the attribute of the item.
37688 LD (HL),A Write the attribute of the item to the first slot.
37689 CALL RemoveEntity Call RemoveEntity to remove the item from the screen.
37692 LD A,(24090) Fetch the room attribute from CurrentRoom_Attribute.
37695 LD (IX+5),A Update the attribute of the item.
37698 CALL SetEntityAttributes_Moved Call SetEntityAttributes_Moved to set the attributes of the cells it covered.
37701 LD (IX+0),0 Write 0 to the sprite ID of the item, as it is not in the room now.
37705 JP SoundsInventory Jump to SoundsInventory to make the sound of picking up.
Prev: 37621 Up: Map Next: 37708