Prev: 89E3 Up: Map Next: 8A32
89ED: Action 00 : Swaps object carried with object in room.
Input
HL Points to address holding index of object required.
Output
Assumes pockets have already been checked for object existing.
Action00_SwapObj 89ED LD A,$01 Stop further action on objects.
89EF LD (ObjEventPause),A
89F2 LD A,(HL) Get index of object required.
89F3 INC HL
89F4 PUSH HL
89F5 LD HL,Pocket1 Check to see if its in pocket 1. If not assumes its in pocket 2.
89F8 CP (HL)
89F9 JR Z,Action00_SwapObj_0
89FB INC HL
Action00_SwapObj_0 89FC LD A,(Wally_RoomNo) Workout the address for the object slot of current room.
89FF LD E,A
8A00 ADD A,A
8A01 ADD A,E
8A02 LD E,A
8A03 PUSH HL
8A04 LD HL,Room_ObjSlots
8A07 LD D,$00
8A09 ADD HL,DE
8A0A EX DE,HL
8A0B POP HL
8A0C LD A,(DE) Get x position for slot on screen and tell draw routine.
8A0D LD (BitmapX),A
8A10 INC DE
8A11 LD A,(DE) Get y position for slot on screen, adjust and tell draw routine.
8A12 ADD A,$10
8A14 LD (BitmapY),A
8A17 INC DE
8A18 LD C,(HL) Get index of required object from pocket.
8A19 LD A,(DE) Get index of object currently in the room.
8A1A LD (HL),A Put it into pocket.
8A1B LD A,C Put object, originally in pocket, into room.
8A1C LD (DE),A
8A1D ADD A,$50 Erase image currently on screen.
8A1F CALL Bitmap16Draw
8A22 LD A,(HL) Draw new object in room.
8A23 ADD A,$50
8A25 CALL Bitmap16Draw
8A28 CALL Inv_Redraw Make sure the screen is updated for new object in pocket.
8A2B CALL Beep_PickUp
8A2E POP HL
8A2F JP Room_TestEvents_0
Prev: 89E3 Up: Map Next: 8A32