![]() |
Routines |
| Prev: 8F53 | Up: Map | Next: 8FBB |
|
Used by the routine at ship_contact.
The attackers' effect. An object damages the ship at most once every 16 passes: it sets the cool-down in the high nibble of its +$17 to 15 (update_objects counts it down) and does nothing while it is not zero. With the shield up (shield_timer) an ordinary attacker (effect $50 or $51) is destroyed instead, with a sound.
damage_ship (the entry point at the middle of this routine), reached also from a beam (beam_hits_ship) and from ship_hits_ground_objects, does nothing with the shield up or while the ship is already dying. Otherwise it counts the hit (the last byte of ship_icon_positions) and recolours the ship icon on the panel: yellow ($46) after the first hit, magenta ($43) after the second, and black after the third, which sets the death byte (death_count) to 1. It is also the repair: a refuel pad (ship_hits_ground_objects) sets the count to $FF first, so it wraps to 0 and the icon goes back to white ($47). The icon is a 4 by 2 character patch (ship_icon_positions) at x=$30 for player 1 and x=$B0 for player 2 (the player number is in player_in_play), painted by fill_attributes.
|
||||||||||
| contact_damage | 8F54 | LD A,(IX+$17) | Still cooling down from the last touch | |||||||
| 8F57 | AND $F0 | |||||||||
| 8F59 | RET NZ | |||||||||
| 8F5A | LD A,(IX+$17) | Cool-down 15 | ||||||||
| 8F5D | ADD A,$F0 | |||||||||
| 8F5F | LD (IX+$17),A | |||||||||
| 8F62 | LD A,(shield_timer) | No shield: damage | ||||||||
| 8F65 | AND A | |||||||||
| 8F66 | JR Z,damage_ship | |||||||||
| 8F68 | LD A,C | Shielded, and an ordinary attacker: it is shot instead | ||||||||
| 8F69 | AND $FE | |||||||||
| 8F6B | CP $50 | |||||||||
| 8F6D | JR NZ,damage_ship | |||||||||
| 8F6F | SET 5,(IX+$10) | |||||||||
| 8F73 | CALL sound_zap | |||||||||
|
This entry point is used by the routines at beam_hits_ship and ship_hits_ground_objects.
|
||||||||||
| damage_ship | 8F76 | LD A,(shield_timer) | No damage with the shield up, or while dying | |||||||
| 8F79 | AND A | |||||||||
| 8F7A | RET NZ | |||||||||
| 8F7B | LD A,(death_count) | |||||||||
| 8F7E | AND A | |||||||||
| 8F7F | RET NZ | |||||||||
| 8F80 | CALL sound_zap | A sound, and one more hit | ||||||||
| 8F83 | LD A,(hit_count) | |||||||||
| 8F86 | INC A | |||||||||
| 8F87 | LD (hit_count),A | |||||||||
| 8F8A | PUSH BC | White after a repair (count 0), yellow after one hit, magenta after two | ||||||||
| 8F8B | LD B,$47 | |||||||||
| 8F8D | AND A | |||||||||
| 8F8E | JR Z,contact_damage_0 | |||||||||
| 8F90 | LD B,$46 | |||||||||
| 8F92 | CP $01 | |||||||||
| 8F94 | JR Z,contact_damage_0 | |||||||||
| 8F96 | LD B,$43 | |||||||||
| contact_damage_0 | 8F98 | CP $03 | The third: the ship dies, and the icon goes black | |||||||
| 8F9A | JR NZ,contact_damage_1 | |||||||||
| 8F9C | LD A,$01 | |||||||||
| 8F9E | LD (death_count),A | |||||||||
| 8FA1 | LD B,$00 | |||||||||
| contact_damage_1 | 8FA3 | LD A,B | The patch's colour | |||||||
| 8FA4 | LD ($8FC1),A | |||||||||
| 8FA7 | LD HL,$0F30 | Paint it over this player's ship icon | ||||||||
| 8FAA | LD A,(player_in_play) | |||||||||
| 8FAD | AND A | |||||||||
| 8FAE | JR Z,contact_damage_2 | |||||||||
| 8FB0 | LD HL,$0FB0 | |||||||||
| contact_damage_2 | 8FB3 | LD DE,icon_patch_record | ||||||||
| 8FB6 | CALL fill_attributes | |||||||||
| 8FB9 | POP BC | |||||||||
| 8FBA | RET | |||||||||
| Prev: 8F53 | Up: Map | Next: 8FBB |