Source:NetHack 5.0.0/include/vision.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to vision.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/include/vision.h#line12]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1. /* NetHack 5.0	vision.h	$NHDT-Date: 1666478832 2022/10/22 22:47:12 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.15 $ */
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. enum ls_sources {
16.     LS_NONE = 0,
17.     LS_OBJECT = 1,
18.     LS_MONSTER = 2,
19.     NUM_LS_SOURCES
20. };
21. 
22. /*
23.  *  cansee()    - Returns true if the hero can see the location.
24.  *
25.  *  couldsee()  - Returns true if the hero has a clear line of sight to
26.  *                the location.
27.  */
28. #define cansee(x, y) ((gv.viz_array[y][x] & IN_SIGHT) != 0)
29. #define couldsee(x, y) ((gv.viz_array[y][x] & COULD_SEE) != 0)
30. #define templit(x, y) ((gv.viz_array[y][x] & TEMP_LIT) != 0)
31. 
32. /*
33.  *  The following assume the monster is not blind.
34.  *
35.  *  m_cansee()  - Returns true if the monster can see the given location.
36.  *
37.  *  m_canseeu() - Returns true if the monster could see the hero.  Assumes
38.  *                that if the hero has a clear line of sight to the monster's
39.  *                location and the hero is visible, then monster can see the
40.  *                hero.
41.  */
42. #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2))
43. 
44. #if 0
45. #define m_canseeu(m) \
46.     ((!Invis || perceives((m)->data))                      \
47.      && !(Underwater || u.uburied || (m)->mburied)         \
48.      && couldsee((m)->mx, (m)->my))
49. #else   /* without 'uburied' and 'mburied' */
50. #define m_canseeu(m) \
51.     ((!Invis || perceives((m)->data))                      \
52.      && !Underwater                                        \
53.      && couldsee((m)->mx, (m)->my))
54. #endif
55. 
56. /*
57.  *  Circle information
58.  */
59. #define MAX_RADIUS 15 /* this is in points from the source */
60. 
61. /* Use this macro to get a list of distances of the edges (see vision.c). */
62. #define circle_ptr(z) (&circle_data[(int) circle_start[z]])
63. 
64. /* howmonseen() bitmask values */
65. #define MONSEEN_NORMAL   0x0001 /* normal vision */
66. #define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */
67. #define MONSEEN_INFRAVIS 0x0004 /* via infravision */
68. #define MONSEEN_TELEPAT  0x0008 /* via telepathy */
69. #define MONSEEN_XRAYVIS  0x0010 /* via Xray vision */
70. #define MONSEEN_DETECT   0x0020 /* via extended monster detection */
71. #define MONSEEN_WARNMON  0x0040 /* via type-specific warning */
72. 
73. #endif /* VISION_H */