Prev: 47036 Up: Map Next: 47230
47120: Fly Thrown Bomb
Move the bomb by its speed. A hit on the alien base scores 12288 and writes 1 to Missile_Destroyed_Flag.
Input
IX Actor slot
Move the thrown bomb by its speed.
FlyThrownBomb 47120 CALL TickObjectTimer Call TickObjectTimer.
47123 LD A,(24227) Fetch RoverCargoFlag.
47126 AND A Jump to FlyThrownBomb_Move if it is not zero.
47127 JR NZ,FlyThrownBomb_Move
47129 CALL CompareActorDistance Call CompareActorDistance.
47132 JR C,FlyThrownBomb_CollectRover Jump to FlyThrownBomb_CollectRover if the bomb is close to the rover.
Move the bomb along and check the ground line.
FlyThrownBomb_Move 47134 CALL MoveBySpeed Call MoveBySpeed.
47137 CP 175 Jump to FlyThrownBomb_Land if the new Y is on or below the ground line.
47139 JR NC,FlyThrownBomb_Land
Test the bomb against the alien base.
47141 LD (IX+4),A Write the actor Y.
47144 CALL FlyThrownBomb_TestBase Call FlyThrownBomb_TestBase.
47147 JP NC,CollectBomb_Loop Jump to CollectBomb_Loop if the bomb missed the base.
Turn the object slots into craters and explosions and record the hit on the base.
47150 CALL Handler_Missile_ConvertExploding Call Handler_Missile_ConvertExploding.
47153 LD A,1 Write 1 to Missile_Destroyed_Flag.
47155 LD (24981),A
Destroying the alien base adds 12288 points.
47158 LD BC,12288 Set the points to award in BC to 12288.
47161 CALL AddPointsToScore Call AddPointsToScore.
Put the bomb on the ground line and change its type to 192.
FlyThrownBomb_Land 47164 LD (IX+4),175 Write 175 to the actor Y.
47168 CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
""Crater"".
47171 LD (IX+0),192 Write type 192.
47175 RET Return.
Flag the bomb as collected by the rover.
FlyThrownBomb_CollectRover 47176 SET 2,(IX+8) Set bit 2 of the actor flags.
47180 LD A,1 Write 1 to RoverCargoFlag.
47182 LD (24227),A
47185 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Test the bomb against the alien-base slot.
FlyThrownBomb_TestBase 47188 LD E,24 E=24.
47190 LD L,(IX+2) Fetch the bomb world X.
47193 LD H,(IX+3) Fetch the high byte.
47196 LD BC,24 Add a 24 window.
47199 ADD HL,BC
47200 LD BC,(24962) Fetch AlienBase_WorldX.
47204 AND A Subtract the alien base world X.
47205 SBC HL,BC
47207 LD A,H Copy the high byte of the difference.
47208 AND %00011111 Keep only bits 0-4.
47210 RET NZ Return if the result is not zero.
47211 LD A,L Copy the low byte of the difference.
47212 CP 32 Return if it is at least 32.
47214 RET NC
47215 LD A,(24964) Fetch the base Y from 24964.
47218 SUB 4 Subtract 4.
47220 SUB (IX+4) Subtract the bomb Y.
47223 JP P,FlyThrownBomb_CompareY Jump to FlyThrownBomb_CompareY if the result is positive.
47226 NEG Negate it.
FlyThrownBomb_CompareY 47228 CP E Compare it with the window.
47229 RET Return.
Prev: 47036 Up: Map Next: 47230