Prev: 28067 Up: Map Next: 28114
28085: Determine which floor ERIC's on when he's not standing directly on one
Continues from the routine at 25534, having determined that ERIC's feet are not on the floor. On entry, the zero flag is set if (a) ERIC is jumping and the zero flag was set (by chance) upon entering the routine at 25534, or (b) bits 1 and 2 of ERIC's status flags at 32749 are both reset. Returns with D=17 if the zero flag is set upon entry (regardless of which floor ERIC is on, which is a bug); otherwise returns with D=3, 10, 14 or 17, indicating which floor ERIC is directly above.
Input
D ERIC's y-coordinate
E ERIC's x-coordinate
28085 LD A,D A=ERIC's y-coordinate
28086 LD D,17 17=bottom floor
28088 RET Z Return with D=17 if the zero flag was set upon entry (regardless of which floor ERIC is on, which is a bug)
28089 LD D,3 3=top floor
28091 CP 4 Is ERIC directly above the top floor?
28093 RET C Return with D=3 if so
28094 LD D,10 10=middle floor
28096 CP 11 Is ERIC directly above the middle floor?
28098 RET C Return with D=10 if so
28099 LD D,17 17=bottom floor
28101 CP 15 Is ERIC below the height of the stage?
28103 RET NC Return with D=17 if so
28104 LD A,E A=ERIC's x-coordinate
28105 CP 76 Return with D=17 if ERIC is not directly above the assembly hall stage
28107 RET C
28108 CP 82
28110 RET NC
28111 LD D,14 14=assembly hall stage
28113 RET
Prev: 28067 Up: Map Next: 28114