![]() |
Routines |
| Prev: 38102 | Up: Map | Next: 38367 |
|
Used by the routines at InglishApplyAMatch, Inglish_AskWhetherToSuppress, Inglish_BuildTheActionSentence, Inglish_CopyTheParserSlot and Turn_ApplyTheSavedMatch.
Runs the handler when one is present. In the dark, with nothing named, the player sees "i see nothing here".
|
||||
| Turn_RunTheHandlerIfPresent | 38159 | PUSH HL | Save HL, IX and BC, and call Turn_AcceptTheNamedObject to accept the named object. | |
| 38160 | PUSH IX | |||
| 38162 | PUSH BC | |||
| 38163 | CALL Turn_AcceptTheNamedObject | |||
| 38166 | JP Z,Turn_RunTheHandlerIfPresent_Examine_CannotDoThat | Jump to Turn_RunTheHandlerIfPresent_Examine_CannotDoThat when Turn_AcceptTheNamedObject returns with the zero flag set. | ||
|
Test whether the location is lit.
|
||||
| 38169 | CALL LocationLit | Call LocationLit to test whether the location is lit. | ||
| 38172 | JR NC,Turn_RunTheHandlerIfPresent_Examine_TestNounFlag | Jump to Turn_RunTheHandlerIfPresent_Examine_TestNounFlag if the location is lit. | ||
|
Test this flag.
|
||||
| 38174 | LD A,(46865) | Jump to Turn_RunTheHandlerIfPresent_Examine_PrintNothing if *46865 is not zero. | ||
| 38177 | AND A | |||
| 38178 | JR NZ,Turn_RunTheHandlerIfPresent_Examine_PrintNothing | |||
|
Test whether the object is being carried.
|
||||
| 38180 | CALL ConditionIsTheObjectCarried | Call ConditionIsTheObjectCarried to test whether the object is carried. | ||
| 38183 | JR NC,Turn_RunTheHandlerIfPresent_Examine_PrintNothing | Jump to Turn_RunTheHandlerIfPresent_Examine_PrintNothing if the object is not being carried. | ||
| 38185 | LD A,(46825) | Read *46825. | ||
| 38188 | CALL ConditionIsTheObjectCarried_0 | Call ConditionIsTheObjectCarried_0 to test whether the character whose turn it is is carrying it. | ||
| 38191 | JR C,Turn_RunTheHandlerIfPresent_Examine_TestNounFlag | Jump to Turn_RunTheHandlerIfPresent_Examine_TestNounFlag if the character whose turn it is is carrying the object. | ||
| Turn_RunTheHandlerIfPresent_Examine_PrintNothing | 38193 | LD HL,44996 | Point at the message "i see nothing here" (44996). | |
| 38196 | CALL PrintMessage | Call PrintMessage to print message. | ||
| 38199 | JR Check_Lit | Jump to Check_Lit to test the message gate. | ||
|
Test the noun-print flag.
|
||||
| Turn_RunTheHandlerIfPresent_Examine_TestNounFlag | 38201 | LD A,(46846) | Jump to Check_ValidAction if *46846 is 1. | |
| 38204 | CP 1 | |||
| 38206 | JP Z,Check_ValidAction | |||
|
Test the current object.
|
||||
| 38209 | LD A,(46824) | Jump to Check_ValidAction if *CurrentObject is 255. | ||
| 38212 | CP 255 | |||
| 38214 | JP Z,Check_ValidAction | |||
|
Find the object's record.
|
||||
| 38217 | CALL LocateObject | Call LocateObject to locate object. | ||
| 38220 | LD (46856),IX | Update *46856. | ||
| 38224 | LD A,(46824) | Read *CurrentObject. | ||
| 38227 | CALL Turn_ReportWhoIsCarryingAnObject | Call Turn_ReportWhoIsCarryingAnObject to report who is carrying the object. | ||
| 38230 | JR NZ,Check_Lit | Jump to Check_Lit unless Turn_ReportWhoIsCarryingAnObject returned zero. | ||
|
Test the second object.
|
||||
| 38232 | LD A,(46825) | Jump to Turn_RunTheHandlerIfPresent_Examine_ReadTheObject if *46825 is 255. | ||
| 38235 | CP 255 | |||
| 38237 | JR Z,Turn_RunTheHandlerIfPresent_Examine_ReadTheObject | |||
|
Test the second-noun flag.
|
||||
| 38239 | LD A,(46847) | Jump to Check_ValidAction if *46847 is 1. | ||
| 38242 | CP 1 | |||
| 38244 | JR Z,Check_ValidAction | |||
| 38246 | LD A,(46825) | Read *46825. | ||
|
Find the object's record.
|
||||
| 38249 | CALL LocateObject | Call LocateObject to locate object. | ||
| 38252 | LD (46858),IX | Update *46858. | ||
| 38256 | CALL Turn_ReportWhoIsCarryingAnObject | Call Turn_ReportWhoIsCarryingAnObject to report who is carrying the object. | ||
| 38259 | JR NZ,Check_Lit | Jump to Check_Lit if Turn_ReportWhoIsCarryingAnObject reported that another character is carrying the object. | ||
| 38261 | CALL Action_MatchAVerbInTheTable | Call Action_MatchAVerbInTheTable to match the action against the five verb bytes. | ||
| 38264 | JR Z,Turn_RunTheHandlerIfPresent_Examine_ReadTheAction | Jump to Turn_RunTheHandlerIfPresent_Examine_ReadTheAction if Action_MatchAVerbInTheTable found the action in the verb list. | ||
| Turn_RunTheHandlerIfPresent_Examine_ReadTheObject | 38266 | LD IX,(46856) | Read *46856. | |
| Turn_RunTheHandlerIfPresent_Examine_ReadTheAction | 38270 | LD A,(46823) | Read *CurrentAction. | |
| 38273 | CALL TableFindAnActionRecord | Call TableFindAnActionRecord to find an action record. | ||
| 38276 | JR NC,Check_ValidAction | Jump to Check_ValidAction if TableFindAnActionRecord did not find the action record. | ||
| Turn_RunTheHandlerIfPresent_Examine_CallHandler | 38278 | LD L,(IX+1) | Read the handler address from this action-list entry. | |
| 38281 | LD H,(IX+2) | |||
| 38284 | CALL TriggerAction | Call TriggerAction to call the handler stored for this action. | ||
| 38287 | INC IX | Jump back to Turn_RunTheHandlerIfPresent_Examine_CallHandler if the next action-list byte is zero. | ||
| 38289 | INC IX | |||
| 38291 | INC IX | |||
| 38293 | SUB A | |||
| 38294 | CP (IX+0) | |||
| 38297 | JR Z,Turn_RunTheHandlerIfPresent_Examine_CallHandler | |||
| Check_Lit | 38299 | LD A,(46842) | If 46842 is not 1 then jump to Check_Return. | |
| 38302 | CP 1 | |||
| 38304 | JR NZ,Check_Return | |||
|
This check is a little unnecessary as the first thing the routine at LocationLit does, is to check exactly this...
|
||||
| 38306 | LD A,(46826) | If CurrentCharacter is not 0 (i.e. "You") then skip the "is location lit" check, instead jump to Check_Action. | ||
| 38309 | CP 0 | |||
| 38311 | JR NZ,Check_Action | |||
|
LocationLit uses the carry flag to indicate if it is light or dark.
|
||||
| 38313 | CALL LocationLit | If the location is dark then call PrintMessage to tell the user "it is dark". | ||
| 38316 | CALL C,PrintMessage | |||
| Check_Action | 38319 | LD A,(46823) | Read the current action. | |
| 38322 | LD B,A | Keep the current action in B. | ||
| 38323 | LD A,(46824) | Call Turn_WakeAnAnimal with IX=46856 and A=CurrentObject. | ||
| 38326 | LD IX,(46856) | |||
| 38330 | CALL Turn_WakeAnAnimal | |||
| 38333 | LD A,(46825) | Call Turn_WakeAnAnimal with IX=46858 and A=46825. | ||
| 38336 | LD IX,(46858) | |||
| 38340 | CALL Turn_WakeAnAnimal | |||
|
Performs housekeeping and returns.
|
||||
| Check_Return | 38343 | POP BC | Restore BC, IX and HL from the stack. | |
| 38344 | POP IX | |||
| 38346 | POP HL | |||
| 38347 | RET | Return. | ||
|
Checks if the action given is valid.
|
||||
| Check_ValidAction | 38348 | LD A,(46823) | Call IndexIdTable with ActionTable, to match the key value of CurrentAction. | |
| 38351 | LD IX,50992 | |||
| 38355 | CALL IndexIdTable | |||
| 38358 | CP 255 | Jump to Turn_RunTheHandlerIfPresent_Examine_CallHandler if IndexIdTable found the action, rather than the 255 terminator. | ||
| 38360 | JR NZ,Turn_RunTheHandlerIfPresent_Examine_CallHandler | |||
| Turn_RunTheHandlerIfPresent_Examine_CannotDoThat | 38362 | CALL Response_ICannotDoThat | Else, call Response_ICannotDoThat and jump to Check_Return. | |
| 38365 | JR Check_Return | |||
| Prev: 38102 | Up: Map | Next: 38367 |