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. It is also used by the routine at 26304.

H Number of character looking for a chair

26263 2E00 LD L,0
26265 CB46 BIT 0,(HL) Is the character midstride?
26267 C2FD63 JP NZ,25597 Finish the stride if so
26270 CDD465 CALL 26068 Is the character standing beside a chair?
26273 A7 AND A
26274 2011 JR NZ,26293 Jump if not
26276 CD3F66 CALL 26175 Knock the character who's sitting here (if any) out of the way
26279 CDB461 CALL 25012 Update SRB for character's current animatory state and location
26282 E6F8 AND 248
26284 C604 ADD A,4 A=animatory state of character sitting in chair
26286 2E12 LD L,18 Remove the address of this routine from bytes 17 and 18 of the character's buffer
26288 3600 LD (HL),0
26290 C33061 JP 24880 Update SRB for character's new animatory state
26293 FE04 CP 4 Now 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 9F SBC A,A
26296 2E00 LD L,0
26298 AE XOR (HL) (HL)=character's animatory state
26299 07 RLCA Now the carry flag is reset if the character must turn round
26300 C32E64 JP 25646 Update animatory state and SRB accordingly