Routines

28315: Check for walls and closed doors in front of ERIC


Used by routines at 28436 and 28460

D ERIC's y-coordinate
E x-coordinate of spot in front of ERIC

28315 7B LD A,E
28316 FEBF CP 191 191: Is ERIC facing the far right wall of the girl's skool?
28318 D0 RET NC Return if so
28319 21F47F LD HL,32756 Doors flags
28322 7A LD A,D
28323 FE03 CP 3 Is ERIC on the top floor?
28325 2024 JR NZ,28363 Jump if not
28327 7B LD A,E
28328 FE9F CP 159 159: Is ERIC facing the far wall of the top-floor room in the girl's skool?
28330 C8 RET Z Return if so
28331 FE5C CP 92 92: Is ERIC facing the window on the top-floor of the boys' skool?
28333 C8 RET Z Return if so
28334 FE48 CP 72 72: Is ERIC facing the head's left study door?
28336 2003 JR NZ,28341 Jump if not
28338 CB46 BIT 0,(HL) Is the head's left study door closed?
28340 C8 RET Z Return if so
28341 FE53 CP 83 83: Is ERIC facing the head's right study door?
28343 2003 JR NZ,28348 Jump if not
28345 CB4E BIT 1,(HL) Is the head's right study door closed?
28347 C8 RET Z Return if so
28348 3A00D2 LD A,(53760) A=ERIC's animatory state
28351 4B LD C,E
28352 42 LD B,D
28353 CB7F BIT 7,A Is ERIC facing right?
28355 2002 JR NZ,28359 Jump if so
28357 1C INC E
28358 1C INC E
28359 1D DEC E
28360 C3D26D JP 28114
28363 FE0A CP 10 Is ERIC on the middle floor?
28365 201E JR NZ,28397 Jump if not
28367 7B LD A,E
28368 FE9F CP 159 159: Is ERIC facing the far wall of the middle-floor classroom in the girls' skool?
28370 C8 RET Z Return if so
28371 FE5E CP 94 94: Is ERIC facing the window on the middle-floor window in the boys' skool?
28373 C8 RET Z Return if so
28374 FE3F CP 63 63: Is ERIC facing the far wall of the science lab storeroom?
28376 C8 RET Z Return if so
28377 FE54 CP 84 84: Is ERIC about to descend the stairs from the middle floor to the stage?
28379 2004 JR NZ,28385 Jump if not
28381 1C INC E Move ERIC one space to the right
28382 C3BE6F JP 28606 Go down a stair
28385 FE36 CP 54 54: Is ERIC facing the science lab storeroom door?
28387 20D7 JR NZ,28348 Jump if not
28389 CB56 BIT 2,(HL) Is the science lab storeroom door open?
28391 CAF173 JP Z,29681 Jump if so
28394 C8 RET Z
28395 18CF JR 28348
28397 FE11 CP 17 Is ERIC on the bottom floor?
28399 7B LD A,E
28400 2013 JR NZ,28421 Jump if not
28402 CD6671 CALL 29030 Let ERIC go no further if ALBERT's in his way
28405 7B LD A,E
28406 FE5E CP 94 94: Is ERIC facing the boys' skool door?
28408 2003 JR NZ,28413 Jump if not
28410 CB5E BIT 3,(HL) Is the boys' skool door closed?
28412 C8 RET Z Return if so
28413 FE85 CP 133 133: Is ERIC facing the skool gate?
28415 20BB JR NZ,28348 Jump if not
28417 CB66 BIT 4,(HL) Is the skool gate closed?
28419 18E5 JR 28394 Jump back and return if so
28421 FE52 CP 82 82: IS ERIC about to ascend the stairs from the stage to the middle floor?
28423 2004 JR NZ,28429 Jump if not
28425 1D DEC E
28426 C3626F JP 28514 Go up a stair
28429 FE4C CP 76 76: IS ERIC about to jump off the stage?
28431 CA916E JP Z,28305 Jump if so
28434 18A8 JR 28348