Difference between revisions of "Source:NetHack 3.6.0/include/vision.h"

From NetHackWiki
Jump to navigation Jump to search
(Created page with "__MIXEDSYNTAXHIGHLIGHT__ Below is the full text to '''vision.h''' from the source code of NetHack 3.6.0. To link to a particular line, write...")
 
 
Line 3: Line 3:
  
 
{{NGPL}}
 
{{NGPL}}
  <span id="line1">1.   /* NetHack 3.6 vision.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $  $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */</span>
+
  <span id="line1">1. /* NetHack 3.6 vision.h $NHDT-Date: 1432512777 2015/05/25 00:12:57 $  $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */</span>
  <span id="line2">2.   /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */</span>
+
  <span id="line2">2. /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */</span>
  <span id="line3">3.   /* NetHack may be freely redistributed.  See license for details. */</span>
+
  <span id="line3">3. /* NetHack may be freely redistributed.  See license for details. */</span>
  <span id="line4">4.   </span>
+
  <span id="line4">4. </span>
  <span id="line5">5.   #ifndef VISION_H</span>
+
  <span id="line5">5. #ifndef VISION_H</span>
  <span id="line6">6.   #define VISION_H</span>
+
  <span id="line6">6. #define VISION_H</span>
  <span id="line7">7.   </span>
+
  <span id="line7">7. </span>
  <span id="line8">8.   #if 0 /* (moved to decl.h) */</span>
+
  <span id="line8">8. #if 0 /* (moved to decl.h) */</span>
  <span id="line9">9.   extern boolean vision_full_recalc; /* TRUE if need vision recalc */</span>
+
  <span id="line9">9. extern boolean vision_full_recalc; /* TRUE if need vision recalc */</span>
  <span id="line10">10.   extern char **viz_array; /* could see/in sight row pointers */</span>
+
  <span id="line10">10. extern char **viz_array; /* could see/in sight row pointers */</span>
  <span id="line11">11.   extern char *viz_rmin; /* min could see indices */</span>
+
  <span id="line11">11. extern char *viz_rmin; /* min could see indices */</span>
  <span id="line12">12.   extern char *viz_rmax; /* max could see indices */</span>
+
  <span id="line12">12. extern char *viz_rmax; /* max could see indices */</span>
  <span id="line13">13.   #endif</span>
+
  <span id="line13">13. #endif</span>
  <span id="line14">14.   #define COULD_SEE 0x1 /* location could be seen, if it were lit */</span>
+
  <span id="line14">14. #define COULD_SEE 0x1 /* location could be seen, if it were lit */</span>
  <span id="line15">15.   #define IN_SIGHT 0x2  /* location can be seen */</span>
+
  <span id="line15">15. #define IN_SIGHT 0x2  /* location can be seen */</span>
  <span id="line16">16.   #define TEMP_LIT 0x4  /* location is temporarily lit */</span>
+
  <span id="line16">16. #define TEMP_LIT 0x4  /* location is temporarily lit */</span>
  <span id="line17">17.   </span>
+
  <span id="line17">17. </span>
  <span id="line18">18.   /*</span>
+
  <span id="line18">18. /*</span>
  <span id="line19">19.   * Light source sources</span>
+
  <span id="line19">19.  * Light source sources</span>
  <span id="line20">20.   */</span>
+
  <span id="line20">20.  */</span>
  <span id="line21">21.   #define LS_OBJECT 0</span>
+
  <span id="line21">21. #define LS_OBJECT 0</span>
  <span id="line22">22.   #define LS_MONSTER 1</span>
+
  <span id="line22">22. #define LS_MONSTER 1</span>
  <span id="line23">23.   </span>
+
  <span id="line23">23. </span>
  <span id="line24">24.   /*</span>
+
  <span id="line24">24. /*</span>
  <span id="line25">25.   *  cansee() - Returns true if the hero can see the location.</span>
+
  <span id="line25">25.  *  cansee() - Returns true if the hero can see the location.</span>
  <span id="line26">26.   *</span>
+
  <span id="line26">26.  *</span>
  <span id="line27">27.   *  couldsee() - Returns true if the hero has a clear line of sight to</span>
+
  <span id="line27">27.  *  couldsee() - Returns true if the hero has a clear line of sight to</span>
  <span id="line28">28.   *   the location.</span>
+
  <span id="line28">28.  *   the location.</span>
  <span id="line29">29.   */</span>
+
  <span id="line29">29.  */</span>
  <span id="line30">30.   #define cansee(x, y) (viz_array[y][x] & IN_SIGHT)</span>
