Prev: D1B9 Up: Map Next: D4AC
D215: Handle collision detection of enemy with Rex and projectiles
Used by the routine at BA5C.
D215 LD A,($A055) Return if Rex is dead
D218 OR A
D219 RET NZ
Configure opcodes for collision box according to enemy type
D21A LD A,$1E Configure opcode ADD A at $D28D to add $1E (y-position height range)
D21C LD ($D28E),A
D21F LD A,$16 Configure opcode ADD A at $D29D to add $1E (x-position width range)
D221 LD ($D29E),A
D224 LD A,$10 Configure opcode ADD A at $D30F and $D320 to add $10
D226 LD ($D310),A
D229 LD ($D321),A
D22C LD A,$10 Configure opcode SUB at $D298 to substract $10 (x-position width range)
D22E LD ($D299),A
D231 LD A,(IX+$02) Jump forward if enemy moving left
D234 OR A
D235 JP Z,$D23D
D238 LD A,$08 Enemy moving right, configure opcode SUB at $D298 to substract $08 (x-position width range)
D23A LD ($D299),A
D23D LD A,(IX+$09) Check enemy type
D240 AND $7F
D242 CP $10 is BOSS?
D244 JP Z,$D254 Jump to reconfigure opcodes
D247 CP $0E is a MINE?
D249 JP Z,$D269 Jump to reconfigure opcodes
D24C CP $0F is a BLOB?
D24E JP Z,$D269 Jump to reconfigure opcodes
D251 JP $D27B Jump forward and check for collision
Configure opcodes for BOSS
D254 LD A,$3E Configure opcode ADD A at $D28D to add $3E (y-position height range)
D256 LD ($D28E),A
D259 LD A,$36 Configure opcode ADD A at $D29D to add $36 (x-position width range)
D25B LD ($D29E),A
D25E LD A,$30 Configure opcode ADD A at $D30F and $D320 to add $30
D260 LD ($D310),A
D263 LD ($D321),A
D266 JP $D27B Jump forward and check for collision
Configure opcodes for MINE and BLOB
D269 LD A,$16 Configure opcode ADD A at $D28D to add $16 (y-position height range)
D26B LD ($D28E),A
D26E LD A,$0E Configure opcode ADD A at $D29D to add $0E (x-position width range)
D270 LD ($D29E),A
D273 LD A,$08 Configure opcode ADD A at $D30F and $D320 to add $08
D275 LD ($D310),A
D278 LD ($D321),A
D27B LD A,($A060) Jump forward if Rex is teleporting
D27E OR A
D27F JP NZ,$D2F6
D282 LD HL,$A0B7 Set HL the y-position of Rex
D285 LD A,(IX+$01) Check if y-position of enemy is in the range of collision with Rex and jump forward if not
D288 SUB $10
D28A CP (HL)
D28B JR NC,$D2F6
D28D ADD A,$1E
D28F CP (HL)
D290 JR C,$D2F6
D292 LD HL,$A0B6 Set HL the x-position of Rex
D295 LD A,(IX+$00) Check if x-position of enemy is in the range of collision with Rex
D298 SUB $10
D29A CP (HL)
D29B JR NC,$D2F6
D29D ADD A,$16
D29F CP (HL)
D2A0 JR C,$D2F6
collision with Rex detected and shield activated
D2A2 LD A,($A049) Jump forward if shield not activated
D2A5 OR A
D2A6 JP Z,$D2CC
D2A9 LD A,(IX+$09) Jump forward if entity is bubble, smartbomb or question
D2AC CP $FE
D2AE JP Z,$D2CC
D2B1 CP $FD
D2B3 JP Z,$D2CC
D2B6 CP $FC
D2B8 JP Z,$D2CC
D2BB CALL $981F Destroy enemy
D2BE LD A,(IX+$14) Computes shield loss into L shield loss = enemy health * 4
D2C1 SLA A
D2C3 SLA A
D2C5 LD L,A
D2C6 CALL $99CE Handle shield loss
D2C9 JP $D2E1 Jump forward
collision with Rex detected and shield not activated
D2CC LD A,(IX+$09) Jump forward if entity is bubble, smartbomb or question
D2CF CP $FE
D2D1 JP Z,$D2E1
D2D4 CP $FD
D2D6 JP Z,$D2E1
D2D9 CP $FC
D2DB JP Z,$D2E1
D2DE CALL $9BDA Handle Rex dead
Rex takes bubble, smartbombs or question
D2E1 LD A,(IX+$09) check enemy?
D2E4 CP $FE is bubble?
D2E6 CALL Z,$D46C Jump to handles Rex takes bubble
D2E9 CP $FD is smartbomb?
D2EB CALL Z,$D494 Jump to handle Rex takes smartbomb
D2EE LD A,(IX+$09)
D2F1 CP $FC is question?
D2F3 CALL Z,$D4B6 Jump to handle question
check collision with Rex projectiles
D2F6 LD IY,$5B60 Set IY to the base address for Rex projectiles configuration
D2FA LD B,$1E Set B to the number of projectiles to check
D2FC LD A,(IY+$06) Set A to the projectile status
D2FF CP $01 is flying?
D301 JP NZ,$D3A7 Jump to check another projectile if not flying
D304 LD A,(IX+$01) Jump to check another projectile if y-position of projectile is not in range of collision with the enemy y-position
D307 ADD A,$05
D309 CP (IY+$01)
D30C JP NC,$D3A7
D30F ADD A,$10
D311 CP (IY+$01)
D314 JP C,$D3A7
D317 LD A,(IX+$00) Jump to check another projectile if x-position of projectile is not in range collision with then enemy x-position
D31A CP (IY+$00)
D31D JP NC,$D3A7
D320 ADD A,$10
D322 CP (IY+$00)
D325 JP C,$D3A7
handle projectile collision with entity
D328 LD A,(IX+$09) Check for entity type
D32B CP $FE Jump to check another projectile if entity is bubble
D32D JP Z,$D3A7
D330 CP $FD Jump to check another projectile if entity is smartbomb
D332 JP Z,$D3A7
D335 CP $FC Jump to handle another projectile if entity is question
D337 JP Z,$D3A7
D33A LD A,($A013) Jump forward if weapon type is laser
D33D CP $02
D33F JP NZ,$D349
D342 LD (IY+$06),$00 Destroy laser projectile
D346 JP $D35B Jump forward
non laser impact
D349 LD (IY+$06),$02 Set projectile status to impact #1
D34D LD A,($D842) Check channel 3
D350 CP $FF Jump forward if channel in use
D352 JP NZ,$D35B
D355 LD DE,$D787 Set DE to base address for projectile impact sound
D358 CALL $D5E7 Configure sound channel and mixer register
handle enemy behaviour on projectile impact
D35B LD A,(IX+$09) Check enemy type
D35E CP $06 Handle collision if enemy type FOOT MAN DYING 6
D360 CALL Z,$D41F
D363 LD A,(IX+$09) Check enemy type
D366 CP $06 Jump to handle next projectile if enemy type is FOOT MAN DYING 6
D368 JP Z,$D3A7
D36B LD A,(IX+$14) Jump forward to handle next projectile if enemy health is zero
D36E OR A
D36F JP Z,$D3A7
D372 DEC A Decrement enemy health
D373 LD (IX+$14),A
D376 CP $01 Jump forward if enemy health <> 1
D378 JP NZ,$D3B1
enemy health is equal to 1
D37B LD A,(IX+$09) Jump forward and destroy enemy if enemy type is not FOOT MAN
D37E AND $7F
D380 OR A
D381 JP NZ,$D3A4
D384 LD A,(IX+$02) Jump forward to check projectile direction if FOOT MAN is facing left
D387 OR A
D388 JP NZ,$D396
D38B LD A,(IY+$04) check projectile direction
D38E BIT 7,A
D390 JP NZ,$D39E Jump forward and FOOT MAN dying #6 animation
D393 JP $D3A4 Jump to destroy enemy
D396 LD A,(IY+$04) check projectile direction
D399 BIT 7,A
D39B JP NZ,$D3A4 Jump to destroy enemy if projectile is facing left
D39E CALL $D3C2 Handle FOOT MAN dying #6
D3A1 JP $D3A7 Jump to handle next projectile
D3A4 CALL $981F Destroy enemy
check for the next projectile if any
D3A7 LD DE,$000F Set IY point to the next projectile configuration
D3AA ADD IY,DE
D3AC DEC B Decrement projectile counter
D3AD JP NZ,$D2FC Jump back and handle next projectil until there are projectiles
D3B0 RET
Enemy health is <> 1
D3B1 LD A,(IX+$09) Jump and handle next projectile if enemy type is not SCANNER
D3B4 AND $7F
D3B6 CP $08
D3B8 JP NZ,$D3A7
D3BB LD (IX+$10),$04 Reset scanner speed
D3BF JP $D3A7 Jump back and handle next projectile
Handle FOOT MAN dying #6
D3C2 LD A,($A013) Check weapon type
D3C5 CP $02 Jump to destroy enemy if weapon type is laser
D3C7 JP Z,$981F
D3CA CP $04 Configure FOOT MAN jumping if weapon type is spray
D3CC CALL Z,$C602
D3CF LD A,(IX+$02) Change direction
D3D2 XOR $01
D3D4 LD (IX+$02),A
D3D7 LD A,$04 Set speed
D3D9 LD (IX+$10),A
D3DC LD HL,$AE85 Set address of table offsets for FOOT MAN dying animation
D3DF LD (IX+$0A),L
D3E2 LD (IX+$0B),H
D3E5 LD HL,$8632 Set address for graphic data of FOOT MAN dying
D3E8 LD (IX+$16),L
D3EB LD (IX+$17),H
D3EE LD (IX+$09),$06 Set enemy type
D3F2 LD (IX+$11),$06 Set counter for state change
D3F6 LD (IX+$14),$02 Set health
D3FA LD (IX+$0E),$03 Set sprite width
D3FE LD A,($A013) Return if weapon type is spray or laser
D401 CP $04
D403 RET Z
D404 CP $02
D406 RET Z
D407 LD HL,$5843 Set base address to attribute file for score points
D40A LD ($A039),HL
D40D LD A,$09 Init counter for score points
D40F LD ($A03B),A
D412 LD HL,$0002 Set next score points
D415 LD ($A03C),HL
D418 LD DE,$0001 Set actual score points
D41B CALL $9A27 Increment score
D41E RET
handle projectile collision with FOOT MAN dying 6
D41F LD A,($A013) Return if projectile type is spray
D422 CP $04
D424 RET Z
D425 LD A,$04 Set enemy speed
D427 LD (IX+$10),A
D42A LD HL,$AE85 Set address pointer for offsets animation
D42D LD (IX+$0A),L
D430 LD (IX+$0B),H
D433 LD HL,$8632 Set address pointer of graphic data for FOOTMAN dying
D436 LD (IX+$16),L
D439 LD (IX+$17),H
D43C LD (IX+$09),$06 Set entity type
D440 LD (IX+$11),$06 Set counter for state change
D444 LD (IX+$14),$02 Set enemy health
D448 LD A,($A03B) Decrement score points counter and return if zero
D44B DEC A
D44C RET Z
D44D LD ($A03B),A Set the new score point counter value
D450 LD DE,($A03C) Set DE bonus score points
D454 CALL $9A27 Increment score
D457 LD HL,($A03C) Increment bonus score points
D45A LD DE,$0001
D45D ADD HL,DE
D45E LD ($A03C),HL
D461 LD HL,($A039) Increment base address into attribute file pointing to bonus points icon in HUD
D464 LD DE,$0003
D467 ADD HL,DE
D468 LD ($A039),HL
D46B RET
handle Rex takes bubble
D46C PUSH AF Save AF
D46D LD DE,$D7DB Set DE sound buffer for catching small bubble
D470 CALL $D5E7 Configure sound channel and mixer register
D473 LD (IX+$0C),$00 Set bubble not visible
D477 LD A,$26 Set A the quantity of energy to increase
D479 CALL $B98E Handle weapon energy increase
D47C XOR A Active HDU flash
D47D LD ($A042),A
D480 LD A,(IX+$15) Jump forward and return if bubble small
D483 OR A
D484 JP Z,$D492
D487 LD A,$26 Set A the quantity of energy to increase
D489 CALL $B98E Handle weapon energy increase
D48C LD DE,$D7C6 Set DE sound buffer for catching big bubble
D48F CALL $D5E7 Configure sound channel and mixer register
D492 POP AF Restore AF
D493 RET
handle Rex takes smartbomb
D494 LD (IX+$0C),$00 Set smartbomb to not visible
D498 LD A,($A06C) Increase number of smartbombs
D49B INC A
D49C CP $04 Return if number of smartbombs is qual to 4
D49E RET Z
D49F LD ($A06C),A Set the new number of smartbombs
D4A2 CALL $A1C9 Draw smartbombs
D4A5 LD DE,$D7F0 Set DE to the address for the smartbomb take sound
D4A8 CALL $D5E7 Configure sound channel and mixer register
D4AB RET
Prev: D1B9 Up: Map Next: D4AC