Prev: B403 Up: Map Next: B483
B414: Update the special beam
Used by the routine at update_shot.
The special beam (record +15 bit 7) is fired by the special key with add-on 7 while the ship is still (special_beam_key), and the ship hangs still while it lasts. It is a band 5 to 8 lines high (beam_frames's frames, cycling 0, 1, 2, 3, 2, 1 a pass) that grows a cell every other pass up to 8 cells, its probe 8 pixels further each time (+12), stops growing when the probe meets the landscape (probe_special_beam), and after 22 passes ($16 in +11), or when the key is let go (end_special_beam), shrinks a cell a pass until gone. Going left, its left end moves out as it grows. A sound every pass (sound_flutter).
Drawing as for a laser (draw_shot), but the pattern for rubbing out is last pass's frame expanded into the sprite buffer at the end of build_shifted_pieces (old_beam_frame), and the new one into sprite_buffer_two (new_beam_frame); the beam is coloured bright magenta. When it has gone the ship is free again (special_beam_on).
It ran in the build's every-add-on session, but only going right and never with the probe in the landscape: the left end's moves going left and the probe's return to the ship are read only. Fired with the ship on the ground, the probe is in the landscape at once: the cell the beam has just grown is taken off again, its length is back to 0, and draw_shot frees the record that same pass, so the beam shows only in the air (run in SkoolKit's simulator for the Animations page).
Input
IX the shot's record
update_special_beam B414 LD A,(IX+$0E) a buzz while it is out
B417 AND A
B418 CALL NZ,sound_flutter
B41B INC (IX+$11) age it
B41E CALL old_beam_frame last pass's frame for rubbing out; its screen address and width into the alternate set
B421 CALL record_screen_address
B424 LD B,(IX+$0E)
B427 EXX
B428 BIT 7,(IX+$10) stopped: shrink
B42C JR NZ,update_special_beam_1
B42E BIT 0,(IX+$11) grow only every other pass
B432 JR Z,update_special_beam_2
B434 LD A,(IX+$12) move the probe a step out
B437 ADD A,(IX+$07)
B43A LD (IX+$07),A
B43D LD A,(IX+$0E) at most 8 cells
B440 CP $08
B442 JR Z,update_special_beam_0
B444 INC (IX+$0E) a cell longer; going left, the left end a cell further out
B447 BIT 7,(IX+$00)
B44B JR Z,update_special_beam_0
B44D LD A,$F8
B44F ADD A,(IX+$0B)
B452 LD (IX+$0B),A
update_special_beam_0 B455 CALL probe_special_beam the probe in the landscape (probe_special_beam)?
B458 JR Z,update_special_beam_2
B45A LD A,(ship_dx) yes: the probe moves with the ship again
B45D LD (IX+$07),A
update_special_beam_1 B460 DEC (IX+$0E) a cell shorter; going left, the left end a cell back
B463 BIT 7,(IX+$00)
B467 JR Z,update_special_beam_2
B469 LD A,$08
B46B ADD A,(IX+$0B)
B46E LD (IX+$0B),A
update_special_beam_2 B471 CALL new_beam_frame this pass's frame (new_beam_frame)
B474 LD A,(IX+$11) 22 passes old: start shrinking; draw it (draw_shot)
B477 CP $16
B479 JP NZ,draw_shot_1
B47C SET 7,(IX+$10)
B480 JP draw_shot_1
Prev: B403 Up: Map Next: B483