Source:NetHack 3.3.0/hack.h

Below is the full text to hack.h from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/hack.h#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)hack.h	3.3	1999/07/02	*/ 2.   /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3.    /* NetHack may be freely redistributed. See license for details. */ 4.     5.    #ifndef HACK_H 6.   #define HACK_H 7.    8.    #ifndef CONFIG_H 9.   #include "config.h"  10. #endif 11.   12.   /*	For debugging beta code. */ 13.   #ifdef BETA 14.  #define Dpline	pline 15.  #endif 16.   17.   #define TELL		1 18.  #define NOTELL		0 19.  #define ON		1 20.  #define OFF		0 21.  #define BOLT_LIM	8 /* from this distance ranged attacks will be made */ 22.  #define MAX_CARR_CAP	1000	/* so that boulders can be heavier */ 23.  #define DUMMY { 0 } 24.   25.   /* symbolic names for capacity levels */ 26.  #define UNENCUMBERED	0 27.  #define SLT_ENCUMBER	1 28.  #define MOD_ENCUMBER	2 29.  #define HVY_ENCUMBER	3 30.  #define EXT_ENCUMBER	4 31.  #define OVERLOADED	5 32.   33.   /* Macros for how a rumor was delivered in outrumor */ 34.  #define BY_ORACLE	0 35.  #define BY_COOKIE	1 36.  #define BY_PAPER	2 37.  #define BY_OTHER	9 38.   39.   #ifdef STEED 40.  /* Macros for why you are no longer riding */ 41.  #define DISMOUNT_GENERIC	0 42.  #define DISMOUNT_FELL		1 43.  #define DISMOUNT_THROWN		2 44.  #define DISMOUNT_POLY		3 45.  #define DISMOUNT_ENGULFED	4 46.  #define DISMOUNT_BYCHOICE	5 47.  #endif 48.   49.   /*  50.    * This is the way the game ends. If these are rearranged, the arrays 51.   * in end.c and topten.c will need to be changed. Some parts of the 52.   * code assume that PANIC separates the deaths from the non-deaths. 53.   */  54.   #define DIED		 0 55.  #define CHOKING		 1 56.  #define POISONING	 2 57.  #define STARVING	 3 58.  #define DROWNING	 4 59.  #define BURNING		 5 60.  #define DISSOLVED	 6 61.  #define CRUSHING	 7 62.  #define STONING		 8 63.  #define TURNED_SLIME	 9 64.  #define GENOCIDED	10 65.  #define PANICKED	11 66.  #define TRICKED		12 67.  #define QUIT		13 68.  #define ESCAPED		14 69.  #define ASCENDED	15 70.   71.   #include "align.h"  72. #include "dungeon.h" 73. #include "monsym.h" 74. #include "mkroom.h" 75. #include "objclass.h" 76. #include "youprop.h" 77. #include "wintype.h" 78. #include "decl.h" 79. #include "timeout.h" 80. 81.  NEARDATA extern coord bhitpos;	/* place where throw or zap hits or stops */ 82.   83.   /* types of calls to bhit */ 84.  #define ZAPPED_WAND	0 85.  #define THROWN_WEAPON	1 86.  #define KICKED_WEAPON	2 87.  #define FLASHED_LIGHT	3 88.  #define INVIS_BEAM	4 89.   90.   #include "trap.h"  91. #include "flag.h" 92. #include "rm.h" 93. #include "vision.h" 94. #include "display.h" 95. #include "engrave.h" 96. #include "rect.h" 97. #include "region.h" 98. 99.  #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */ 100. #undef NDECL 101. #define NDECL(f) f 102. #endif 103.  104.  #include "extern.h"  105. #include "winprocs.h" 106. 107. #ifdef USE_TRAMPOLI 108. #include "wintty.h"  109. #undef WINTTY_H 110. #include "trampoli.h"  111. #undef EXTERN_H 112. #include "extern.h"  113. #endif /* USE_TRAMPOLI */ 114.  115.  #define NO_SPELL	0 116.  117.  /* flags to control makemon */ 118. #define NO_MM_FLAGS	  0x00	/* use this rather than plain 0 */ 119. #define NO_MINVENT	  0x01	/* suppress minvent when creating mon */ 120. #define MM_NOWAIT	  0x02	/* don't set STRAT_WAITMASK flags */ 121. #define MM_EDOG		  0x04	/* add edog structure */ 122. #define MM_EMIN		  0x08	/* add emin structure */ 123. #define MM_ANGRY	  0x10  /* monster is created angry */ 124.  125.  /* flags to control query_objlist */ 126. #define BY_NEXTHERE	  0x1	/* follow objlist by nexthere field */ 127. #define AUTOSELECT_SINGLE 0x2	/* if only 1 object, don't ask */ 128. #define USE_INVLET	  0x4	/* use object's invlet */ 129. #define INVORDER_SORT	  0x8	/* sort objects by packorder */ 130. #define SIGNAL_NOMENU	  0x10	/* return -1 rather than 0 if none allowed */ 131.  132.  /* Flags to control query_category */ 133. /* BY_NEXTHERE used by query_category too, so skip 0x01 */ 134. #define UNPAID_TYPES 0x02 135. #define GOLD_TYPES   0x04 136. #define WORN_TYPES   0x08 137. #define ALL_TYPES    0x10 138. #define BILLED_TYPES 0x20 139. #define CHOOSE_ALL   0x40 140. #define ALL_TYPES_SELECTED -2 141.  142.  /*** some utility macros ***/ 143. #define yn(query) yn_function(query,ynchars, 'n') 144. #define ynq(query) yn_function(query,ynqchars, 'q') 145. #define ynaq(query) yn_function(query,ynaqchars, 'y') 146. #define nyaq(query) yn_function(query,ynaqchars, 'n') 147. #define nyNaq(query) yn_function(query,ynNaqchars, 'n') 148. #define ynNaq(query) yn_function(query,ynNaqchars, 'y') 149.  150.  /* Macros for scatter */ 151. #define VIS_EFFECTS	0x01	/* display visual effects */ 152. #define MAY_HITMON	0x02	/* objects may hit monsters */ 153. #define MAY_HITYOU	0x04	/* objects may hit you */ 154. #define MAY_HIT		(MAY_HITMON|MAY_HITYOU) 155. #define MAY_DESTROY	0x08	/* objects may be destroyed at random */ 156. #define MAY_FRACTURE	0x10	/* boulders & statues may fracture */ 157.  158.  /* Macros for launching objects */ 159. #define ROLL	1 160. #define FLING	2 161.  162.  /* Flags to control menus */ 163. #define MENUTYPELEN sizeof("traditional ") 164. #define MENU_TRADITIONAL 0 165. #define MENU_COMBINATION 1 166. #define MENU_PARTIAL	 2 167. #define MENU_FULL	 3 168.  169.  #define MENU_SELECTED	TRUE 170. #define MENU_UNSELECTED FALSE 171.  172.  #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \  173.  	((unsigned long)minor << 16) | \  174.  	((unsigned long)patch << 8) | \  175.  	((unsigned long)0)) 176.  177.  #define FEATURE_NOTICE_VER_MAJ	  (flags.suppress_alert >> 24) 178. #define FEATURE_NOTICE_VER_MIN	  (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16) 179. #define FEATURE_NOTICE_VER_PATCH  (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >>  8) 180.  181.  #ifndef max 182. #define max(a,b) ((a) > (b) ? (a) : (b)) 183. #endif 184. #ifndef min 185. #define min(x,y) ((x) < (y) ? (x) : (y)) 186. #endif 187. #define plur(x) (((x) == 1) ? "" : "s") 188.  189.  #define ARM_BONUS(obj)	(objects[(obj)->otyp].a_ac + (obj)->spe \  190.  			 - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac)) 191.  192.  #define makeknown(x)	discover_object((x),TRUE,TRUE) 193. #define distu(xx,yy)	dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 194. #define onlineu(xx,yy)	online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 195.  196.  #define rn1(x,y)	(rn2(x)+(y)) 197.  198.  /* negative armor class is randomly weakened to prevent invulnerability */ 199. #define AC_VALUE(AC)	((AC) >= 0 ? (AC) : -rnd(-(AC))) 200.  201.  #if defined(MICRO) && !defined(__DJGPP__) 202. #define getuid 1 203. #define getlogin ((char *)0) 204. #endif /* MICRO */ 205.  206.  #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB)) 207. # define USE_OVLx 208. # define STATIC_DCL extern 209. # define STATIC_OVL 210. # ifdef OVLB 211. #  define STATIC_VAR 212. # else 213. #  define STATIC_VAR extern 214. # endif 215.  216.  #else	/* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */ 217. # define STATIC_DCL static 218. # define STATIC_OVL static 219. # define STATIC_VAR static 220.  221.  /* If not compiling an overlay, compile everything. */ 222.  # define OVL0	/* highest priority */ 223. # define OVL1 224. # define OVL2 225. # define OVL3	/* lowest specified priority */ 226. # define OVLB	/* the base overlay segment */ 227. #endif	/* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */ 228.  229.  /* Macro for a few items that are only static if we're not overlaid.... */ 230.  #if defined(USE_TRAMPOLI) || defined(USE_OVLx) 231. # define STATIC_PTR 232. #else 233. # define STATIC_PTR static 234. #endif 235.  236.  #endif /* HACK_H */