Prev: 28313 Up: Map Next: 28436
28315: Check for walls and closed doors in front of ERIC
Used by the routines at 28436 and 28460. Impedes ERIC's progress if he's confronted by an immovable object, or opens the Science Lab storeroom door (if ERIC has the key and is trying to go right at the relevant location). Also sends ERIC down the first step of the staircase leading down to the assembly hall stage, or begins his descent off the assembly hall stage (if ERIC is trying to go left at the relevant location).
Input
D ERIC's y-coordinate
E x-coordinate of the spot in front of ERIC
28315 LD A,E A=x-coordinate of the spot in front of ERIC
28316 CP 191 Is ERIC facing the far right wall of the girls' skool?
28318 RET NC Return if so (ERIC can't walk through walls)
28319 LD HL,32756 32756 holds the doors flags
28322 LD A,D A=ERIC's y-coordinate
28323 CP 3 Is ERIC on the top floor?
28325 JR NZ,28363 Jump if not
ERIC is on the top floor.
28327 LD A,E A=x-coordinate of the spot in front of ERIC
28328 CP 159 Is ERIC facing the far wall of the top-floor room in the girls' skool?
28330 RET Z Return if so
28331 CP 92 Is ERIC facing the window on the top floor of the boys' skool?
28333 RET Z Return if so
28334 CP 72 Is ERIC facing the head's left study door?
28336 JR NZ,28341 Jump if not
28338 BIT 0,(HL) Is the head's left study door closed?
28340 RET Z Return if so
28341 CP 83 Is ERIC facing the head's right study door?
28343 JR NZ,28348 Jump if not
28345 BIT 1,(HL) Is the head's right study door closed?
28347 RET Z Return if so
ERIC's path is not blocked, so let him move forward.
28348 LD A,(53760) A=ERIC's animatory state
28351 LD C,E Copy the coordinates of the spot in front of ERIC (his post-midstride coordinates) from DE to BC
28352 LD B,D
28353 BIT 7,A Is ERIC facing right?
28355 JR NZ,28359 Jump if so
28357 INC E
28358 INC E
28359 DEC E Set E to ERIC's current x-coordinate (which will also be his midstride x-coordinate)
28360 JP 28114 Put ERIC midstride
ERIC's not on the top floor. Is he on the middle floor?
28363 CP 10 Is ERIC on the middle floor?
28365 JR NZ,28397 Jump if not
ERIC is on the middle floor.
28367 LD A,E A=x-coordinate of the spot in front of ERIC
28368 CP 159 Is ERIC facing the far wall of the middle-floor classroom in the girls' skool?
28370 RET Z Return if so
28371 CP 94 Is ERIC facing the window on the middle floor of the boys' skool?
28373 RET Z Return if so
28374 CP 63 Is ERIC facing the far wall of the Science Lab storeroom?
28376 RET Z Return if so
28377 CP 84 Is ERIC about to descend the stairs from the middle floor to the stage?
28379 JR NZ,28385 Jump if not
28381 INC E E=85 (ERIC's current x-coordinate)
28382 JP 28606 Start moving ERIC down a stair
28385 CP 54 Is ERIC facing the Science Lab storeroom door?
28387 JR NZ,28348 Jump if not
28389 BIT 2,(HL) Is the Science Lab storeroom door closed?
28391 JP Z,29681 Jump if so (and open it if ERIC has the key)
28394 RET Z Return if the door/gate is (still) closed
28395 JR 28348 Otherwise move ERIC forward
ERIC's not on the top floor or the middle floor. Is he on the bottom floor?
28397 CP 17 Is ERIC on the bottom floor?
28399 LD A,E A=x-coordinate of the spot in front of ERIC
28400 JR NZ,28421 Jump if not
ERIC is on the bottom floor.
28402 CALL 29030 Let ERIC go no further if ALBERT's in his way
28405 LD A,E A=x-coordinate of the spot in front of ERIC
28406 CP 94 Is ERIC facing the boys' skool door?
28408 JR NZ,28413 Jump if not
28410 BIT 3,(HL) Is the boys' skool door closed?
28412 RET Z Return if so
28413 CP 133 Is ERIC facing the skool gate?
28415 JR NZ,28348 Jump if not
28417 BIT 4,(HL) Is the skool gate closed?
28419 JR 28394 Jump back and return if so, or move ERIC forward if not
ERIC is on the assembly hall stage.
28421 CP 82 Is ERIC about to ascend the stairs from the stage to the middle floor?
28423 JR NZ,28429 Jump if not
28425 DEC E E=81 (ERIC's current x-coordinate)
28426 JP 28514 Start moving ERIC up a stair
28429 CP 76 Is ERIC about to jump off the stage?
28431 JP Z,28305 Jump if so to deal with ERIC's descent to the floor
28434 JR 28348 Otherwise move ERIC forward
Prev: 28313 Up: Map Next: 28436