| Routines

64416: Deal with ERIC when he's falling to the floor to land on his feet

Used by the routine at 63405 when bit 3 at 32749 is set (by the routine at 64259 or 64316).
64416 | LD HL,32755 | 32755 holds ERIC's main action timer
64419 | DEC (HL) | Is it time to deal with ERIC yet?
64420 | RET NZ | Return if not
64421 | EX DE,HL |
64422 | LD HL,53762 | Point HL at byte 2 of ERIC's buffer
64425 | INC (HL) | Increment ERIC's y-coordinate temporarily (for testing purposes)
64426 | CALL 30543 | Has ERIC reached the floor yet?
64429 | JR NZ,64452 | Jump if not
64431 | CP 17 | This is the y-coordinate of the bottom floor
64433 | DEC HL | Point HL at byte 1 of ERIC's buffer
64434 | JR Z,64441 | Jump if ERIC has landed on the bottom floor
64436 | LD A,(HL) | A=ERIC's x-coordinate
64437 | CP 95 | This is the x-coordinate of the rightmost end of the boys' skool
64439 | JR NC,64451 | Jump if ERIC is outside the boys' skool (and therefore cannot land on the top or middle floors)
64441 | EX DE,HL | Reset all of ERIC's status flags at 32749 and 32763, indicating that ERIC has landed safely
64442 | LD L,237
64444 | LD (HL),0
64446 | LD L,251
64448 | LD (HL),0
64450 | EX DE,HL
64451 | INC L | L=2
64452 | DEC (HL) | Restore ERIC's y-coordinate (we've finished testing)
64453 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
64456 | INC D | Increment ERIC's y-coordinate (i.e. make him drop one level)
64457 | JP 62231 | Update ERIC's location, update the SRB, and reset ERIC's main action timer at 32755 to 6