Prev: 38780 Up: Map Next: 38900
38829: 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 38829 SUB A Clear the character, the scratch flag and the talk flag.
38830 LD (46826),A Update *CurrentCharacter.
38833 LD (46833),A Store the result at 46833.
38836 LD (46841),A Update *46841.
38839 LD HL,49435 Point *Pointer_CurrentCharacter at "You".
38842 LD (46860),HL
38845 LD A,4 Roll a random number below 4.
Roll a random number.
38847 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
38850 INC A Add one, making the roll 1-4.
38851 LD B,A Copy the result into B.
38852 LD IY,51208 Point IY at 51208.
38856 LD DE,6 Each entry is 6 bytes.
Turn_ResetToThePlayer_StepToTheNextExtraExit 38859 ADD IY,DE Step IY on to the next 6-byte entry.
38861 DJNZ Turn_ResetToThePlayer_StepToTheNextExtraExit Loop back to Turn_ResetToThePlayer_StepToTheNextExtraExit until the roll in B runs out.
38863 LD (42961),IY Plant this extra-exit entry in the LD IY at 42959.
38867 LD L,(IY+1) Read the low byte of this extra exit's direction token.
38870 LD H,(IY+2) Read the high byte of this extra exit's direction token.
38873 LD B,3 Count 3 passes.
Turn_ResetToThePlayer_ClearTheBytes 38875 LD (HL),0 Write zero into the byte HL points at.
38877 INC HL Step to the next byte.
38878 DJNZ Turn_ResetToThePlayer_ClearTheBytes Loop back to Turn_ResetToThePlayer_ClearTheBytes until 3 runs out.
38880 LD A,3 Roll a random number below 3.
Roll a random number.
38882 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
38885 LD E,A Keep 3.
38886 LD D,0 The character-table offset's high byte is zero.
38888 SLA E Double the roll and keep the overflow.
38890 SLA E Double the roll and keep the overflow.
38892 LD HL,51196 Index the riddle table at 51196.
38895 ADD HL,DE
38896 LD (46830),HL Update *46830.
38899 RET Return.
Prev: 38780 Up: Map Next: 38900