Routines 
Prev: 64416  Up: Map  Next: 64560 
64460  LD HL,32749  32749 holds ERIC's secondary status flags  
64463  BIT 6,(HL)  Has ERIC already begun his descent?  
64465  JR NZ,64513  Jump if so  
ERIC has not begun his descent yet, which means we need to figure out what his trajectory will be first.


64467  LD H,210  210=ERIC  
64469  CALL 25012  Update the SRB for ERIC's current animatory state and location  
64472  AND 128  A=0 if ERIC's facing left, 128 if facing right  
This entry point is used by the routine at 29462 when ERIC has jumped from the saddle of the bike (with A=2 or 130, and D holding the ycoordinate of the spot above ERIC's hand).


64474  LD B,A  Now B=0 (or 2) if ERIC's facing left, 128 (or 130) if facing right  
64475  LD A,D  A=ycoordinate of ERIC (or the spot above his hand)  
64476  CP 17  Is ERIC on the bottom floor?  
64478  JR NZ,64482  Jump if not  
64480  DEC D  D=16  
64481  DEC A  A=16  
64482  ADD A,4  Set A=7+(y3)%7 if y<17, or 1 if y=17 (where y is ERIC's ycoordinate); this is the distance (negated) left to travel till ERIC reaches the floor  
64484  SUB 7  
64486  JR NC,64484  
64488  ADD A,166  A=159165 (normal descent table entry pointer)  
64490  PUSH AF  Save this briefly  
64491  LD A,5  Now A=animatory state of ERIC sitting on the floor (5/133) or with his arm up (7/135)  
64493  ADD A,B  
64494  CALL 24880  Update ERIC's animatory state and location and update the SRB  
64497  POP AF  Restore the normal descent table entry pointer to A  
64498  LD H,A  Point HL at the appropriate entry (H=159165) in the normal descent table (L=252) for ERIC's current height above the floor  
64499  LD L,252  
64501  LD (32727),HL  Store the descent table pointer at 32727  
64504  LD HL,32749  32749 holds ERIC's secondary status flags  
64507  LD (HL),80  Set bits 4 (ERIC is still falling) and 6 (ERIC has begun his descent)  
64509  LD L,243  Set ERIC's main action timer at 32755 to 7  
64511  LD (HL),7  
Deal with the next phase of ERIC's descent.


64513  LD L,243  HL=32755 (which holds ERIC's main action timer)  
64515  DEC (HL)  Is it time to deal with ERIC yet?  
64516  RET NZ  Return if not  
64517  LD (HL),3  Reset ERIC's action timer to 3  
64519  LD L,216  HL=32727 (which holds the descent table pointer)  
64521  INC (HL)  Collect the descent table pointer into DE  
64522  LD D,(HL)  
64523  DEC L  
64524  LD E,(HL)  
64525  LD A,(DE)  Pick up an entry from the descent table in A  
64526  AND A  Has ERIC landed yet?  
64527  JR NZ,64546  Jump if not  
64529  LD L,251  HL=32763 (ERIC's main status flags)  
64531  INC D  Collect the first set of flags from the descent table  
64532  LD A,(DE)  
64533  LD (HL),A  Copy them into 32763  
64534  INC D  Collect the second set of flags from the descent table  
64535  LD A,(DE)  
64536  LD L,237  Copy them into 32749  
64538  LD (HL),A  
64539  AND A  Did ERIC jump from the top floor window (bit 5 set)?  
64540  CALL NZ,62770  Set MR WACKER on his way to expel ERIC if so  
64543  JP 62147  Make a sound effect for ERIC's landing  
ERIC hasn't landed yet. Determine his next move through the air.


64546  PUSH AF  Save the descent table entry briefly  
64547  LD H,210  210=ERIC  
64549  CALL 25012  Update the SRB for ERIC's current animatory state and location  
64552  AND 128  B=0 if ERIC's facing left, 128 if facing right  
64554  LD B,A  
64555  POP AF  Restore the descent table entry to A  
64556  LD C,A  Copy it to C  
64557  JP 23808  The routine continues at 23808  
This routine uses a descent table to guide ERIC to the floor. The bits in each table entry have the following significance:
The descent tables themselves contain the following entries:

Prev: 64416  Up: Map  Next: 64560 