Routines

28085: Determine which floor ERIC's on (if he's not standing directly on one)


Used by routine at 25534. It returns with D=3, 10, 14 or 17, indicating which floor ERIC's closest to.

Z Set if ERIC is standing on or stepping off a plant or plant pot

28085 7A LD A,D A=ERIC's y-coordinate
28086 1611 LD D,17 17=bottom floor
28088 C8 RET Z Return if ERIC's standing on or stepping off a plant or plant pot
28089 1603 LD D,3 3=top floor
28091 FE04 CP 4
28093 D8 RET C Return if on top floor
28094 160A LD D,10 10=middle floor
28096 FE0B CP 11
28098 D8 RET C Return if on middle floor
28099 1611 LD D,17 17=bottom floor
28101 FE0F CP 15
28103 D0 RET NC Return unless 11≤A≤14
28104 7B LD A,E A=ERIC's x-coordinate
28105 FE4C CP 76 Return unless 76≤A≤81
28107 D8 RET C
28108 FE52 CP 82
28110 D0 RET NC
28111 160E LD D,14 14=assembly hall stage
28113 C9 RET