Prev: 43892 Up: Map Next: 44015
43998: Choose Tribesman Velocity
Used by the routine at HandlerTribesman.
Chooses a new velocity for a tribesman if it did not manage to move. The velocities are held in TribesmanVelocities, so each one has a one in four chance of being chosen for each direction.
Input
DE The new position of the tribesman (E is X and D is Y)
IX Actor record of the tribesman
ChooseTribesmanVelocity 43998 CALL TestPositionUnchanged Test whether the tribesman has stayed where it was.
44001 RET NZ Return if the tribesman has moved.
44002 LD BC,44068 Point BC at the table of tribesman velocities at TribesmanVelocities.
44005 LD A,(38549) Fetch the random seed from RandomNumber.
44008 AND %00000011 Keep only bits 0-1.
44010 LD L,A Stash the velocity index in L.
44011 LD H,0 Clear H.
44013 ADD HL,BC Add the table address to get the address of the velocity.
44014 LD A,(HL) Fetch the X velocity from the table.
Prev: 43892 Up: Map Next: 44015