![]() |
Routines |
| Prev: 42442 | Up: Map | Next: 42922 |
|
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 51846 calls this.
|
||||
| Event_TheBarrel | 42491 | SUB A | Clear the flag at 46832. | |
| 42492 | LD (46832),A | Update *46832. | ||
| 42495 | LD A,(49436) | Read where the player is. | ||
| 42498 | CP 19 | Is the player inside object 19, i.e. using the "Barrel"? | ||
| 42500 | LD HL,45868 | Point at the message "you are thrown onto the bank of the long lake" (45868). | ||
| 42503 | CALL Z,PrintMessage | Call PrintMessage to print it if the player is inside the barrel. | ||
| 42506 | LD A,34 | Write 34 to *50174. | ||
| 42508 | LD (50174),A | |||
| 42511 | LD B,A | Copy the result into B. | ||
| 42512 | LD A,19 | Use the barrel, object 19. | ||
| 42514 | CALL Object_MoveContents_0 | Call Object_MoveContents_0 to move what is inside the barrel to location 34. | ||
| 42517 | LD IX,50158 | Point IX at 19 - "Barrel". | ||
| 42521 | LD (IX+16),32 | Update the location of the object to location 32 - "Elvenkings Cellar". | ||
| 42525 | RES 5,(IX+7) | Close the object. | ||
| 42529 | SET 2,(IX+7) | Mark the object full. | ||
| 42533 | SUB A | Clear the time-of-day flag, then look up object 19. | ||
| 42534 | LD (46850),A | Update *NightDay. | ||
| 42537 | LD A,19 | Look up where object 19 is. | ||
| 42539 | CALL Condition_WhereTheObjectIs_0 | Call Condition_WhereTheObjectIs_0 to find where the object is. | ||
| 42542 | LD A,1 | Write 1 (day) to *NightDay. | ||
| 42544 | LD (46850),A | |||
| 42547 | LD IY,50200 | Point IY at 20 - "Wine". | ||
| 42551 | LD (IY+16),32 | Set the object's location to 32. | ||
| 42555 | LD (IY+1),19 | Set where this object is to 19. | ||
| 42559 | RET | Return. | ||
| 42560 | LD A,(46838) | Read *46838. | ||
| 42563 | LD HL,46837 | Return if the script location is not where the player starts. | ||
| 42566 | CP (HL) | |||
| 42567 | RET NZ | |||
| 42568 | LD A,(49442) | Return if the player is visible. | ||
| 42571 | BIT 7,A | |||
| 42573 | RET NZ | |||
|
If the message is held back, the thief question is not printed.
|
||||
| 42574 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the thief question is not printed. | ||
| 42577 | LD HL,45259 | Point at the message "where's the thief ?[0x16]" (45259). | ||
| 42580 | 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.
|
||||
| 42583 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the barrel does not throw the player out. | ||
| 42586 | LD A,8 | Roll a random number below 8. | ||
|
Roll a random number.
|
||||
| 42588 | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| 42591 | CP 5 | Return if the roll is not below 5. | ||
| 42593 | RET NC | |||
| 42594 | CP 3 | Jump back to Turn_FinishTheSentence if the roll is not below 3. | ||
| 42596 | LD HL,45300 | |||
| 42599 | JP NC,Turn_FinishTheSentence | |||
| 42602 | LD HL,45269 | Point HL at 45269 and jump back to Response_YouSay if the roll is 3 (never taken: a roll of 3 has already jumped at 42599). | ||
| 42605 | JP Z,Response_YouSay | |||
| 42608 | LD HL,45285 | Jump back to Turn_FinishTheSentence when the roll is zero. | ||
| 42611 | CP 0 | |||
| 42613 | JP Z,Turn_FinishTheSentence | |||
| 42616 | LD HL,45147 | Point at the message "hurry up." (45147). | ||
| 42619 | JP Response_YouSay | Jump back to Response_YouSay to print "hurry up.". | ||
|
Reached through the action list of 12 - "Large Trap Door" for actions 12 and 16, dispatched by TriggerAction.
|
||||
| 42622 | LD IX,(46860) | Read *Pointer_CurrentCharacter. | ||
| 42626 | LD A,(IX+16) | Read the location from the object record. | ||
| 42629 | CP 32 | Jump back to PrintMessage if the object's location is not 32. | ||
| 42631 | LD HL,45339 | |||
| 42634 | JP NZ,PrintMessage | |||
|
Test the current action.
|
||||
| 42637 | LD A,(46823) | Jump to Action_Close if *CurrentAction is 12 (close). | ||
| 42640 | CP 12 | |||
| 42642 | JP Z,Action_Close | |||
| 42645 | JP ActionOpenOrClose | Jump to ActionOpenOrClose to open or close. | ||
|
Test the flag.
|
||||
| 42648 | LD A,(49451) | Jump to Event_TheBarrel_LetTheMessageThrough if *49451 is 39. | ||
| 42651 | CP 39 | |||
| 42653 | JR Z,Event_TheBarrel_LetTheMessageThrough | |||
| 42655 | CP 44 | Jump to Event_TheBarrel_LetTheMessageThrough if the current location is 44. | ||
| 42657 | JR Z,Event_TheBarrel_LetTheMessageThrough | |||
| 42659 | CP 41 | Return if the current location is not 41. | ||
| 42661 | RET NZ | |||
|
If the message is held back, the location is not changed.
|
||||
| Event_TheBarrel_LetTheMessageThrough | 42662 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the location is not changed. | |
| 42665 | LD A,(49451) | Read the current location. | ||
| 42668 | LD HL,49475 | Point HL at the location byte at 49475. | ||
| 42671 | CP (HL) | Return if the current location is that object's location. | ||
| 42672 | RET Z | |||
| 42673 | LD (HL),A | Store it at 49475. | ||
| 42674 | LD A,1 | Write 1 (day) to *NightDay. | ||
| 42676 | LD (46850),A | |||
| 42679 | LD HL,49467 | Point HL at "St Ll N". | ||
| 42682 | PUSH HL | Point at the message "[0x00] enter(s|d|ing|es).[0x14]". | ||
| 42683 | LD HL,45079 | |||
|
Print the message at HL.
|
||||
| Event_TheBarrel_PrintMessage | 42686 | CALL PrintMessage | Call PrintMessage to print message. | |
| 42689 | RET | Return. | ||
| 42690 | LD A,(49451) | Return if the current location is not the script location. | ||
| 42693 | LD HL,46838 | |||
| 42696 | CP (HL) | |||
| 42697 | RET NZ | |||
|
If the message is held back, the player's attributes are left alone.
|
||||
| 42698 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the player's attributes are left alone. | ||
| 42701 | LD A,(49442) | Read the player's attributes. | ||
| 42704 | AND 128 | Keep only bit 7. | ||
| 42706 | LD HL,45438 | Point HL at "the dragon say(s|d|ing|es)". | ||
| 42709 | JR Z,Event_TheBarrel_DragonSays | Jump to Event_TheBarrel_DragonSays if the player is not visible. | ||
| 42711 | LD HL,45405 | Point HL at "the dragon say(s|d|ing|es)". | ||
| Event_TheBarrel_DragonSays | 42714 | JR Event_TheBarrel_PrintMessage | Jump back to Event_TheBarrel_PrintMessage to print "the dragon say(s|d|ing|es)". | |
| 42716 | LD A,(50653) | Return if that object's location is 41. | ||
| 42719 | CP 41 | |||
| 42721 | RET Z | |||
| 42722 | LD A,(49451) | Read the current location. | ||
|
Find the location's record.
|
||||
| 42725 | CALL LocateLocation | Call LocateLocation to locate location. | ||
| 42728 | BIT 7,(IX+0) | Return if bit 7 of the location attribute is clear. | ||
| 42732 | RET Z | |||
|
If the message is held back, day is not announced.
|
||||
| 42733 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, day is not announced. | ||
| 42736 | LD A,1 | Write 1 (day) to *NightDay. | ||
| 42738 | LD (46850),A | |||
| 42741 | LD HL,45478 | Point HL at "in the distance you see the shape of a monstrous dragon flying after you". | ||
| 42744 | LD A,100 | Take the roll limit 100. | ||
|
Roll a random number.
|
||||
| 42746 | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| 42749 | CP 80 | Jump to Event_TheBarrel_PrintMessage if the roll is below 80. | ||
| 42751 | JR C,Event_TheBarrel_PrintMessage | |||
|
Print the message at HL.
|
||||
| 42753 | LD HL,45498 | Point HL at the message and call PrintMessage. | ||
| 42756 | CALL PrintMessage | |||
| 42759 | JP YouAreDead | Jump to YouAreDead to end the game. | ||
|
Find the exit through the current object.
|
||||
| 42762 | CALL ExitsFindTheExitThroughAnObject | Call ExitsFindTheExitThroughAnObject to find the exit through the current object. | ||
| 42765 | CP 255 | Return if no matching exit was found. | ||
| 42767 | RET Z | |||
| 42768 | SUB A | Return zero; the exit is cleared below. | ||
| 42769 | LD (IX+0),0 | Clear this exit's direction. | ||
| 42773 | LD (IX+1),0 | Clear the object this exit goes via. | ||
| 42777 | LD (IX+2),0 | Clear this exit's destination. | ||
| 42781 | RET | Return. | ||
|
If the message is held back, the barrel event stops.
Reached through the action list of 13 - "Magic Door" for action 28, dispatched by TriggerAction.
|
||||
| 42782 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the barrel event stops. | ||
| 42785 | LD IX,(46860) | Read *Pointer_CurrentCharacter. | ||
| 42789 | BIT 7,(IX+7) | Test the object's attributes. | ||
| 42793 | LD HL,45044 | Point HL at "You see nothing special here". | ||
| 42796 | JP NZ,PrintMessage | Jump back to PrintMessage if the object is visible. | ||
| 42799 | LD A,(51879) | Copy the magic-door id at 51879 into the next byte. | ||
| 42802 | LD (51880),A | |||
|
Say "The magic door warn(s|d|ing|es) of elves approach(s|d|ing|es)".
|
||||
| 42805 | LD HL,45738 | Point HL at the message and call PrintMessage. | ||
| 42808 | JP PrintMessage | |||
|
Reached through the action list of 63 - "Thorin" for action 0, dispatched by TriggerAction.
|
||||
| 42811 | LD HL,50105 | Return if that object is not broken. | ||
| 42814 | BIT 3,(HL) | |||
| 42816 | RET Z | |||
| 42817 | CALL Turn_GateTheMessage | Call Turn_GateTheMessage to let the message through or hold it back. | ||
| 42820 | LD IX,49581 | Point IX at 2 - "Small Curious Key". | ||
| 42824 | SET 3,(IX+7) | Mark the object broken. | ||
| 42828 | LD A,2 | Clear the tie on object 2. | ||
| 42830 | CALL Action_ClearTheTie | Call Action_ClearTheTie to clear the tie on the object. | ||
| 42833 | LD A,2 | Pass object id 2. | ||
| 42835 | LD IY,49435 | Point IY at 0 - "You". | ||
| 42839 | CALL Condition_SwapAndRetest | Call Condition_SwapAndRetest to swap the objects and test visibility again. | ||
| 42842 | RET Z | Return if the object is not visible. | ||
|
Say "the small curious key shatter(s|d|ing|es)".
|
||||
| 42843 | LD HL,45321 | Point HL at the message and call PrintMessage. | ||
| 42846 | JP PrintMessage | |||
|
Test whose turn it is.
Reached through the action list of 27 - "Window" for actions 12 and 16, dispatched by TriggerAction.
|
||||
| 42849 | LD A,(46826) | Jump to Event_TheBarrel_TestForClose if *CurrentCharacter is not 0 (the player). | ||
| 42852 | CP 0 | |||
| 42854 | JR NZ,Event_TheBarrel_TestForClose | |||
| 42856 | LD A,(49436) | Read where the player is. | ||
| 42859 | LD HL,45339 | Point HL at "you cannot reach[0x07]". | ||
| 42862 | CP 255 | Jump back to PrintMessage if where the player is is 255. | ||
| 42864 | JP Z,PrintMessage | |||
| 42867 | JP ResponseThatWillNotWork | Jump to ResponseThatWillNotWork to say that will not work. | ||
|
Test the current action.
|
||||
| Event_TheBarrel_TestForClose | 42870 | LD A,(46823) | Jump to Action_Close if *CurrentAction is 12 (close). | |
| 42873 | CP 12 | |||
| 42875 | JP Z,Action_Close | |||
| 42878 | CP 16 | Jump back to ActionOpenOrClose if the current action is 16. | ||
| 42880 | JP Z,ActionOpenOrClose | |||
| 42883 | RET | Return. | ||
|
Test whose turn it is.
Reached through the action list of 27 - "Window" for actions 11, 24 and 30, dispatched by TriggerAction.
|
||||
| 42884 | LD A,(46826) | Jump to Event_TheBarrel_TestTheAction if *CurrentCharacter is not 0 (the player). | ||
| 42887 | CP 0 | |||
| 42889 | JP NZ,Event_TheBarrel_TestTheAction | |||
| 42892 | LD A,(49436) | Read where the player is. | ||
| 42895 | CP 255 | Compare where the player is with 255. | ||
| 42897 | LD HL,45339 | Point HL at "you cannot reach[0x07]". | ||
| 42900 | JP Z,PrintMessage | Jump back to PrintMessage if where the player is is 255. | ||
|
Test the current action.
|
||||
| Event_TheBarrel_TestTheAction | 42903 | LD A,(46823) | Jump to Action_LeaveIfTheWayIsOpen if *CurrentAction is 30. | |
| 42906 | CP 30 | |||
| 42908 | JP Z,Action_LeaveIfTheWayIsOpen | |||
| 42911 | CP 11 | Jump back to Action_UseTheOtherObject if the current action is 11. | ||
| 42913 | JP Z,Action_UseTheOtherObject | |||
| 42916 | CP 24 | Jump back to Action_CarryOnWithTheObject if the current action is 24. | ||
| 42918 | JP Z,Action_CarryOnWithTheObject | |||
| 42921 | RET | Return. | ||
| Prev: 42442 | Up: Map | Next: 42922 |