![]() |
Routines |
| Prev: 29017 | Up: Map | Next: 29268 |
|
Used by the routine at Handler_BulletCollision.
|
||||||||||||
|
Check if this is phase 0 1 or 4. The first section targets only the Pheenix aliens in phase 2 and 3.
|
||||||||||||
| Handler_BulletCollisionEffects | 29118 | LD A,(26353) | Jump to BulletCollisionWithMothership if bit 1 of *Phase is not set, so phases
|
|||||||||
| 29121 | BIT 1,A | |||||||||||
| 29123 | JR Z,BulletCollisionWithMothership | |||||||||||
|
Handle the Pheenix aliens in either phase 2 or 3.
|
||||||||||||
| 29125 | LD A,(HL) | Load the attribute value from the bullet attribute buffer address. | ||||||||||
|
Check for the Pheenix wing attribute values from either phase.
|
||||||||||||
| 29126 | CP 67 | Jump to PlayWingHitSound if the attribute value is either INK:MAGENTA, PAPER:BLACK (BRIGHT) or INK:BLUE, PAPER:BLACK (BRIGHT). | ||||||||||
| 29128 | JR Z,PlayWingHitSound | |||||||||||
| 29130 | CP 65 | |||||||||||
| 29132 | JR Z,PlayWingHitSound | |||||||||||
|
Return if the bullet is just passing over background.
|
||||||||||||
| 29134 | CP 5 | Return if the attribute value is not CYAN. | ||||||||||
| 29136 | RET NZ | |||||||||||
|
Play a sound when the Pheenix wings are hit (but not in demo mode).
|
||||||||||||
| PlayWingHitSound | 29137 | LD A,(26355) | Return if *Flag_ActiveDemoMode is active. | |||||||||
| 29140 | OR A | |||||||||||
| 29141 | RET NZ | |||||||||||
|
|
||||||||||||
| 29142 | LD B,24 | Set a counter B for 24 loops. | ||||||||||
| 29144 | LD HL,290 | Set the initial pitch to 0290. | ||||||||||
| WingHitSound_Loop | 29147 | PUSH BC | Stash the loop counter and pitch on the stack. | |||||||||
| 29148 | PUSH HL | |||||||||||
| 29149 | LD DE,1 | Set the sound duration to 0001. | ||||||||||
| 29152 | CALL 949 | Call BEEPER. | ||||||||||
| 29155 | DI | Disable interrupts. | ||||||||||
| 29156 | POP HL | Restore the pitch from the stack. | ||||||||||
| 29157 | INC HL | Increment the pitch by three. | ||||||||||
| 29158 | INC HL | |||||||||||
| 29159 | INC HL | |||||||||||
| 29160 | POP BC | Restore the loop counter from the stack. | ||||||||||
| 29161 | DJNZ WingHitSound_Loop | Decrease the loop counter by one and loop back to WingHitSound_Loop until all the sound loops are complete. | ||||||||||
| 29163 | RET | Return. | ||||||||||
|
The only other special bullet handling is when bullets hit the hull of the mothership (only in phase 4).
|
||||||||||||
| BulletCollisionWithMothership | 29164 | CP 4 | Return if *Phase is not phase 4. | |||||||||
| 29166 | RET NZ | |||||||||||
Start by handling the final stage of the rotating blue strip.
|
||||||||||||
| 29167 | LD A,(HL) | Load the attribute value from the bullet attribute buffer address. | ||||||||||
| 29168 | CP 1 | Jump to MothershipRotatingStrip if the attribute value is not equal to BLUE. | ||||||||||
| 29170 | JR NZ,MothershipRotatingStrip | |||||||||||
|
This part of the ship is BLUE - so it's the rotating strip about to be destroyed (so destroy it).
|
||||||||||||
| 29172 | LD (HL),64 | Write INK:BLACK, PAPER:BLACK (BRIGHT) to the bullet/ rotating strip attribute pointer. | ||||||||||
| 29174 | JR MothershipHull_ClearUDG | Jump to MothershipHull_ClearUDG. | ||||||||||
|
Handle a first hit on the rotating blue strip.
|
||||||||||||
| MothershipRotatingStrip | 29176 | CP 15 | Jump to MothershipHull_Stage_02 if the attribute value is not equal to INK:WHITE, PAPER:BLUE. | |||||||||
| 29178 | 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.
|
||||||||||||
| 29180 | LD (HL),1 | Write BLUE to the bullet/ rotating strip attribute pointer. | ||||||||||
| 29182 | JR MothershipHull_DrawLargeDent | Jump to MothershipHull_DrawLargeDent. | ||||||||||
|
Handle the second stage of the hull being shot.
|
||||||||||||
| MothershipHull_Stage_02 | 29184 | CP 2 | Jump to MothershipHull_Stage_01 if the attribute value is not equal to RED. | |||||||||
| 29186 | JR NZ,MothershipHull_Stage_01 | |||||||||||
|
This part of the ship is RED so has been hit once already.
|
||||||||||||
| 29188 | PUSH HL | Stash the attribute buffer pointer on the stack. | ||||||||||
| 29189 | LD A,L | Move up one row in the attribute buffer (subtract 32). | ||||||||||
| 29190 | SUB 32 | |||||||||||
| 29192 | LD L,A | |||||||||||
| 29193 | LD A,(HL) | Load the attribute value from the new attribute buffer address. | ||||||||||
| 29194 | CP 16 | Jump to MothershipHull_ClearAttribute if the attribute value is not equal to INK:BLACK, PAPER:RED. | ||||||||||
| 29196 | JR NZ,MothershipHull_ClearAttribute | |||||||||||
| 29198 | LD H,77 | Set H to 77 (screen buffer). | ||||||||||
|
Draw the degraded hull partial sprite:
Note that the "move to the next UDG graphic data byte" moves backwards not forwards as you'd expect.
|
||||||||||||
| 29200 | LD B,3 | Set a line counter in B for 3 (this is a partial graphic from the larger Graphics_MothershipDegradedHull_01). | ||||||||||
| 29202 | LD DE,25071 | DE=Graphics_MothershipDegradedHull_02. | ||||||||||
| MothershipHull_DrawLoop | 29205 | LD A,(DE) | Copy the UDG data to the screen buffer. | |||||||||
| 29206 | LD (HL),A | |||||||||||
| 29207 | INC H | Move down one pixel line in the screen buffer. | ||||||||||
| 29208 | DEC DE | Move to the next UDG graphic data byte. | ||||||||||
| 29209 | DJNZ MothershipHull_DrawLoop | Decrease the line counter by one and loop back to MothershipHull_DrawLoop until all 3 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 | 29211 | POP HL | Restore the attribute buffer pointer from the stack. | |||||||||
| 29212 | LD (HL),0 | 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 | 29214 | LD DE,15616 | DE=15616. | |||||||||
| 29217 | JR MothershipHull_DrawUDG | Jump to MothershipHull_DrawUDG. | ||||||||||
|
Handle the first stage of the hull being shot.
|
||||||||||||
| MothershipHull_Stage_01 | 29219 | CP 16 | Jump to MothershipHull_IsAlienShot if the attribute value is not equal to INK:BLACK, PAPER:RED. | |||||||||
| 29221 | JR NZ,MothershipHull_IsAlienShot | |||||||||||
| 29223 | LD (HL),2 | Write RED to the bullet/ hull attribute pointer. | ||||||||||
|
Draw the degraded hull large sprite:
|
||||||||||||
| MothershipHull_DrawLargeDent | 29225 | LD DE,25067 | DE=Graphics_MothershipDegradedHull_01. | |||||||||
| MothershipHull_DrawUDG | 29228 | LD H,72 | Set H to 72 (screen buffer). | |||||||||
| 29230 | LD B,8 | Set a line counter in B (8 lines in a UDG). | ||||||||||
| MothershipHull_DrawUDG_Loop | 29232 | LD A,(DE) | Copy the UDG data to the screen buffer. | |||||||||
| 29233 | LD (HL),A | |||||||||||
| 29234 | INC DE | Move to the next UDG graphic data byte. | ||||||||||
| 29235 | INC H | Move down one pixel line in the screen buffer. | ||||||||||
| 29236 | DJNZ MothershipHull_DrawUDG_Loop | Decrease the line counter by one and loop back to MothershipHull_DrawUDG_Loop until all 8 lines of the UDG character have been drawn. | ||||||||||
|
Award 53 points for damaging the hull.
|
||||||||||||
| 29238 | LD A,53 | Write 53 to *25902. | ||||||||||
| 29240 | LD (25902),A | |||||||||||
| 29243 | CALL Handler_Score | Call Handler_Score. | ||||||||||
| 29246 | CALL PrintScore | Call PrintScore. | ||||||||||
| 29249 | CALL PrintLives | Call PrintLives. | ||||||||||
| 29252 | RET | Return. | ||||||||||
|
Handle checking if the mothership alien has been shot?
Is this empty space within the mothership graphic?
|
||||||||||||
| MothershipHull_IsAlienShot | 29253 | CP 64 | Return if the attribute value is not equal to INK:BLACK, PAPER:BLACK (BRIGHT). | |||||||||
| 29255 | RET NZ | |||||||||||
|
Check the attribute block above where the bullet is positioned.
|
||||||||||||
| 29256 | 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?
|
||||||||||||
| 29258 | LD A,(HL) | Return if the attribute value at the new position is not equal to INK:RED, PAPER:BLACK (BRIGHT). | ||||||||||
| 29259 | CP 66 | |||||||||||
| 29261 | RET NZ | |||||||||||
|
The bullet has hit the mothership alien.
|
||||||||||||
| 29262 | LD A,1 | Write 1 to *MothershipAlienState to mark that the mothership alien has been shot (and so phase 4 is now complete). | ||||||||||
| 29264 | LD (26323),A | |||||||||||
| 29267 | RET | Return. | ||||||||||
| Prev: 29017 | Up: Map | Next: 29268 |