Routines

26136: Check if any character is sitting in a chair


Used by routine at 26175

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 CD2166 CALL 26145 Any of the first B characters sitting here?
26139 C8 RET Z Return if so
26140 018F02 LD BC,655 B=2, C=143
26143 16CE LD D,206 206=BOY WANDER

This entry point also is used by the routine at 26175:
26145 1E01 LD E,1
26147 1A LD A,(DE) A=test character's x-coordinate
26148 BE CP (HL) Compare with that of the character trying to sit down
26149 2014 JR NZ,26171 Jump to consider the next character if they don't match
26151 1C INC E
26152 2C INC L
26153 1A LD A,(DE) A=test character's y-coordinate
26154 1D DEC E
26155 BE CP (HL) Is the test character at the same location as the character wanting to sit?
26156 2B DEC HL
26157 200C JR NZ,26171 Jump if not
26159 1D DEC E
26160 1A LD A,(DE) A=test character's animatory state
26161 A1 AND C
26162 FE04 CP 4 Is the test character sitting in the chair here?
26164 2005 JR NZ,26171 Jump if not
26166 1E12 LD E,18 Pick up the MSB of the address of a controlling routine from byte 18 of the test character's buffer
26168 1A LD A,(DE)
26169 A7 AND A Is there a controlling routine address here?
26170 C8 RET Z Return if not
26171 14 INC D Next character to test
26172 10E3 DJNZ 26145
26174 C9 RET