Prev: 9E09 Up: Map Next: 9E2F
9E0E: Choose Flame Direction
Used by the routine at HandlerFlame.
Starts a new direction timer for a flame (40 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).
Input
IX Flame record
ChooseFlameDirection 9E0E LD (IX+$02),$40 Set the direction timer of the flame to 40.
9E12 LD A,($9693) Fetch the low byte of the game timer from GameTimer.
9E15 AND %00000001 Keep only bit 0.
9E17 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.
9E19 LD A,($9695) Fetch the random seed from RandomNumber.
9E1C AND %00000111 Keep only bits 0-2.
9E1E CALL FetchFlameVelocity Fetch a velocity from the table.
9E21 LD (IX+$06),A Set the X velocity of the flame.
9E24 LD A,R Fetch the Z80 refresh register as a source of randomness.
9E26 LD C,A Stash it in C.
9E27 LD A,($9693) Fetch the low byte of the game timer from GameTimer.
9E2A ADD A,C Add the refresh register value.
9E2B LD (IX+$07),A Set the Y velocity of the flame.
9E2E RET Return.
Prev: 9E09 Up: Map Next: 9E2F