Prev: 62464 Up: Map Next: 62571
62495: Deal with ERIC when he's firing the catapult
Used by the routine at 27353 when bit 0 of ERIC's status flags at 32763 is set (by the routine at 62574).
Input
Output
62495 LD HL,32758 32758 holds the catapult-firing action timer (initially 24)
62498 DEC (HL) Has ERIC finished firing the catapult?
62499 JR NZ,62516 Jump if not
This entry point is used by the routines at 62628 and 62771 to restore ERIC's animatory state to what it was before he jumped or threw a punch.
62501 XOR A Clear all of ERIC's status flags at 32763
62502 LD (32763),A
62505 LD H,172 172=ERIC
62507 CALL 25108 Update the SRB for ERIC's current animatory state
62510 LD L,102 Restore ERIC's animatory state to what it was before he fired the catapult, jumped, or threw the punch
62512 LD A,(HL)
62513 JP 25008 Update ERIC's animatory state and location and update the SRB
ERIC hasn't finished firing the catapult. Check which phase of the firing action we're at.
62516 LD A,(HL) Pick up the current value of the action timer in A
62517 LD H,172 172=ERIC
62519 CP 18 Is it time to raise the catapult to eye level?
62521 JP Z,28737 Jump if so
62524 CP 6 Is it time to start lowering the catapult?
62526 JP Z,28779 Jump if so
62529 CP 12 Is it time to launch the pellet?
62531 RET NZ Return if not
It's time to launch the catapult pellet.
62532 LD L,96 Byte 96 of ERIC's buffer holds his animatory state
62534 LD A,(HL) Pick this up in A
62535 OR 127 A=127 or 255 (catapult pellet)
62537 INC L Pick up ERIC's coordinates in DE; they will be the initial coordinates of the catapult pellet
62538 LD D,(HL)
62539 INC L
62540 LD E,(HL)
62541 DEC H H=171 (ERIC's catapult pellet)
62542 CALL 28759 Launch the catapult pellet
62545 CALL 65141 Play the catapult sound effect
62548 LD B,13 Reprimand message 13: CATAPULTS ARE FORBIDDEN
This entry point is used by the routines at 62628 (with B=14: DON'T HIT YOUR MATES) and 62771 (with B=15: YOU ARE NOT A KANGAROO).
62550 LD H,172 172=ERIC
62552 PUSH BC Save the reprimand message identifier
62553 CALL 28220 Check whether any teachers saw ERIC throw a punch, fire his catapult, or jump
62556 POP BC Restore the reprimand message identifier to B
62557 RET NC Return if ERIC wasn't seen by a teacher
62558 EXX
62559 LD L,97 Byte 97 of the teacher's buffer holds his y-coordinate
62561 LD D,(HL) Pick up the coordinates of the teacher who saw ERIC in DE'
62562 INC L
62563 LD E,(HL)
62564 PUSH DE
62565 EXX
62566 POP DE Now DE holds the coordinates of the teacher who saw ERIC
62567 LD A,H A=172 (ERIC)
62568 JP 30464 Make the teacher give ERIC lines
Prev: 62464 Up: Map Next: 62571