| Routines

26263: Deal with a character who is looking for a seat

The address of this uninterruptible subcommand 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), or by the routine at 26304.
Input
H | Character number (183-209)
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 anybody who's sitting here out of the way
26279 | CALL 25012 | Update the SRB for the character's current animatory state and location
26282 | AND 248 |
26284 | ADD A,4 | A=animatory state of the character (as if sitting in a 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 the character's animatory state and update the SRB
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 the SRB