1 /* NetHack 3.7 vision.h $NHDT-Date: 1596498568 2020/08/03 23:49:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.13 $ */ 2 /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef VISION_H 6 #define VISION_H 7 8 #define COULD_SEE 0x1 /* location could be seen, if it were lit */ 9 #define IN_SIGHT 0x2 /* location can be seen */ 10 #define TEMP_LIT 0x4 /* location is temporarily lit */ 11 12 /* 13 * Light source sources 14 */ 15 #define LS_OBJECT 0 16 #define LS_MONSTER 1 17 18 /* 19 * cansee() - Returns true if the hero can see the location. 20 * 21 * couldsee() - Returns true if the hero has a clear line of sight to 22 * the location. 23 */ 24 #define cansee(x, y) (g.viz_array[y][x] & IN_SIGHT) 25 #define couldsee(x, y) (g.viz_array[y][x] & COULD_SEE) 26 #define templit(x, y) (g.viz_array[y][x] & TEMP_LIT) 27 28 /* 29 * The following assume the monster is not blind. 30 * 31 * m_cansee() - Returns true if the monster can see the given location. 32 * 33 * m_canseeu() - Returns true if the monster could see the hero. Assumes 34 * that if the hero has a clear line of sight to the monster's 35 * location and the hero is visible, then monster can see the 36 * hero. 37 */ 38 #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2)) 39 40 #if 0 41 #define m_canseeu(m) \ 42 ((!Invis || perceives((m)->data)) \ 43 && !(Underwater || u.uburied || (m)->mburied) \ 44 && couldsee((m)->mx, (m)->my)) 45 #else /* without 'uburied' and 'mburied' */ 46 #define m_canseeu(m) \ 47 ((!Invis || perceives((m)->data)) \ 48 && !Underwater \ 49 && couldsee((m)->mx, (m)->my)) 50 #endif 51 52 /* 53 * Circle information 54 */ 55 #define MAX_RADIUS 16 /* this is in points from the source */ 56 57 /* Use this macro to get a list of distances of the edges (see vision.c). */ 58 #define circle_ptr(z) (&circle_data[(int) circle_start[z]]) 59 60 /* howmonseen() bitmask values */ 61 #define MONSEEN_NORMAL 0x0001 /* normal vision */ 62 #define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */ 63 #define MONSEEN_INFRAVIS 0x0004 /* via infravision */ 64 #define MONSEEN_TELEPAT 0x0008 /* via telepathy */ 65 #define MONSEEN_XRAYVIS 0x0010 /* via Xray vision */ 66 #define MONSEEN_DETECT 0x0020 /* via extended monster detection */ 67 #define MONSEEN_WARNMON 0x0040 /* via type-specific warning */ 68 69 #endif /* VISION_H */ 70