Prev: BBDD Up: Map Next: BC6C
BC37: Choose Outlaw Move
Used by the routine at HandleWaitingOutlaw.
Gives the waiting outlaw a new move: a speed in each direction of up to three, taken from random numbers, and a time for the move of eight to thirty nine frames. On the last move the speeds are doubled.
Input
IX The address of the outlaw
Choose a horizontal speed.
ChooseOutlawMove BC37 LD A,($A218) Fetch a random number and keep it in C.
BC3A LD C,A
BC3B AND %00000011 Keep a number from 00 to 03.
BC3D BIT 7,C Jump to ChooseOutlawMove_Vertical if the top bit of the random number is clear.
BC3F JR Z,ChooseOutlawMove_Vertical
BC41 NEG Make the speed negative.
Store it, then choose a vertical speed.
ChooseOutlawMove_Vertical BC43 LD (IX+$01),A Set the horizontal speed.
BC46 LD A,($A219) Fetch another random number and keep it in C.
BC49 LD C,A
BC4A AND %00000011 Keep a number from 00 to 03.
BC4C BIT 7,C Jump to ChooseOutlawMove_Time if the top bit of the random number is clear.
BC4E JR Z,ChooseOutlawMove_Time
BC50 NEG Make the speed negative.
Store the vertical speed, then set the time of the move.
ChooseOutlawMove_Time BC52 LD (IX+$03),A Set the vertical speed.
BC55 LD A,($A216) Fetch the frame counter.
BC58 AND %00011111 Keep a number from 00 to 1F.
BC5A ADD A,$08 Add eight.
BC5C LD (IX+$0B),A Set the timer for the move.
BC5F DEC (IX+$0A) Count down the moves left.
BC62 RET NZ Return unless that was the last move.
BC63 SLA (IX+$01) Double the horizontal speed.
BC67 SLA (IX+$03) Double the vertical speed.
BC6B RET Return.
Prev: BBDD Up: Map Next: BC6C