Prev: 8CB1 Up: Map Next: 8D1F
8CB2: Break the ship up
Used by the routine at update_objects.
Called by update_objects when the death byte (death_count) reaches 10. Fills all nine object records (object_records): the first four as debris (type $15, made by the second entry point of check_shot) 28 pixels to the right of the ship and above it by half the ship sprite's height (ship_height), +$15 0, $40, $80 and $C0 so that each piece takes a different part of the debris path; the other five as type $1C bullets (frame 0) at the same place (+$14 = 2, frames 0-2, which also marks them as pieces of the wreck), thrown out with the velocities at wreck_velocities and pulled down by gravity (Y acceleration $0020).
wreck_ship 8CB2 LD IY,ship_record Four records from the first; the offset above the ship
8CB6 LD BC,$0400
8CB9 LD IX,object_records
8CBD LD A,(ship_height)
8CC0 SRL A
8CC2 NEG
8CC4 LD (ground_cell),A
wreck_ship_0 8CC7 PUSH BC At the ship (place_at_ship); debris (type $15)
8CC8 CALL place_at_ship
8CCB CALL make_debris
8CCE LD (IX+$0D),$FF Colour white, path phase C, next
8CD2 POP BC
8CD3 LD A,C
8CD4 LD (IX+$15),A
8CD7 ADD A,$40
8CD9 LD C,A
8CDA LD DE,$0018
8CDD ADD IX,DE
8CDF DJNZ wreck_ship_0
8CE1 LD BC,$0500 Five more, at the ship
wreck_ship_1 8CE4 PUSH BC
8CE5 CALL place_at_ship
8CE8 LD (IX+$00),$1C Type $1C, frame 0, top speed 7, wreck piece, colour yellow
8CEC LD (IX+$10),$06
8CF0 LD (IX+$13),$50
8CF4 LD (IX+$14),$02
8CF8 LD (IX+$15),$40
8CFC LD (IX+$0D),$EE
8D00 POP BC Velocity from wreck_velocities
8D01 LD A,C
8D02 LD HL,wreck_velocities
8D05 CALL add_a_to_hl
8D08 LD A,(HL)
8D09 LD (IX+$07),A
8D0C INC HL
8D0D LD A,(HL)
8D0E LD (IX+$09),A
8D11 INC C Gravity; next
8D12 INC C
8D13 LD (IX+$0F),$20
8D17 LD DE,$0018
8D1A ADD IX,DE
8D1C DJNZ wreck_ship_1
8D1E RET Done
Prev: 8CB1 Up: Map Next: 8D1F