![]() |
Routines |
| Prev: 8D3D | Up: Map | Next: 8E21 |
|
Used by the routine at play.
Called from the play loop (play) once a pass, and the most expensive thing in it: for each of the nine records at object_records that is not free it rubs out last pass's picture, runs the type's update routine through run_sky_object_handler (which moves, animates and redraws it), tests it against the ship (ship_contact) and against the player's shots (test_player_shots). It also keeps the death byte (death_count) counting, and at the end starts a new cloud or attacker when the load (object_load) is light.
The load is the throttle on spawning: one for every record in use, one more for each that was on the screen last pass, one more for a big cloud, and half the number of rocket parts delivered (rocket_parts_load), since draw_rocket draws those in the same pass. Below 4 this routine spawns; spawn_tick stops at 8 and find_free_record at 7.
|
||||
| update_objects | 8D42 | LD A,(death_count) | Count the death byte up once a pass while it is not zero | |
| 8D45 | AND A | |||
| 8D46 | JR Z,update_objects_0 | |||
| 8D48 | INC A | |||
| 8D49 | LD (death_count),A | |||
| update_objects_0 | 8D4C | CP $0A | At 10 the ship breaks up into nine pieces (wreck_ship) | |
| 8D4E | CALL Z,wreck_ship | |||
| 8D51 | LD A,(death_count) | From 10 on, the death sound (sound_death) | ||
| 8D54 | CP $0A | |||
| 8D56 | CALL NC,sound_death | |||
| 8D59 | LD A,(fuel_saver) | Keep last pass's contact flag (last_pass_contact) and clear it for this pass | ||
| 8D5C | LD (last_pass_contact),A | |||
| 8D5F | XOR A | |||
| 8D60 | LD (object_load),A | |||
| 8D63 | LD (fuel_saver),A | |||
| 8D66 | LD A,(rocket_parts_load) | The load starts at the rocket parts' share (rocket_parts_load) | ||
| 8D69 | LD (object_load),A | |||
| 8D6C | LD IX,object_records | Nine records | ||
| 8D70 | LD B,$09 | |||
| update_objects_1 | 8D72 | PUSH BC | A free record (type $FF) is skipped (skip_free_record) | |
| 8D73 | PUSH IX | |||
| 8D75 | LD A,(IX+$00) | |||
| 8D78 | INC A | |||
| 8D79 | JP Z,skip_free_record | |||
| 8D7C | LD A,(IX+$17) | Count the contact cool-down in the high nibble of +$17 down by one | ||
| 8D7F | AND $F0 | |||
| 8D81 | JR Z,update_objects_2 | |||
| 8D83 | SUB $10 | |||
| 8D85 | LD B,A | |||
| 8D86 | LD A,(IX+$17) | |||
| 8D89 | AND $0F | |||
| 8D8B | OR B | |||
| 8D8C | LD (IX+$17),A | |||
| update_objects_2 | 8D8F | LD A,(death_count) | While the ship is beginning to die (death byte 1-3) every object explodes | |
| 8D92 | AND A | |||
| 8D93 | JR Z,update_objects_3 | |||
| 8D95 | CP $04 | |||
| 8D97 | JR NC,update_objects_3 | |||
| 8D99 | SET 3,(IX+$17) | |||
| update_objects_3 | 8D9D | LD A,$50 | The default contact effect: damage and push ($50, see ship_contact) | |
| 8D9F | LD (contact_effect),A | |||
| 8DA2 | LD A,(object_load) | Count the record in the load | ||
| 8DA5 | INC A | |||
| 8DA6 | LD (object_load),A | |||
| 8DA9 | CALL clear_sprite_pair | No sprite sizes yet this pass (clear_sprite_pair) | ||
| 8DAC | BIT 7,(IX+$10) | Drawn last pass: count it again and rub it out (count_and_erase) | ||
| 8DB0 | CALL NZ,count_and_erase | |||
| 8DB3 | RES 6,(IX+$10) | Clear the straddling flag; placing it sets it again | ||
| 8DB7 | EXX | The update routines run in the other register set | ||
| 8DB8 | CALL run_sky_object_handler | The type's update routine (run_sky_object_handler) | ||
| 8DBB | CALL ship_contact | Contact with the ship (ship_contact) | ||
| 8DBE | POP IX | Clouds (type $13), type $1D and type $1C... | ||
| 8DC0 | LD A,(IX+$00) | |||
| 8DC3 | CP $13 | |||
| 8DC5 | JR Z,update_objects_5 | |||
| 8DC7 | CP $1C | |||
| 8DC9 | JR Z,update_objects_4 | |||
| 8DCB | CP $1D | |||
| 8DCD | JR Z,update_objects_5 | |||
| 8DCF | JR update_objects_6 | |||
| update_objects_4 | 8DD1 | LD A,(IX+$14) | ...but not a piece of the ship's wreck (+$14 = 2)... | |
| 8DD4 | CP $02 | |||
| 8DD6 | JR Z,update_objects_6 | |||
| update_objects_5 | 8DD8 | LD A,(old_sprite_rows) | ...are freed once they have left the view: drawn last pass and not this one (the two heights in old_sprite_x) | |
| 8DDB | AND A | |||
| 8DDC | JR Z,update_objects_6 | |||
| 8DDE | LD A,(new_sprite_rows) | |||
| 8DE1 | AND A | |||
| 8DE2 | JR NZ,update_objects_6 | |||
| 8DE4 | LD (IX+$00),$FF | |||
| update_objects_6 | 8DE8 | BIT 5,(IX+$10) | Shot already, or exploding: no shot test | |
| 8DEC | JR NZ,next_object | |||
| 8DEE | BIT 3,(IX+$17) | |||
| 8DF2 | JR NZ,next_object | |||
| 8DF4 | CALL object_box | Its box (object_box) against the player's shots (test_player_shots) | ||
| 8DF7 | CALL test_player_shots | |||
|
This entry point is used by the routine at skip_free_record.
|
||||
| next_object | 8DFA | LD BC,$0018 | Next record | |
| 8DFD | ADD IX,BC | |||
| 8DFF | POP BC | |||
| 8E00 | DEC B | |||
| 8E01 | JP NZ,update_objects_1 | |||
| 8E04 | LD A,(object_load) | A load of 4 or more: nothing new this pass | ||
| 8E07 | CP $04 | |||
| 8E09 | RET NC | |||
| 8E0A | LD A,R | Half the time, while the view is in page rows 3-10, a cloud (spawn_cloud, which makes one only in rows 3-9) | ||
| 8E0C | AND $08 | |||
| 8E0E | JR Z,update_objects_7 | |||
| 8E10 | LD A,(view_row) | |||
| 8E13 | CP $0B | |||
| 8E15 | JR NC,update_objects_7 | |||
| 8E17 | CP $03 | |||
| 8E19 | JR C,update_objects_7 | |||
| 8E1B | JP spawn_cloud | |||
| update_objects_7 | 8E1E | JP spawn_attacker | Otherwise an attacker from the wave table (the entry point in spawn_tick) | |
| Prev: 8D3D | Up: Map | Next: 8E21 |