Routines

64316: Deal with ERIC when standing on plant or plant pot


This routine is called by the routine at 63405 when bit 1 at 32749 is set

64316 21F37F LD HL,32755
64319 35 DEC (HL) Is it time to deal with ERIC yet?
64320 C0 RET NZ Return if not
64321 34 INC (HL) Now (HL) = 1
64322 CDFA71 CALL 29178 Get offset from keypress table into A
64325 C8 RET Z Return if no keys were pressed
64326 21F37F LD HL,32755
64329 3605 LD (HL),5
64331 CB9F RES 3,A
64333 FE56 CP 86 Was "down" pressed?
64335 2005 JR NZ,64342 Jump if not
64337 2EED LD L,237 HL=32749
64339 3608 LD (HL),8 Set bit 3: ERIC is falling and will land on feet
64341 C9 RET
64342 EB EX DE,HL
64343 2100D2 LD HL,53760 Point to the first byte of ERIC's buffer (page 210)
64346 FE52 CP 82 Was "right" pressed?
64348 2032 JR NZ,64400 Jump if not
64350 CB7E BIT 7,(HL) Is ERIC facing left?
64352 CA386E JP Z,28216 Jump if so
64355 2C INC L L=1
64356 7E LD A,(HL) A=ERIC's x-coordinate
64357 EB EX DE,HL
64358 2C INC L HL=32756 (doors flags)
64359 FE84 CP 132 132=x-coordinate of plant pot to left of gate
64361 3814 JR C,64383 Jump if ERIC is standing on a plant pot in the boys' skool
64363 2805 JR Z,64370 Jump if ERIC is standing on a plant pot on either side of the gate
64365 3E04 LD A,4 Make sound effect, update SRB and set bit 2 at 32749 (ERIC is stepping off plant/plant pot)
64367 C3F4FA JP 64244

ERIC was standing on one of the plant pots on either side of the skool gate, and has tried to step off the plant or plant pot in the direction of the gate.
64370 CB66 BIT 4,(HL) HL=32756 (doors flags)
64372 20F7 JR NZ,64365 Jump if the skool gate is open
64374 060E LD B,14 14=y-coordinate of ERIC if he's standing on a fully-grown plant on the bottom floor
64376 1C INC E DE=53762 (byte 2 of ERIC's buffer)
64377 1A LD A,(DE) A=ERIC's y-coordinate
64378 B8 CP B Is ERIC on top of a fully-grown plant?
64379 C0 RET NZ Return if not
64380 C3F2FA JP 64242 Otherwise make sound effect, update SRB, and set bits 2 and 3 at 32749

ERIC is standing on one of the plant pots in the boys' skool, and has attempted to step off in the direction of the window.
64383 FE5B CP 91 Is ERIC standing on the top floor plant pot?
64385 2007 JR NZ,64394 Jump if not
64387 0600 LD B,0 0=y-coordinate of ERIC if he's standing on a fully-grown plant on the top floor
64389 CB76 BIT 6,(HL) Is the top floor window closed?
64391 C8 RET Z Return if so
64392 18EE JR 64376
64394 0607 LD B,7 7=y-coordinate of ERIC if he's standing on a fully-grown plant on the middle floor
64396 CB7E BIT 7,(HL) Is the middle floor window closed?
64398 18F7 JR 64391
64400 FE50 CP 80 Was "left" pressed?
64402 C0 RET NZ Return if not
64403 CB7E BIT 7,(HL) Is ERIC facing right?
64405 C2386E JP NZ,28216 Jump to turn ERIC round if so
64408 2C INC L HL=53761 (byte 1 of ERIC's buffer)
64409 7E LD A,(HL) A=ERIC's x-coordinate
64410 EB EX DE,HL
64411 2C INC L HL=32756 (doors flags)
64412 FE87 CP 135 135=x-coordinate of plant pot to right of gate
64414 18CB JR 64363