| Routines

29597: Check whether a gangster should start chasing Sam

Used by the routine at 31319. Returns with the carry flag reset if Sam is close enough (and not disguised well enough) that the gangster should start chasing him, and the appropriate command list offset in A.
Input
H | Gangster's character number (215-224)
29597 | CALL 28150 | Set A=1
29600 | DEC A | Set the zero flag
29601 | SCF | Set the carry flag
29602 | RET NZ | This return never happens
29603 | LD L,23 | Point HL at byte 23 of the gangster's buffer
29605 | LD E,(HL) | Collect the command list start address in DE
29606 | INC L
29607 | LD D,(HL)
29608 | LD B,H | B=gangster's character number
29609 | LD HL,65530 | Point HL at the second entry in the relevant table of region definitions at 64780, 64806, 64836, 64868 or 64892
29612 | ADD HL,DE
29613 | LD D,230 | 230=Sam
29615 | CALL 29578 | Is Sam inside the region?
29618 | JR C,29630 | Jump if not
29620 | LD A,(32713) | Collect the ID of Sam's current disguise (0-7) from 32713
29623 | CP (HL) | Compare it with the disguise ID in the region definition table
29624 | SCF | Set the carry flag
29625 | JR Z,29630 | Jump if Sam's current disguise matches (the gangster will let Sam pass)
29627 | INC HL | Collect the command list offset from the region definition table
29628 | LD A,(HL)
29629 | AND A | Clear the carry flag
29630 | LD H,B | H=gangster's character number
29631 | RET |