Prev: 8134 Up: Map Next: 817C
814B: Throw Fireball
Used by the routine at HandlerWizard.
Launches a fireball for the wizard, unless a weapon is already in flight or the player is in a doorway. The fireball sprites have the IDs 34 to 37 and are animated by HandlerFireball.
Input
IX The player entity
ThrowFireball 814B LD A,($EA98) Return if a weapon is already in flight.
814E AND A
814F RET NZ
8150 LD A,($5E2D) Return if the player is in a doorway.
8153 AND A
8154 RET NZ
8155 CALL SoundsFireball Call SoundsFireball to make the fireball sound.
8158 CALL SetWeaponVelocity Call SetWeaponVelocity to set the velocity of the weapon.
815B LD HL,$EA98 Point HL at the player weapon at PlayerWeapon.
815E LD (HL),$34 Write 34 to the weapon, the sprite ID of the first fireball frame.
This entry point is used by the routines at ThrowAxe and ThrowSword.
Place the weapon in the same room as the player, at the position of the player, and draw it.
LaunchWeapon 8160 INC HL Move HL on to the room of the weapon.
8161 LD A,(IX+$01) Fetch the room of the player.
8164 LD (HL),A Write the room of the player to the room of the weapon.
8165 INC HL Move HL on to the X position of the weapon.
8166 INC HL
8167 LD A,(IX+$03) Fetch the X position of the player.
816A LD (HL),A Write the X position of the player to the X position of the weapon.
816B INC HL Move HL on to the Y position of the weapon.
816C LD A,(IX+$04) Fetch the Y position of the player.
816F LD (HL),A Write the Y position of the player to the Y position of the weapon.
8170 PUSH IX Stash the player entity on the stack.
8172 LD IX,$EA98 Point IX at the weapon at PlayerWeapon.
8176 CALL DrawEntity Call DrawEntity to draw the weapon.
8179 POP IX Restore the player entity from the stack.
817B RET Return.
Prev: 8134 Up: Map Next: 817C