| Routines

64057: Control water fired from the pistol (2)

Continues from 63915. On entry the carry flag is set if the water is travelling to the right. In the following, 'water' may refer to either water or sherry.
Input
A | Water's current x-coordinate
B | Water's new animatory state
C | x-coordinate increment (-2, -1 or 0)
D | Water's new y-coordinate
H | 214 (water)
64057 | JR NC,64061 | Jump if the water is travelling to the left
64059 | SUB C | Add 0, 1 or 2 to the water's current x-coordinate
64060 | SUB C | Do the same again to compensate for the ADD A,C instruction below
64061 | ADD A,C | Now A=new x-coordinate for the water
64062 | LD E,A | Copy this to E
64063 | CP 191 | Reset the carry flag if the water has hit the far left wall of the boys' skool or the far right wall of the girls' skool
64065 | LD A,B | Transfer the water's new animatory state to A
64066 | JP C,24880 | Update the water's animatory state and location and update the SRB (if the water hasn't hit one of the far walls, i.e. it's still entirely on-screen)
64069 | LD L,18 | Otherwise remove the uninterruptible subcommand routine address (63960) from bytes 17 and 18 of the water's buffer
64071 | LD (HL),0
64073 | JP 29910 | Place the water out of sight