Back to Skool Routines
26263: Control character looking for a chair
The address of this routine is placed into bytes 17 and 18 of a character's buffer by the routine at 26239 after he's been knocked out of his chair and just got up to look for another one (or the same one, in EINSTEIN's case). It is also used by the routine at 26304.
H Number of character looking for a chair
26263 LD L,0 Byte 0 holds the character's animatory state
26265 BIT 0,(HL) Is the character midstride?
26267 JP NZ,25597 Finish the stride if so
26270 CALL 26068 Is the character standing beside a chair?
26273 AND A
26274 JR NZ,26293 Jump if not
26276 CALL 26175 Knock the character who's sitting here (if any) out of the way
26279 CALL 25012 Update SRB for the character's current animatory state and location
26282 AND 248
26284 ADD A,4 A=animatory state of the character sitting in chair
26286 LD L,18 Remove the address of this routine from bytes 17 and 18 of the character's buffer
26288 LD (HL),0
26290 JP 24880 Update SRB for the character's new animatory state
26293 CP 4 A=0 if the character must walk back to the rightmost chair in the room, or 255 if there is one in front of him
26295 SBC A,A
26296 LD L,0 Byte 0 holds the character's animatory state
26298 XOR (HL) Reset the carry flag if the character must turn round
26299 RLCA
26300 JP 25646 Update the character's animatory state and update SRB accordingly