Prev: 6CEC Up: Map Next: 6CFF
6CEE: Get the x-coordinate range within which a character can see or be seen
Used by the routines at 6D62 and 6D7D. Returns with C and B holding the lower and upper x-coordinates of the range within which the target character can see or be seen. This routine is called with H holding either (a) the character number of a teacher (to determine where kids must be in order to get lines), or (b) the character number of a kid (to determine where a teacher must be in order to give lines).
Input
H Target character's number
6CEE LD L,$02 Point HL at byte 0x02 of the character's buffer
6CF0 LD D,(HL) D=character's y-coordinate
6CF1 DEC L L=0x01
6CF2 LD E,(HL) E=character's x-coordinate
6CF3 LD C,$00 Prepare a lower limit of 0 in case E<10
6CF5 LD A,E A=X (character's x-coordinate)
6CF6 SUB $0A
6CF8 JR C,$6CFB
6CFA LD C,A C=max(0, X-10) (lower limit of the range)
6CFB ADD A,$14
6CFD LD B,A B=X+10 (upper limit of the range)
6CFE RET
Prev: 6CEC Up: Map Next: 6CFF