| Routines

31110: Make a character speak (1)

The address of this interruptible subcommand routine is placed into bytes 105 and 106 of a character's buffer by the routines at 31282, 31996 and 62464. The subcommand terminates if the character is off-screen; otherwise it waits for anybody else to stop speaking before printing the speech bubble above the character's head and handing over control to the routine at 31130.
Input
H | Character number (152-169)
31110 | LD L,110 | Zero out bytes 109 and 110 of the character's buffer, which normally hold the address of the next character in the submessage being spoken (when a character starts speaking, there is no submessage)
31112 | XOR A
31113 | LD (HL),A
31114 | DEC L
31115 | LD (HL),A
This entry point is used while the character is waiting for someone else to stop speaking.
31116 | CALL 29518 | Make the character start speaking if possible
31119 | JP C,25252 | Terminate this interruptible subcommand if the character is off-screen
31122 | LD L,105 | Set the interruptible subcommand routine address in bytes 105 and 106 of the character's buffer to the entry point at 31116
31124 | LD (HL),140
31126 | RET NZ | Return if somebody else is speaking at the moment
Now it's this character's turn to speak.
31127 | LD (HL),154 | Set the interruptible subcommand routine address in bytes 105 and 106 of the character's buffer to 31130
31129 | RET |