Prev: 23296 Up: Map Next: 23843
23808: Deal with ERIC while he's falling (2)
Continues from 64460.
Input
A Descent table entry (see 64460)
B 0 if ERIC's facing left, 128 if he's facing right
C Same as A
D ERIC's y-coordinate
E ERIC's x-coordinate
H 210 (ERIC)
23808 AND 15 Retain only bits 0-3 (the animatory state)
23810 ADD A,B Now A=ERIC's new animatory state
23811 LD B,A Store this in B for now
23812 LD A,C A=descent table entry
23813 RLCA Is ERIC ascending (bit 7 of C set)?
23814 JR NC,23817 Jump if not
23816 DEC D Move ERIC up a level
23817 RLCA Is ERIC descending (bit 6 of C set)?
23818 JR NC,23821 Jump if not
23820 INC D Move ERIC down a level
23821 RLCA Should ERIC move forward one space (bit 5 of C set)?
23822 JR NC,23829 Jump if not
23824 BIT 7,B Is ERIC facing right?
23826 JR NZ,23838 Jump if so
23828 DEC E
23829 RLCA Should ERIC move backwards one space (bit 4 of C set)?
23830 JR NC,23839 Jump if not
23832 DEC E
23833 BIT 7,B Is ERIC facing right?
23835 JR NZ,23839 Jump if so
23837 INC E
23838 INC E Now E=ERIC's new x-coordinate, D=ERIC's new y-coordinate
23839 LD A,B A=ERIC's new animatory state
23840 JP 28172 Update ERIC's animatory state and location, update the SRB make a sound effect, and scroll the screen if necessary
Prev: 23296 Up: Map Next: 23843