| Routines

31092: Make a female character stand on a chair or start jumping

The address of this uninterruptible subcommand routine is placed into bytes 17 and 18 of a female character's buffer by the routine at 31150 when there's a mouse in the vicinity. It makes the female character either stand on a chair (if there's one beside her) or start jumping up and down.
Input
H | Character number (183-189, 204 or 209)
31092 | LD L,17 | Replace the address of this routine in bytes 17 and 18 of the character's buffer with that of 31078
31094 | LD (HL),102
31096 | CALL 25012 | Update the SRB for the character's current animatory state and location
31099 | LD L,20 | Store the character's current animatory state in byte 20 of her buffer, so it can be restored when she's finished jumping
31101 | LD (HL),A
31102 | INC L | Initialise byte 21 to 0 on the assumption that there is no chair to stand on
31103 | LD (HL),0
31105 | DEC D | Jump up
31106 | PUSH DE |
31107 | LD L,0 | Pretend the character is facing left by resetting bit 7 of her animatory state (to make the chair check work)
31109 | RES 7,(HL)
31111 | CALL 26068 | Check whether this character is beside a chair
31114 | POP DE |
31115 | LD L,21 |
31117 | AND A | Is this character standing beside a chair?
31118 | JR NZ,31121 | Jump if not
31120 | INC (HL) | Set byte 21 to 1 to indicate that the character is standing on a chair
31121 | DEC L | Collect the character's original animatory state from byte 20
31122 | LD A,(HL)
31123 | AND 248 | A=character's base animatory state
31125 | JP 24880 | Update the character's animatory state and location and update the SRB