Routines

64077: Deal with water from water pistol at certain stages


Used by routine at 63915

A Data from byte 255 of water animation table
H 214 (water's buffer)

64077 3D DEC A Is the water at the right stage to fill a cup?
64078 202E JR NZ,64126 Jump if not
64080 2E02 LD L,2
64082 7E LD A,(HL) A=water's y-coordinate
64083 D60E SUB 14 All cups have y-coordinate of 14
64085 C0 RET NZ Return if the water's not at the right height
64086 6F LD L,A L=0
64087 3D DEC A A=255
64088 CB7E BIT 7,(HL) Is the water travelling to the left?
64090 2802 JR Z,64094 Jump if so
64092 3E03 LD A,3
64094 2C INC L L=1
64095 86 ADD A,(HL) A=x-coordinate of spot where water is falling
64096 CD0976 CALL 30217 Is this the x-coordinate of one of the cups?
64099 C0 RET NZ Return if not
64100 21EB7F LD HL,32747
64103 CB66 BIT 4,(HL) Is there sherry in the pistol?
64105 2177DC LD HL,56439 H=220, L=119
64108 2802 JR Z,64112 Jump if not
64110 2E7C LD L,124
64112 24 INC H Point HL at a cup data table
64113 BE CP (HL) Is this the right data table for the cup?
64114 20FC JR NZ,64112 Jump back to check the next table if not
64116 2D DEC L Point HL to start of data table (56694/56699, 56950/56955, 57206/57211 or 57462/57467)
64117 CD186C CALL 27672 Alter UDG and attribute references in play area to show filled cup
64120 E1 POP HL Drop the return address from the stack
64121 26D6 LD H,214 214=water's buffer
64123 C3CF74 JP 29903

The water/sherry hasn't hit a cup. Has it hit the floor?
64126 35 DEC (HL)
64127 CD4F77 CALL 30543 Has the water/sherry hit the floor yet?
64130 200F JR NZ,64147 Jump if not
64132 FE11 CP 17 Did it hit the bottom floor?
64134 28F0 JR Z,64120 Jump back to terminate the water if so
64136 2D DEC L
64137 7E LD A,(HL) A=water's x-coordinate
64138 FE60 CP 96 Jump back to terminate the water/sherry if A<96 (inside boys' skool) or A≥160 (inside girls' skool)
64140 38EA JR C,64120
64142 FEA0 CP 160
64144 30E6 JR NC,64120
64146 C9 RET

The water/sherry hasn't hit a cup or the floor. Has it hit a plant pot?
64147 CD86F9 CALL 63878 Has the water/sherry hit a plant pot?
64150 C0 RET NZ Return if not
64151 3AEB7F LD A,(32747) Inventory flags
64154 CB67 BIT 4,A Has the pistol got sherry in it?
64156 20DA JR NZ,64120 Jump back to terminate the sherry if so
64158 D1 POP DE Drop the return address from the stack
64159 CDB461 CALL 25012 Update SRB for water's current animatory state and location
64162 14 INC D
64163 2E13 LD L,19
64165 3616 LD (HL),22 Set parameter governing time before plant grows
64167 2C INC L L=20
64168 73 LD (HL),E Fill in x-coordinate of plant
64169 1E00 LD E,0
64171 7B LD A,E
64172 CD4677 CALL 30534 Place address 64175 in plant's buffer and update SRB
64175 2E13 LD L,19
64177 35 DEC (HL) Is the plant ready to die?
64178 200F JR NZ,64195 Jump if not
64180 3AED7F LD A,(32749)
64183 FE02 CP 2 Is ERIC standing on the plant?
64185 2005 JR NZ,64192 Jump if not
64187 3E10 LD A,16 ERIC is standing on a plant that's about to die
64189 32ED7F LD (32749),A
64192 C3CF74 JP 29903 Kill the plant
64195 7E LD A,(HL)
64196 FE08 CP 8 Is it time for the plant to start growing?
64198 2009 JR NZ,64209 Jump if not
64200 2C INC L
64201 5E LD E,(HL) E=x-coordinate of plant
64202 2E02 LD L,2
64204 56 LD D,(HL) D=y-coordinate of plant
64205 3E2A LD A,42 42: flower, half-grown
64207 1807 JR 64216
64209 FE04 CP 4 Is it time for the plant to reach full height?
64211 C0 RET NZ Return if not
64212 CDB461 CALL 25012 Update SRB for plant's current animatory state
64215 3C INC A A=43: flower, fully grown
64216 CD3061 CALL 24880 Update SRB for plant's new animatory state
64219 3AED7F LD A,(32749)
64222 FE02 CP 2 Is ERIC standing on a plant?
64224 C0 RET NZ Return if not
64225 3A01D2 LD A,(53761) A=ERIC's x-coordinate
64228 2E01 LD L,1
64230 BE CP (HL) Is ERIC standing on this plant?
64231 C0 RET NZ Return if not
64232 26D2 LD H,210 210=ERIC
64234 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
64237 15 DEC D ERIC will rise one level
64238 C33061 JP 24880 Update SRB for ERIC's new location