Prev: AD36 Up: Map Next: ADAB
AD59: Handler: Alien Base
Draw the alien base, then turn it and its launcher into craters once PlayerInactive is set or the destroyed flag at Missile_Destroyed_Flag is set.
Input
IX Actor slot
Draw the base using the frame that matches its pixel offset.
Handler_AlienBase AD59 LD E,$14 E=14.
AD5B CALL TickThenExplode_TestJetman Call TickThenExplode_TestJetman.
AD5E CALL C,TickThenExplode_KillJetman Call TickThenExplode_KillJetman if this actor is close enough.
Pick the frame for the base's pixel offset and write it as the actor type.
AD61 LD A,($607A) Fetch Jetman_Position.
AD64 SUB (IX+$02) Subtract the actor world X.
AD67 NEG Negate the difference.
AD69 AND %00000111 Keep only bits 0-2.
Sprite IDs begin at 68 ("Alien Base: Frame 1").
AD6B ADD A,$68 Add 68 for the alien base frames.
AD6D LD (IX+$00),A Write it to the actor type.
Draw the base and colour its attribute tiles.
AD70 CALL DrawActorSprite Call DrawActorSprite.
AD73 LD A,($5E58) Fetch SpriteHeight.
AD76 SUB $08 Subtract 08.
AD78 LD ($5E58),A Write it back.
AD7B CALL ColouriseSprite Call ColouriseSprite.
Return unless the base has been destroyed or PlayerInactive is set.
AD7E LD A,($5E6C) Fetch PlayerInactive.
AD81 AND A Jump to Handler_Missile_HideSlots if it is not zero.
AD82 JR NZ,Handler_Missile_HideSlots
AD84 LD A,(IX+$15) Fetch the destroyed flag at *IX+15.
AD87 AND A Return if it is zero.
AD88 RET Z
Erase the base, turn Object_Slot_5 and AlienBase_Slot into craters (type C0), move the base 08 left and clear 6188.
Handler_Missile_HideSlots AD89 CALL ClearSpriteScratch Call ClearSpriteScratch.
AD8C LD A,$C0 A=C0.
AD8E LD ($6168),A Write it to Object_Slot_5.
AD91 LD ($6180),A Write it to AlienBase_Slot.
Move the world X at AlienBase_WorldX left by 08.
AD94 LD HL,($6182) Fetch AlienBase_WorldX.
AD97 LD BC,$FFF8 Set the offset in BC to FFF8 (-08).
AD9A CALL MaskWorldX Call MaskWorldX.
AD9D LD ($6182),HL Write it back.
Clear 08 bytes of that slot from 6188.
ADA0 LD HL,$6188 HL=6188.
ADA3 LD B,$08 Set a byte counter in B for 08 loops.
Handler_Missile_Loop ADA5 LD (HL),$00 Write 00 to the current byte.
ADA7 INC HL Move onto the next byte.
ADA8 DJNZ Handler_Missile_Loop Decrease the byte counter by one and loop back to Handler_Missile_Loop until the tail is clear.
ADAA RET Return.
Prev: AD36 Up: Map Next: ADAB