+
  <span id="line30">30. #define cansee(x, y) (viz_array[y][x] & IN_SIGHT)</span>
  <span id="line31">31.   #define couldsee(x, y) (viz_array[y][x] & COULD_SEE)</span>
+
  <span id="line31">31. #define couldsee(x, y) (viz_array[y][x] & COULD_SEE)</span>
  <span id="line32">32.   #define templit(x, y) (viz_array[y][x] & TEMP_LIT)</span>
+
  <span id="line32">32. #define templit(x, y) (viz_array[y][x] & TEMP_LIT)</span>
  <span id="line33">33.   </span>
+
  <span id="line33">33. </span>
  <span id="line34">34.   /*</span>
+
  <span id="line34">34. /*</span>
  <span id="line35">35.   *  The following assume the monster is not blind.</span>
+
  <span id="line35">35.  *  The following assume the monster is not blind.</span>
  <span id="line36">36.   *</span>
+
  <span id="line36">36.  *</span>
  <span id="line37">37.   *  m_cansee() - Returns true if the monster can see the given location.</span>
+
  <span id="line37">37.  *  m_cansee() - Returns true if the monster can see the given location.</span>
  <span id="line38">38.   *</span>
+
  <span id="line38">38.  *</span>
  <span id="line39">39.   *  m_canseeu() - Returns true if the monster could see the hero.  Assumes</span>
+
  <span id="line39">39.  *  m_canseeu() - Returns true if the monster could see the hero.  Assumes</span>
  <span id="line40">40.   *   that if the hero has a clear line of sight to the monster's</span>
+
  <span id="line40">40.  *   that if the hero has a clear line of sight to the monster's</span>
  <span id="line41">41.   *   location and the hero is visible, then monster can see the</span>
+
  <span id="line41">41.  *   location and the hero is visible, then monster can see the</span>
  <span id="line42">42.   *   hero.</span>
+
  <span id="line42">42.  *   hero.</span>
  <span id="line43">43.   */</span>
+
  <span id="line43">43.  */</span>
  <span id="line44">44.   #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2))</span>
+
  <span id="line44">44. #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2))</span>
  <span id="line45">45.   </span>
+
  <span id="line45">45. </span>
  <span id="line46">46.   #define m_canseeu(m)                                      \</span>
+
  <span id="line46">46. #define m_canseeu(m)                                      \</span>
  <span id="line47">47.       ((!Invis || perceives((m)->data))                      \</span>
+
  <span id="line47">47.     ((!Invis || perceives((m)->data))                      \</span>
  <span id="line48">48.               && !(Underwater || u.uburied || (m)->mburied) \</span>
+
  <span id="line48">48.             && !(Underwater || u.uburied || (m)->mburied) \</span>
  <span id="line49">49.           ? couldsee((m)->mx, (m)->my)                      \</span>
+
  <span id="line49">49.         ? couldsee((m)->mx, (m)->my)                      \</span>
  <span id="line50">50.           : 0)</span>
+
  <span id="line50">50.         : 0)</span>
  <span id="line51">51.   </span>
+
  <span id="line51">51. </span>
  <span id="line52">52.   /*</span>
+
  <span id="line52">52. /*</span>
  <span id="line53">53.   *  Circle information</span>
+
  <span id="line53">53.  *  Circle information</span>
  <span id="line54">54.   */</span>
+
  <span id="line54">54.  */</span>
  <span id="line55">55.   #define MAX_RADIUS 15 /* this is in points from the source */</span>
+
  <span id="line55">55. #define MAX_RADIUS 15 /* this is in points from the source */</span>
  <span id="line56">56.   </span>
+
  <span id="line56">56. </span>
  <span id="line57">57.   /* Use this macro to get a list of distances of the edges (see vision.c). */</span>
+
  <span id="line57">57. /* Use this macro to get a list of distances of the edges (see vision.c). */</span>
  <span id="line58">58.   #define circle_ptr(z) (&circle_data[(int) circle_start[z]])</span>
+
  <span id="line58">58. #define circle_ptr(z) (&circle_data[(int) circle_start[z]])</span>
  <span id="line59">59.   </span>
+
  <span id="line59">59. </span>
  <span id="line60">60.   /* howmonseen() bitmask values */</span>
+
  <span id="line60">60. /* howmonseen() bitmask values */</span>
  <span id="line61">61.   #define MONSEEN_NORMAL 0x0001  /* normal vision */</span>
+
  <span id="line61">61. #define MONSEEN_NORMAL 0x0001  /* normal vision */</span>
  <span id="line62">62.   #define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */</span>
+
  <span id="line62">62. #define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */</span>
  <span id="line63">63.   #define MONSEEN_INFRAVIS 0x0004 /* via infravision */</span>
