Routines |
Prev: 31338 | Up: Map | Next: 31413 |
Used by the routine at 25385. Makes a gangster start or continue chasing Sam if appropriate. Whether the gangster continues to chase Sam depends on Sam's and the gangster's locations relative to the two regions defined in the gangster's region definition table. If Sam has left the first region, the gangster gives up the chase and restarts his command list; if the gangster has already chased Sam to the boundary of the second region, he will stand on guard there; and if the gangster is close enough to Sam to pick him up, he will do so and move to the next command in the command list.
|
||||||||
31362 | CALL 25074 | Is the gangster close enough to Sam to pick him up? | ||||||
31365 | JP C,29149 | Jump if so | ||||||
31368 | CALL 63128 | Exit now if the gangster is midstride | ||||||
31371 | LD L,23 | Point HL at byte 23 of the gangster's buffer | ||||||
31373 | LD E,(HL) | Collect the command list start address in DE | ||||||
31374 | INC L | |||||||
31375 | LD D,(HL) | |||||||
31376 | LD B,H | B=gangster's character number | ||||||
31377 | LD HL,65526 | Point HL at the relevant table of region definitions (64780, 64806, 64836, 64868 or 64892) | ||||||
31380 | ADD HL,DE | |||||||
31381 | LD D,230 | 230=Sam | ||||||
31383 | CALL 29578 | Check whether Sam is inside the first region | ||||||
31386 | LD D,B | D=gangster's character number | ||||||
31387 | EX DE,HL | H=gangster's character number | ||||||
31388 | JP C,63198 | Restart the command list if Sam is outside the first region | ||||||
31391 | EX DE,HL | D=gangster's character number | ||||||
31392 | CALL 29578 | Check whether the gangster is inside the second region | ||||||
31395 | RET C | Return if he's outside the second region | ||||||
Sam is inside the first region, and the gangster hasn't reached the boundary of the second region, so the chase is still on.
|
||||||||
31396 | LD H,B | H=gangster's character number | ||||||
31397 | CALL 29072 | Set the gangster's destination to Sam's current location | ||||||
31400 | CALL 60812 | Determine the next move the gangster should make to reach Sam | ||||||
31403 | CP 5 | Is the gangster standing next to a closed door? | ||||||
31405 | JP NC,63100 | Jump if so | ||||||
31408 | AND A | Has the gangster reached his destination? | ||||||
31409 | RET Z | Return if so | ||||||
31410 | JP 63036 | Move the gangster one step closer to Sam |
Prev: 31338 | Up: Map | Next: 31413 |