Prev: BF4B Up: Map Next: C141
BF4F: Draw enemies (2/2)
Used by the routine at BEF1.
Create projectile for PLANT
BF4F PUSH AF Save AF and DE
BF50 PUSH DE
BF51 CALL $B5B6 Configure weapon sound and check for weapon free slot
BF54 LD A,(IX+$00) Set x-position for the projectile
BF57 SUB $08
BF59 LD ($A22C),A
BF5C LD A,$08 Set increment of y-position for the projectile
BF5E CALL $B5D4 Create a new projectile
BF61 LD (IY+$0B),$87 Set projectile type to seed plant
BF65 LD (IY+$0C),$00 Set projectile trajectory index
BF69 POP DE Restore DE
BF6A LD (IY+$04),E Set x-delta for the projectile
BF6D POP AF Restore AF
BF6E SLA A Computes index into table of trajectory addresses
BF70 SLA A
BF72 LD (IY+$0E),A
BF75 RET
PLANT is closing
BF76 LD L,(IX+$04) Point to the next graphic data
BF79 LD H,(IX+$05)
BF7C LD DE,$0020
BF7F AND A
BF80 SBC HL,DE
BF82 LD (IX+$04),L
BF85 LD (IX+$05),H
BF88 DEC (IX+$12) Decrement state change counter
BF8B JP NZ,$BD59 Jump back and process next enemy if counter is not zero
BF8E LD (IX+$11),$00 Set state to standing-by
BF92 JP $BD59 Jump back and process next enemy
PLANT is standing-by
BF95 CALL $A51D Generate a random number
BF98 CP $0A if number greater than 10 then jump back and process next enemy
BF9A JP NC,$BD59
BF9D LD (IX+$11),$01 Set Plant opening
BFA1 LD (IX+$12),$06 Set state change counter
BFA5 JP $BD59 Jump back and process next enemy
Handle BULB
BFA8 LD A,(IX+$11) Check status indicator
BFAB OR A BULB state is standing-by?
BFAC JP Z,$C01F Jump if so
BFAF CP $01 BULB state is expanding?
BFB1 JP Z,$BFBC Jump if so
BFB4 CP $02 BULB state is retracting?
BFB6 JP Z,$C000 Jump if so
BFB9 JP $BD59 Jump back and continue processing the next enemy
BULB is expanding
BFBC LD L,(IX+$04) Point to the next graphic data for the sprite
BFBF LD H,(IX+$05)
BFC2 LD DE,$0020
BFC5 ADD HL,DE
BFC6 LD (IX+$04),L
BFC9 LD (IX+$05),H
BFCC DEC (IX+$12) Decrement state change counter
BFCF JP NZ,$BD59 Jump back and process next enemy if state change counter is not zero
BFD2 LD (IX+$11),$02 Set state to retract BULB
BFD6 LD (IX+$12),$05 Set state change counter
BULB fires weapon
BFDA LD A,$04 Set the projectile type to spray
BFDC LD ($A1ED),A
BFDF CALL $B5B6 Configure weapon sound and check for weapon free slot
BFE2 CALL $C141 Configure projectile | extra-left
BFE5 CALL $B5B6 Configure weapon sound and check for weapon free slot
BFE8 CALL $C15B Configure projectile | left
BFEB CALL $B5B6 Configure weapon sound and check for weapon free slot
BFEE CALL $C181 Configure projectile | middle
BFF1 CALL $B5B6 Configure weapon sound and check for weapon free slot
BFF4 CALL $C19B Configure projectile | right
BFF7 CALL $B5B6 Configure weapon sound and check for weapon free slot
BFFA CALL $C1B3 Configure projectile | extra-right
BFFD JP $BD59 Jump back and process next enemy
BULB is retracting
C000 LD L,(IX+$04) Point to the next graphic data for the sprite
C003 LD H,(IX+$05)
C006 LD DE,$0020
C009 AND A
C00A SBC HL,DE
C00C LD (IX+$04),L
C00F LD (IX+$05),H
C012 DEC (IX+$12) Decrement state change counter
C015 JP NZ,$BD59 Jump back and process next enemy if state change counter is not zero
C018 LD (IX+$11),$00 Set state to stand-by BULB
C01C JP $BD59 Jump back and process next enemy
BULB is standing-by
C01F CALL $A51D Computes a random number
C022 CP $0A Jump back and process next enemy if random number is greater than 10
C024 JP NC,$BD59
C027 LD (IX+$11),$01 Change state to expanding
C02B LD (IX+$12),$05 Set state change counter
C02F JP $BD59 Jump back and process next enemy
Handle Foot Man dying 6
C032 LD A,(IX+$11) Set A to state change counter
C035 CP $04 counter is 4?
C037 JP NZ,$C04C Jump if not
C03A LD HL,$AF7A Set address for animation offsets of dying foot man
C03D LD (IX+$0A),L
C040 LD (IX+$0B),H
C043 LD HL,$82B8 Set graphic data for dying Foot man 7
C046 LD (IX+$16),L
C049 LD (IX+$17),H
C04C DEC (IX+$11) Decrement state change counter
C04F JP NZ,$BD27 If not zero jump back and continue to process other enemies
C052 LD (IX+$09),$07 Set enemy type to FOOT MAN dying 7
C056 JP $BD27 Jump back and continue to process other enemies
Handle explosion and configure gift: bubble, smartbomb or question
Handle debris expansion
C059 LD HL,$AA57 Set HL to the offset of positions for debris 1
C05C CALL $C25E Handle debris movement and draw it
C05F LD HL,$AA67 Set HL to the offset of positions for debris 2
C062 CALL $C25E Handle debris movement and draw it
C065 LD HL,$AA77 Set HL to the offset of positions for debris 3
C068 CALL $C25E Handle debris movement and draw it
C06B LD HL,$AA87 Set HL to the offset of positions for debris 4
C06E CALL $C25E Handle debris movement and draw it
C071 LD HL,$AA97 Set HL to the offset of positions for debris 5
C074 CALL $C25E Handle debris movement and draw it
C077 LD HL,$AAA7 Set HL to the offset of positions for debris 6
C07A CALL $C25E Handle debris movement and draw it
C07D INC (IX+$03) Increment explosion debris counter
Draw central explosion
C080 LD A,(IX+$00) Set A248 the x-pixel-position of the explosion
C083 LD ($A248),A
C086 LD A,(IX+$01) Set A249 the x-pixel-position of the explosion
C089 LD ($A249),A
C08C CALL $BC17 Draw random attribute color for explosion
C08F LD L,(IX+$04) Increment the graphic data address for the explosion
C092 LD H,(IX+$05)
C095 LD DE,$0048
C098 ADD HL,DE
C099 LD (IX+$04),L
C09C LD (IX+$05),H
C09F DEC (IX+$0D) Decrement explosion counter
C0A2 JP NZ,$BD5C Jump to the next enemy configuration if not zero explosion has ended, configure gift: bubble, smartbomb or question
C0A5 LD HL,($A22C) Set HL to the address into the attribute file for the explosion
C0A8 LD DE,($A22E) Set DE to the address into the attribute buffer for the explosion
C0AC CALL $BBEA Reset attribute color when explosion ended
C0AF LD A,(IX+$00) x-pixel-position of sprite is less than 24?
C0B2 CP $18
C0B4 JP C,$C11C Jump if so
C0B7 LD (IX+$09),$FE Set Enemy configuration to energy bubble
C0BB LD (IX+$0F),$10 Set sprite height
C0BF LD (IX+$0E),$02 Set sprite width
C0C3 LD A,(IX+$01) Add 8 pixels to y-pixel-position
C0C6 ADD A,$08
C0C8 LD (IX+$01),A
configure big bubble
C0CB LD (IX+$03),$00 Reset configuration
C0CF LD (IX+$06),$00 Reset configuration
C0D3 LD (IX+$11),$64 Set bubble counter to $64
C0D7 LD (IX+$10),$00 Reset configuration
C0DB LD HL,$8718 Set HL to graphic data address for big bubble
C0DE LD (IX+$12),L Set graphic data address for bubble
C0E1 LD (IX+$13),H
C0E4 LD (IX+$04),L
C0E7 LD (IX+$05),H
C0EA LD A,(IX+$15) Check bubble type
C0ED CP $FF No bubble?
C0EF JP Z,$C11C Jump if so
C0F2 CALL $A51D Set A to a pseudo-random number
C0F5 CP $03 is less than 3?
C0F7 JP C,$C123 you are lucky, you got an smartbomb
C0FA CP $06 is less than 6?
C0FC JP C,$C12D you are lucky, you got a question mark (random gift)
C0FF LD A,(IX+$15) is bubble type big?
C102 OR A
C103 JP NZ,$BD5C Jump if so and process next object
configure small bubble
C106 LD HL,$87D8 Set HL to graphic data for small bubble
C109 LD (IX+$12),L Set graphic data for the bubble
C10C LD (IX+$13),H
C10F LD (IX+$11),$8C Set bubble counter to $8C
C113 LD (IX+$04),L Set graphic data for the bubble
C116 LD (IX+$05),H
C119 JP $BD5C Jump to the next enemy configuration
configure no bubble
C11C LD (IX+$0C),$00 Set object live/visibility to dead/not visible
C120 JP $BD5C Jump to the next enemy configuration
configure smartbomb
C123 LD (IX+$09),$FD Set object type to smartbomb
C127 LD HL,$8BA0 Set graphic data for smartbomb
C12A JP $C134 Jump forward
configure question
C12D LD (IX+$09),$FC Set object type to question
C131 LD HL,$8BC0 Set graphic data for question
C134 LD (IX+$04),L Copy address to object configuration
C137 LD (IX+$05),H
C13A LD (IX+$02),$01 Set sprite to reverse
C13E JP $BD5C Jump to the next enemy configuration
Prev: BF4B Up: Map Next: C141