| Routines

23907: Deal with ERIC when he's jumping

Called by the routine at 63405 when bit 0 at 32763 is set (by the routine at 23887). Checks whether ERIC has jumped onto a plant pot, up to the safe, or up to the drinks cabinet.
23907 | LD HL,32755 | 32755 holds ERIC's main action timer
23910 | DEC (HL) | Is it time for ERIC to land?
23911 | RET NZ | Return if not
23912 | LD L,251 | Reset all of ERIC's status flags at 32763 (ERIC is no longer doing anything special)
23914 | LD (HL),0
23916 | LD H,210 | 210=ERIC
23918 | CALL 63878 | Set the zero flag if ERIC is in the same position as a plant pot
23921 | LD A,2 | Bit 1 set at 32763: make the routine at 63405 inspect ERIC's other status flags at 32749; bit 1 set at 32749: ERIC is standing on a plant pot
23923 | JR NZ,23940 | Jump if ERIC's not in the same position as a plant pot
This entry point is used by the routine at 24263 with A=0.
23925 | LD DE,32763 | Set or reset the appropriate status flags at 32763
23928 | LD (DE),A
23929 | LD E,237 | Set or reset the appropriate status flags at 32749
23931 | LD (DE),A
23932 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
23935 | AND 128 | Restore ERIC's animatory state to 0 (facing left) or 128 (facing right) as appropriate
This entry point is used by the routine at 23887.
23937 | JP 62231 | Update ERIC's animatory state and update the SRB
ERIC has jumped, but not onto a plant pot.
23940 | LD L,A | L=2
23941 | LD A,(HL) | A=ERIC's y-coordinate
23942 | SUB L |
23943 | JR Z,23953 | Jump if ERIC jumped while on the top floor
23945 | LD H,210 | 210=ERIC
23947 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
23950 | INC D | Increment ERIC's y-coordinate, bringing him back to the floor
23951 | JR 23935 | Restore ERIC's animatory state and update the SRB
ERIC jumped while on the top floor. Up to the drinks cabinet?
23953 | LD L,A | L=0
23954 | LD A,(HL) | A=ERIC's animatory state
23955 | INC L | Now A=x-coordinate of ERIC's raised arm
23956 | RLCA
23957 | SBC A,A
23958 | ADD A,A
23959 | CPL
23960 | INC A
23961 | ADD A,(HL)
23962 | LD HL,32756 | 32756 holds the door/window status flags
23965 | CP 190 | Did ERIC jump up to the drinks cabinet?
23967 | JR C,23996 | Jump if not
23969 | BIT 5,(HL) | Is the drinks cabinet door open?
23971 | JR Z,23945 | Just bring ERIC back to the floor if not
ERIC has jumped up to the drinks cabinet, and it's open. But has he got the water pistol?
23973 | LD L,235 | HL=32747 (which holds the inventory flags)
23975 | BIT 4,(HL) | Has ERIC already got a sherry-filled water pistol?
23977 | JR NZ,23945 | Jump if so
23979 | BIT 3,(HL) | Has ERIC got a water-filled water pistol?
23981 | JR Z,23945 | Jump if not
23983 | SET 4,(HL) | Signal: ERIC now has a sherry-filled water pistol
23985 | CALL 31746 | Print the inventory
Acknowledge the sherry-filled water pistol with a sound effect. Your browser doesn't support HTML5 audio. Here is a link to the audio instead.
23988 | LD HL,534 | Make a sound effect
23991 | CALL 62150
23994 | JR 23945 | Bring ERIC back to the floor
ERIC has jumped, but not onto a plant pot or up to the drinks cabinet. Up to the safe?
23996 | CP 81 | Did ERIC jump up to the safe in WACKER's study?
23998 | JR NZ,23945 | Jump if not
24000 | LD L,235 | HL=32747 (which holds the inventory flags)
24002 | BIT 0,(HL) | Has ERIC got the safe key?
24004 | JR Z,23945 | Just bring ERIC back to the floor if not
ERIC has jumped up to the safe, and he has the safe key. Celebration time.
24006 | LD L,222 | Set 32734 to 1 so the game will be restarted instead of going into demo mode
24008 | INC (HL)
24009 | LD A,200 | Add 2000 to the score and print it
24011 | CALL 29621
24014 | XOR A | A=0: 'ONTO THE NEXT YEAR'
24015 | CALL 32478 | Print this in the lesson box and ring the bell
24018 | LD HL,56363 | Play the up-a-year tune
24021 | CALL 24485
24024 | JP 63189 | Restart the game