Prev: AE37 Up: Map Next: AF1C
AE78: Spawn Missile
Copy the left-facing missile and flame templates at Missile_Object_Template (or the right-facing pair at Missile_Object_Template_2, entered at Handler_Missile_CopyTemplate2) into Object_Slot_1 and place them at this actor. The hit count is the level plus 08 (up to 63). Then jump to ShowLaserEstimate to show the laser estimate, unless 6172 is non-zero or Jetman's type is 2A or above with no lives left.
Input
IX Actor slot
Copy the A0 template into Object_Slot_1.
Handler_Missile_CopyTemplate AE78 LD HL,$AEBC HL=Missile_Object_Template.
Handler_Missile_FillObjectSlots AE7B LD DE,$6108 DE=Object_Slot_1.
AE7E LD BC,$0030 Copy the 30-byte template into the object slots.
AE81 LDIR
Place the missile at this actor's X, and 0C above its Y.
AE83 LD L,(IX+$02) Fetch the actor world X.
AE86 LD H,(IX+$03) Fetch the high byte.
AE89 LD ($610A),HL Write it to 610A.
AE8C LD A,(IX+$04) Fetch the actor Y.
AE8F SUB $0C Subtract 0C.
AE91 LD ($610C),A Write it to 610C.
Set the hit count to the level plus 08, up to 63.
AE94 LD A,($5EA0) Fetch ActivePlayer_Level.
AE97 ADD A,$08 Add 08.
AE99 CP $63 Jump to Handler_Missile_WriteHitCount if that is less than 63.
AE9B JR C,Handler_Missile_WriteHitCount
AE9D LD A,$63 A=63.
Handler_Missile_WriteHitCount AE9F LD ($611E),A Write it to 611E.
Decide whether to show the laser estimate at ShowLaserEstimate.
AEA2 LD A,($6172) Fetch 6172.
AEA5 AND A Return if it is not zero.
AEA6 RET NZ
AEA7 LD A,($5EA1) Fetch ActivePlayer_Lives.
AEAA AND A Jump to ShowLaserEstimate if any lives remain.
AEAB JP NZ,ShowLaserEstimate
AEAE LD A,($6078) Fetch Jetman_Slot.
AEB1 CP $2A Return if Jetman's type is at least 2A.
AEB3 RET NC
AEB4 JP ShowLaserEstimate Jump to ShowLaserEstimate.
This entry point is used by the routine at Handler_MissileSpawner.
Handler_Missile_CopyTemplate2 AEB7 LD HL,$AEEC HL=Missile_Object_Template_2.
AEBA JR Handler_Missile_FillObjectSlots Jump to Handler_Missile_FillObjectSlots.
Missile_Object_Template AEBC DEFB $A0,$00,$00,$00,$00,$FD,$00,$46
AEC4 DEFB $00,$00,$00,$00,$00,$00,$00,$00
AECC DEFB $00,$00,$00,$00,$00,$00,$00,$00
AED4 DEFB $A2,$00,$00,$00,$00,$00,$00,$42
AEDC DEFB $00,$00,$00,$00,$00,$00,$00,$00
AEE4 DEFB $00,$00,$00,$00,$00,$00,$00,$00
Missile_Object_Template_2 AEEC DEFB $A4,$00,$00,$00,$00,$03,$00,$46
AEF4 DEFB $00,$00,$00,$00,$00,$00,$00,$00
AEFC DEFB $00,$00,$00,$00,$00,$00,$00,$00
AF04 DEFB $A6,$00,$00,$00,$00,$00,$00,$42
AF0C DEFB $00,$00,$00,$00,$00,$00,$00,$00
AF14 DEFB $00,$00,$00,$00,$00,$00,$00,$00
Prev: AE37 Up: Map Next: AF1C