![]() |
Routines |
| Prev: 8F1E | Up: Map | Next: 8FC4 |
|
Used by the routine at ApplyCollisionEffects.
Damages the player's ship. A ship that has just been hit cannot be hit again for a few frames. Each hit changes the colour of the damage indicator, and the third hit destroys the ship.
|
||||||||
| DamageShip | 8F54 | LD A,(IX+$17) | Fetch the second set of flags of the object. | |||||
| 8F57 | AND %11110000 | Keep the top four bits. | ||||||
| 8F59 | RET NZ | Return if they are not zero. | ||||||
| 8F5A | LD A,(IX+$17) | Fetch the second set of flags again. | ||||||
| 8F5D | ADD A,$F0 | Set the top four bits. | ||||||
| 8F5F | LD (IX+$17),A | Store them. | ||||||
| 8F62 | LD A,($896F) | Fetch the flag from 896F. | ||||||
| 8F65 | AND A | Test it. | ||||||
| 8F66 | JR Z,DamageShip_Hit | Jump to DamageShip_Hit if it is zero. | ||||||
| 8F68 | LD A,C | Fetch the collision effects. | ||||||
| 8F69 | AND %11111110 | Clear bit 0. | ||||||
| 8F6B | CP $50 | Jump to DamageShip_Hit if the remaining effects are not 50. | ||||||
| 8F6D | JR NZ,DamageShip_Hit | |||||||
| 8F6F | SET 5,(IX+$10) | Set bit 5 of the flags of the object. | ||||||
| 8F73 | CALL PlayHitSound | Play the explosion sound. | ||||||
|
This entry point is used by the routines at CheckBeamHit and CheckMapObjectCollisions.
|
||||||||
| DamageShip_Hit | 8F76 | LD A,($896F) | Fetch the flag from 896F. | |||||
| 8F79 | AND A | Test it. | ||||||
| 8F7A | RET NZ | Return if it is set. | ||||||
| 8F7B | LD A,($8F53) | Fetch the explosion counter from 8F53. | ||||||
| 8F7E | AND A | Test it. | ||||||
| 8F7F | RET NZ | Return if the ship is exploding. | ||||||
| 8F80 | CALL PlayHitSound | Play the explosion sound. | ||||||
| 8F83 | LD A,($8FC3) | Fetch the damage counter from 8FC3. | ||||||
| 8F86 | INC A | Add one and store it. | ||||||
| 8F87 | LD ($8FC3),A | |||||||
| 8F8A | PUSH BC | Stash BC on the stack. | ||||||
| 8F8B | LD B,$47 | Use bright white for the first hit... | ||||||
| 8F8D | AND A | Test the counter. | ||||||
| 8F8E | JR Z,DamageShip_Colour | Jump to DamageShip_Colour if it is zero. | ||||||
| 8F90 | LD B,$46 | Use bright yellow for the second hit... | ||||||
| 8F92 | CP $01 | Jump to DamageShip_Colour if the counter is one. | ||||||
| 8F94 | JR Z,DamageShip_Colour | |||||||
| 8F96 | LD B,$43 | Otherwise use bright magenta. | ||||||
| DamageShip_Colour | 8F98 | CP $03 | Jump to DamageShip_Indicator if the counter is not three. | |||||
| 8F9A | JR NZ,DamageShip_Indicator | |||||||
| 8F9C | LD A,$01 | Set the explosion counter to one. | ||||||
| 8F9E | LD ($8F53),A | |||||||
| 8FA1 | LD B,$00 | Use black for the damage indicator. | ||||||
| DamageShip_Indicator | 8FA3 | LD A,B | Store the attribute in the data at DamageShip_Attribute. | |||||
| 8FA4 | LD ($8FC1),A | |||||||
| 8FA7 | LD HL,$0F30 | Set the position of the damage indicator. | ||||||
| 8FAA | LD A,($CA1C) | Fetch the flag from CA1C. | ||||||
| 8FAD | AND A | Test it. | ||||||
| 8FAE | JR Z,DamageShip_Draw | Jump to DamageShip_Draw if it is zero. | ||||||
| 8FB0 | LD HL,$0FB0 | Move the damage indicator. | ||||||
| DamageShip_Draw | 8FB3 | LD DE,$8FBF | Use the data at DamageShip_Attribute. | |||||
| 8FB6 | CALL FillAttributes | Draw the damage indicator. | ||||||
| 8FB9 | POP BC | Bring BC back off the stack. | ||||||
| 8FBA | RET | Return. | ||||||
| 8FBB | DEFB $30,$0F,$B0,$0F | |||||||
| DamageShip_Attribute | 8FBF | DEFB $04,$02,$00,$C9,$00 | ||||||
| Prev: 8F1E | Up: Map | Next: 8FC4 |