![]() |
Routines |
| Prev: 48093 | Up: Map | Next: 48236 |
|
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.
|
||||||||
|
Choose a horizontal speed.
|
||||||||
| ChooseOutlawMove | 48183 | LD A,(41496) | Fetch a random number and keep it in C. | |||||
| 48186 | LD C,A | |||||||
| 48187 | AND %00000011 | Keep a number from 0 to 3. | ||||||
| 48189 | BIT 7,C | Jump to ChooseOutlawMove_Vertical if the top bit of the random number is clear. | ||||||
| 48191 | JR Z,ChooseOutlawMove_Vertical | |||||||
| 48193 | NEG | Make the speed negative. | ||||||
|
Store it, then choose a vertical speed.
|
||||||||
| ChooseOutlawMove_Vertical | 48195 | LD (IX+1),A | Set the horizontal speed. | |||||
| 48198 | LD A,(41497) | Fetch another random number and keep it in C. | ||||||
| 48201 | LD C,A | |||||||
| 48202 | AND %00000011 | Keep a number from 0 to 3. | ||||||
| 48204 | BIT 7,C | Jump to ChooseOutlawMove_Time if the top bit of the random number is clear. | ||||||
| 48206 | JR Z,ChooseOutlawMove_Time | |||||||
| 48208 | NEG | Make the speed negative. | ||||||
|
Store the vertical speed, then set the time of the move.
|
||||||||
| ChooseOutlawMove_Time | 48210 | LD (IX+3),A | Set the vertical speed. | |||||
| 48213 | LD A,(41494) | Fetch the frame counter. | ||||||
| 48216 | AND %00011111 | Keep a number from 0 to 31. | ||||||
| 48218 | ADD A,8 | Add eight. | ||||||
| 48220 | LD (IX+11),A | Set the timer for the move. | ||||||
| 48223 | DEC (IX+10) | Count down the moves left. | ||||||
| 48226 | RET NZ | Return unless that was the last move. | ||||||
| 48227 | SLA (IX+1) | Double the horizontal speed. | ||||||
| 48231 | SLA (IX+3) | Double the vertical speed. | ||||||
| 48235 | RET | Return. | ||||||
| Prev: 48093 | Up: Map | Next: 48236 |