| Routines

29149: Make a gangster or policeman pick Sam up

Used by the routines at 25081, 31362 and 31642.
Input
H | Character number (215-229)
29149 | XOR A | 32666 holds the ID of the telephone that Sam is calling; set this to 0, effectively making Sam hang up
29150 | LD (32666),A
29153 | LD L,0 | Point HL at byte 0 of the character's buffer
29155 | LD A,(HL) | A=character's animatory state
29156 | AND 112 | Discard bits 0-3 and 7
29158 | SUB 16 | 16: Is this character a policeman?
29160 | JR NZ,29165 | Jump if not
29162 | LD (32747),A | Clear all flags at 32747 (Sam is no longer wanted by the police, because he's just been arrested)
29165 | LD A,1 | Set bit 0 of Sam's status flags at 32764, indicating that he's being carried
29167 | LD (32764),A
29170 | BIT 0,(HL) | Is the character midstride?
29172 | CALL NZ,60506 | If so, move the character from the midstride position and update the SRB
29175 | CALL 59848 | Update the SRB for the character's current animatory state and location
29178 | ADD A,8 | A=animatory state of the character while carrying Sam
29180 | CALL 59861 | Update the character's animatory state and location and update the SRB
29183 | LD L,9 | Remove the address of the primary command routine from bytes 8 and 9 of the character's buffer, thus moving to the next command in the command list
29185 | LD (HL),0
29187 | LD HL,1 | Set Sam's main action timer (in byte 8 of his buffer) to 1, and his midstride/mid-action timer (in byte 9) to 0
29190 | LD (58888),HL
29193 | RET |