| Routines

FA39: Control water fired from the pistol (2)

Continues from F9AB. 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 | 0xD6 (water)
FA39 | JR NC,$FA3D | Jump if the water is travelling to the left
FA3B | SUB C | Add 0, 1 or 2 to the water's current x-coordinate
FA3C | SUB C | Do the same again to compensate for the ADD A,C instruction below
FA3D | ADD A,C | Now A=new x-coordinate for the water
FA3E | LD E,A | Copy this to E
FA3F | CP $BF | 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
FA41 | LD A,B | Transfer the water's new animatory state to A
FA42 | JP C,$6130 | 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)
FA45 | LD L,$12 | Otherwise remove the uninterruptible subcommand routine address (F9D8) from bytes 0x11 and 0x12 of the water's buffer
FA47 | LD (HL),$00
FA49 | JP $74D6 | Place the water out of sight