Prev: 97FD Up: Map Next: 98AF
981F: Destroy enemy
Used by the routines at 9786, C14D, C3E0, C620, C6C2, D215 and D3C2.
981F LD HL,$E9FF Set A039 the base address for attribute buffer pointing to score points
9822 LD ($A039),HL
9825 LD HL,$0000 Set A03C the score points for enemy dying
9828 LD ($A03C),HL
982B LD A,(IX+$09) Check enemy type
982E CP $90 is Boss?
9830 JP Z,$98AF Jump to handle Boss destruction
9833 LD A,(IX+$01) Return if y-position of enemy is greater than $B0
9836 CP $B0
9838 RET NC
9839 CP $10 Return if y-position of enemy is less than $10
983B RET C
983C LD A,(IX+$09) Check enemy type
983F CP $05 is front train?
9841 CALL Z,$9968 Jump to handle train destruction
9844 LD HL,$81B2 Set base address for explosion graphic data
9847 LD (IX+$04),L
984A LD (IX+$05),H
984D LD (IX+$0D),$08 Set explosion counter
9851 LD (IX+$0F),$18 Set height of explosion
9855 LD (IX+$0E),$03 Set width of explosion
9859 LD A,(IX+$09) Check enemy
985C OR A is FOOT MAN?
985D CALL Z,$98A7 Jump to increment enemy dead count
9860 CP $07 is FOOT MAN dying?
9862 CALL Z,$98A7 Jump to increment enemy dead count
9865 CP $06 is FOOT MAN crouched/dying?
9867 CALL Z,$98A7 Jump to increment enemy dead count
986A CP $0C is Pod?
986C CALL Z,$98A7 Jump to increment enemy dead count
986F CP $04 is rear train?
9871 CALL Z,$98A7 Jump to increment enemy dead count
9874 CP $05 is front train?
9876 CALL Z,$98A7 Jump to increment enemy dead count
9879 AND $0F Set into HL to the address into the enemy points table
987B LD E,A
987C LD D,$00
987E LD HL,$994E
9881 ADD HL,DE
9882 LD E,(HL) Set DE to the points obtained
9883 LD D,$00
9885 LD A,E Check number of points
9886 OR A
9887 CALL NZ,$9A27 if points greater than 0 then increment score
988A LD DE,$D790 Set address for explosion sound
988D CALL $D5E7 Configure sound channel and mixer register
9890 LD (IX+$09),$FF Set entity type explosion
9894 LD (IX+$02),$00 Reset sprite direction
9898 LD A,(IX+$01) Set explosion y-position (fixed grid)
989B SUB $08
989D AND $F8
989F LD (IX+$01),A
98A2 LD (IX+$03),$00 Reset explosion debris expansion counter
98A6 RET
Increment enemy dead counter
98A7 LD HL,($A089) Increment humans killed
98AA INC HL
98AB LD ($A089),HL
98AE RET
Prev: 97FD Up: Map Next: 98AF