Routines

23907: Deal with ERIC while he's jumping


This routine is called by the routine at 63405 when bit 0 at 32763 is set

23907 21F37F LD HL,32755
23910 35 DEC (HL) Is it time for ERIC to land?
23911 C0 RET NZ Return if not
23912 2EFB LD L,251 HL=32763
23914 3600 LD (HL),0 Reset all bits (ERIC is no longer doing anything special)
23916 26D2 LD H,210 210=ERIC
23918 CD86F9 CALL 63878 Is ERIC in the same position as a plant pot?
23921 3E02 LD A,2 Bit 1 set: make routine at 63405 inspect 32749
23923 200F JR NZ,23940 Jump if not

This entry point is used by the routine at 24263:
23925 11FB7F LD DE,32763
23928 12 LD (DE),A
23929 1EED LD E,237 DE=32749
23931 12 LD (DE),A
23932 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
23935 E680 AND 128 Restore ERIC's animatory state to 0 (facing left) or 128 (facing right) as appropriate
23937 C317F3 JP 62231 Update SRB for ERIC's new animatory state

ERIC has jumped, but not onto a plant pot. Up to the drinks cabinet?
23940 6F LD L,A L=2
23941 7E LD A,(HL) A=ERIC's y-coordinate
23942 95 SUB L
23943 2808 JR Z,23953 Jump if ERIC jumped while on the top floor
23945 26D2 LD H,210 210=ERIC
23947 CDB461 CALL 25012 Update SRB for ERIC's current animatory state and location
23950 14 INC D Bring ERIC back to the floor
23951 18EE JR 23935 Jump back to update SRB
23953 6F LD L,A L=0
23954 7E LD A,(HL) A=ERIC's animatory state
23955 2C INC L
23956 07 RLCA
23957 9F SBC A,A
23958 87 ADD A,A
23959 2F CPL
23960 3C INC A
23961 86 ADD A,(HL) Now A=x-coordinate of ERIC's raised arm
23962 21F47F LD HL,32756 Doors flags
23965 FEBE CP 190 Did ERIC jump up to the drinks cabinet?
23967 381B JR C,23996 Jump if not
23969 CB6E BIT 5,(HL) Is the drinks cabinet door open?
23971 28E4 JR Z,23945 Jump if not
23973 2EEB LD L,235 HL=32747 (inventory)
23975 CB66 BIT 4,(HL) Has ERIC got a sherry-filled water pistol?
23977 20DE JR NZ,23945 Jump if so
23979 CB5E BIT 3,(HL) Has ERIC got a water-filled water pistol?
23981 28DA JR Z,23945 Jump if not
23983 CBE6 SET 4,(HL) Signal: ERIC now has a sherry-filled water pistol
23985 CD027C CALL 31746 Print the inventory
23988 211602 LD HL,534 Make sound effect
23991 CDC6F2 CALL 62150
23994 18CD JR 23945

ERIC has jumped, but not onto a plant pot or up to the drinks cabinet. Up to the safe?
23996 FE51 CP 81 81=x-coordinate of safe in WACKER's study
23998 20C9 JR NZ,23945 Jump if ERIC didn't jump up to the safe
24000 2EEB LD L,235 HL=32747 (inventory)
24002 CB46 BIT 0,(HL) Has ERIC got the safe key?
24004 28C3 JR Z,23945 Jump if not
24006 2EDE LD L,222 HL=32734
24008 34 INC (HL)
24009 3EC8 LD A,200 Add 2000 to the score and print it
24011 CDB573 CALL 29621
24014 AF XOR A Print "ONTO THE NEXT YEAR" and ring bell
24015 CDDE7E CALL 32478
24018 212BDC LD HL,56363 Play the up-a-year tune
24021 CDA55F CALL 24485
24024 C3D5F6 JP 63189 Restart game