Routines

30229: Check if pellet has hit water/sherry/frog-filled cup


Used by routine at 30380. It returns with the zero flag set if the pellet hit a water- or sherry-filled cup. Otherwise it returns with the zero flag reset, but releases the frog if the pellet hit the cup containing it.

H Pellet's character number

30229 CDFD75 CALL 30205 Has pellet hit a cup?
30232 C0 RET NZ Return with zero flag reset if not
30233 3AEB7F LD A,(32747) Pick up inventory flags
30236 CB4F BIT 1,A Has ERIC got the storeroom key?
30238 2816 JR Z,30262 Jump if not
30240 3A01D4 LD A,(54273) A=frog's x-coordinate
30243 3C INC A
30244 BB CP E Does the frog's x-coordinate match that of the cup in the girls' skool?
30245 200F JR NZ,30262 Jump if not
30247 3A02D4 LD A,(54274) A=frog's y-coordinate
30250 FE0B CP 11 Was the frog in the cup in the girls' skool?
30252 2008 JR NZ,30262 Jump if not
30254 E5 PUSH HL
30255 215478 LD HL,30804 Place the address of the routine at 30804 into bytes 17 and 18 of the frog's buffer
30258 2211D4 LD (54289),HL
30261 E1 POP HL
30262 3AFF7F LD A,(32767) A=column of play area at far left of screen
30265 47 LD B,A
30266 7B LD A,E
30267 90 SUB B
30268 D8 RET C Return if the cup was off-screen (to the left)
30269 FE20 CP 32
30271 D0 RET NC Return if the cup was off-screen (to the right)
30272 C6C0 ADD A,192
30274 5F LD E,A Point DE at the attribute file byte for the cup
30275 1659 LD D,89
30277 1A LD A,(DE) Pick up the attribute byte
30278 FE28 CP 40 Did the cup contain water?
30280 2003 JR NZ,30285 Jump if not
30282 3E1F LD A,31 31: Drop of water
30284 C9 RET Return with zero flag set
30285 FE58 CP 88 Did the cup contain sherry?
30287 C0 RET NZ Return if not
30288 3E9F LD A,159 159: Drop of sherry
30290 C9 RET Return with zero flag set