Prev: 46897 Up: Map Next: 47155
46930: Launch Shot
Used by the routine at CheckSpecialShot.
Launches a shot, from the first free slot out of the four at ShotSlots. It faces the way the ship is facing and starts at the ship. Three kinds of shot can be launched: an ordinary one, a chasing shot if the ship has part 8 and the weapon toggle at WeaponToggle is one, and a special shot if bit 2 of the toggle is set.
LaunchShot 46930 LD IX,45946 The shot slots.
46934 LD A,4 A=4.
LaunchShot_Slot 46936 EX AF,AF' Switch to the alternate accumulator and flags.
46937 BIT 7,(IX+22) Jump to LaunchShot_Check if bit 7 of offset 22 of IX is set.
46941 JR NZ,LaunchShot_Check
46943 LD A,(IX+11) Read offset 11 of IX.
46946 AND A Jump to LaunchShot_Free if A is zero.
46947 JR Z,LaunchShot_Free
LaunchShot_Check 46949 LD A,(IX+0) Read offset 0 of IX.
46952 INC A Advance A.
46953 JR NZ,LaunchShot_Next Jump to LaunchShot_Next if the zero flag is clear.
LaunchShot_Free 46955 CALL FreeObjectSlot Call FreeObjectSlot.
46958 LD A,(51453) The ship's facing.
46961 LD (IX+0),A Write A to offset 0 of IX.
46964 LD (IX+11),153 Store 153 at offset 11 of IX.
46968 CALL StartShotAtShip Call StartShotAtShip.
46971 LD A,(46896) The weapon toggle.
46974 BIT 2,A Jump to LaunchShot_Special if bit 2 of A is set.
46976 JP NZ,LaunchShot_Special
46979 DEC A Step A back.
46980 JP Z,LaunchShot_Chasing Jump to LaunchShot_Chasing if the zero flag is set.
LaunchShot_Ordinary 46983 CALL MoveObject Call MoveObject.
46986 LD (IX+9),0 Store 0 at offset 9 of IX.
46990 BIT 7,(IX+21) Return if bit 7 of offset 21 of IX is set.
46994 RET NZ
46995 JP PlayShotSound Jump to PlayShotSound.
LaunchShot_Next 46998 LD BC,24 BC=24.
47001 ADD IX,BC IX gains BC.
47003 EX AF,AF' Switch to the alternate accumulator and flags.
47004 DEC A Step A back.
47005 JR NZ,LaunchShot_Slot Jump to LaunchShot_Slot if the zero flag is clear.
47007 RET Return.
LaunchShot_Chasing 47008 LD A,(62965) The eighth part, which makes a chasing shot.
47011 AND A Jump to LaunchShot_Ordinary if A is zero.
47012 JP Z,LaunchShot_Ordinary
47015 LD A,(IX+7) Read offset 7 of IX.
47018 CP 8 Jump to LaunchShot_Speed if A is 8.
47020 JR Z,LaunchShot_Speed
47022 LD (IX+7),32 Store 32 at offset 7 of IX.
LaunchShot_Speed 47026 LD A,(IX+9) Read offset 9 of IX.
47029 SUB 3 Subtract 3 from A.
47031 LD (IX+9),A Write A to offset 9 of IX.
47034 LD (IX+8),0 Store 0 at offset 8 of IX.
47038 LD (IX+10),0 Store 0 at offset 10 of IX.
47042 CALL MoveObject Call MoveObject.
47045 LD (IX+9),0 Store 0 at offset 9 of IX.
47049 LD (IX+16),39 Store 39 at offset 16 of IX.
47053 LD A,(IX+7) Read offset 7 of IX.
47056 LD (IX+7),8 Store 8 at offset 7 of IX.
47060 CP 32 Jump to LaunchShot_Set if A is 32.
47062 JR Z,LaunchShot_Set
47064 LD (IX+7),248 Store 248 at offset 7 of IX.
LaunchShot_Set 47068 LD (IX+0),0 Store 0 at offset 0 of IX.
47072 LD (IX+13),221 Store 221 at offset 13 of IX.
47076 LD (IX+21),127 Store 127 at offset 21 of IX.
47080 LD (IX+22),128 Store 128 at offset 22 of IX.
47084 CALL ClearShot Call ClearShot.
47087 LD (IX+23),240 Store 240 at offset 23 of IX.
47091 JP PlayShotSound Jump to PlayShotSound.
LaunchShot_Special 47094 LD A,128 A=128.
47096 LD (IX+21),A Write A to offset 21 of IX.
47099 LD (47154),A A special shot has been launched.
47102 LD (IX+13),67 Store 67 at offset 13 of IX.
47106 LD A,(23608) The ship row.
47109 ADD A,9 Add 9 to A.
47111 LD (IX+12),A Write A to offset 12 of IX.
47114 LD A,(IX+9) Read offset 9 of IX.
47117 ADD A,9 Add 9 to A.
47119 LD (IX+9),A Write A to offset 9 of IX.
47122 LD A,(IX+7) Read offset 7 of IX.
47125 ADD A,8 Add 8 to A.
47127 AND %00100000 Keep the bits of A that are set in 32.
47129 LD (IX+7),A Write A to offset 7 of IX.
47132 LD (IX+18),248 Store 248 at offset 18 of IX.
47136 LD (IX+11),96 Store 96 at offset 11 of IX.
47140 JP Z,LaunchShot_Ordinary Jump to LaunchShot_Ordinary if the zero flag is set.
47143 LD (IX+18),8 Store 8 at offset 18 of IX.
47147 LD (IX+11),144 Store 144 at offset 11 of IX.
47151 JP LaunchShot_Ordinary Jump to LaunchShot_Ordinary.
47154 NOP Do nothing.
Prev: 46897 Up: Map Next: 47155