Skool Daze Routines
28304: Determine which floor is nearest to a character
Used by the routines at 28220 and 30890. The routine returns with the floor (155, 162, 169) nearest to the character in D.
H 172 (ERIC), 168 (ANGELFACE) or 167 (BOY WANDER)
28304 LD L,98 Byte 98 of a character's buffer holds his x-coordinate
28306 LD E,(HL) Pick this up in E
28307 DEC L L=97
28308 LD D,(HL) D=character's y-coordinate
28309 DEC L L=96
This entry point is used by the routines at 30636 and 30890.
28310 CALL 26184 Is the character on a staircase?
28313 RET Z Return if not
The character is on a staircase. Which floor is he nearest?
28314 LD D,155 155=top floor
28316 CP 158 Is the character nearest the top floor?
28318 RET C Return if so
28319 LD D,162 162=middle floor
28321 CP 165 Is the character nearest the middle floor?
28323 RET C Return if so
28324 LD D,169 169=bottom floor
28326 RET