Routines
 Prev: 28885 Up: Map Next: 28940
28886: Check whether a character is visible to passers-by
Used by the routine at 29218. Returns with the zero flag set if the character is not inside any building, or is in the stairwell of the police station or one of the apartment buildings, or is on the catwalk, or is on the roof of a building.
Input
H Character number (215-230)
28886 LD L,4 Point HL at byte 4 of the character's buffer
28888 BIT 0,(HL) Is the character indoors?
28890 RET Z Return with the zero flag set if not
The character is indoors, so examine his location more precisely.
28891 LD L,1 Point HL at byte 1 of the character's buffer
28893 LD A,(HL) A=x (character's x-coordinate)
28894 INC A A=INT((x+1)/8)
28895 AND 248
28897 CP 8 Return if 7<=x<=14 (the character is in the stairwell of the apartment building at the far left of town)
28899 RET Z
28900 CP 136 Return if 135<=x<=142 (the character is in the stairwell of the police station)
28902 RET Z
28903 CP 192 Return if 191<=x<=198 (the character is in the stairwell of the apartment building next to no. 19)
28905 RET Z
28906 CP 24 Return if 23<=x<=30 (the character is on the catwalk)
28908 RET Z
The character is neither on the catwalk, nor in a stairwell that is visible from outside.
28909 LD A,(HL) A=x (the character's x-coordinate)
28910 DEC L L=0 (this should be 'INC L', so that HL points at the character's y-coordinate)
28911 CP 56 Jump if x<56 (the character is in no. 74 or the apartment building next to it)
28913 JR C,28930
28915 CP 104 Return with the zero flag reset if 56<=x<=103 (the character is in the hotel, whose roof is inaccessible)
28917 RET C
28918 CP 123 Jump if 104<=x<=122 (the character is in no. 31)
28920 JR C,28934
28922 CP 207 Jump if 123<=x<=206 (the character is in the police station, no. 27 or the apartment building next to no. 19)
28924 JR C,28930
28926 CP 222 Jump if 207<=x<=221 (the character is in no. 19)
28928 JR C,28934
If we get here, then the character is in the apartment building at the far left of town, no. 74, the police station, no. 27, the apartment building next to no. 19, no. 17, or no. 15.
28930 LD A,8 If the character's y-coordinate is greater than this, he's inside (as opposed to on the roof)
28932 JR 28936
If we get here, then the character is in no. 31 or no. 19.
28934 LD A,14 If the character's y-coordinate is greater than this, he's inside (as opposed to on the roof)
The next instruction is supposed to compare A with the character's y-coordinate to see whether he's on the roof of a building (as opposed to inside it), but because of the erroneous 'DEC L' instruction above, it instead compares A with the character's animatory state. This is a bug.
28936 CP (HL) Compare A (8 or 14) with the character's animatory state
28937 RET C Return with the zero flag reset if A is smaller
28938 XOR A Set the zero flag (the character is visible)
28939 RET
 Prev: 28885 Up: Map Next: 28940