Prev: 28303 Up: Map Next: 28327
28304: Determine which floor is nearest to a character
Used by the routines at 28220 and 30890. Returns with D holding 155 (top), 162 (middle), or 169 (bottom), corresponding to the floor nearest to the character.
Input
H 167 (BOY WANDER), 168 (ANGELFACE), 169 (EINSTEIN) or 172 (ERIC)
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 This is the y-coordinate of the top floor
28316 CP 158 Is the character nearest the top floor?
28318 RET C Return if so
28319 LD D,162 This is the y-coordinate of the middle floor
28321 CP 165 Is the character nearest the middle floor?
28323 RET C Return if so
28324 LD D,169 This is the y-coordinate of the bottom floor
28326 RET
Prev: 28303 Up: Map Next: 28327