Prev: A92C Up: Map Next: AA7F
AA30: Handler: Pick Up Objects
Used by the routines at Handler_Move_Characters and EB01.
Handler_PickUpObjects AA30 PUSH HL Stash HL on the stack.
AA31 CALL Handler_ItemsCurrentRoom Call Handler_ItemsCurrentRoom.
AA34 INC HL Increment HL by three.
AA35 INC HL
AA36 INC HL
AA37 LD A,(HL)
AA38 AND (IY-$28)
AA3B JR Z,Handler_PickUpObjects_1
AA3D LD A,(HL)
AA3E AND %10000000 Keep only bit 7.
AA40 JR Z,Handler_PickUpObjects_0
AA42 PUSH HL Stash HL on the stack.
AA43 CALL Character_Active Call Character_Active.
AA46 POP HL Restore HL from the stack.
AA47 JR NZ,Handler_PickUpObjects_1
Handler_PickUpObjects_0 AA49 LD A,(HL)
AA4A RES 7,A
AA4C LD D,A
AA4D LD A,(HL)
AA4E AND %10000000 Keep only bit 7.
AA50 OR (IY-$32)
AA53 LD (HL),A
AA54 LD A,(IY-$37)
AA57 LD (IY-$32),A
AA5A LD (IY-$37),D
Fetch the item 2 ID, we're about to drop it.
AA5D LD A,(IY+$55) A=*IY+55.
AA60 DEC HL Decrease HL by three.
AA61 DEC HL
AA62 DEC HL
Fetch the picked up item ID.
AA63 LD E,(HL) E=*HL.
Write the dropped item ID to *HL.
AA64 LD (HL),A Write A to *HL.
Move the characters collected item 1 to item 2.
AA65 LD A,(IY+$50) A=*IY+50.
AA68 LD (IY+$55),A Write A to *IY+55.
Write the picked up item to the characters item 1.
AA6B LD (IY+$50),E Write E to *IY+50.
AA6E CALL Character_Active Call Character_Active.
AA71 CALL Z,$E41D
Handler_PickUpObjects_1 AA74 LD A,($B951)
AA77 CP (IY+$0F)
AA7A CALL Z,Sounds_PickUp
AA7D POP HL Restore HL from the stack.
AA7E RET Return.
Prev: A92C Up: Map Next: AA7F