Routines
 Prev: 30205 Up: Map Next: 30291
30229: Check whether a pellet has hit a cup containing water, sherry or the frog
Used by the routine at 30380. 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.
Input
H Pellet's character number (213 or 214)
30229 CALL 30205 Has the pellet hit a cup?
30232 RET NZ Return with the zero flag reset if not
30233 LD A,(32747) Pick up the inventory flags from 32747
30236 BIT 1,A Has ERIC got the Science Lab storeroom key?
30238 JR Z,30262 Jump if not
30240 LD A,(54273) A=frog's x-coordinate
30243 INC A Adjust it for comparison with that of the cup that was hit
30244 CP E Does the frog's x-coordinate match that of the cup?
30245 JR NZ,30262 Jump if not
30247 LD A,(54274) A=frog's y-coordinate
30250 CP 11 Is the frog in the cup?
30252 JR NZ,30262 Jump if not
30254 PUSH HL
30255 LD HL,30804 Place the address of the uninterruptible subcommand routine at 30804 into bytes 17 and 18 of the frog's buffer, thus releasing the frog
30258 LD (54289),HL
30261 POP HL
30262 LD A,(32767) A=leftmost column of the play area on screen
30265 LD B,A Return if the cup is off-screen to the left
30266 LD A,E
30267 SUB B
30268 RET C
30269 CP 32 Return if the cup is off-screen to the right
30271 RET NC
30272 ADD A,192 Point DE at the attribute file byte for the cup
30274 LD E,A
30275 LD D,89
30277 LD A,(DE) Pick up the attribute byte of the cup
30278 CP 40 Does the cup contain water (PAPER 5)?
30280 JR NZ,30285 Jump if not
30282 LD A,31 31: Drop of water
30284 RET Return with the zero flag set
30285 CP 88 Does the cup contain sherry (BRIGHT 1: PAPER 3)?
30287 RET NZ Return if not
30288 LD A,159 159: Drop of sherry
30290 RET Return with the zero flag set
 Prev: 30205 Up: Map Next: 30291