Prev: 35928 Up: Map Next: 36127
36018: Explode Player Ship
Used by the routine at UpdateEnemies.
Fills all nine enemy slots with the pieces of debris from the player's exploding ship: four pieces of type 21 followed by five pieces of type 28.
ExplodePlayerShip 36018 LD IY,51429 Use the player's object.
36022 LD BC,1024 Set the piece counter and timer in BC.
36025 LD IX,39284 Use the first enemy slot.
36029 LD A,(49577) Fetch the scroll value from ShipHeight.
36032 SRL A Halve it.
36034 NEG Negate it.
36036 LD (23581),A Store it in TileNumber.
ExplodePlayerShip_First 36039 PUSH BC Save the counters.
36040 CALL StartDebrisPiece Start a piece at the position of the player.
36043 CALL StartExplosion Make the piece type 21.
36046 LD (IX+13),255 Make the attribute of the piece 255.
36050 POP BC Restore the counters.
36051 LD A,C Set the timer of the piece.
36052 LD (IX+21),A
36055 ADD A,64 Add 64 to the timer for the next piece.
36057 LD C,A
36058 LD DE,24 Set the length of a slot.
36061 ADD IX,DE Move on to the next slot.
36063 DJNZ ExplodePlayerShip_First Decrease the piece counter by one and loop back to ExplodePlayerShip_First until none remain.
36065 LD BC,1280 Set the counter for five more pieces.
ExplodePlayerShip_Second 36068 PUSH BC Save the counters.
36069 CALL StartDebrisPiece Start a piece at the position of the player.
36072 LD (IX+0),28 Make the piece type 28.
36076 LD (IX+16),6 Set the flags of the piece.
36080 LD (IX+19),80 Set the first state byte of the piece.
36084 LD (IX+20),2 Set the second state byte of the piece.
36088 LD (IX+21),64 Set the lifetime of the piece.
36092 LD (IX+13),238 Make the attribute of the piece 238.
36096 POP BC Restore the counters.
36097 LD A,C Fetch the timer.
36098 LD HL,36127 Use the table of speeds at DebrisSpeeds.
36101 CALL AddAToHL Add the offset to the address.
36104 LD A,(HL) Set the horizontal speed of the piece from the table.
36105 LD (IX+7),A
36108 INC HL Fetch the next byte of the table.
36109 LD A,(HL) Set the vertical speed of the piece from the table.
36110 LD (IX+9),A
36113 INC C Move on to the next pair of speeds.
36114 INC C
36115 LD (IX+15),32 Set the vertical acceleration of the piece.
36119 LD DE,24 Set the length of a slot.
36122 ADD IX,DE Move on to the next slot.
36124 DJNZ ExplodePlayerShip_Second Decrease the piece counter by one and loop back to ExplodePlayerShip_Second until none remain.
36126 RET Return.
Prev: 35928 Up: Map Next: 36127