![]() |
Routines |
| Prev: 40457 | Up: Map | Next: 40495 |
|
Used by the routine at HandlerFlame.
Starts a new direction timer for a flame (64 frames) and chooses its velocity. On every other call the velocity is random: the X velocity comes from the table at FlameVelocities and the Y velocity from the counter and the Z80 refresh register. On the other calls the flame heads towards the player (see AimFlameAtPlayer).
|
||||||||
| ChooseFlameDirection | 40462 | LD (IX+2),64 | Set the direction timer of the flame to 64. | |||||
| 40466 | LD A,(38547) | Fetch the low byte of the game timer from GameTimer. | ||||||
| 40469 | AND %00000001 | Keep only bit 0. | ||||||
| 40471 | JR NZ,AimFlameAtPlayer | Jump to AimFlameAtPlayer to aim the flame at the player if bit 0 of the pass counter is set. | ||||||
|
Choose a random velocity.
|
||||||||
| 40473 | LD A,(38549) | Fetch the random seed from RandomNumber. | ||||||
| 40476 | AND %00000111 | Keep only bits 0-2. | ||||||
| 40478 | CALL FetchFlameVelocity | Fetch a velocity from the table. | ||||||
| 40481 | LD (IX+6),A | Set the X velocity of the flame. | ||||||
| 40484 | LD A,R | Fetch the Z80 refresh register as a source of randomness. | ||||||
| 40486 | LD C,A | Stash it in C. | ||||||
| 40487 | LD A,(38547) | Fetch the low byte of the game timer from GameTimer. | ||||||
| 40490 | ADD A,C | Add the refresh register value. | ||||||
| 40491 | LD (IX+7),A | Set the Y velocity of the flame. | ||||||
| 40494 | RET | Return. | ||||||
| Prev: 40457 | Up: Map | Next: 40495 |