Prev: B7BC Up: Map Next: B87E
B810: Fly Thrown Bomb
Move the bomb by its speed. A hit on the alien base scores 3000 and writes 01 to Missile_Destroyed_Flag.
Input
IX Actor slot
Move the thrown bomb by its speed.
FlyThrownBomb B810 CALL TickObjectTimer Call TickObjectTimer.
B813 LD A,($5EA3) Fetch RoverCargoFlag.
B816 AND A Jump to FlyThrownBomb_Move if it is not zero.
B817 JR NZ,FlyThrownBomb_Move
B819 CALL CompareActorDistance Call CompareActorDistance.
B81C 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 B81E CALL MoveBySpeed Call MoveBySpeed.
B821 CP $AF Jump to FlyThrownBomb_Land if the new Y is on or below the ground line.
B823 JR NC,FlyThrownBomb_Land
Test the bomb against the alien base.
B825 LD (IX+$04),A Write the actor Y.
B828 CALL FlyThrownBomb_TestBase Call FlyThrownBomb_TestBase.
B82B 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.
B82E CALL Handler_Missile_ConvertExploding Call Handler_Missile_ConvertExploding.
B831 LD A,$01 Write 01 to Missile_Destroyed_Flag.
B833 LD ($6195),A
Destroying the alien base adds 3000 points.
B836 LD BC,$3000 Set the points to award in BC to 3000.
B839 CALL AddPointsToScore Call AddPointsToScore.
Put the bomb on the ground line and change its type to C0.
FlyThrownBomb_Land B83C LD (IX+$04),$AF Write AF to the actor Y.
B840 CALL DrawCurrentActor_Draw Call DrawCurrentActor_Draw.
""Crater"".
B843 LD (IX+$00),$C0 Write type C0.
B847 RET Return.
Flag the bomb as collected by the rover.
FlyThrownBomb_CollectRover B848 SET 2,(IX+$08) Set bit 2 of the actor flags.
B84C LD A,$01 Write 01 to RoverCargoFlag.
B84E LD ($5EA3),A
B851 JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Test the bomb against the alien-base slot.
FlyThrownBomb_TestBase B854 LD E,$18 E=18.
B856 LD L,(IX+$02) Fetch the bomb world X.
B859 LD H,(IX+$03) Fetch the high byte.
B85C LD BC,$0018 Add a 18 window.
B85F ADD HL,BC
B860 LD BC,($6182) Fetch AlienBase_WorldX.
B864 AND A Subtract the alien base world X.
B865 SBC HL,BC
B867 LD A,H Copy the high byte of the difference.
B868 AND %00011111 Keep only bits 0-4.
B86A RET NZ Return if the result is not zero.
B86B LD A,L Copy the low byte of the difference.
B86C CP $20 Return if it is at least 20.
B86E RET NC
B86F LD A,($6184) Fetch the base Y from 6184.
B872 SUB $04 Subtract 04.
B874 SUB (IX+$04) Subtract the bomb Y.
B877 JP P,FlyThrownBomb_CompareY Jump to FlyThrownBomb_CompareY if the result is positive.
B87A NEG Negate it.
FlyThrownBomb_CompareY B87C CP E Compare it with the window.
B87D RET Return.
Prev: B7BC Up: Map Next: B87E