Prev: 36667 Up: Map Next: 36813
36781: Action: Run
Runs in the commanded direction until the way is blocked. Reached through the action table at ActionTable, dispatched by Turn_RunTheHandlerIfPresent.
Action_Run 36781 LD A,10 Roll a random number below 10.
Roll a random number.
36783 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
36786 CP 0 Jump back to Action_Run when the roll is zero.
36788 JR Z,Action_Run
Action_Run_Loop 36790 LD B,A Copy the result into B.
36791 CALL TableFindAnExitInADirection Call TableFindAnExitInADirection to find an exit in the direction in A.
36794 CP B Jump to Action_Run_StartTheMove if this exit's direction is the one being sought.
36795 JR Z,Action_Run_StartTheMove
36797 LD A,B Try the next direction and jump back to Action_Run_Loop while it is below 10.
36798 INC A
36799 CP 10
36801 JR C,Action_Run_Loop
36803 LD A,1 Set the direction back to 1.
36805 JR Action_Run_Loop Jump back to Action_Run_Loop to find an exit in the direction in A.
Action_Run_StartTheMove 36807 LD (46823),A Update *CurrentAction.
36810 JP Action_Direction Jump to Action_Direction to move.
Prev: 36667 Up: Map Next: 36813