Skool Daze Routines
25534: Make character go to a location
Used by command lists 128, 130, 132, 134, 136, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 184, 186, 188, 190, 192, 198, 200, 202, 208, 212, 214, 216, 218 and 222.
H Character number (152-169)
L 122
25534 LD A,(HL) Reset bits 5 and 6 of byte 122 of the character's buffer, indicating that he should no longer walk fast or slow continuously (if he was doing so)
25535 AND 159
25537 LD (HL),A
25538 LD L,101 Get y-coordinate of destination from command list and place it in byte 101 of the character's buffer
25540 CALL 24972
25543 LD (HL),A
25544 INC L Get x-coordinate of destination from command list and place it in byte 102 of the character's buffer
25545 CALL 24972
25548 LD (HL),A
This entry point is used by the routines at 27111 and 27266.
25549 NOP
25550 CALL 27888 Make character stand up if he's not already
25553 LD L,97 Collect the x- and y-coordinates of the character in E and D
25555 LD D,(HL)
25556 INC L
25557 LD E,(HL)
25558 LD L,101 Bytes 101 & 102 contain the destination coordinates
25560 LD BC,25404 Point BC at 25404 (guide character to intermediate destination)
25563 LD A,D A=character's y-coordinate
25564 CP (HL) Is the character on the same floor as his destination?
25565 JP Z,25750 Jump if so
25568 CP 155 Is the character on the top floor?
25570 JP Z,25695 Jump if so.
25573 CP 169 Is the character on the bottom floor?
25575 JP Z,25700 Jump if so.
The character is on the middle floor and destined for another floor.
25578 LD A,(HL) A=y-coordinate of destination
25579 CP 169 169=bottom floor
25581 LD A,38 38=x-coordinate of wall between White and Exam Rooms
25583 JR NZ,25639 Jump if the character is going to the top floor
This entry point is used by the routine at 25695 with A=57 (the x-coordinate of the wall between the Map and Reading Rooms).
25585 CP E
25586 LD A,12 12=x-coordinate of top of staircases at left of skool
25588 JR NC,25592
This entry point is used by routine at 25750 when the character is on the right-middle or right-top floors and needs to go down the stairs to get to his destination.
25590 LD A,77 77=x-coordinate of top of stairs at right of skool
This entry point is used by routine at 25750 with A=12 when the character is on the left-middle or left-top floors and needs to go down the stairs to get to his destination.
25592 CP E Is character at top of stairs he needs to descend?
25593 JR NZ,25627 Jump if not
25595 LD L,96 Byte 96 holds the character's animatory state
25597 BIT 0,(HL) Is the character midstride (about to descend)?
25599 JR NZ,25627 Jump if so
25601 CP 48 Is the target staircase on the right of the skool?
25603 JR NC,25611 Jump if so
25605 BIT 7,(HL) Is the character facing left?
25607 JR Z,25615 Jump if so
25609 JR 25623
The character must go to the top of a staircase at the right of the skool.
25611 BIT 7,(HL) Is the character facing left?
25613 JR Z,25623 Jump if so
25615 CALL 25108 Update SRB for current location of character
25618 XOR 128 Turn character round
25620 JP 25008 Update character's animatory state and location and update SRB
25623 LD C,144 BC=25488 (guide character down stairs)
25625 LD A,15 Going up or down a staircase entails 15 movements
25627 LD L,105 Place the routine address in BC (25404, 25484 or 25488) in bytes 105 and 106 of the character's buffer
25629 LD (HL),C
25630 INC L
25631 LD (HL),B
25632 INC L Byte 107 will contain either (a) the x-coordinate of the top or bottom of the staircase the character is heading for (BC=25404), or (b) 15, that being the number of movements required to ascend or descend a staircase (BC=25484 or 25488)
25633 LD (HL),A
25634 INC L L=108
25635 LD (HL),9 The contents of byte 108 are used by 25404
25637 PUSH BC Make an indirect jump to 25404, 25484 or 25488
25638 RET
The character is on the middle floor but is destined for the top floor. At this point A=38 (the x-coordinate of the wall between the White and Exam Rooms).
25639 INC L L=102 (which holds the destination x-coordinate)
25640 CP E
25641 LD A,57 57=x-coordinate of wall between Map and Reading Rooms
25643 JR NC,25667 Jump if character is to the left of the White Room wall
25645 CP (HL) (HL) holds the destination x-coordinate
25646 LD A,70 70=x-coordinate of bottom of staircases at right of skool
25648 JR NC,25590 Jump if destination is to the left of the Map Room wall
25650 CP E Is character at the bottom of the target staircase?
25651 JR NZ,25627 Jump if not
25653 LD L,96 Byte 96 holds the character's animatory state
25655 BIT 0,(HL) Is the character midstride?
25657 JR NZ,25627 Jump if so
25659 BIT 7,(HL) Is the character facing left?
25661 JR Z,25615 Jump if so
25663 LD C,140 BC=25484 (guide character up stairs)
25665 JR 25625
The character is on the middle floor to the left of the White Room wall, and is destined for the top floor. At this point A=57 (the x-coordinate of the wall between the Map and Reading Rooms).
25667 CP (HL) (HL) holds the destination x-coordinate
25668 LD A,12 12=x-coordinate of top of stairs at left of skool
25670 JR C,25592 Jump if destination is to the right of the Map Room wall
25672 LD A,19 19=x-coordinate of bottom of stairs at left of skool
25674 CP E Is character at the bottom of the stairs?
25675 JR NZ,25627 Jump if not
25677 LD L,96 Byte 96 holds the character's animatory state
25679 BIT 0,(HL) Is the character midstride?
25681 JR NZ,25627 Jump if so
25683 BIT 7,(HL) Is the character facing right?
25685 JR NZ,25615 Jump if so
25687 LD C,140 BC=25484 (guide character up stairs)
25689 JR 25625