Prev: 7030 Up: Map Next: 71BE
7159: Handler: Bullet Collision
Used by the routine at Handler_PlayerBullets.
Handler_BulletCollision 7159 LD A,($66F1) Jump to Handler_BulletCollision_0 if this *Phase is either 02 or 03.
715C AND %00000010
715E JR NZ,Handler_BulletCollision_0
7160 LD DE,($667D) DE=*Pheenix_Colour_01.
7164 LD A,(HL) Jump to Handler_BulletCollision_0 if *HL is not equal to D.
7165 CP D
7166 JR NZ,Handler_BulletCollision_0
7168 INC HL Increment HL by one.
7169 LD A,(HL) A=*HL.
716A DEC HL Decrease HL by one.
716B CP E Jump to Handler_BulletCollision_1 if A is equal to E.
716C JR Z,Handler_BulletCollision_1
716E DEC HL Decrease HL by one.
716F LD A,(HL) A=*HL.
7170 DEC HL Decrease HL by one.
7171 CP E Jump to Handler_BulletCollision_1 if A is equal to E.
7172 JR Z,Handler_BulletCollision_1
7174 INC HL Increment HL by two.
7175 INC HL
Handler_BulletCollision_0 7176 LD A,(HL) Jump to Handler_BulletCollisionEffects if *HL is not equal to 06.
7177 CP $06
7179 JR NZ,Handler_BulletCollisionEffects
717B DEC HL Decrease HL by one.
717C AND A HL-=BC.
717D SBC HL,BC
Handler_BulletCollision_1 717F PUSH HL Stash HL on the stack.
7180 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
7183 EX DE,HL Exchange the DE and HL registers.
7184 LD HL,$65DD HL=Table_CurrentAlienPhaseData.
7187 LD A,($66F1) A=*Phase.
718A AND %00000110 Keep only bits 1-2.
718C LD B,$08 B=08.
718E JR NZ,Handler_BulletCollision_2 Jump to Handler_BulletCollision_2 if HL is not equal to A.
7190 LD B,$0F B=0F.
Handler_BulletCollision_2 7192 LD A,(HL) Jump to Handler_BulletCollision_4 if *HL is equal to E.
7193 CP E
7194 JR Z,Handler_BulletCollision_4
7196 INC HL Increment HL by two.
Handler_BulletCollision_3 7197 INC HL
7198 DJNZ Handler_BulletCollision_2 Decrease counter by one and loop back to Handler_BulletCollision_2 until counter is zero.
719A POP HL Restore HL from the stack.
719B RET Return.
Handler_BulletCollision_4 719C INC HL Increment HL by one.
719D PUSH DE Stash DE on the stack.
719E LD D,(HL) D=*HL.
719F RES 7,D Reset bit 7 of D.
71A1 LD A,D A=D.
71A2 POP DE Restore DE from the stack.
71A3 CP D Jump to Handler_BulletCollision_5 if A is equal to D.
71A4 JR Z,Handler_BulletCollision_5
71A6 JR Handler_BulletCollision_3 Jump to Handler_BulletCollision_3.
Handler_BulletCollision_5 71A8 LD (HL),$00 Write 00 to *HL.
71AA POP DE Restore DE from the stack.
This entry point is used by the routine at Handler_AliensMovement_Spawning.
Locate an empty explosion slot.
Noting that ... this doesn't check for an "end" so has the potential to overwrite data!
FindEmptySlot 71AB LD HL,$66D5 HL=Table_AlienExplosions.
FindEmptySlot_Loop 71AE LD A,(HL) Jump to ActivateExplosion if the active flag of this slot is marked as inactive.
71AF OR A
71B0 JR Z,ActivateExplosion
71B2 INC HL Move to the next set of explosion data.
71B3 INC HL
71B4 INC HL
71B5 JR FindEmptySlot_Loop Jump back to FindEmptySlot_Loop.
Activate this explosion slot.
ActivateExplosion 71B7 LD (HL),$01 Activate this explosion slot.
71B9 INC HL Write the position held by DE to the explosion slot data.
71BA LD (HL),E
71BB INC HL
71BC LD (HL),D
71BD RET Return.
Prev: 7030 Up: Map Next: 71BE