![]() |
Routines |
| Prev: 36638 | Up: Map | Next: 36804 |
|
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 | 36692 | LD A,(IX+23) | Fetch the second set of flags of the object. | |||||
| 36695 | AND %11110000 | Keep the top four bits. | ||||||
| 36697 | RET NZ | Return if they are not zero. | ||||||
| 36698 | LD A,(IX+23) | Fetch the second set of flags again. | ||||||
| 36701 | ADD A,240 | Set the top four bits. | ||||||
| 36703 | LD (IX+23),A | Store them. | ||||||
| 36706 | LD A,(35183) | Fetch the flag from 35183. | ||||||
| 36709 | AND A | Test it. | ||||||
| 36710 | JR Z,DamageShip_Hit | Jump to DamageShip_Hit if it is zero. | ||||||
| 36712 | LD A,C | Fetch the collision effects. | ||||||
| 36713 | AND %11111110 | Clear bit 0. | ||||||
| 36715 | CP 80 | Jump to DamageShip_Hit if the remaining effects are not 80. | ||||||
| 36717 | JR NZ,DamageShip_Hit | |||||||
| 36719 | SET 5,(IX+16) | Set bit 5 of the flags of the object. | ||||||
| 36723 | CALL PlayHitSound | Play the explosion sound. | ||||||
|
This entry point is used by the routines at CheckBeamHit and CheckMapObjectCollisions.
|
||||||||
| DamageShip_Hit | 36726 | LD A,(35183) | Fetch the flag from 35183. | |||||
| 36729 | AND A | Test it. | ||||||
| 36730 | RET NZ | Return if it is set. | ||||||
| 36731 | LD A,(36691) | Fetch the explosion counter from 36691. | ||||||
| 36734 | AND A | Test it. | ||||||
| 36735 | RET NZ | Return if the ship is exploding. | ||||||
| 36736 | CALL PlayHitSound | Play the explosion sound. | ||||||
| 36739 | LD A,(36803) | Fetch the damage counter from 36803. | ||||||
| 36742 | INC A | Add one and store it. | ||||||
| 36743 | LD (36803),A | |||||||
| 36746 | PUSH BC | Stash BC on the stack. | ||||||
| 36747 | LD B,71 | Use bright white for the first hit... | ||||||
| 36749 | AND A | Test the counter. | ||||||
| 36750 | JR Z,DamageShip_Colour | Jump to DamageShip_Colour if it is zero. | ||||||
| 36752 | LD B,70 | Use bright yellow for the second hit... | ||||||
| 36754 | CP 1 | Jump to DamageShip_Colour if the counter is one. | ||||||
| 36756 | JR Z,DamageShip_Colour | |||||||
| 36758 | LD B,67 | Otherwise use bright magenta. | ||||||
| DamageShip_Colour | 36760 | CP 3 | Jump to DamageShip_Indicator if the counter is not three. | |||||
| 36762 | JR NZ,DamageShip_Indicator | |||||||
| 36764 | LD A,1 | Set the explosion counter to one. | ||||||
| 36766 | LD (36691),A | |||||||
| 36769 | LD B,0 | Use black for the damage indicator. | ||||||
| DamageShip_Indicator | 36771 | LD A,B | Store the attribute in the data at DamageShip_Attribute. | |||||
| 36772 | LD (36801),A | |||||||
| 36775 | LD HL,3888 | Set the position of the damage indicator. | ||||||
| 36778 | LD A,(51740) | Fetch the flag from 51740. | ||||||
| 36781 | AND A | Test it. | ||||||
| 36782 | JR Z,DamageShip_Draw | Jump to DamageShip_Draw if it is zero. | ||||||
| 36784 | LD HL,4016 | Move the damage indicator. | ||||||
| DamageShip_Draw | 36787 | LD DE,36799 | Use the data at DamageShip_Attribute. | |||||
| 36790 | CALL FillAttributes | Draw the damage indicator. | ||||||
| 36793 | POP BC | Bring BC back off the stack. | ||||||
| 36794 | RET | Return. | ||||||
| 36795 | DEFB 48,15,176,15 | |||||||
| DamageShip_Attribute | 36799 | DEFB 4,2,0,201,0 | ||||||
| Prev: 36638 | Up: Map | Next: 36804 |