Prev: 7159 Up: Map Next: 7254
71BE: Handler: Bullet Collision Effects
Used by the routine at Handler_BulletCollision.
Input
HL Bullet attribute buffer address
Check if this is phase 00 01 or 04. The first section targets only the Pheenix aliens in phase 02 and 03.
Handler_BulletCollisionEffects 71BE LD A,($66F1) Jump to BulletCollisionWithMothership if bit 1 of *Phase is not set, so phases
  • 00
  • 01
  • 04
71C1 BIT 1,A
71C3 JR Z,BulletCollisionWithMothership
Handle the Pheenix aliens in either phase 02 or 03.
71C5 LD A,(HL) Load the attribute value from the bullet attribute buffer address.
Check for the Pheenix wing attribute values from either phase.
pheenix-04-blue pheenix-04-magenta
71C6 CP $43 Jump to PlayWingHitSound if the attribute value is either INK:MAGENTA, PAPER:BLACK (BRIGHT) or INK:BLUE, PAPER:BLACK (BRIGHT).
71C8 JR Z,PlayWingHitSound
71CA CP $41
71CC JR Z,PlayWingHitSound
Return if the bullet is just passing over background.
71CE CP $05 Return if the attribute value is not CYAN.
71D0 RET NZ
Play a sound when the Pheenix wings are hit (but not in demo mode).
PlayWingHitSound 71D1 LD A,($66F3) Return if *Flag_ActiveDemoMode is active.
71D4 OR A
71D5 RET NZ
71D6 LD B,$18 Set a counter B for 18 loops.
71D8 LD HL,$0122 Set the initial pitch to 0122.
WingHitSound_Loop 71DB PUSH BC Stash the loop counter and pitch on the stack.
71DC PUSH HL
71DD LD DE,$0001 Set the sound duration to 0001.
71E0 CALL $03B5 Call BEEPER.
71E3 DI Disable interrupts.
71E4 POP HL Restore the pitch from the stack.
71E5 INC HL Increment the pitch by three.
71E6 INC HL
71E7 INC HL
71E8 POP BC Restore the loop counter from the stack.
71E9 DJNZ WingHitSound_Loop Decrease the loop counter by one and loop back to WingHitSound_Loop until all the sound loops are complete.
71EB RET Return.
The only other special bullet handling is when bullets hit the hull of the mothership (only in phase 04).
BulletCollisionWithMothership 71EC CP $04 Return if *Phase is not phase 04.
71EE RET NZ
mothership
Start by handling the final stage of the rotating blue strip.
71EF LD A,(HL) Load the attribute value from the bullet attribute buffer address.
71F0 CP $01 Jump to MothershipRotatingStrip if the attribute value is not equal to BLUE.
71F2 JR NZ,MothershipRotatingStrip
This part of the ship is BLUE - so it's the rotating strip about to be destroyed (so destroy it).
71F4 LD (HL),$40 Write INK:BLACK, PAPER:BLACK (BRIGHT) to the bullet/ rotating strip attribute pointer.
71F6 JR MothershipHull_ClearUDG Jump to MothershipHull_ClearUDG.
Handle a first hit on the rotating blue strip.
MothershipRotatingStrip 71F8 CP $0F Jump to MothershipHull_Stage_02 if the attribute value is not equal to INK:WHITE, PAPER:BLUE.
71FA JR NZ,MothershipHull_Stage_02
This part of the ship is INK:WHITE, PAPER:BLUE - so it's a "fresh" part of the rotating strip.
71FC LD (HL),$01 Write BLUE to the bullet/ rotating strip attribute pointer.
71FE JR MothershipHull_DrawLargeDent Jump to MothershipHull_DrawLargeDent.
Handle the second stage of the hull being shot.
MothershipHull_Stage_02 7200 CP $02 Jump to MothershipHull_Stage_01 if the attribute value is not equal to RED.
7202 JR NZ,MothershipHull_Stage_01
This part of the ship is RED so has been hit once already.
7204 PUSH HL Stash the attribute buffer pointer on the stack.
7205 LD A,L Move up one row in the attribute buffer (subtract 20).
7206 SUB $20
7208 LD L,A
7209 LD A,(HL) Load the attribute value from the new attribute buffer address.
720A CP $10 Jump to MothershipHull_ClearAttribute if the attribute value is not equal to INK:BLACK, PAPER:RED.
720C JR NZ,MothershipHull_ClearAttribute
720E LD H,$4D Set H to 4D (screen buffer).
Draw the degraded hull partial sprite:
$61EF
Note that the "move to the next UDG graphic data byte" moves backwards not forwards as you'd expect.
7210 LD B,$03 Set a line counter in B for 03 (this is a partial graphic from the larger Graphics_MothershipDegradedHull_01).
7212 LD DE,$61EF DE=Graphics_MothershipDegradedHull_02.
MothershipHull_DrawLoop 7215 LD A,(DE) Copy the UDG data to the screen buffer.
7216 LD (HL),A
7217 INC H Move down one pixel line in the screen buffer.
7218 DEC DE Move to the next UDG graphic data byte.
7219 DJNZ MothershipHull_DrawLoop Decrease the line counter by one and loop back to MothershipHull_DrawLoop until all 03 lines of the UDG character have been drawn.
Set the attribute value to BLACK now that this section of the hull has been destroyed.
MothershipHull_ClearAttribute 721B POP HL Restore the attribute buffer pointer from the stack.
721C LD (HL),$00 Write BLACK to *HL.
Point to the "SPACE" (empty UDG graphic) in the ZX Spectrum font to clear the whole UDG area of the hull.
MothershipHull_ClearUDG 721E LD DE,$3D00 DE=3D00.
7221 JR MothershipHull_DrawUDG Jump to MothershipHull_DrawUDG.
Handle the first stage of the hull being shot.
MothershipHull_Stage_01 7223 CP $10 Jump to MothershipHull_IsAlienShot if the attribute value is not equal to INK:BLACK, PAPER:RED.
7225 JR NZ,MothershipHull_IsAlienShot
7227 LD (HL),$02 Write RED to the bullet/ hull attribute pointer.
Draw the degraded hull large sprite:
udg25067_2x4
MothershipHull_DrawLargeDent 7229 LD DE,$61EB DE=Graphics_MothershipDegradedHull_01.
MothershipHull_DrawUDG 722C LD H,$48 Set H to 48 (screen buffer).
722E LD B,$08 Set a line counter in B (08 lines in a UDG).
MothershipHull_DrawUDG_Loop 7230 LD A,(DE) Copy the UDG data to the screen buffer.
7231 LD (HL),A
7232 INC DE Move to the next UDG graphic data byte.
7233 INC H Move down one pixel line in the screen buffer.
7234 DJNZ MothershipHull_DrawUDG_Loop Decrease the line counter by one and loop back to MothershipHull_DrawUDG_Loop until all 08 lines of the UDG character have been drawn.
Award 35 points for damaging the hull.
7236 LD A,$35 Write 35 to *652E.
7238 LD ($652E),A
723B CALL Handler_Score Call Handler_Score.
723E CALL PrintScore Call PrintScore.
7241 CALL PrintLives Call PrintLives.
7244 RET Return.
Handle checking if the mothership alien has been shot?
Is this empty space within the mothership graphic?
MothershipHull_IsAlienShot 7245 CP $40 Return if the attribute value is not equal to INK:BLACK, PAPER:BLACK (BRIGHT).
7247 RET NZ
Check the attribute block above where the bullet is positioned.
7248 RES 5,L Clear bit 5 of L to move up one row to the alien attribute position.
Has the bullet reached the mothership alien?
Graphic Attribute Byte Attribute Colour
mothership-alien-01 44 INK:GREEN, PAPER:BLACK (BRIGHT)
42 INK:RED, PAPER:BLACK (BRIGHT)
724A LD A,(HL) Return if the attribute value at the new position is not equal to INK:RED, PAPER:BLACK (BRIGHT).
724B CP $42
724D RET NZ
The bullet has hit the mothership alien.
724E LD A,$01 Write 01 to *MothershipAlienState to mark that the mothership alien has been shot (and so phase 04 is now complete).
7250 LD ($66D3),A
7253 RET Return.
Prev: 7159 Up: Map Next: 7254