| Routines

29462: Deal with ERIC when he's standing on the saddle of the bike

Called by the routine at 63405 when bit 7 at 32749 is set (by the routine at 29278). Listens for and responds appropriately to keypresses while ERIC is standing on the saddle of the bike.
29462 | LD HL,32755 | 32755 holds ERIC's main action timer
29465 | DEC (HL) | Is it time to deal with ERIC yet?
29466 | RET NZ | Return if not
29467 | INC (HL) | Set ERIC's action timer to 1, ensuring that we pass through the following section of code on the next call to this routine if no keypress is detected this time
29468 | CALL 29178 | A=value from the keypress offset table corresponding to the key just pressed (if any)
29471 | RET Z | Return if no game key was pressed
29472 | LD HL,32755 | 32755 holds ERIC's main action timer
29475 | CP 114 | Was 'jump' pressed?
29477 | JR Z,29517 | Jump if so
29479 | SET 3,A | Ignore the difference between fast (upper case) and slow (lower case) keys when ERIC's on the bike
29481 | CP 92 | Was 'up' pressed?
29483 | JR Z,29517 | Jump if so
29485 | CP 94 | Was 'down' pressed?
29487 | RET NZ | Return if not
This entry point is used by the routine at 29574 when ERIC has just got on the bike.
29488 | LD (HL),5 | Reset ERIC's main action timer at 32755 to 5
29490 | LD L,237 | HL=32749 (ERIC's status flags)
29492 | LD (HL),1 | Set bit 0: ERIC is riding the bike
29494 | LD H,210 | 210=ERIC
29496 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
29499 | INC H | H=211: bike
29500 | CALL 25012 | Update the SRB for the bike's current animatory state and location
29503 | LD L,1 | Point HL at byte 1 of the bike's buffer
29505 | LD (HL),224 | Set the bike's x-coordinate to 224 (out of sight)
29507 | LD L,18 | Remove the address of the routine at 29194 from bytes 17 and 18 of the bike's buffer
29509 | LD (HL),0
29511 | DEC H | H=210: ERIC
29512 | SUB 12 | A=animatory state of ERIC riding the bike
29514 | JP 24880 | Update ERIC's animatory state and update the SRB
ERIC has tried to jump off the saddle of the bike. Check whether he has the frog and is underneath a cup.
29517 | LD H,210 | 210=ERIC
29519 | CALL 25012 | Update the SRB for ERIC's current animatory state and location
29522 | ADD A,2 | A=2 or 130
29524 | DEC D | Set D to the y-coordinate of the spot above ERIC's hand as he jumps from the saddle
29525 | DEC D
29526 | CALL 64474 | Prepare ERIC for his descent from the bike saddle
29529 | LD H,210 | 210=ERIC
29531 | XOR A |
29532 | LD L,A | Point HL at byte 0 of ERIC's buffer
29533 | BIT 7,(HL) | Is ERIC facing left?
29535 | JR Z,29539 | Jump if so
29537 | LD A,2 |
29539 | INC L | Point HL at byte 1 of ERIC's buffer
29540 | ADD A,(HL) | A=x-coordinate of ERIC's hand
29541 | LD E,A | Now DE=coordinates of the spot above ERIC's hand
29542 | LD HL,32747 | 32747 holds the inventory flags
29545 | BIT 2,(HL) | Has ERIC got the frog?
29547 | RET Z | Return if not
29548 | CALL 30216 | Is ERIC's arm directly underneath a cup?
29551 | RET NZ | Return if not
29552 | RES 2,(HL) | Signal: ERIC no longer has the frog
29554 | LD H,212 | 212=frog
29556 | LD A,28 | 28: frog sitting (as on the floor or in a cup)
29558 | DEC E | Set DE to the frog's new in-cup coordinates
29559 | LD D,11
29561 | CALL 24880 | Update the frog's animatory state and location and update the SRB
29564 | JP 62401 | Print the inventory and make a celebratory sound effect