Prev: 36118 Up: Map Next: 36229
36138: Game Loop
Used by the routines at HandlerMatchVerb and GameStart.
Run the scenic check, read a command and dispatch it.
GameLoop 36138 CALL HandlerTurnBasedEvents Call HandlerTurnBasedEvents to turn-based events.
36141 LD HL,25124 Check the scenic-event rooms.
36144 LD BC,8 There are eight scenic rooms to check.
GameLoop_Loop1 36147 LD A,(25123) Fetch the current room.
36150 CPIR See whether the player is standing in this scenic room.
36152 JR NZ,GameLoop_Step1 The player is not in this scenic room.
36154 PUSH HL Keep the scenic search while the warning is printed.
36155 PUSH BC
36156 LD HL,30801 Print An alien soldier has appeared. He fires a plasma gun at you..
36159 CALL PrintStringAndANewline
36162 LD A,20 The plasma shell has one chance in 20 of hitting.
36164 CALL GenerateRandomNumber Call GenerateRandomNumber to generate random number.
36167 JR Z,HandlerPlasmaShell The shell hits when that draw comes up zero.
36169 LD HL,30863 Print But he missed..
36172 CALL PrintStringAndANewline
36175 POP BC Restore the scenic-room search.
36176 POP HL
36177 XOR A See whether another scenic room is still to be checked.
36178 OR C
36179 JR NZ,GameLoop_Loop1 Check the next scenic room.
GameLoop_Step1 36181 CALL Handler_UserInput Call Handler_UserInput to read another command.
36184 LD A,(25233) Fetch the first word of the command.
36187 CP 89 Jump to GameLoop_Step3 when Y (89) was not pressed.
36189 JR NZ,GameLoop_Step3
GameLoop_Step2 36191 LD HL,39295 Continue at HandlerMatchVerb_Step2 to run Action: Type.
36194 JP HandlerMatchVerb_Step2
GameLoop_Step3 36197 XOR A Start the synonym scan with a clear result.
36198 LD HL,25233 Check the command's word tokens for a noun.
36201 LD B,10 A command has at most 10 word tokens.
GameLoop_Loop2 36203 LD A,(HL) Read the next word token.
36204 CP 255 Jump to HandlerMatchVerb when the command has no more words (255).
36206 JR Z,HandlerMatchVerb
36208 EXX Look that token up in the noun list without losing the token pointer.
36209 LD HL,34920
36212 LD BC,(25288)
36216 CPIR
36218 JR NZ,GameLoop_Step4 This token is not a noun, so try the next word.
36220 CALL Parser_ResolvePhrase Call Parser_ResolvePhrase to resolve phrase.
36223 JR C,GameLoop Jump back to GameLoop when the carry flag is set.
GameLoop_Step4 36225 EXX Bring the token pointer back.
36226 INC HL Move on to the next word token.
36227 DJNZ GameLoop_Loop2 Repeat for the remaining words of the command.
Prev: 36118 Up: Map Next: 36229