![]() |
Routines |
Prev: 25749 | Up: Map |
Used by the routine at 25534 when the character under consideration is on the same floor as his destination.
|
||||||||||||||
25750 | INC L | Point HL at the destination x-coordinate | ||||||||||||
25751 | LD A,E | A=character's current x-coordinate | ||||||||||||
25752 | CP (HL) | Is the character at the destination? | ||||||||||||
25753 | JR NZ,25765 | Jump if not | ||||||||||||
25755 | LD L,96 | Byte 96 holds the character's animatory state | ||||||||||||
25757 | BIT 0,(HL) | Is the character midstride? | ||||||||||||
25759 | JP Z,25256 | Move to the next command in the command list if not | ||||||||||||
25762 | JP 25627 | Otherwise finish the stride | ||||||||||||
The character hasn't reached his destination yet. Figure out his next move.
|
||||||||||||||
25765 | LD A,D | A=character's y-coordinate | ||||||||||||
25766 | CP 169 | Set the zero flag if the character is on the bottom floor | ||||||||||||
25768 | LD A,(HL) | A=destination x-coordinate | ||||||||||||
25769 | JP Z,25627 | Jump if the character is on the bottom floor | ||||||||||||
The character is on the middle floor or the top floor. But which side of the wall?
|
||||||||||||||
25772 | LD A,D | A=character's y-coordinate | ||||||||||||
25773 | CP 155 | Set the zero flag if the character is on the top floor | ||||||||||||
25775 | LD A,57 | This is the x-coordinate of the wall between the Map and Reading Rooms | ||||||||||||
25777 | JR Z,25781 | Jump if the character is on the top floor | ||||||||||||
25779 | LD A,38 | This is the x-coordinate of the wall between the White and Exam Rooms | ||||||||||||
25781 | CP E | Is the character to the left of the wall? | ||||||||||||
25782 | JR NC,25792 | Jump if so | ||||||||||||
The character is on the right side of the wall.
|
||||||||||||||
25784 | CP (HL) | Compare the wall's x-coordinate (in A) with the destination x-coordinate | ||||||||||||
25785 | LD A,(HL) | A=destination x-coordinate | ||||||||||||
25786 | JP C,25627 | Jump if the character doesn't need to go down the stairs | ||||||||||||
25789 | JP 25590 | Send the character to the top of the staircase | ||||||||||||
The character is on the left side of the wall.
|
||||||||||||||
25792 | CP (HL) | Compare the wall's x-coordinate (in A) with the destination x-coordinate | ||||||||||||
25793 | LD A,(HL) | A=destination x-coordinate | ||||||||||||
25794 | JP NC,25627 | Jump if the character doesn't need to go down the stairs | ||||||||||||
25797 | LD A,12 | This is the x-coordinate of the tops of the staircases at the left of the skool | ||||||||||||
25799 | JP 25592 | Send the character to the top of the staircase |
Prev: 25749 | Up: Map |