Source:NetHack 3.4.0/hack.h
Jump to navigation
Jump to search
Below is the full text to hack.h from the source code of NetHack 3.4.0. To link to a particular line, write [[NetHack 3.4.0/hack.h#line123]], for example.
Warning! This is the source code from an old release. For the latest release, see Source code
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. /* SCCS Id: @(#)hack.h 3.4 2001/04/12 */ 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_BONES 5 47. #define DISMOUNT_BYCHOICE 6 48. #endif 49. 50. /* Special returns from mapglyph() */ 51. #define MG_CORPSE 0x01 52. #define MG_INVIS 0x02 53. #define MG_DETECT 0x04 54. #define MG_PET 0x08 55. #define MG_RIDDEN 0x10 56. 57. /* sellobj_state() states */ 58. #define SELL_NORMAL (0) 59. #define SELL_DELIBERATE (1) 60. #define SELL_DONTSELL (2) 61. 62. /* 63. * This is the way the game ends. If these are rearranged, the arrays 64. * in end.c and topten.c will need to be changed. Some parts of the 65. * code assume that PANIC separates the deaths from the non-deaths. 66. */ 67. #define DIED 0 68. #define CHOKING 1 69. #define POISONING 2 70. #define STARVING 3 71. #define DROWNING 4 72. #define BURNING 5 73. #define DISSOLVED 6 74. #define CRUSHING 7 75. #define STONING 8 76. #define TURNED_SLIME 9 77. #define GENOCIDED 10 78. #define PANICKED 11 79. #define TRICKED 12 80. #define QUIT 13 81. #define ESCAPED 14 82. #define ASCENDED 15 83. 84. #include "align.h" 85. #include "dungeon.h" 86. #include "monsym.h" 87. #include "mkroom.h" 88. #include "objclass.h" 89. #include "youprop.h" 90. #include "wintype.h" 91. #include "decl.h" 92. #include "timeout.h" 93. 94. NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */ 95. 96. /* types of calls to bhit() */ 97. #define ZAPPED_WAND 0 98. #define THROWN_WEAPON 1 99. #define KICKED_WEAPON 2 100. #define FLASHED_LIGHT 3 101. #define INVIS_BEAM 4 102. 103. #define MATCH_WARN_OF_MON(mon) (Warn_of_mon && flags.warntype && \ 104. (flags.warntype & (mon)->data->mflags2)) 105. 106. #include "trap.h" 107. #include "flag.h" 108. #include "rm.h" 109. #include "vision.h" 110. #include "display.h" 111. #include "engrave.h" 112. #include "rect.h" 113. #include "region.h" 114. 115. #ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */ 116. #undef NDECL 117. #define NDECL(f) f() 118. #endif 119. 120. #include "extern.h" 121. #include "winprocs.h" 122. 123. #ifdef USE_TRAMPOLI 124. #include "wintty.h" 125. #undef WINTTY_H 126. #include "trampoli.h" 127. #undef EXTERN_H 128. #include "extern.h" 129. #endif /* USE_TRAMPOLI */ 130. 131. #define NO_SPELL 0 132. 133. /* flags to control makemon() */ 134. #define NO_MM_FLAGS 0x00 /* use this rather than plain 0 */ 135. #define NO_MINVENT 0x01 /* suppress minvent when creating mon */ 136. #define MM_NOWAIT 0x02 /* don't set STRAT_WAITMASK flags */ 137. #define MM_EDOG 0x04 /* add edog structure */ 138. #define MM_EMIN 0x08 /* add emin structure */ 139. #define MM_ANGRY 0x10 /* monster is created angry */ 140. #define MM_NONAME 0x20 /* monster is not christened */ 141. #define MM_NOCOUNTBIRTH 0x40 /* don't increment born counter (for revival) */ 142. 143. /* flags for special ggetobj status returns */ 144. #define ALL_FINISHED 0x01 /* called routine already finished the job */ 145. 146. /* flags to control query_objlist() */ 147. #define BY_NEXTHERE 0x1 /* follow objlist by nexthere field */ 148. #define AUTOSELECT_SINGLE 0x2 /* if only 1 object, don't ask */ 149. #define USE_INVLET 0x4 /* use object's invlet */ 150. #define INVORDER_SORT 0x8 /* sort objects by packorder */ 151. #define SIGNAL_NOMENU 0x10 /* return -1 rather than 0 if none allowed */ 152. 153. /* Flags to control query_category() */ 154. /* BY_NEXTHERE used by query_category() too, so skip 0x01 */ 155. #define UNPAID_TYPES 0x02 156. #define GOLD_TYPES 0x04 157. #define WORN_TYPES 0x08 158. #define ALL_TYPES 0x10 159. #define BILLED_TYPES 0x20 160. #define CHOOSE_ALL 0x40 161. #define BUC_BLESSED 0x80 162. #define BUC_CURSED 0x100 163. #define BUC_UNCURSED 0x200 164. #define BUC_UNKNOWN 0x400 165. #define BUC_ALLBKNOWN (BUC_BLESSED|BUC_CURSED|BUC_UNCURSED) 166. #define ALL_TYPES_SELECTED -2 167. 168. /* Flags to control find_mid() */ 169. #define FM_FMON 0x01 /* search the fmon chain */ 170. #define FM_MIGRATE 0x02 /* search the migrating monster chain */ 171. #define FM_MYDOGS 0x04 /* search mydogs */ 172. #define FM_EVERYWHERE (FM_FMON | FM_MIGRATE | FM_MYDOGS) 173. 174. /* Flags to control pick_[race,role,gend,align] routines in role.c */ 175. #define PICK_RANDOM 0 176. #define PICK_RIGID 1 177. 178. /* Flags to control dotrap() in trap.c */ 179. #define NOWEBMSG 0x01 /* suppress stumble into web message */ 180. 181. /*** some utility macros ***/ 182. #define yn(query) yn_function(query,ynchars, 'n') 183. #define ynq(query) yn_function(query,ynqchars, 'q') 184. #define ynaq(query) yn_function(query,ynaqchars, 'y') 185. #define nyaq(query) yn_function(query,ynaqchars, 'n') 186. #define nyNaq(query) yn_function(query,ynNaqchars, 'n') 187. #define ynNaq(query) yn_function(query,ynNaqchars, 'y') 188. 189. /* Macros for scatter */ 190. #define VIS_EFFECTS 0x01 /* display visual effects */ 191. #define MAY_HITMON 0x02 /* objects may hit monsters */ 192. #define MAY_HITYOU 0x04 /* objects may hit you */ 193. #define MAY_HIT (MAY_HITMON|MAY_HITYOU) 194. #define MAY_DESTROY 0x08 /* objects may be destroyed at random */ 195. #define MAY_FRACTURE 0x10 /* boulders & statues may fracture */ 196. 197. /* Macros for launching objects */ 198. #define ROLL 1 199. #define FLING 2 200. 201. /* Macros for explosion types */ 202. #define EXPL_DARK 0 203. #define EXPL_NOXIOUS 1 204. #define EXPL_MUDDY 2 205. #define EXPL_WET 3 206. #define EXPL_MAGICAL 4 207. #define EXPL_FIERY 5 208. #define EXPL_FROSTY 6 209. #define EXPL_MAX 7 210. 211. /* Macros for messages referring to hands, eyes, feet, etc... */ 212. #define ARM 0 213. #define EYE 1 214. #define FACE 2 215. #define FINGER 3 216. #define FINGERTIP 4 217. #define FOOT 5 218. #define HAND 6 219. #define HANDED 7 220. #define HEAD 8 221. #define LEG 9 222. #define LIGHT_HEADED 10 223. #define NECK 11 224. #define SPINE 12 225. #define TOE 13 226. #define HAIR 14 227. #define BLOOD 15 228. #define LUNG 16 229. #define NOSE 17 230. #define STOMACH 18 231. 232. /* Flags to control menus */ 233. #define MENUTYPELEN sizeof("traditional ") 234. #define MENU_TRADITIONAL 0 235. #define MENU_COMBINATION 1 236. #define MENU_PARTIAL 2 237. #define MENU_FULL 3 238. 239. #define MENU_SELECTED TRUE 240. #define MENU_UNSELECTED FALSE 241. 242. /* 243. * Option flags 244. * Each higher number includes the characteristics of the numbers 245. * below it. 246. */ 247. #define SET_IN_FILE 0 /* config file option only */ 248. #define SET_VIA_PROG 1 /* may be set via extern program, not seen in game */ 249. #define DISP_IN_GAME 2 /* may be set via extern program, displayed in game */ 250. #define SET_IN_GAME 3 /* may be set via extern program or set in the game */ 251. 252. #define FEATURE_NOTICE_VER(major,minor,patch) (((unsigned long)major << 24) | \ 253. ((unsigned long)minor << 16) | \ 254. ((unsigned long)patch << 8) | \ 255. ((unsigned long)0)) 256. 257. #define FEATURE_NOTICE_VER_MAJ (flags.suppress_alert >> 24) 258. #define FEATURE_NOTICE_VER_MIN (((unsigned long)(0x0000000000FF0000L & flags.suppress_alert)) >> 16) 259. #define FEATURE_NOTICE_VER_PATCH (((unsigned long)(0x000000000000FF00L & flags.suppress_alert)) >> 8) 260. 261. #ifndef max 262. #define max(a,b) ((a) > (b) ? (a) : (b)) 263. #endif 264. #ifndef min 265. #define min(x,y) ((x) < (y) ? (x) : (y)) 266. #endif 267. #define plur(x) (((x) == 1) ? "" : "s") 268. 269. #define ARM_BONUS(obj) (objects[(obj)->otyp].a_ac + (obj)->spe \ 270. - min((int)greatest_erosion(obj),objects[(obj)->otyp].a_ac)) 271. 272. #define makeknown(x) discover_object((x),TRUE,TRUE) 273. #define distu(xx,yy) dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 274. #define onlineu(xx,yy) online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 275. 276. #define rn1(x,y) (rn2(x)+(y)) 277. 278. /* negative armor class is randomly weakened to prevent invulnerability */ 279. #define AC_VALUE(AC) ((AC) >= 0 ? (AC) : -rnd(-(AC))) 280. 281. #if defined(MICRO) && !defined(__DJGPP__) 282. #define getuid() 1 283. #define getlogin() ((char *)0) 284. #endif /* MICRO */ 285. 286. #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB)) 287. # define USE_OVLx 288. # define STATIC_DCL extern 289. # define STATIC_OVL 290. # ifdef OVLB 291. # define STATIC_VAR 292. # else 293. # define STATIC_VAR extern 294. # endif 295. 296. #else /* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */ 297. # define STATIC_DCL static 298. # define STATIC_OVL static 299. # define STATIC_VAR static 300. 301. /* If not compiling an overlay, compile everything. */ 302. # define OVL0 /* highest priority */ 303. # define OVL1 304. # define OVL2 305. # define OVL3 /* lowest specified priority */ 306. # define OVLB /* the base overlay segment */ 307. #endif /* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */ 308. 309. /* Macro for a few items that are only static if we're not overlaid.... */ 310. #if defined(USE_TRAMPOLI) || defined(USE_OVLx) 311. # define STATIC_PTR 312. #else 313. # define STATIC_PTR static 314. #endif 315. 316. #endif /* HACK_H */