Back to Skool Routines
26136: Check if any character is sitting in a chair
Used by the routine at 26175. Returns with the zero flag set if a character is sitting in the chair under consideration.
B Number of characters to check
C 135 or 143: animatory state mask
D Number of first character to check
H Number of character trying to sit down
L 1
26136 CALL 26145 Any of the first B characters sitting here?
26139 RET Z Return if so
26140 LD BC,655 B=2, C=143
26143 LD D,206 206=BOY WANDER
This entry point also is used by the routine at 26175:
26145 LD E,1
26147 LD A,(DE) A=test character's x-coordinate
26148 CP (HL) Compare with that of the character trying to sit down
26149 JR NZ,26171 Jump to consider the next character if they don't match
26151 INC E E=2
26152 INC L L=2
26153 LD A,(DE) A=test character's y-coordinate
26154 DEC E E=1
26155 CP (HL) Is the test character at the same location as the character wanting to sit?
26156 DEC HL L=1
26157 JR NZ,26171 Jump if not
26159 DEC E E=0
26160 LD A,(DE) A=test character's animatory state
26161 AND C C=10001111 for BOY WANDER, ANGELFACE or ERIC; 10000111 for anybody else
26162 CP 4 Is the test character sitting in the chair here?
26164 JR NZ,26171 Jump if not
26166 LD E,18 Is there a routine address in bytes 17 and 18 of the test character's buffer?
26168 LD A,(DE)
26169 AND A
26170 RET Z Return if not
26171 INC D Next character to test
26172 DJNZ 26145 Jump back until done
26174 RET