| Routines

25700: Guide a character from the bottom floor to another floor

Used by the routine at 25534 when the character under consideration is on the bottom floor but is destined for another floor.
Input
BC | 25404
E | Character's x-coordinate
H | Character number (152-169)
L | 101
25700 | LD A,(HL) | A=destination y-coordinate
25701 | CP 162 | Set the zero flag if the character is going to the middle floor
25703 | LD A,38 | This is the x-coordinate of the wall between the White and Exam Rooms
25705 | JR Z,25709 | Jump if the character is going to the middle floor
25707 | LD A,57 | This is the x-coordinate of the wall between the Map and Reading Rooms
25709 | INC L | Set the carry flag if the character is destined for some place to the right of the wall referred to by A
25710 | CP (HL)
25711 | LD A,70 | This is the x-coordinate of the bottoms of the staircases at the right of the skool
25713 | JR C,25717 | Jump if the character must go to a staircase on the right
25715 | LD A,19 | This is the x-coordinate of the bottoms of the staircases at the left of the skool
25717 | CP E | Is the character at the bottom of the staircase he must climb?
25718 | JP NZ,25627 | Jump if not (to send the character there)
25721 | LD L,96 | Byte 96 of the character's buffer holds his animatory state
25723 | BIT 0,(HL) | Is the character midstride?
25725 | JP NZ,25627 | Jump if so (to finish the stride)
25728 | CP 48 | Is the character at the bottom of a staircase at the right of the skool?
25730 | JR NC,25739 | Jump if so
25732 | BIT 7,(HL) | Is the character facing right?
25734 | JP NZ,25615 | Turn him round if so
25737 | JR 25744 |
25739 | BIT 7,(HL) | Is the character facing left?
25741 | JP Z,25615 | Turn him round if so
25744 | LD C,140 | Set BC=25484 (guide character up stairs) and place this interruptible subcommand routine address into bytes 105 and 106 of the character's buffer
25746 | JP 25625