Prev: 44342 Up: Map Next: 44459
44377: 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 44377 LD E,20 E=20.
44379 CALL TickThenExplode_TestJetman Call TickThenExplode_TestJetman.
44382 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.
44385 LD A,(24698) Fetch Jetman_Position.
44388 SUB (IX+2) Subtract the actor world X.
44391 NEG Negate the difference.
44393 AND %00000111 Keep only bits 0-2.
Sprite IDs begin at 104 ("Alien Base: Frame 1").
44395 ADD A,104 Add 104 for the alien base frames.
44397 LD (IX+0),A Write it to the actor type.
Draw the base and colour its attribute tiles.
44400 CALL DrawActorSprite Call DrawActorSprite.
44403 LD A,(24152) Fetch SpriteHeight.
44406 SUB 8 Subtract 8.
44408 LD (24152),A Write it back.
44411 CALL ColouriseSprite Call ColouriseSprite.
Return unless the base has been destroyed or PlayerInactive is set.
44414 LD A,(24172) Fetch PlayerInactive.
44417 AND A Jump to Handler_Missile_HideSlots if it is not zero.
44418 JR NZ,Handler_Missile_HideSlots
44420 LD A,(IX+21) Fetch the destroyed flag at *IX+21.
44423 AND A Return if it is zero.
44424 RET Z
Erase the base, turn Object_Slot_5 and AlienBase_Slot into craters (type 192), move the base 8 left and clear 24968.
Handler_Missile_HideSlots 44425 CALL ClearSpriteScratch Call ClearSpriteScratch.
44428 LD A,192 A=192.
44430 LD (24936),A Write it to Object_Slot_5.
44433 LD (24960),A Write it to AlienBase_Slot.
Move the world X at AlienBase_WorldX left by 8.
44436 LD HL,(24962) Fetch AlienBase_WorldX.
44439 LD BC,65528 Set the offset in BC to 65528 (-8).
44442 CALL MaskWorldX Call MaskWorldX.
44445 LD (24962),HL Write it back.
Clear 8 bytes of that slot from 24968.
44448 LD HL,24968 HL=24968.
44451 LD B,8 Set a byte counter in B for 8 loops.
Handler_Missile_Loop 44453 LD (HL),0 Write 0 to the current byte.
44455 INC HL Move onto the next byte.
44456 DJNZ Handler_Missile_Loop Decrease the byte counter by one and loop back to Handler_Missile_Loop until the tail is clear.
44458 RET Return.
Prev: 44342 Up: Map Next: 44459