Skool Daze Routines
31768: Make teacher track down the truant ERIC (2)
Continues from 31648.
A 1 if teacher's going upstairs, 2 if going down
BC 0
DE 0
H Character number of teacher tracking down ERIC (163-166)
L 96
31768 INC B B=1
31769 DEC A Is the teacher going downstairs?
31770 JR NZ,31774 Jump if so
31772 DEC B B=0
31773 DEC D D=-1
31774 INC C C=1
31775 BIT 7,(HL) Is the teacher facing right?
31777 JR NZ,31781 Jump if so
31779 DEC C C=-1
31780 DEC C
This entry point is used by the routine at 31648 when the character looking for ERIC is not on a staircase; in this case B=D=E=0, and C=-1 if the chaser is to ERIC's left, or 1 if he is to ERIC's right.
31781 LD L,107 C=-1 if chaser is to ERIC's left, or 1 if to his right; B=1 if the chaser is going downstairs, 0 otherwise; place these values in bytes 107 and 108 of the teacher's buffer
31783 LD (HL),C
31784 INC L
31785 LD (HL),B
31786 LD L,105 Change the routine address in bytes 105 and 106 of the chaser's buffer from 31648 to 31739
31788 LD (HL),251
31790 PUSH DE
31791 CALL 25108 Update SRB for chaser's current location
31794 INC A A=chaser's next animatory state (midstride)
31795 LD L,A Store this in L briefly
31796 POP BC Get the appropriate y- and x-coordinate changes in BC
31797 LD A,B Get the chaser's new y-coordinate in D (which is the same as his current y-coordinate unless he's going up a staircase)
31798 ADD A,D
31799 LD D,A
31800 LD A,C Get the chaser's new x-coordinate in E (which will one more or one less than his current x-coordinate)
31801 ADD A,E
31802 LD E,A
31803 LD A,L Restore chaser's new animatory state to A
31804 JP 25008 Update chaser's animatory state and location and update SRB