Prev: 43478 Up: Map Next: 43612
43493: Event: Give The Lunch
When the script location matches where the player started, gives the lunch (object 38). A character script in 51475 calls this through the handler address at 51617.
Event_GiveTheLunch 43493 LD A,(46838) Read *46838.
43496 LD HL,46837 Return if the script location is not where the player starts.
43499 CP (HL)
43500 RET NZ
43501 LD IX,50787 Point IX at 38 - "Lunch".
43505 LD A,(IX+16) Read the location from the object record.
43508 CP 0 Jump to Event_GiveTheLunch_HoldTheMessage if the object's location is zero.
43510 JR Z,Event_GiveTheLunch_HoldTheMessage
43512 LD A,65 Return unless this object is with 65.
43514 CP (IX+1)
43517 RET NZ
If the message is held back, the lunch is not given.
Event_GiveTheLunch_HoldTheMessage 43518 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the lunch is not given.
43521 LD A,(46838) Read *46838.
43524 LD (IX+16),A Update the object's location.
43527 LD (IX+1),65 Set where this object is to 65.
43531 LD BC,38 Make 38 the current object and 0 (the player) the second object.
43534 LD (46824),BC Update *CurrentObject.
43538 LD A,29 Write 29 (give) to *CurrentAction.
43540 LD (46823),A
43543 LD (46856),IX Update *46856.
43547 LD HL,49435 Point *46858 at "You".
43550 LD (46858),HL
Say that will not work.
43553 CALL ResponseThatWillNotWork Call ResponseThatWillNotWork to answer with that will not work.
43556 JP Action_Give Jump to Action_Give to give.
Reached through the action list of 19 - "Barrel" for action 56, dispatched by TriggerAction.
43559 LD IY,(46856) Read *46856.
43563 LD A,(IY+16) Read the current object's location.
43566 LD B,A Copy the result into B.
43567 CALL ExitsFindTheExitToALocation Call ExitsFindTheExitToALocation to find an exit whose destination is that location.
43570 CP 255 Compare the exit search with 255.
43572 LD HL,45825 Point HL at "You cannot jump onto[0x07] from here".
43575 JP Z,PrintMessage Jump back to PrintMessage if no exit leads there.
43578 LD A,(IX+0) Read this exit's direction.
43581 CP 10 Jump to TextMessages_0 if this direction is not down (10). TextMessages_0 is inside the message text, which looks like a bug in the original.
43583 JP NZ,45825
If the message is held back, the lunch is not handed over.
43586 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the lunch is not handed over.
43589 LD A,(46824) Read *CurrentObject.
43592 LD IX,(46860) Read *Pointer_CurrentCharacter.
43596 LD (IX+1),A Update where this object is.
43599 CALL Object_MoveContents_0 Call Object_MoveContents_0 to move what is inside the current object to that location.
43602 LD A,(46826) Read *CurrentCharacter.
43605 CP 0 Return if it is not the player's turn.
43607 RET NZ
43608 LD A,B Use the object's location again.
43609 JP YouSeePreposition Jump back to YouSeePreposition to locate location.
Prev: 43478 Up: Map Next: 43612