Prev: 97E5 Up: Map Next: 9896
9807: Destroy enemy
Used by the routines at 976E, C3C1, C433, C691, C721, C78C, CFB5 and D15A.
9807 LD HL,$E9FF Set A1D2 the base address for attribute buffer pointing to score points
980A LD ($A1D2),HL
980D LD HL,$0000 Set A1D5 the score points for enemy dying
9810 LD ($A1D5),HL
9813 LD A,(IX+$09) Check enemy type
9816 CP $83 is BRAIN?
9818 CALL Z,$9876 Handle BRAIN destruction
981B LD A,(IX+$01) Return if y-position of enemy is greater than $B0
981E CP $B0
9820 RET NC
9821 CP $10 Return if y-position of enemy is less than $10
9823 RET C
9824 LD HL,$84D8 Set base address for explosion graphic data
9827 LD (IX+$04),L
982A LD (IX+$05),H
982D LD (IX+$0D),$08 Set explosion counter
9831 LD (IX+$0F),$18 Set height of explosion
9835 LD (IX+$0E),$03 Set width of explosion
9839 LD A,(IX+$09) Check enemy
983C OR A Increment dead counter if not FOOT MAN
983D CALL NZ,$986E
9840 AND $0F Set into HL to the address into the enemy points table
9842 LD E,A
9843 LD D,$00
9845 LD HL,$9896
9848 ADD HL,DE
9849 LD E,(HL) Set DE to the points obtained
984A LD D,$00
984C LD A,E Check number of points
984D OR A
984E CALL NZ,$9945 if points greater than 0 then increment score
9851 LD DE,$D528 Set address for explosion sound
9854 CALL $D37F Configure sound channel and mixer register
9857 LD (IX+$09),$FF Set entity type explosion
985B LD (IX+$02),$00 Reset sprite direction
985F LD A,(IX+$01) Set explosion y-position (fixed grid)
9862 SUB $08
9864 AND $F8
9866 LD (IX+$01),A
9869 LD (IX+$03),$00 Reset explosion debris expansion counter
986D RET
Increment enemy dead counter
986E LD HL,($A222) Increment BIO GROWTH DEATH counter
9871 INC HL
9872 LD ($A222),HL
9875 RET
Handle the destroy of Brain enemy
9876 LD A,(IX+$11) Increase wound counter
9879 INC A
987A LD (IX+$11),A
987D CP $0A Return if counter is 10
987F RET Z
9880 LD L,(IX+$04) Point to the next BRAIN graphic data
9883 LD H,(IX+$05)
9886 LD DE,$0020
9889 ADD HL,DE
988A LD (IX+$04),L
988D LD (IX+$05),H
9890 LD (IX+$14),$02 Reset BRAIN health
9894 POP BC Restore BC
9895 RET
Prev: 97E5 Up: Map Next: 9896