![]() |
Routines |
| Prev: 955F | Up: Map | Next: 96AB |
|
Used by the routine at update_ground_objects.
Called by update_ground_objects. The rocket is built at a fixed place, page column $52 and row 10, from up to eight parts brought there by the ship (drop_part, update_rocket_part). Each pass the view is near it (columns $51-$52, rows 9-10) -- or the rocket is launching -- every part delivered is drawn from the one record rocket_record: the base position (rocket_x, rocket_y) plus the part's offset from rocket_part_table, frame the part's number (part 6 uses frame 8). The part's flags and drawn position are kept in its entry of the table between passes, so its old picture can be rubbed out. Half the parts' number counts in the load (rocket_parts_load).
When all eight are there and the ship stops in place in the rocket (column $52 pixel $5C, row 10, line $63 or below), the launch starts: launch_state is set, the ship is put away (two routines inside draw_ship, run with the death byte at 10 for their sake), and from then on the base moves up each pass (at the view's vertical scroll speed (scroll_down), or 4 lines a pass in page row 0), with the launch sound (sound_launch). Once part 0 has left the screen launch_state is set to $FF, which ends the play loop (play) in the game's end sequence.
It all ran in the build's sessions: the launch, and the deliveries of part 0 and of the ore tank. In the staged launch the rocket kept its place on the screen while the view climbed from page row 10 to row 0, its base moving up by the view's own scroll, and then rose 4 lines a pass off the top; the launch took about 390 passes (run in SkoolKit's simulator for the Animations page).
|
||||
| draw_rocket | 9572 | XOR A | No share in the load yet | |
| 9573 | LD (rocket_parts_load),A | |||
| 9576 | LD A,(launch_state) | Launching: draw | ||
| 9579 | AND A | |||
| 957A | JR NZ,draw_rocket_1 | |||
| 957C | LD HL,(view_column) | Otherwise only with the rocket's place in view | ||
| 957F | LD A,L | |||
| 9580 | CP $51 | |||
| 9582 | JR Z,draw_rocket_0 | |||
| 9584 | CP $52 | |||
| 9586 | RET NZ | |||
| draw_rocket_0 | 9587 | LD A,H | ||
| 9588 | CP $09 | |||
| 958A | JR Z,draw_rocket_1 | |||
| 958C | CP $0A | |||
| 958E | RET NZ | |||
| draw_rocket_1 | 958F | LD A,(parts_built) | No parts: nothing; half their number counts in the load | |
| 9592 | AND A | |||
| 9593 | RET Z | |||
| 9594 | INC A | |||
| 9595 | SRL A | |||
| 9597 | LD (rocket_parts_load),A | |||
| 959A | LD IX,rocket_record | The drawing record; part 0 first | ||
| 959E | LD (IX+$13),$00 | |||
| 95A2 | LD A,(launch_state) | |||
| 95A5 | AND A | |||
| 95A6 | JR Z,draw_rocket_3 | |||
| 95A8 | LD A,(pass_counter) | Launching: the sound | ||
| 95AB | AND $03 | |||
| 95AD | CALL sound_launch | |||
| 95B0 | CALL put_rocket_record | Move the base up with the view, or by 4 at the top | ||
| 95B3 | LD A,(scroll_down) | |||
| 95B6 | NEG | |||
| 95B8 | LD (IX+$09),A | |||
| 95BB | LD A,(view_row) | |||
| 95BE | AND A | |||
| 95BF | JR NZ,draw_rocket_2 | |||
| 95C1 | LD (IX+$09),$FC | |||
| draw_rocket_2 | 95C5 | CALL move_object | ||
| 95C8 | LD L,(IX+$02) | Keep the base | ||
| 95CB | LD H,(IX+$01) | |||
| 95CE | LD (rocket_x),HL | |||
| 95D1 | LD L,(IX+$05) | |||
| 95D4 | LD H,(IX+$04) | |||
| 95D7 | LD (rocket_y),HL | |||
| draw_rocket_3 | 95DA | CALL put_rocket_record | Each part: the base... | |
| 95DD | LD A,(IX+$13) | ...its flags and drawn position from the table... | ||
| 95E0 | LD B,A | |||
| 95E1 | ADD A,A | |||
| 95E2 | ADD A,A | |||
| 95E3 | ADD A,B | |||
| 95E4 | LD HL,rocket_part_table | |||
| 95E7 | CALL add_a_to_hl | |||
| 95EA | LD DE,rocket_record_flags | |||
| 95ED | LD BC,$0003 | |||
| 95F0 | LDIR | |||
| 95F2 | LD A,(HL) | ...plus its offset | ||
| 95F3 | LD (IX+$07),A | |||
| 95F6 | INC HL | |||
| 95F7 | LD A,(HL) | |||
| 95F8 | LD (IX+$09),A | |||
| 95FB | CALL move_object | |||
| 95FE | LD (IX+$07),$00 | |||
| 9602 | LD (IX+$09),$00 | |||
| 9606 | LD A,(IX+$13) | Part 6 is drawn with frame 8 | ||
| 9609 | CP $06 | |||
| 960B | JR NZ,draw_rocket_4 | |||
| 960D | LD (IX+$13),$08 | |||
| draw_rocket_4 | 9611 | CALL clear_sprite_pair | Rub out its old picture | |
| 9614 | BIT 7,(IX+$10) | |||
| 9618 | CALL NZ,prepare_erase | |||
| 961B | RES 6,(IX+$10) | |||
| 961F | EXX | |||
| 9620 | CALL place_object | Place, draw and colour it | ||
| 9623 | CALL draw_object_images | |||
| 9626 | CALL colour_sprite | |||
| 9629 | LD IX,rocket_record | Its flags and drawn position back to the table | ||
| 962D | LD A,(IX+$13) | |||
| 9630 | CP $08 | |||
| 9632 | JR NZ,draw_rocket_5 | |||
| 9634 | LD A,$06 | |||
| 9636 | LD (IX+$13),A | |||
| draw_rocket_5 | 9639 | LD B,A | ||
| 963A | ADD A,A | |||
| 963B | ADD A,A | |||
| 963C | ADD A,B | |||
| 963D | LD HL,rocket_part_table | |||
| 9640 | CALL add_a_to_hl | |||
| 9643 | LD DE,rocket_record_flags | |||
| 9646 | EX DE,HL | |||
| 9647 | LD BC,$0003 | |||
| 964A | LDIR | |||
| 964C | INC (IX+$13) | Next part | ||
| 964F | LD A,(parts_built) | |||
| 9652 | CP (IX+$13) | |||
| 9655 | JP NZ,draw_rocket_3 | |||
| 9658 | LD A,(parts_built) | All eight? | ||
| 965B | CP $08 | |||
| 965D | RET NZ | |||
| 965E | LD A,(launch_state) | Launching... | ||
| 9661 | AND A | |||
| 9662 | JR Z,draw_rocket_6 | |||
| 9664 | CALL lift_jet | ...until part 0 is off the screen: then the game's end | ||
| 9667 | LD A,(rocket_part_table) | |||
| 966A | AND $80 | |||
| 966C | RET NZ | |||
| 966D | DEC A | |||
| 966E | LD (launch_state),A | |||
| 9671 | RET | |||
| draw_rocket_6 | 9672 | LD HL,(view_page_column) | The ship in place in the rocket? | |
| 9675 | LD A,L | |||
| 9676 | CP $52 | |||
| 9678 | RET NZ | |||
| 9679 | LD A,H | |||
| 967A | CP $5C | |||
| 967C | RET NZ | |||
| 967D | LD HL,(view_page_row) | |||
| 9680 | LD A,L | |||
| 9681 | CP $0A | |||
| 9683 | RET NZ | |||
| 9684 | LD A,H | |||
| 9685 | CP $63 | |||
| 9687 | RET C | |||
| 9688 | LD (launch_state),A | The launch begins; the death byte 10 for the next two calls | ||
| 968B | LD A,$0A | |||
| 968D | LD (death_count),A | |||
| 9690 | CALL draw_ship_image | Put the ship away | ||
| 9693 | CALL draw_trail | |||
| 9696 | XOR A | The death byte back to 0; the carried thing's state $80 (carried_part); the ship's X velocity 0; a sound | ||
| 9697 | LD (death_count),A | |||
| 969A | LD A,$80 | |||
| 969C | LD (carried_part_redraw),A | |||
| 969F | CALL carried_part | |||
| 96A2 | LD HL,$0000 | |||
| 96A5 | LD (ship_across_speed),HL | |||
| 96A8 | JP sound_zap | |||
| Prev: 955F | Up: Map | Next: 96AB |