Prev: C00B Up: Map Next: C041
C00E: Pick up or drop an object
Used by the routine at player_controls.
Called from the player's handler with IX on the player's lower record at $5C08. One press does one thing: pick up a charm the player is on or beside if there is one; otherwise put down the oldest charm carried. $5BB3 latches the press so holding the key down does nothing more.
Nothing happens unless the player is inside the room (not in an arch), not jumping, and standing on something. It also checks whether there is an object within 12 units above the player's head; if so, $5BD3 is set and a drop is refused, because a drop lifts the player 12 units onto the dropped object.
handle_pickup_drop C00E LD A,($5BB3) still held from the last press: wait for release
C011 AND A
C012 JP NZ,wait_pickup_release
C015 CALL chk_pickup_drop
C018 RET Z
C019 CALL chk_plyr_OOB only inside the room's walls
C01C RET NC
C01D BIT 3,(IX+$0C) not while jumping (+$0C bit 3), only when standing on something (bit 2)
C021 RET NZ
C022 BIT 2,(IX+$0C)
C026 RET Z
C027 XOR A anything within 12 units above? The player's z is raised to look, then put back
C028 LD ($5BD3),A
C02B LD A,(IX+$03)
C02E LD B,A
C02F ADD A,$0C
C031 LD (IX+$03),A
C034 CALL do_any_objs_intersect
C037 LD (IX+$03),B
C03A JR NC,start_pickup_drop
C03C LD A,$01 yes: there is no room to stand on a dropped object
C03E LD ($5BD3),A
Prev: C00B Up: Map Next: C041