![]() |
Routines |
| Prev: B414 | Up: Map | Next: B5AF |
|
Used by the routine at update_shots.
Called for each laser (and special beam) in flight (update_shots). A laser is a line one pixel high, drawn on the screen and coloured a cell high, which grows out of the ship's nose: its head 16 pixels a pass and its tail 8, its length (+E, in cells) one more each pass. A probe moves through the world 16 pixels a pass ahead of the ship (probe_laser, the record's +7 being the ship's speed plus 16); when it meets the landscape, or the head reaches the play area's edge (x $B8 for the left end of a beam going right), the head stops (+10 bit 7). The pattern's offset (+F) then counts down to 0, after which the tail catches up (bit 6) a cell a pass until the beam has gone. While stopped the beam is moved by the scroll, so it stays on what it hit. The attackers are checked against it in test_player_shots.
On its first pass (+E 0) the line is set: the ship's shot line (ship_line) less this pass's climb, plus a random -1, 0 or +1, and a random colour (random_beam_colour), and the record's world position is moved by that. Going left is update_left_shot; both end in draw_shot, which draws the beam and frees the record when it has gone.
piece_step_x is set to $80 for collide_with_landscape: a shot stops at the first box of landscape it touches.
|
||||||||
| update_shot | B483 | LD A,(ship_dx) | the probe moves with the ship; piece_step_x = $80, a shot | |||||
| B486 | LD (IX+$07),A | |||||||
| B489 | LD A,$80 | |||||||
| B48B | LD (piece_step_x),A | |||||||
| B48E | BIT 7,(IX+$15) | the special beam: update_special_beam | ||||||
| B492 | JP NZ,update_special_beam | |||||||
| B495 | LD A,$01 | a laser is one line high, drawn and rubbed out | ||||||
| B497 | LD (old_sprite_rows),A | |||||||
| B49A | LD (new_sprite_rows),A | |||||||
| B49D | LD A,(IX+$0E) | not its first pass | ||||||
| B4A0 | AND A | |||||||
| B4A1 | JR NZ,update_shot_0 | |||||||
| B4A3 | LD (IX+$10),$00 | its first: no flags, no speed; the line, shaken by one; a colour; move the record to it | ||||||
| B4A7 | LD (IX+$07),$00 | |||||||
| B4AB | CALL random_jitter | |||||||
| B4AE | LD A,(scroll_down) | |||||||
| B4B1 | NEG | |||||||
| B4B3 | ADD A,B | |||||||
| B4B4 | LD (IX+$09),B | |||||||
| B4B7 | LD B,A | |||||||
| B4B8 | LD A,(ship_line) | |||||||
| B4BB | ADD A,B | |||||||
| B4BC | LD (IX+$0C),A | |||||||
| B4BF | CALL random_beam_colour | |||||||
| B4C2 | CALL move_object | |||||||
| B4C5 | LD (IX+$09),$00 | |||||||
| update_shot_0 | B4C9 | BIT 7,(IX+$00) | going left: update_left_shot | |||||
| B4CD | JP NZ,update_left_shot | |||||||
| B4D0 | LD DE,laser_pattern_right | last pass's pattern, screen address and width into the alternate set | ||||||
| B4D3 | CALL beam_pattern | |||||||
| B4D6 | CALL record_screen_address | |||||||
| B4D9 | LD B,(IX+$0E) | |||||||
| B4DC | EXX | |||||||
| B4DD | BIT 7,(IX+$10) | the head has stopped | ||||||
| B4E1 | JR NZ,update_shot_4 | |||||||
| B4E3 | LD A,(IX+$0E) | first pass: the pattern's offset 8; the left end at x $88 | ||||||
| B4E6 | AND A | |||||||
| B4E7 | JR NZ,update_shot_1 | |||||||
| B4E9 | LD (IX+$0F),$08 | |||||||
| B4ED | LD (IX+$0B),$88 | |||||||
| update_shot_1 | B4F1 | LD A,$10 | the probe 16 pixels ahead | |||||
| B4F3 | ADD A,(IX+$07) | |||||||
| B4F6 | LD (IX+$07),A | |||||||
| B4F9 | CALL probe_laser | in the landscape (probe_laser)? | ||||||
| B4FC | JR Z,update_shot_2 | |||||||
| B4FE | LD A,$F0 | yes: the probe back; the head stops, a hit | ||||||
| B500 | ADD A,(IX+$07) | |||||||
| B503 | LD (IX+$07),A | |||||||
| B506 | SET 7,(IX+$10) | |||||||
| B50A | SET 5,(IX+$10) | |||||||
| B50E | JP update_shot_9 | |||||||
| update_shot_2 | B511 | LD A,$08 | the left end 8 on; at $B8 the head is at the edge | |||||
| B513 | ADD A,(IX+$0B) | |||||||
| B516 | LD (IX+$0B),A | |||||||
| B519 | CP $B8 | |||||||
| B51B | JR NZ,update_shot_3 | |||||||
| B51D | SET 7,(IX+$10) | |||||||
| update_shot_3 | B521 | LD A,(IX+$0E) | a cell longer, the pattern's offset one less; draw it | |||||
| B524 | INC A | |||||||
| B525 | LD (IX+$0E),A | |||||||
| B528 | LD A,(IX+$0F) | |||||||
| B52B | DEC A | |||||||
| B52C | LD (IX+$0F),A | |||||||
| B52F | JP update_shot_10 | |||||||
| update_shot_4 | B532 | BIT 5,(IX+$10) | stopped: probe again until it hits | |||||
| B536 | JR NZ,update_shot_5 | |||||||
| B538 | CALL probe_laser | |||||||
| B53B | JR Z,update_shot_8 | |||||||
| B53D | SET 5,(IX+$10) | |||||||
| update_shot_5 | B541 | LD A,(IX+$07) | follow the scroll across; no more probing speed | |||||
| B544 | NEG | |||||||
| B546 | ADD A,(IX+$0B) | |||||||
| B549 | LD (IX+$0B),A | |||||||
| B54C | LD (IX+$07),$00 | |||||||
| B550 | BIT 6,(IX+$10) | the right end past the edge at $E4-$EF: a cell shorter; past $F0 (off the screen): gone | ||||||
| B554 | LD B,(IX+$0E) | |||||||
| B557 | LD C,(IX+$0B) | |||||||
| B55A | JR Z,update_shot_6 | |||||||
| B55C | DEC B | |||||||
| B55D | LD A,C | |||||||
| B55E | ADD A,$08 | |||||||
| B560 | LD C,A | |||||||
| update_shot_6 | B561 | SLA B | ||||||
| B563 | SLA B | |||||||
| B565 | SLA B | |||||||
| B567 | LD A,B | |||||||
| B568 | ADD A,C | |||||||
| B569 | AND $F8 | |||||||
| B56B | CP $E4 | |||||||
| B56D | JR C,update_shot_8 | |||||||
| B56F | CP $F0 | |||||||
| B571 | JR C,update_shot_7 | |||||||
| B573 | LD (IX+$0E),$00 | |||||||
| update_shot_7 | B577 | LD A,(IX+$0E) | a cell shorter at the right | |||||
| B57A | DEC A | |||||||
| B57B | LD (IX+$0E),A | |||||||
| B57E | LD A,(IX+$0B) | |||||||
| B581 | SUB $08 | |||||||
| B583 | LD (IX+$0B),A | |||||||
| update_shot_8 | B586 | BIT 6,(IX+$10) | the tail catching up: a cell shorter, the left end 8 on | |||||
| B58A | JR Z,update_shot_9 | |||||||
| B58C | LD A,(IX+$0E) | |||||||
| B58F | DEC A | |||||||
| B590 | LD (IX+$0E),A | |||||||
| B593 | LD A,(IX+$0B) | |||||||
| B596 | ADD A,$08 | |||||||
| B598 | LD (IX+$0B),A | |||||||
| B59B | JR update_shot_10 | |||||||
| update_shot_9 | B59D | LD A,(IX+$0F) | the pattern's offset down to 0: then the tail starts | |||||
| B5A0 | DEC A | |||||||
| B5A1 | LD (IX+$0F),A | |||||||
| B5A4 | JR NZ,update_shot_10 | |||||||
| B5A6 | SET 6,(IX+$10) | |||||||
| update_shot_10 | B5AA | LD DE,laser_pattern_right | the right-going pattern; draw it | |||||
| B5AD | JR draw_shot_0 | |||||||
| Prev: B414 | Up: Map | Next: B5AF |