Prev: CEE5 Up: Map Next: CFB5
CF59: Handle enemy projectile collision with Rex
Used by the routine at 9470.
CF59 LD A,($A1EE) Return if Rex is dead
CF5C OR A
CF5D RET NZ
CF5E LD A,($A1F9) Return if Rex is teleporting
CF61 OR A
CF62 RET NZ
CF63 LD IY,$5D22 Set IY to base address for enemy projectiles
CF67 LD B,$14 Set B to the number of projectiles to check
CF69 LD A,(IY+$06) check projectile status
CF6C CP $01 is flying?
CF6E JP NZ,$CFAB Jump forward and check next projectile if not flying
CF71 LD A,($A250) Check if projectile y-position is in range of collision based on Rex y-position
CF74 ADD A,$05
CF76 CP (IY+$01)
CF79 JP NC,$CFAB
CF7C ADD A,$11
CF7E CP (IY+$01)
CF81 JP C,$CFAB
CF84 LD A,($A24F) Check if projectile x-position is in range of collision based on Rex x-position
CF87 CP (IY+$00)
CF8A JP NC,$CFAB
CF8D ADD A,$10
CF8F CP (IY+$00)
CF92 JP C,$CFAB
Impact with Rex
CF95 LD (IY+$06),$02 Set projectile status to impact #1
CF99 LD A,($A1E2) Check if Rex has the shield activated
CF9C OR A Jump to kill Rex if shield not active
CF9D JP Z,$CFA8
Shield activated
CFA0 LD L,$05 Set L to the shield loss quantity
CFA2 CALL $98EC Handle shield loss
CFA5 JP $CFAB Jump to handle next projectile
Shield not activated
CFA8 CALL $9CC5 Kill Rex
CFAB LD DE,$000F Point IY to the next projectile data
CFAE ADD IY,DE
CFB0 DEC B Decrement projectile counter
CFB1 JP NZ,$CF69 Jump back and check next projectile
CFB4 RET
Prev: CEE5 Up: Map Next: CFB5