Source:NetHack 3.1.0/hack.h
Revision as of 14:17, 6 July 2024 by Furey (talk | contribs) (Delete link-to-particular-source instructions. Source code covers that now. "the latest release" -> "newer releases".)
Below is the full text to hack.h from the source code of NetHack 3.1.0.
Warning! This is the source code from an old release. For newer releases, 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.1 93/01/15 */ 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. #ifndef __SASC_60 24. #ifdef NULL 25. #undef NULL 26. #endif /* NULL */ 27. #define NULL ((char *)0) 28. #endif 29. #define DUMMY { 0 } 30. 31. /* symbolic names for capacity levels */ 32. #define UNENCUMBERED 0 33. #define SLT_ENCUMBER 1 34. #define MOD_ENCUMBER 2 35. #define HVY_ENCUMBER 3 36. #define EXT_ENCUMBER 4 37. #define OVERLOADED 5 38. 39. /* this is the way the game ends */ 40. /* if these are rearranged, the arrays in end.c will need to be changed */ 41. #define DIED 0 42. #define CHOKING 1 43. #define POISONING 2 44. #define STARVING 3 45. #define DROWNING 4 46. #define BURNING 5 47. #define CRUSHING 6 48. #define STONING 7 49. #define GENOCIDED 8 50. #define PANICKED 9 51. #define TRICKED 10 52. #define QUIT 11 53. #define ESCAPED 12 54. #define ASCENDED 13 55. 56. #ifndef DUNGEON_H /* includes align.h */ 57. #include "dungeon.h" 58. #endif 59. 60. #ifndef MONSYM_H 61. #include "monsym.h" 62. #endif 63. #ifndef MKROOM_H 64. #include "mkroom.h" 65. #endif 66. #ifndef OBJCLASS_H 67. #include "objclass.h" 68. #endif 69. 70. #ifndef DECL_H 71. #include "decl.h" 72. #endif 73. 74. extern coord bhitpos; /* place where thrown weapon falls to the ground */ 75. 76. /* types of calls to bhit() */ 77. #define ZAPPED_WAND 0 78. #define THROWN_WEAPON 1 79. #define KICKED_WEAPON 2 80. #define FLASHED_LIGHT 3 81. #define INVIS_BEAM 4 82. 83. #ifndef TRAP_H 84. #include "trap.h" 85. #endif 86. #ifndef FLAG_H 87. #include "flag.h" 88. #endif 89. 90. #ifndef RM_H 91. #include "rm.h" 92. #endif 93. 94. #ifndef VISION_H 95. #include "vision.h" 96. #endif 97. 98. #ifndef DISPLAY_H 99. #include "display.h" 100. #endif 101. 102. #ifndef WINTYPE_H 103. #include "wintype.h" 104. #endif 105. 106. #ifndef ENGRAVE_H 107. #include "engrave.h" 108. #endif 109. 110. #ifndef RECT_H 111. #include "rect.h" 112. #endif 113. 114. #ifdef OVERLAY /* This doesn't belong here, but we have little choice */ 115. #undef NDECL 116. #define NDECL(f) f() 117. #endif 118. 119. #ifndef EXTERN_H 120. #include "extern.h" 121. #endif 122. 123. #ifndef WINPROCS_H 124. #include "winprocs.h" 125. #endif 126. 127. #if defined(OVERLAY) && !defined(MOVERLAY) 128. #include "wintty.h" 129. #undef WINTTY_H 130. 131. #ifndef TRAMPOLI_H 132. #include "trampoli.h" 133. #endif 134. 135. #undef EXTERN_H 136. #include "extern.h" 137. #endif /* OVERLAY */ 138. 139. #define NO_SPELL 0 140. 141. /*** some utility macros ***/ 142. #define yn(query) yn_function(query,ynchars, 'n') 143. #define ynq(query) yn_function(query,ynqchars, 'q') 144. #define ynaq(query) yn_function(query,ynaqchars, 'y') 145. #define nyaq(query) yn_function(query,ynaqchars, 'n') 146. #define nyNaq(query) yn_function(query,ynNaqchars, 'n') 147. #define ynNaq(query) yn_function(query,ynNaqchars, 'y') 148. 149. #ifndef max 150. #define max(a,b) ((a) > (b) ? (a) : (b)) 151. #endif 152. #ifndef min 153. #define min(x,y) ((x) < (y) ? (x) : (y)) 154. #endif 155. #define plur(x) (((x) == 1) ? "" : "s") 156. 157. #define ARM_BONUS(obj) (objects[(obj)->otyp].a_ac + (obj)->spe \ 158. - min((int)(obj)->oeroded,objects[(obj)->otyp].a_ac)) 159. 160. #define makeknown(x) discover_object((x),TRUE) 161. #define distu(xx,yy) dist2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 162. #define onlineu(xx,yy) online2((int)(xx),(int)(yy),(int)u.ux,(int)u.uy) 163. 164. #define rn1(x,y) (rn2(x)+(y)) 165. 166. #ifndef MUSE 167. #define find_mac(m) ((m)->data->ac) 168. #endif 169. 170. #if defined(MICRO) 171. #define getuid() 1 172. #define getlogin() (NULL) 173. #endif /* MICRO */ 174. 175. /* Macro for a few items that are only static if we're not overlaid.... */ 176. #if defined(OVERLAY) 177. # define STATIC_PTR 178. #else 179. # define STATIC_PTR static 180. #endif 181. 182. #if defined(OVERLAY)&&(defined(OVL0)||defined(OVL1)||defined(OVL2)||defined(OVL3)||defined(OVLB)) 183. # define STATIC_DCL extern 184. # define STATIC_OVL 185. # ifdef OVLB 186. # define STATIC_VAR 187. # else 188. # define STATIC_VAR extern 189. # endif 190. 191. #else /* !OVERLAY || (!OVL0 && !OVL1 && !OVL2 && !OVL3 && !OVLB) */ 192. # define STATIC_DCL static 193. # define STATIC_OVL static 194. # define STATIC_VAR static 195. 196. /* If not compiling an overlay, compile everything. */ 197. # define OVL0 /* Highest priority */ 198. # define OVL1 199. # define OVL2 200. # define OVL3 /* Lowest specified priority */ 201. # define OVLB /* The base overlay segment */ 202. #endif /* OVERLAY && (OVL0 || OVL1 || OVL2 || OVL3 || OVLB) */ 203. 204. #endif /* HACK_H */