Prev: A541 Up: Map Next: A5CA
A55F: Event: Containers And Scripts
Runs container checks and the character scripts for this turn. Reached through the action lists of $13 - "Barrel", $25 - "Wooden Chest" and $29 - "Wooden Boat" for action 36, dispatched by TriggerAction.
EventContainersAndScripts A55F LD IY,($B70C) Read *Pointer_CurrentCharacter.
A563 LD A,($B6E8) Read *CurrentObject.
A566 CP (IY+$01) Jump back to ResponseThatWillNotWork if the current object is where this object is.
A569 JP Z,ResponseThatWillNotWork
A56C LD IY,($B708) Read *B708.
A570 CALL ConditionTheObjectIsHere Call ConditionTheObjectIsHere to test whether the object is here.
A573 JP Z,ResponseThatWillNotWork Jump back to ResponseThatWillNotWork if ConditionTheObjectIsHere did not find the object here.
A576 LD A,($B6E8) Read *CurrentObject.
Find the object's record.
EventContainersAndScripts_Loop A579 CALL LocateObject Call LocateObject to locate object.
A57C LD A,(IX+$01) Read where this object is from the object record.
A57F CP $FF Jump to EventContainersAndScripts_TotalTheVolume if this object is not inside another object.
A581 JR Z,EventContainersAndScripts_TotalTheVolume
A583 LD A,($B6EA) Read *CurrentCharacter.
A586 CP (IX+$01) Compare the character whose turn it is with where this object is.
A589 LD A,(IX+$01) Read where this object is from the object record.
A58C JR NZ,EventContainersAndScripts_Loop Jump back to EventContainersAndScripts_Loop if the character whose turn it is is not where this object is.
A58E LD IX,($B708) Read *B708.
A592 LD (IX+$01),$FF Mark where this object is as unset.
EventContainersAndScripts_TotalTheVolume A596 LD IY,($B70C) Read *Pointer_CurrentCharacter.
A59A LD A,($B6EA) Read *CurrentCharacter.
A59D CALL Condition_TotalTheVolumeInside Call Condition_TotalTheVolumeInside to total the volume inside the character.
A5A0 ADD A,(IY+$02) Add the character's volume onto the total from Condition_TotalTheVolumeInside.
A5A3 JR C,EventContainersAndScripts_TestTheVolume Jump to EventContainersAndScripts_TestTheVolume if the sum overflowed, keeping the wrapped total.
A5A5 LD A,$FF There was no carry, so take FF as the total.
EventContainersAndScripts_TestTheVolume A5A7 LD B,A Copy the result into B.
A5A8 LD IX,($B708) Read *B708.
A5AC CALL Event_TestTheOpenFlag Call Event_TestTheOpenFlag to test whether the object is open.
A5AF JP Z,Message_NameFromThisRecord Jump to Message_NameFromThisRecord if the object is not open.
A5B2 LD A,(IX+$02) Read the volume from the object record.
A5B5 CP $FF Jump to EventContainersAndScripts_LetTheMessageThrough if this object's volume byte is FF.
A5B7 JR Z,EventContainersAndScripts_LetTheMessageThrough
A5B9 SUB B Subtract B from the object's volume.
A5BA LD HL,$B13E Point HL at "You are too big".
A5BD JP NC,PrintMessage Jump to PrintMessage to print it if the object's volume is not below B.
If the message is held back, the container checks are skipped.
EventContainersAndScripts_LetTheMessageThrough A5C0 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the container checks are skipped.
A5C3 LD A,($B6E8) Read *CurrentObject.
A5C6 LD (IY+$01),A Update where this object is.
A5C9 RET Return.
Prev: A541 Up: Map Next: A5CA