Prev: 64259 Up: Map Next: 64416
64316: Deal with ERIC when he's standing on a plant or plant pot
Used by the routine at 63405 when bit 1 at 32749 is set (by the routine at 23907). If 'down', 'left' or 'right' is pressed while ERIC is standing on a plant or plant pot, this routine will set bit 2 or 3 of ERIC's status flags at 32749 as follows:
Bit(s) Meaning
2 ERIC is stepping off a plant or plant pot straight to the floor
3 ERIC is falling and will land on his feet ('down' pressed)
2 & 3 ERIC is stepping off a fully grown plant in the direction of an open window or the closed skool gate
64316 LD HL,32755 32755 holds ERIC's main action timer
64319 DEC (HL) Is it time to deal with ERIC yet?
64320 RET NZ Return if not
64321 INC (HL) Set ERIC's main action timer to 1, ensuring that we pass through the following section of code on the next call to this routine if no keypress is detected this time
64322 CALL 29178 Get the value from the keypress offset table corresponding to the last key pressed (if any)
64325 RET Z Return if no keys were pressed
A key was pressed while ERIC was standing on a plant or plant pot.
64326 LD HL,32755 Reset ERIC's main action timer at 32755 to 5
64329 LD (HL),5
64331 RES 3,A Reset bit 3 of the keypress code to make it lower case
64333 CP 86 Was 'down' pressed?
64335 JR NZ,64342 Jump if not
'Down' was pressed, so make ERIC descend gracefully.
64337 LD L,237 HL=32749 (ERIC's secondary status flags)
64339 LD (HL),8 Set bit 3: ERIC is falling and will land on his feet
64341 RET
It wasn't 'down'. Was it 'left' or 'right'?
64342 EX DE,HL
64343 LD HL,53760 Point HL at byte 0 of ERIC's buffer
64346 CP 82 Was 'right' pressed?
64348 JR NZ,64400 Jump if not
'Right' was pressed.
64350 BIT 7,(HL) Is ERIC facing left?
64352 JP Z,28216 Turn ERIC round if so
64355 INC L L=1
64356 LD A,(HL) A=ERIC's x-coordinate
64357 EX DE,HL
64358 INC L HL=32756 (which holds the door/window status flags)
64359 CP 132 This is the x-coordinate of the plant pot to the left of the gate
64361 JR C,64383 Jump if ERIC is standing on a plant pot in the boys' skool
64363 JR Z,64370 Jump if ERIC is standing on one of the plant pots beside the gate
64365 LD A,4 Make a sound effect, update the SRB, and set bit 2 at 32749 (ERIC is stepping off a plant/plant pot)
64367 JP 64244
ERIC is 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 BIT 4,(HL) Is the skool gate open?
64372 JR NZ,64365 Jump if so
64374 LD B,14 This is the y-coordinate of ERIC if he's standing on a fully grown plant on the bottom floor
64376 INC E Point DE at byte 2 of ERIC's buffer
64377 LD A,(DE) A=ERIC's y-coordinate
64378 CP B Is ERIC on top of a fully grown plant?
64379 RET NZ Return if not
64380 JP 64242 Otherwise make a sound effect, update the SRB, and set bits 2 and 3 at 32749
ERIC is standing on one of the plant pots in the boys' skool, and has tried to step off in the direction of the window.
64383 CP 91 Is ERIC standing on the top-floor plant pot?
64385 JR NZ,64394 Jump if not
64387 LD B,0 This is the y-coordinate of ERIC if he's standing on a fully-grown plant on the top floor
64389 BIT 6,(HL) Is the top-floor window closed?
64391 RET Z Return if so
64392 JR 64376
64394 LD B,7 This is the y-coordinate of ERIC if he's standing on a fully-grown plant on the middle floor
64396 BIT 7,(HL) Set the zero flag if the middle-floor window is closed
64398 JR 64391
'Right' wasn't pressed. Was it 'left'?
64400 CP 80 Was 'left' pressed?
64402 RET NZ Return if not
'Left' was pressed.
64403 BIT 7,(HL) Is ERIC facing right?
64405 JP NZ,28216 Turn ERIC round if so
64408 INC L Point HL at byte 1 of ERIC's buffer
64409 LD A,(HL) A=ERIC's x-coordinate
64410 EX DE,HL
64411 INC L HL=32756 (which holds the door/window status flags)
64412 CP 135 This is the x-coordinate of the plant pot to the right of the gate; set the carry flag if ERIC is to the left of this, or set the zero flag if he's standing on it
64414 JR 64363
Prev: 64259 Up: Map Next: 64416