Prev: 62750 Up: Map Next: 62902
62771: Deal with ERIC when he's jumping
Used by the routine at 27353 when bit 2 of ERIC's status flags at 32763 is set (by the routine at 62574, via 62617).
Input
Output
62771 LD HL,32758 Decrement the jumping action timer at 32758 (which starts at 16)
62774 DEC (HL) Has ERIC completed the jump?
62775 JP Z,62501 Jump if so
62778 LD A,(HL) Pick up the current value of the action timer in A
62779 CP 12
62781 LD B,15 Lines reprimand 15: YOU ARE NOT A KANGAROO
62783 JP Z,62550 Jump if it's time to check whether any teachers can see ERIC jumping
62786 LD H,172 172=ERIC
62788 CP 13 Is it time to check whether ERIC has touched a shield or opened the safe?
62790 JP Z,62750 Jump if so
62793 CP 14 Is it time to make the jumping sound effect?
62795 JP Z,60139 Jump if so
62798 CP 9 Is it time to move ERIC's arm back?
62800 JP Z,28779 Jump if so
62803 CP 3 Is it time to bring ERIC back down to the floor?
62805 JR NZ,62814 Jump if not
62807 CALL 25108 Update the SRB for ERIC's current location
62810 INC D Move ERIC downwards
62811 JP 25008 Update ERIC's location and update the SRB
62814 CP 6 Return if A < 6 (nothing to check or do)
62816 RET C
At this point A=6 (which means it's time to check whether ERIC has jumped onto a boy, or ERIC is already standing on a boy), or A is one of {7, 8, 10, 11, 15}, or A>128 (which means ERIC has jumped while standing on a boy).
62817 JR NZ,62891 Jump unless (a) it's time to check whether ERIC has jumped on a boy, or (b) ERIC is already standing on a boy
This entry point is erroneously used by the routine at 60139 with H=3 (which means (D,E) is set to (198,32) by the code that follows, and the routine exits at 62841).
62819 LD L,97 Byte 97 of ERIC's buffer holds his y-coordinate
62821 LD D,(HL) Pick this up in D
62822 INC D Down a level (where the boy that ERIC is standing on would be, if any)
62823 INC L Byte 98 holds ERIC's x-coordinate
62824 LD E,(HL) Pick this up in E
62825 LD B,11 There are 11 little boys
62827 LD H,152 152=little boy no. 1
62829 CALL 62905 Is ERIC standing on a little boy?
62832 JR C,62842 Jump if so
62834 LD H,167 167=BOY WANDER
62836 LD B,3 There are three main kids besides ERIC
62838 CALL 62911 Is ERIC standing on one of the three main kids?
62841 RET NC Return if not
ERIC is standing on a kid who's been knocked out.
62842 CALL 26426 Check for keypresses
62845 LD HL,32758 Set the jumping action timer at 32758 to 7, so that we keep returning to this section of code while ERIC is standing on a boy
62848 LD (HL),7
62850 RET Z Return if no key of interest was pressed
62851 SET 5,A Convert the ASCII code of the keypress in A to lower case
62853 CP 106 Was 'j' (jump) pressed?
62855 JR NZ,62860 Jump if not
62857 LD (HL),144 Set the jumping action timer at 32758 to 144 to indicate that ERIC has jumped while standing on a boy
62859 RET Return to the main loop with the carry flag reset
A key other than 'j' was pressed while ERIC was standing on a boy.
62860 CP 111 111='o'
62862 LD B,0 Set B=0 (ERIC facing left) for later comparison
62864 JR Z,62871 Jump if 'o' (left) was pressed
62866 LD B,128 Set B=128 (ERIC facing right) for later comparison
62868 CP 112 Was 'p' (right) pressed?
62870 RET NZ Return if not
62871 LD HL,44134 A=animatory state of ERIC before he jumped (stored in byte 102 of his buffer)
62874 LD A,(HL)
62875 AND 128 Keep only the 'direction' bit
62877 CP B Should ERIC turn round?
62878 RET Z Return if not
62879 LD A,(HL) Adjust ERIC's pre-jump animatory state to reflect his turning round while standing on a boy
62880 XOR 128
62882 LD (HL),A
62883 CALL 25108 Update the SRB for ERIC's current animatory state
62886 XOR 128 A=animatory state of ERIC facing the other way
62888 JP 25008 Update ERIC's animatory state and update the SRB
At this point A is one of {7, 8, 10, 11, 15} (which means there is nothing to do), or A=128-143 (which means ERIC has jumped while standing on a boy).
62891 CP 134 Return now if the SUB 128 instruction below would make A=6
62893 RET Z
62894 SUB 128 Return unless ERIC jumped while standing on a boy
62896 RET C
So ERIC has jumped while standing on a boy. Now either A=0, meaning it's time to set the jumping action timer at 32758 back to 7, so we can deal with ERIC while he's standing on a boy; or A=1-15 (but not 6, because that would lead us into the code at 62819 to perform a redundant check on whether ERIC is standing on a boy), meaning we need to run the usual checks while ERIC is in mid-air.
62897 JP NZ,62779 Run the usual checks while ERIC is in mid-air above a supine boy
62900 JR 62844 This should be JR 62845
Prev: 62750 Up: Map Next: 62902