Prev: E6DC Up: Map Next: E76C
E6F6: Update any lasers in the room
Used by the routines at CA5B, CDD3, DD8D and E6DC.
Input
IY Pointer to laser data
E6F6 LD C,(IY+$03) Put the width in C.
E6F9 LD HL,$E6D9 Get the curent tick count. (E6D9)
E6FC INC (HL) Increment it.
E6FD BIT 7,(HL) Is it at 80 or above?
E6FF JP Z,$E7D7 Jump if it isn't.
The laser should be firing now.
E702 LD A,(HL) Get the current tick count.
E703 AND $03 Put the lowest two bits in B.
E705 LD B,A
E706 ADD A,A Multiply by 8 to get a suitable UDG offset.
E707 ADD A,A
E708 ADD A,A
E709 LD E,A Put this in DE.
E70A LD D,$00
E70C LD HL,$ECBD Add the base address of the laser graphic. (ECBD)
E70F ADD HL,DE
E710 EX DE,HL Swap DE and HL so HL has the actual graphic to use.
E711 LD A,B Add 3 to the previously stored two bits of the tick count to use as the length. (E6DB)
E712 ADD A,$03
E714 LD ($E6DB),A
E717 LD HL,$E6DA Get the current colour. (E6DA)
E71A BIT 7,(HL) Is bit 7 set?
E71C JR Z,$E742 Jump forward if it isn't.
E71E DEC (HL) Otherwise move down a colour.
E71F CALL $ECF4 Change the colour
E722 CALL $E775 Play the "laser fired" sound effect.
E725 LD A,(HL) Remove the bright and flash parts of the colour.
E726 AND $3F
E728 JR NZ,$E73A Jump forward while the laser has a non-black colour.
The laser needs to be erased.
E72A XOR A Set the colour to black
E72B LD (HL),A
E72C DEC HL Get the tick count (E6D9) to 0.
E72D LD (HL),A
E72E LD L,(IY+$01) Put the position in HL.
E731 LD H,(IY+$02)
E734 CALL $E76C Clear a section of laser.
E737 JP $E7D7 Pause and return.
The laser should be drawn.
E73A CALL $E756 Draw one frame
E73D CALL $E76C Clear any redundant sections.
E740 JR $E782 Move the laser forward.
E742 INC (HL)
E743 CALL $ECF4
E746 CALL $E775
E749 LD A,(HL)
E74A AND $3F
E74C CP C
E74D JR NZ,$E751
E74F SET 7,(HL)
E751 CALL $E756 Draw one frame.
E754 JR $E782
Prev: E6DC Up: Map Next: E76C