![]() |
Routines |
| Prev: A5CA | Up: Map | Next: A7AA |
|
Runs for the barrel. When the player is inside it, the player is thrown onto the bank of the long lake. The barrel record at CA86 calls this.
|
||||
| Event_TheBarrel | A5FB | SUB A | Clear the flag at B6F0. | |
| A5FC | LD ($B6F0),A | Update *B6F0. | ||
| A5FF | LD A,($C11C) | Read where the player is. | ||
| A602 | CP $13 | Is the player inside object 13, i.e. using the "Barrel"? | ||
| A604 | LD HL,$B32C | Point at the message "you are thrown onto the bank of the long lake" (B32C). | ||
| A607 | CALL Z,PrintMessage | Call PrintMessage to print it if the player is inside the barrel. | ||
| A60A | LD A,$22 | Write 22 to *C3FE. | ||
| A60C | LD ($C3FE),A | |||
| A60F | LD B,A | Copy the result into B. | ||
| A610 | LD A,$13 | Use the barrel, object 13. | ||
| A612 | CALL Object_MoveContents_0 | Call Object_MoveContents_0 to move what is inside the barrel to location 22. | ||
| A615 | LD IX,$C3EE | Point IX at $13 - "Barrel". | ||
| A619 | LD (IX+$10),$20 | Update the location of the object to location 20 - "Elvenkings Cellar". | ||
| A61D | RES 5,(IX+$07) | Close the object. | ||
| A621 | SET 2,(IX+$07) | Mark the object full. | ||
| A625 | SUB A | Clear the time-of-day flag, then look up object 13. | ||
| A626 | LD ($B702),A | Update *NightDay. | ||
| A629 | LD A,$13 | Look up where object 13 is. | ||
| A62B | CALL Condition_WhereTheObjectIs_0 | Call Condition_WhereTheObjectIs_0 to find where the object is. | ||
| A62E | LD A,$01 | Write 01 (day) to *NightDay. | ||
| A630 | LD ($B702),A | |||
| A633 | LD IY,$C418 | Point IY at $14 - "Wine". | ||
| A637 | LD (IY+$10),$20 | Set the object's location to 20. | ||
| A63B | LD (IY+$01),$13 | Set where this object is to 13. | ||
| A63F | RET | Return. | ||
| A640 | LD A,($B6F6) | Read *B6F6. | ||
| A643 | LD HL,$B6F5 | Return if the script location is not where the player starts. | ||
| A646 | CP (HL) | |||
| A647 | RET NZ | |||
| A648 | LD A,($C122) | Return if the player is visible. | ||
| A64B | BIT 7,A | |||
| A64D | RET NZ | |||
|
If the message is held back, the thief question is not printed.
|
||||
| A64E | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the thief question is not printed. | ||
| A651 | LD HL,$B0CB | Point at the message "where's the thief ?[0x16]" (B0CB). | ||
| A654 | JP Response_YouSay | Jump back to Response_YouSay to print "where's the thief ?". | ||
|
If the message is held back, the barrel does not throw the player out.
|
||||
| A657 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the barrel does not throw the player out. | ||
| A65A | LD A,$08 | Roll a random number below 08. | ||
|
Roll a random number.
|
||||
| A65C | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| A65F | CP $05 | Return if the roll is not below 05. | ||
| A661 | RET NC | |||
| A662 | CP $03 | Jump back to Turn_FinishTheSentence if the roll is not below 03. | ||
| A664 | LD HL,$B0F4 | |||
| A667 | JP NC,Turn_FinishTheSentence | |||
| A66A | LD HL,$B0D5 | Point HL at B0D5 and jump back to Response_YouSay if the roll is 03 (never taken: a roll of 03 has already jumped at A667). | ||
| A66D | JP Z,Response_YouSay | |||
| A670 | LD HL,$B0E5 | Jump back to Turn_FinishTheSentence when the roll is zero. | ||
| A673 | CP $00 | |||
| A675 | JP Z,Turn_FinishTheSentence | |||
| A678 | LD HL,$B05B | Point at the message "hurry up." (B05B). | ||
| A67B | JP Response_YouSay | Jump back to Response_YouSay to print "hurry up.". | ||
|
Reached through the action list of $0C - "Large Trap Door" for actions 0C and 10, dispatched by TriggerAction.
|
||||
| A67E | LD IX,($B70C) | Read *Pointer_CurrentCharacter. | ||
| A682 | LD A,(IX+$10) | Read the location from the object record. | ||
| A685 | CP $20 | Jump back to PrintMessage if the object's location is not 20. | ||
| A687 | LD HL,$B11B | |||
| A68A | JP NZ,PrintMessage | |||
|
Test the current action.
|
||||
| A68D | LD A,($B6E7) | Jump to Action_Close if *CurrentAction is 0C (close). | ||
| A690 | CP $0C | |||
| A692 | JP Z,Action_Close | |||
| A695 | JP ActionOpenOrClose | Jump to ActionOpenOrClose to open or close. | ||
|
Test the flag.
|
||||
| A698 | LD A,($C12B) | Jump to Event_TheBarrel_LetTheMessageThrough if *C12B is 27. | ||
| A69B | CP $27 | |||
| A69D | JR Z,Event_TheBarrel_LetTheMessageThrough | |||
| A69F | CP $2C | Jump to Event_TheBarrel_LetTheMessageThrough if the current location is 2C. | ||
| A6A1 | JR Z,Event_TheBarrel_LetTheMessageThrough | |||
| A6A3 | CP $29 | Return if the current location is not 29. | ||
| A6A5 | RET NZ | |||
|
If the message is held back, the location is not changed.
|
||||
| Event_TheBarrel_LetTheMessageThrough | A6A6 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the location is not changed. | |
| A6A9 | LD A,($C12B) | Read the current location. | ||
| A6AC | LD HL,$C143 | Point HL at the location byte at C143. | ||
| A6AF | CP (HL) | Return if the current location is that object's location. | ||
| A6B0 | RET Z | |||
| A6B1 | LD (HL),A | Store it at C143. | ||
| A6B2 | LD A,$01 | Write 01 (day) to *NightDay. | ||
| A6B4 | LD ($B702),A | |||
| A6B7 | LD HL,$C13B | Point HL at "St Ll N". | ||
| A6BA | PUSH HL | Point at the message "[0x00] enter(s|d|ing|es).[0x14]". | ||
| A6BB | LD HL,$B017 | |||
|
Print the message at HL.
|
||||
| Event_TheBarrel_PrintMessage | A6BE | CALL PrintMessage | Call PrintMessage to print message. | |
| A6C1 | RET | Return. | ||
| A6C2 | LD A,($C12B) | Return if the current location is not the script location. | ||
| A6C5 | LD HL,$B6F6 | |||
| A6C8 | CP (HL) | |||
| A6C9 | RET NZ | |||
|
If the message is held back, the player's attributes are left alone.
|
||||
| A6CA | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the player's attributes are left alone. | ||
| A6CD | LD A,($C122) | Read the player's attributes. | ||
| A6D0 | AND $80 | Keep only bit 7. | ||
| A6D2 | LD HL,$B17E | Point HL at "the dragon say(s|d|ing|es)". | ||
| A6D5 | JR Z,Event_TheBarrel_DragonSays | Jump to Event_TheBarrel_DragonSays if the player is not visible. | ||
| A6D7 | LD HL,$B15D | Point HL at "the dragon say(s|d|ing|es)". | ||
| Event_TheBarrel_DragonSays | A6DA | JR Event_TheBarrel_PrintMessage | Jump back to Event_TheBarrel_PrintMessage to print "the dragon say(s|d|ing|es)". | |
| A6DC | LD A,($C5DD) | Return if that object's location is 29. | ||
| A6DF | CP $29 | |||
| A6E1 | RET Z | |||
| A6E2 | LD A,($C12B) | Read the current location. | ||
|
Find the location's record.
|
||||
| A6E5 | CALL LocateLocation | Call LocateLocation to locate location. | ||
| A6E8 | BIT 7,(IX+$00) | Return if bit 7 of the location attribute is clear. | ||
| A6EC | RET Z | |||
|
If the message is held back, day is not announced.
|
||||
| A6ED | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, day is not announced. | ||
| A6F0 | LD A,$01 | Write 01 (day) to *NightDay. | ||
| A6F2 | LD ($B702),A | |||
| A6F5 | LD HL,$B1A6 | Point HL at "in the distance you see the shape of a monstrous dragon flying after you". | ||
| A6F8 | LD A,$64 | Take the roll limit 64. | ||
|
Roll a random number.
|
||||
| A6FA | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| A6FD | CP $50 | Jump to Event_TheBarrel_PrintMessage if the roll is below 50. | ||
| A6FF | JR C,Event_TheBarrel_PrintMessage | |||
|
Print the message at HL.
|
||||
| A701 | LD HL,$B1BA | Point HL at the message and call PrintMessage. | ||
| A704 | CALL PrintMessage | |||
| A707 | JP YouAreDead | Jump to YouAreDead to end the game. | ||
|
Find the exit through the current object.
|
||||
| A70A | CALL ExitsFindTheExitThroughAnObject | Call ExitsFindTheExitThroughAnObject to find the exit through the current object. | ||
| A70D | CP $FF | Return if no matching exit was found. | ||
| A70F | RET Z | |||
| A710 | SUB A | Return zero; the exit is cleared below. | ||
| A711 | LD (IX+$00),$00 | Clear this exit's direction. | ||
| A715 | LD (IX+$01),$00 | Clear the object this exit goes via. | ||
| A719 | LD (IX+$02),$00 | Clear this exit's destination. | ||
| A71D | RET | Return. | ||
|
If the message is held back, the barrel event stops.
Reached through the action list of $0D - "Magic Door" for action 1C, dispatched by TriggerAction.
|
||||
| A71E | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the barrel event stops. | ||
| A721 | LD IX,($B70C) | Read *Pointer_CurrentCharacter. | ||
| A725 | BIT 7,(IX+$07) | Test the object's attributes. | ||
| A729 | LD HL,$AFF4 | Point HL at "You see nothing special here". | ||
| A72C | JP NZ,PrintMessage | Jump back to PrintMessage if the object is visible. | ||
| A72F | LD A,($CAA7) | Copy the magic-door id at CAA7 into the next byte. | ||
| A732 | LD ($CAA8),A | |||
|
Say "The magic door warn(s|d|ing|es) of elves approach(s|d|ing|es)".
|
||||
| A735 | LD HL,$B2AA | Point HL at the message and call PrintMessage. | ||
| A738 | JP PrintMessage | |||
|
Reached through the action list of $3F - "Thorin" for action 00, dispatched by TriggerAction.
|
||||
| A73B | LD HL,$C3B9 | Return if that object is not broken. | ||
| A73E | BIT 3,(HL) | |||
| A740 | RET Z | |||
| A741 | CALL Turn_GateTheMessage | Call Turn_GateTheMessage to let the message through or hold it back. | ||
| A744 | LD IX,$C1AD | Point IX at $02 - "Small Curious Key". | ||
| A748 | SET 3,(IX+$07) | Mark the object broken. | ||
| A74C | LD A,$02 | Clear the tie on object 02. | ||
| A74E | CALL Action_ClearTheTie | Call Action_ClearTheTie to clear the tie on the object. | ||
| A751 | LD A,$02 | Pass object id 02. | ||
| A753 | LD IY,$C11B | Point IY at $00 - "You". | ||
| A757 | CALL Condition_SwapAndRetest | Call Condition_SwapAndRetest to swap the objects and test visibility again. | ||
| A75A | RET Z | Return if the object is not visible. | ||
|
Say "the small curious key shatter(s|d|ing|es)".
|
||||
| A75B | LD HL,$B109 | Point HL at the message and call PrintMessage. | ||
| A75E | JP PrintMessage | |||
|
Test whose turn it is.
Reached through the action list of $1B - "Window" for actions 0C and 10, dispatched by TriggerAction.
|
||||
| A761 | LD A,($B6EA) | Jump to Event_TheBarrel_TestForClose if *CurrentCharacter is not 00 (the player). | ||
| A764 | CP $00 | |||
| A766 | JR NZ,Event_TheBarrel_TestForClose | |||
| A768 | LD A,($C11C) | Read where the player is. | ||
| A76B | LD HL,$B11B | Point HL at "you cannot reach[0x07]". | ||
| A76E | CP $FF | Jump back to PrintMessage if where the player is is FF. | ||
| A770 | JP Z,PrintMessage | |||
| A773 | JP ResponseThatWillNotWork | Jump to ResponseThatWillNotWork to say that will not work. | ||
|
Test the current action.
|
||||
| Event_TheBarrel_TestForClose | A776 | LD A,($B6E7) | Jump to Action_Close if *CurrentAction is 0C (close). | |
| A779 | CP $0C | |||
| A77B | JP Z,Action_Close | |||
| A77E | CP $10 | Jump back to ActionOpenOrClose if the current action is 10. | ||
| A780 | JP Z,ActionOpenOrClose | |||
| A783 | RET | Return. | ||
|
Test whose turn it is.
Reached through the action list of $1B - "Window" for actions 0B, 18 and 1E, dispatched by TriggerAction.
|
||||
| A784 | LD A,($B6EA) | Jump to Event_TheBarrel_TestTheAction if *CurrentCharacter is not 00 (the player). | ||
| A787 | CP $00 | |||
| A789 | JP NZ,Event_TheBarrel_TestTheAction | |||
| A78C | LD A,($C11C) | Read where the player is. | ||
| A78F | CP $FF | Compare where the player is with FF. | ||
| A791 | LD HL,$B11B | Point HL at "you cannot reach[0x07]". | ||
| A794 | JP Z,PrintMessage | Jump back to PrintMessage if where the player is is FF. | ||
|
Test the current action.
|
||||
| Event_TheBarrel_TestTheAction | A797 | LD A,($B6E7) | Jump to Action_LeaveIfTheWayIsOpen if *CurrentAction is 1E. | |
| A79A | CP $1E | |||
| A79C | JP Z,Action_LeaveIfTheWayIsOpen | |||
| A79F | CP $0B | Jump back to Action_UseTheOtherObject if the current action is 0B. | ||
| A7A1 | JP Z,Action_UseTheOtherObject | |||
| A7A4 | CP $18 | Jump back to Action_CarryOnWithTheObject if the current action is 18. | ||
| A7A6 | JP Z,Action_CarryOnWithTheObject | |||
| A7A9 | RET | Return. | ||
| Prev: A5CA | Up: Map | Next: A7AA |