Prev: 42305 Up: Map Next: 42442
42335: Event: Containers And Scripts
Runs container checks and the character scripts for this turn. Reached through the action lists of 19 - "Barrel", 37 - "Wooden Chest" and 41 - "Wooden Boat" for action 54, dispatched by TriggerAction.
EventContainersAndScripts 42335 LD IY,(46860) Read *Pointer_CurrentCharacter.
42339 LD A,(46824) Read *CurrentObject.
42342 CP (IY+1) Jump back to ResponseThatWillNotWork if the current object is where this object is.
42345 JP Z,ResponseThatWillNotWork
42348 LD IY,(46856) Read *46856.
42352 CALL ConditionTheObjectIsHere Call ConditionTheObjectIsHere to test whether the object is here.
42355 JP Z,ResponseThatWillNotWork Jump back to ResponseThatWillNotWork if ConditionTheObjectIsHere did not find the object here.
42358 LD A,(46824) Read *CurrentObject.
Find the object's record.
EventContainersAndScripts_Loop 42361 CALL LocateObject Call LocateObject to locate object.
42364 LD A,(IX+1) Read where this object is from the object record.
42367 CP 255 Jump to EventContainersAndScripts_TotalTheVolume if this object is not inside another object.
42369 JR Z,EventContainersAndScripts_TotalTheVolume
42371 LD A,(46826) Read *CurrentCharacter.
42374 CP (IX+1) Compare the character whose turn it is with where this object is.
42377 LD A,(IX+1) Read where this object is from the object record.
42380 JR NZ,EventContainersAndScripts_Loop Jump back to EventContainersAndScripts_Loop if the character whose turn it is is not where this object is.
42382 LD IX,(46856) Read *46856.
42386 LD (IX+1),255 Mark where this object is as unset.
EventContainersAndScripts_TotalTheVolume 42390 LD IY,(46860) Read *Pointer_CurrentCharacter.
42394 LD A,(46826) Read *CurrentCharacter.
42397 CALL Condition_TotalTheVolumeInside Call Condition_TotalTheVolumeInside to total the volume inside the character.
42400 ADD A,(IY+2) Add the character's volume onto the total from Condition_TotalTheVolumeInside.
42403 JR C,EventContainersAndScripts_TestTheVolume Jump to EventContainersAndScripts_TestTheVolume if the sum overflowed, keeping the wrapped total.
42405 LD A,255 There was no carry, so take 255 as the total.
EventContainersAndScripts_TestTheVolume 42407 LD B,A Copy the result into B.
42408 LD IX,(46856) Read *46856.
42412 CALL Event_TestTheOpenFlag Call Event_TestTheOpenFlag to test whether the object is open.
42415 JP Z,Message_NameFromThisRecord Jump to Message_NameFromThisRecord if the object is not open.
42418 LD A,(IX+2) Read the volume from the object record.
42421 CP 255 Jump to EventContainersAndScripts_LetTheMessageThrough if this object's volume byte is 255.
42423 JR Z,EventContainersAndScripts_LetTheMessageThrough
42425 SUB B Subtract B from the object's volume.
42426 LD HL,45374 Point HL at "You are too big".
42429 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 42432 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the container checks are skipped.
42435 LD A,(46824) Read *CurrentObject.
42438 LD (IY+1),A Update where this object is.
42441 RET Return.
Prev: 42305 Up: Map Next: 42442