![]() |
Routines |
Prev: 28940 | Up: Map |
|
||||||||||
28942 | LD A,(32764) | Collect Sam's status flags from 32764 | ||||||||
28945 | DEC A | Now A=0 if Sam's being carried at the moment | ||||||||
28946 | AND A | Clear the carry flag, and set the zero flag if Sam's being carried | ||||||||
28947 | RET Z | Return with the carry flag reset if Sam's being carried | ||||||||
Sam is not being carried at the moment. Compare his x- and y-coordinates with those of the character chasing him.
|
||||||||||
28948 | LD L,2 | Point HL at byte 2 of the character's buffer | ||||||||
28950 | CALL 25944 | Collect Sam's x- and y-coordinates in E and D | ||||||||
28953 | NOP | |||||||||
28954 | LD A,(HL) | A=character's y-coordinate | ||||||||
28955 | INC A | Is the character more than one y-coordinate above or below Sam? | ||||||||
28956 | SUB D | |||||||||
28957 | CP 3 | |||||||||
28959 | RET NC | Return if so | ||||||||
28960 | DEC L | L=1 | ||||||||
28961 | LD A,(HL) | A=character's x-coordinate | ||||||||
28962 | DEC L | L=0 | ||||||||
28963 | BIT 7,(HL) | Is the character facing left? | ||||||||
28965 | JR Z,28969 | Jump if so | ||||||||
28967 | ADD A,2 | A=2+character's x-coordinate | ||||||||
28969 | SUB E | Is the character facing Sam and no more than two x-coordinates away from him? | ||||||||
28970 | CP 3 | |||||||||
28972 | RET NC | Return if not | ||||||||
The character is facing Sam, no more than one y-coordinate above or below him, and no more than two x-coordinates to the left or right of him. Now we compare the z-coordinates.
|
||||||||||
28973 | LD A,(58884) | A=Sam's z-coordinate | ||||||||
28976 | LD L,4 | Set the zero flag if the character's z-coordinate matches Sam's | ||||||||
28978 | CP (HL) | |||||||||
28979 | SCF | Return with the carry flag set if the character can pick up Sam at his current location | ||||||||
28980 | RET Z | |||||||||
The z-coordinates don't match. However, the character will still be able to pick up Sam if they are both standing at or near the open entrance to a building (one inside and the other outside).
|
||||||||||
28981 | PUSH HL | Save the character number briefly | ||||||||
28982 | LD H,230 | 230=Sam | ||||||||
28984 | CALL 60179 | Obtain descriptors for Sam's current location | ||||||||
28987 | POP HL | Restore the character number to H | ||||||||
28988 | CP 3 | Is Sam standing at the open entrance to a building? | ||||||||
28990 | JR Z,28979 | Jump if so (Sam can be picked up here) | ||||||||
28992 | PUSH HL | Save the character number briefly | ||||||||
28993 | CALL 60179 | Obtain descriptors for the character's current location | ||||||||
28996 | POP HL | Restore the character number to H | ||||||||
28997 | CP 3 | Is the character standing at the open entrance to a building? | ||||||||
28999 | JR Z,28979 | Jump if so (the character can pick Sam up here) | ||||||||
29001 | AND A | Clear the carry flag (Sam cannot be picked up) | ||||||||
29002 | RET |
Prev: 28940 | Up: Map |