Prev: A9D6 Up: Map Next: AA5C
A9E5: Event: Give The Lunch
When the script location matches where the player started, gives the lunch (object 26). A character script in C913 calls this through the handler address at C9A1.
Event_GiveTheLunch A9E5 LD A,($B6F6) Read *B6F6.
A9E8 LD HL,$B6F5 Return if the script location is not where the player starts.
A9EB CP (HL)
A9EC RET NZ
A9ED LD IX,$C663 Point IX at $26 - "Lunch".
A9F1 LD A,(IX+$10) Read the location from the object record.
A9F4 CP $00 Jump to Event_GiveTheLunch_HoldTheMessage if the object's location is zero.
A9F6 JR Z,Event_GiveTheLunch_HoldTheMessage
A9F8 LD A,$41 Return unless this object is with 41.
A9FA CP (IX+$01)
A9FD RET NZ
If the message is held back, the lunch is not given.
Event_GiveTheLunch_HoldTheMessage A9FE CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the lunch is not given.
AA01 LD A,($B6F6) Read *B6F6.
AA04 LD (IX+$10),A Update the object's location.
AA07 LD (IX+$01),$41 Set where this object is to 41.
AA0B LD BC,$0026 Make 26 the current object and 00 (the player) the second object.
AA0E LD ($B6E8),BC Update *CurrentObject.
AA12 LD A,$1D Write 1D (give) to *CurrentAction.
AA14 LD ($B6E7),A
AA17 LD ($B708),IX Update *B708.
AA1B LD HL,$C11B Point *B70A at "You".
AA1E LD ($B70A),HL
Say that will not work.
AA21 CALL ResponseThatWillNotWork Call ResponseThatWillNotWork to answer with that will not work.
AA24 JP Action_Give Jump to Action_Give to give.
Reached through the action list of $13 - "Barrel" for action 38, dispatched by TriggerAction.
AA27 LD IY,($B708) Read *B708.
AA2B LD A,(IY+$10) Read the current object's location.
AA2E LD B,A Copy the result into B.
AA2F CALL ExitsFindTheExitToALocation Call ExitsFindTheExitToALocation to find an exit whose destination is that location.
AA32 CP $FF Compare the exit search with FF.
AA34 LD HL,$B301 Point HL at "You cannot jump onto[0x07] from here".
AA37 JP Z,PrintMessage Jump back to PrintMessage if no exit leads there.
AA3A LD A,(IX+$00) Read this exit's direction.
AA3D CP $0A Jump to TextMessages_0 if this direction is not down (0A). TextMessages_0 is inside the message text, which looks like a bug in the original.
AA3F JP NZ,$B301
If the message is held back, the lunch is not handed over.
AA42 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the lunch is not handed over.
AA45 LD A,($B6E8) Read *CurrentObject.
AA48 LD IX,($B70C) Read *Pointer_CurrentCharacter.
AA4C LD (IX+$01),A Update where this object is.
AA4F CALL Object_MoveContents_0 Call Object_MoveContents_0 to move what is inside the current object to that location.
AA52 LD A,($B6EA) Read *CurrentCharacter.
AA55 CP $00 Return if it is not the player's turn.
AA57 RET NZ
AA58 LD A,B Use the object's location again.
AA59 JP YouSeePreposition Jump back to YouSeePreposition to locate location.
Prev: A9D6 Up: Map Next: AA5C