Prev: AD59 Up: Map Next: ADEA
ADAB: Handler: Upward Missile
Fly an upward missile (types 80 and 84) by its speed and thrust. It explodes when it touches Jetman or is shot, or once its Y is less than 3C.
Input
IX Actor slot
Fly the missile, or explode it on a hit.
Handler_UpwardMissile ADAB CALL TickThenExplode_CloseRange Call TickThenExplode_CloseRange.
ADAE JR C,Handler_Missile_HitJetman Jump to Handler_Missile_HitJetman if Jetman is in range.
ADB0 BIT 0,(IX+$10) Jump to Handler_Missile_AwardPoints if bit 0 of the explode flag is set.
ADB4 JR NZ,Handler_Missile_AwardPoints
Move the missile along by its speed and thrust.
ADB6 LD L,(IX+$02) Fetch the actor world X.
ADB9 LD H,(IX+$03) Fetch the high byte.
ADBC LD B,$00 Clear B.
ADBE LD A,(IX+$05) Fetch the actor speed.
ADC1 LD C,A Copy it into C.
ADC2 AND A Jump to Handler_Missile_AddSpeed if the speed is positive.
ADC3 JP P,Handler_Missile_AddSpeed
ADC6 DEC B Sign-extend into B.
Handler_Missile_AddSpeed ADC7 ADD HL,BC Add the speed to the world X.
ADC8 LD (IX+$02),L Write the low byte back.
ADCB LD (IX+$03),H Write the high byte back.
Move the missile along its Y by the thrust.
ADCE LD A,(IX+$04) Fetch the actor Y.
ADD1 ADD A,(IX+$06) Add the thrust.
ADD4 LD (IX+$04),A Write it back.
Explode the missile once it has flown above Y 3C, otherwise draw it.
ADD7 CP $3C Jump to Handler_Missile_Explode if the Y is less than 3C.
ADD9 JR C,Handler_Missile_Explode
ADDB JP DrawCurrentActor_Draw Jump to DrawCurrentActor_Draw.
Handler_Missile_HitJetman ADDE CALL TickThenExplode_KillJetman Call TickThenExplode_KillJetman.
Destroying the missile adds 0500 points.
Handler_Missile_AwardPoints ADE1 LD BC,$0500 Set the points to award in BC to 0500.
ADE4 CALL AddPointsToScore Call AddPointsToScore.
Handler_Missile_Explode ADE7 JP StartExplosion_SetSprite Jump to StartExplosion_SetSprite.
Prev: AD59 Up: Map Next: ADEA