Prev: 28720 Up: Map Next: 29118
29017: Handler: Bullet Collision
Used by the routine at Handler_PlayerBullets.
Handler_BulletCollision 29017 LD A,(26353) Jump to Handler_BulletCollision_0 if this *Phase is either 2 or 3.
29020 AND %00000010
29022 JR NZ,Handler_BulletCollision_0
29024 LD DE,(26237) DE=*Pheenix_Colour_01.
29028 LD A,(HL) Jump to Handler_BulletCollision_0 if *HL is not equal to D.
29029 CP D
29030 JR NZ,Handler_BulletCollision_0
29032 INC HL Increment HL by one.
29033 LD A,(HL) A=*HL.
29034 DEC HL Decrease HL by one.
29035 CP E Jump to Handler_BulletCollision_1 if A is equal to E.
29036 JR Z,Handler_BulletCollision_1
29038 DEC HL Decrease HL by one.
29039 LD A,(HL) A=*HL.
29040 DEC HL Decrease HL by one.
29041 CP E Jump to Handler_BulletCollision_1 if A is equal to E.
29042 JR Z,Handler_BulletCollision_1
29044 INC HL Increment HL by two.
29045 INC HL
Handler_BulletCollision_0 29046 LD A,(HL) Jump to Handler_BulletCollisionEffects if *HL is not equal to 6.
29047 CP 6
29049 JR NZ,Handler_BulletCollisionEffects
29051 DEC HL Decrease HL by one.
29052 AND A HL-=BC.
29053 SBC HL,BC
Handler_BulletCollision_1 29055 PUSH HL Stash HL on the stack.
29056 CALL ConvertAttributeToScreenBufferAddress Call ConvertAttributeToScreenBufferAddress.
29059 EX DE,HL Exchange the DE and HL registers.
29060 LD HL,26077 HL=Table_CurrentAlienPhaseData.
29063 LD A,(26353) A=*Phase.
29066 AND %00000110 Keep only bits 1-2.
29068 LD B,8 B=8.
29070 JR NZ,Handler_BulletCollision_2 Jump to Handler_BulletCollision_2 if HL is not equal to A.
29072 LD B,15 B=15.
Handler_BulletCollision_2 29074 LD A,(HL) Jump to Handler_BulletCollision_4 if *HL is equal to E.
29075 CP E
29076 JR Z,Handler_BulletCollision_4
29078 INC HL Increment HL by two.
Handler_BulletCollision_3 29079 INC HL
29080 DJNZ Handler_BulletCollision_2 Decrease counter by one and loop back to Handler_BulletCollision_2 until counter is zero.
29082 POP HL Restore HL from the stack.
29083 RET Return.
Handler_BulletCollision_4 29084 INC HL Increment HL by one.
29085 PUSH DE Stash DE on the stack.
29086 LD D,(HL) D=*HL.
29087 RES 7,D Reset bit 7 of D.
29089 LD A,D A=D.
29090 POP DE Restore DE from the stack.
29091 CP D Jump to Handler_BulletCollision_5 if A is equal to D.
29092 JR Z,Handler_BulletCollision_5
29094 JR Handler_BulletCollision_3 Jump to Handler_BulletCollision_3.
Handler_BulletCollision_5 29096 LD (HL),0 Write 0 to *HL.
29098 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 29099 LD HL,26325 HL=Table_AlienExplosions.
FindEmptySlot_Loop 29102 LD A,(HL) Jump to ActivateExplosion if the active flag of this slot is marked as inactive.
29103 OR A
29104 JR Z,ActivateExplosion
29106 INC HL Move to the next set of explosion data.
29107 INC HL
29108 INC HL
29109 JR FindEmptySlot_Loop Jump back to FindEmptySlot_Loop.
Activate this explosion slot.
ActivateExplosion 29111 LD (HL),1 Activate this explosion slot.
29113 INC HL Write the position held by DE to the explosion slot data.
29114 LD (HL),E
29115 INC HL
29116 LD (HL),D
29117 RET Return.
Prev: 28720 Up: Map Next: 29118