+
  <span id="line63">63. #define MONSEEN_INFRAVIS 0x0004 /* via infravision */</span>
  <span id="line64">64.   #define MONSEEN_TELEPAT 0x0008  /* via telepathy */</span>
+
  <span id="line64">64. #define MONSEEN_TELEPAT 0x0008  /* via telepathy */</span>
  <span id="line65">65.   #define MONSEEN_XRAYVIS 0x0010  /* via Xray vision */</span>
+
  <span id="line65">65. #define MONSEEN_XRAYVIS 0x0010  /* via Xray vision */</span>
  <span id="line66">66.   #define MONSEEN_DETECT 0x0020  /* via extended monster detection */</span>
+
  <span id="line66">66. #define MONSEEN_DETECT 0x0020  /* via extended monster detection */</span>
  <span id="line67">67.   #define MONSEEN_WARNMON 0x0040  /* via type-specific warning */</span>
+
  <span id="line67">67. #define MONSEEN_WARNMON 0x0040  /* via type-specific warning */</span>
  <span id="line68">68.   </span>
+
  <span id="line68">68. </span>
  <span id="line69">69.   #endif /* VISION_H */</span>
+
  <span id="line69">69. #endif /* VISION_H */</span>
 
[[Category:NetHack 3.6.0 source code|include/vision.h]]
 
[[Category:NetHack 3.6.0 source code|include/vision.h]]

Latest revision as of 13:44, 15 December 2015

Below is the full text to vision.h from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/include/vision.h#line123]], 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.

 /* NetHack 3.6	vision.h	$NHDT-Date: 1432512777 2015/05/25 00:12:57 $  $NHDT-Branch: master $:$NHDT-Revision: 1.9 $ */
 /* Copyright (c) Dean Luick, with acknowledgements to Dave Cohrs, 1990. */
 /* NetHack may be freely redistributed.  See license for details.	*/
 
 #ifndef VISION_H
 #define VISION_H
 
 #if 0 /* (moved to decl.h) */
 extern boolean vision_full_recalc;	/* TRUE if need vision recalc */
 extern char **viz_array;		/* could see/in sight row pointers */
 extern char *viz_rmin;			/* min could see indices */
 extern char *viz_rmax;			/* max could see indices */
 #endif
 #define COULD_SEE 0x1 /* location could be seen, if it were lit */
 #define IN_SIGHT 0x2  /* location can be seen */
 #define TEMP_LIT 0x4  /* location is temporarily lit */
 
 /*
  * Light source sources
  */
 #define LS_OBJECT 0
 #define LS_MONSTER 1
 
 /*
  *  cansee()	- Returns true if the hero can see the location.
  *
  *  couldsee()	- Returns true if the hero has a clear line of sight to
  *		  the location.
  */
 #define cansee(x, y) (viz_array[y][x] & IN_SIGHT)
 #define couldsee(x, y) (viz_array[y][x] & COULD_SEE)
 #define templit(x, y) (viz_array[y][x] & TEMP_LIT)
 
 /*
  *  The following assume the monster is not blind.
  *
  *  m_cansee()	- Returns true if the monster can see the given location.
  *
  *  m_canseeu() - Returns true if the monster could see the hero.  Assumes
  *		  that if the hero has a clear line of sight to the monster's
  *		  location and the hero is visible, then monster can see the
  *		  hero.
  */
 #define m_cansee(mtmp, x2, y2) clear_path((mtmp)->mx, (mtmp)->my, (x2), (y2))
 
 #define m_canseeu(m)                                       \
     ((!Invis || perceives((m)->data))                      \
              && !(Underwater || u.uburied || (m)->mburied) \
          ? couldsee((m)->mx, (m)->my)                      \
          : 0)
 
 /*
  *  Circle information
  */
 #define MAX_RADIUS 15 /* this is in points from the source */
 
 /* Use this macro to get a list of distances of the edges (see vision.c). */
 #define circle_ptr(z) (&circle_data[(int) circle_start[z]])
 
 /* howmonseen() bitmask values */
 #define MONSEEN_NORMAL 0x0001   /* normal vision */
 #define MONSEEN_SEEINVIS 0x0002 /* seeing invisible */
 #define MONSEEN_INFRAVIS 0x0004 /* via infravision */
 #define MONSEEN_TELEPAT 0x0008  /* via telepathy */
 #define MONSEEN_XRAYVIS 0x0010  /* via Xray vision */
 #define MONSEEN_DETECT 0x0020   /* via extended monster detection */
 #define MONSEEN_WARNMON 0x0040  /* via type-specific warning */
 
 #endif /* VISION_H */