Prev: 977C Up: Map Next: 97F4
97AD: Turn: Reset To The Player
Used by the routine at TurnReadAndTokeniseTheCommand.
Resets the turn to the player, clears the talk flag, and points the current character at the player's object.
Turn_ResetToThePlayer 97AD SUB A Clear the character, the scratch flag and the talk flag.
97AE LD ($B6EA),A Update *CurrentCharacter.
97B1 LD ($B6F1),A Store the result at B6F1.
97B4 LD ($B6F9),A Update *B6F9.
97B7 LD HL,$C11B Point *Pointer_CurrentCharacter at "You".
97BA LD ($B70C),HL
97BD LD A,$04 Roll a random number below 04.
Roll a random number.
97BF CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
97C2 INC A Add one, making the roll 01-04.
97C3 LD B,A Copy the result into B.
97C4 LD IY,$C808 Point IY at C808.
97C8 LD DE,$0006 Each entry is 06 bytes.
Turn_ResetToThePlayer_StepToTheNextExtraExit 97CB ADD IY,DE Step IY on to the next 06-byte entry.
97CD DJNZ Turn_ResetToThePlayer_StepToTheNextExtraExit Loop back to Turn_ResetToThePlayer_StepToTheNextExtraExit until the roll in B runs out.
97CF LD ($A7D1),IY Plant this extra-exit entry in the LD IY at A7CF.
97D3 LD L,(IY+$01) Read the low byte of this extra exit's direction token.
97D6 LD H,(IY+$02) Read the high byte of this extra exit's direction token.
97D9 LD B,$03 Count 03 passes.
Turn_ResetToThePlayer_ClearTheBytes 97DB LD (HL),$00 Write zero into the byte HL points at.
97DD INC HL Step to the next byte.
97DE DJNZ Turn_ResetToThePlayer_ClearTheBytes Loop back to Turn_ResetToThePlayer_ClearTheBytes until 03 runs out.
97E0 LD A,$03 Roll a random number below 03.
Roll a random number.
97E2 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
97E5 LD E,A Keep 03.
97E6 LD D,$00 The character-table offset's high byte is zero.
97E8 SLA E Double the roll and keep the overflow.
97EA SLA E Double the roll and keep the overflow.
97EC LD HL,$C7FC Index the riddle table at C7FC.
97EF ADD HL,DE
97F0 LD ($B6EE),HL Update *B6EE.
97F3 RET Return.
Prev: 977C Up: Map Next: 97F4