Prev: ABA9 Up: Map Next: AC39
ABBA: Handler: Missile Launcher
Handle the missile launcher (types 70 to 7F). Kill Jetman if he is in range, then while *IX+17 is set step the frame, count it down, draw its gauge and flash the base or alien banner. Otherwise continue at AlignToRover_TestRoverY.
Input
IX Actor slot
Test range, then draw the missile banner when *IX+17 is set.
Handler_MissileLauncher ABBA LD E,$18 E=18.
ABBC CALL TickThenExplode_TestJetman Call TickThenExplode_TestJetman.
ABBF CALL C,TickThenExplode_KillJetman Call TickThenExplode_KillJetman if this actor is close enough.
ABC2 LD A,(IX+$17) Jump to AlignToRover_TestRoverY if *IX+17 is zero.
ABC5 AND A
ABC6 JR Z,AlignToRover_TestRoverY
ABC8 CALL DrawCurrentActor Call DrawCurrentActor.
Count down *IX+17 every sixteenth frame, unless the countdown is suspended.
ABCB LD A,($5E42) Fetch GameTimer.
ABCE CPL Invert the bits.
ABCF AND %00001111 Keep only bits 0-3.
ABD1 RET NZ Return if the result is not zero.
ABD2 LD A,($5E67) Jump to Handler_MissileLauncher_Gauge if GameDelayTimer is not zero.
ABD5 AND A
ABD6 JR NZ,Handler_MissileLauncher_Gauge
ABD8 LD A,($6078) Fetch Jetman_Slot.
ABDB CP $81 Compare it against 81.
Handler_MissileLauncher_TestType ABDD JR Z,Handler_MissileLauncher_Gauge Jump to Handler_MissileLauncher_Gauge if Jetman's type is 81.
ABDF DEC (IX+$17) Decrease *IX+17 by one.
ABE2 CALL Z,Handler_Missile_ConvertExploding Call Handler_Missile_ConvertExploding if it is now zero.
Draw the gauge for *IX+17.
Handler_MissileLauncher_Gauge ABE5 LD A,(IX+$17) Fetch *IX+17.
ABE8 LD HL,$2040 HL=2040.
ABEB CALL DrawGauge Call DrawGauge.
Flash one of the banner tiles, chosen by which side of Jetman the actor is on.
ABEE CALL Handler_Missile Call Handler_Missile.
ABF1 JR NC,Handler_MissileLauncher_FlashBanner Jump to Handler_MissileLauncher_FlashBanner if the actor is not to the left of Jetman.
The actor is to the left, so flash the first tile (587B) and set the second tile (587D) to a steady colour.
ABF3 CALL FlashAttribute Call FlashAttribute to fetch the flashing attribute.
ABF6 LD HL,$587B Point HL at the first banner tile (587B).
ABF9 CALL Handler_Colour2x2 Call Handler_Colour2x2 to colour the tile with A.
ABFC LD HL,$587D Point HL at the second banner tile (587D).
ABFF LD A,$42 Set the steady attribute in A to INK:RED, PAPER:BLACK (BRIGHT).
Handler_MissileLauncher_Loop AC01 CALL Handler_Colour2x2 Call Handler_Colour2x2 to colour the tile with A.
Print the base or alien banner message at fixed points in the timer, otherwise return.
AC04 LD A,($5E42) Fetch GameTimer.
AC07 AND %00111111 Keep only bits 0-5.
AC09 CP $0F Compare it against 0F.
AC0B JR Z,Handler_MissileLauncher_PrintBase Jump to Handler_MissileLauncher_PrintBase if they are equal.
AC0D CP $2F Return if it is not 2F.
AC0F RET NZ
Handle printing the "alien" messaging.
AC10 LD DE,$AC24 DE=BannerMessaging_Alien.
BannerMessaging_Print AC13 LD HL,$10D8 HL=10D8 (screen location).
AC16 CALL PrintStringColour Call PrintStringColour.
AC19 RET Return.
Handle printing the "base" messaging.
Handler_MissileLauncher_PrintBase AC1A LD DE,$AC1F DE=BannerMessaging_Base.
AC1D JR BannerMessaging_Print Jump to BannerMessaging_Print.
BannerMessaging_Base AC1F DEFM "Ecde","f"+$80 Attribute: INK:CYAN, PAPER:BLACK (BRIGHT) + "base".
BannerMessaging_Alien AC24 DEFM "Eghi","j"+$80 Attribute: INK:CYAN, PAPER:BLACK (BRIGHT) + "alien".
The actor is not to the left, so flash the second tile (587D) and set the first tile (587B) to a steady colour.
Handler_MissileLauncher_FlashBanner AC29 CALL FlashAttribute Call FlashAttribute to fetch the flashing attribute.
AC2C LD HL,$587D Point HL at the second banner tile (587D).
AC2F CALL Handler_Colour2x2 Call Handler_Colour2x2 to colour the tile with A.
AC32 LD HL,$587B Point HL at the first banner tile (587B).
AC35 LD A,$42 Set the steady attribute in A to INK:RED, PAPER:BLACK (BRIGHT).
AC37 JR Handler_MissileLauncher_Loop Jump to Handler_MissileLauncher_Loop to colour the tile with A.
Prev: ABA9 Up: Map Next: AC39