Source:NetHack 3.4.3/include/vision.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/vision.h from NetHack 3.4.3. To link to a particular line, write [[vision.h#line123]], for example.

  1. /*	SCCS Id: @(#)vision.h	3.4	1995/01/26	*/
  2. /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
  3. /* NetHack may be freely redistributed.  See license for details.	*/

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. #ifndef VISION_H
  2. #define VISION_H
  3.  
  4. #if 0	/* (moved to decl.h) */
  5. extern boolean vision_full_recalc;	/* TRUE if need vision recalc */
  6. extern char **viz_array;		/* could see/in sight row pointers */
  7. extern char *viz_rmin;			/* min could see indices */
  8. extern char *viz_rmax;			/* max could see indices */
  9. #endif
  10. #define COULD_SEE 0x1		/* location could be seen, if it were lit */
  11. #define IN_SIGHT  0x2		/* location can be seen */
  12. #define TEMP_LIT  0x4		/* location is temporarily lit */
  13.  
  14. /*
  15. * Light source sources
  16. */
  17. #define LS_OBJECT 0
  18. #define LS_MONSTER 1
  19.  
  20. /*
  21. *  cansee()	- Returns true if the hero can see the location.
  22. *
  23. *  couldsee()	- Returns true if the hero has a clear line of sight to
  24. *		  the location.
  25. */
  26. #define cansee(x,y)	(viz_array[y][x] & IN_SIGHT)
  27. #define couldsee(x,y)	(viz_array[y][x] & COULD_SEE)
  28. #define templit(x,y)	(viz_array[y][x] & TEMP_LIT)
  29.  
  30. /*
  31. *  The following assume the monster is not blind.
  32. *
  33. *  m_cansee()	- Returns true if the monster can see the given location.
  34. *
  35. *  m_canseeu() - Returns true if the monster could see the hero.  Assumes
  36. *		  that if the hero has a clear line of sight to the monster's
  37. *		  location and the hero is visible, then monster can see the
  38. *		  hero.
  39. */
  40. #define m_cansee(mtmp,x2,y2)	clear_path((mtmp)->mx,(mtmp)->my,(x2),(y2))
  41.  
  42. #define m_canseeu(m)	((!Invis || perceives((m)->data)) && \
  43. 			  !(Underwater || u.uburied || (m)->mburied) ? \
  44. 			     couldsee((m)->mx,(m)->my) : 0)
  45.  
  46. /*
  47. *  Circle information
  48. */
  49. #define MAX_RADIUS 15	/* this is in points from the source */
  50.  
  51. /* Use this macro to get a list of distances of the edges (see vision.c). */
  52. #define circle_ptr(z) (&circle_data[(int)circle_start[z]])
  53.  
  54. #endif /* VISION_H */