Routines
 Prev: 70D5 Up: Map Next: 710C
70D6: Check whether a character is visible to passers-by
Used by the routine at 7222. 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 (0xD7-0xE6)
70D6 LD L,\$04 Point HL at byte 0x04 of the character's buffer
70D8 BIT 0,(HL) Is the character indoors?
70DA RET Z Return with the zero flag set if not
The character is indoors, so examine his location more precisely.
70DB LD L,\$01 Point HL at byte 0x01 of the character's buffer
70DD LD A,(HL) A=x (character's x-coordinate)
70DE INC A A=INT((x+1)/8)
70DF AND \$F8
70E1 CP \$08 Return if 7<=x<=14 (the character is in the stairwell of the apartment building at the far left of town)
70E3 RET Z
70E4 CP \$88 Return if 135<=x<=142 (the character is in the stairwell of the police station)
70E6 RET Z
70E7 CP \$C0 Return if 191<=x<=198 (the character is in the stairwell of the apartment building next to no. 19)
70E9 RET Z
70EA CP \$18 Return if 23<=x<=30 (the character is on the catwalk)
70EC RET Z
The character is neither on the catwalk, nor in a stairwell that is visible from outside.
70ED LD A,(HL) A=x (the character's x-coordinate)
70EE DEC L L=0x00 (this should be 'INC L', so that HL points at the character's y-coordinate)
70EF CP \$38 Jump if x<56 (the character is in no. 74 or the apartment building next to it)
70F1 JR C,\$7102
70F3 CP \$68 Return with the zero flag reset if 56<=x<=103 (the character is in the hotel, whose roof is inaccessible)
70F5 RET C
70F6 CP \$7B Jump if 104<=x<=122 (the character is in no. 31)
70F8 JR C,\$7106
70FA CP \$CF Jump if 123<=x<=206 (the character is in the police station, no. 27 or the apartment building next to no. 19)
70FC JR C,\$7102
70FE CP \$DE Jump if 207<=x<=221 (the character is in no. 19)
7100 JR C,\$7106
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.
7102 LD A,\$08 If the character's y-coordinate is greater than this, he's inside (as opposed to on the roof)
7104 JR \$7108
If we get here, then the character is in no. 31 or no. 19.
7106 LD A,\$0E 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.
7108 CP (HL) Compare A (8 or 14) with the character's animatory state
7109 RET C Return with the zero flag reset if A is smaller
710A XOR A Set the zero flag (the character is visible)
710B RET
 Prev: 70D5 Up: Map Next: 710C