Source:NetHack 3.6.2/src/decl.c
Jump to navigation
Jump to search
Below is the full text to decl.c from the source code of NetHack 3.6.2. To link to a particular line, write [[Source:NetHack 3.6.2/src/decl.c#line12]], 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.
1. /* NetHack 3.6 decl.c $NHDT-Date: 1547025164 2019/01/09 09:12:44 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */ 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /*-Copyright (c) Michael Allison, 2009. */ 4. /* NetHack may be freely redistributed. See license for details. */ 5. 6. #include "hack.h" 7. 8. int NDECL((*afternmv)); 9. int NDECL((*occupation)); 10. 11. /* from xxxmain.c */ 12. const char *hname = 0; /* name of the game (argv[0] of main) */ 13. int hackpid = 0; /* current process id */ 14. #if defined(UNIX) || defined(VMS) 15. int locknum = 0; /* max num of simultaneous users */ 16. #endif 17. #ifdef DEF_PAGER 18. char *catmore = 0; /* default pager */ 19. #endif 20. char chosen_windowtype[WINTYPELEN]; 21. 22. NEARDATA int bases[MAXOCLASSES] = DUMMY; 23. 24. NEARDATA int multi = 0; 25. const char *multi_reason = NULL; 26. NEARDATA int nroom = 0; 27. NEARDATA int nsubroom = 0; 28. NEARDATA int occtime = 0; 29. 30. /* maze limits must be even; masking off lowest bit guarantees that */ 31. int x_maze_max = (COLNO - 1) & ~1, y_maze_max = (ROWNO - 1) & ~1; 32. 33. int otg_temp; /* used by object_to_glyph() [otg] */ 34. 35. NEARDATA int in_doagain = 0; 36. 37. /* 38. * The following structure will be initialized at startup time with 39. * the level numbers of some "important" things in the game. 40. */ 41. struct dgn_topology dungeon_topology = { DUMMY }; 42. 43. struct q_score quest_status = DUMMY; 44. 45. NEARDATA int warn_obj_cnt = 0; 46. NEARDATA int smeq[MAXNROFROOMS + 1] = DUMMY; 47. NEARDATA int doorindex = 0; 48. NEARDATA char *save_cm = 0; 49. 50. NEARDATA struct kinfo killer = DUMMY; 51. NEARDATA long done_money = 0; 52. const char *nomovemsg = 0; 53. NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */ 54. NEARDATA char pl_character[PL_CSIZ] = DUMMY; 55. NEARDATA char pl_race = '\0'; 56. 57. NEARDATA char pl_fruit[PL_FSIZ] = DUMMY; 58. NEARDATA struct fruit *ffruit = (struct fruit *) 0; 59. 60. NEARDATA char tune[6] = DUMMY; 61. NEARDATA boolean ransacked = 0; 62. 63. const char *occtxt = DUMMY; 64. const char quitchars[] = " \r\n\033"; 65. const char vowels[] = "aeiouAEIOU"; 66. const char ynchars[] = "yn"; 67. const char ynqchars[] = "ynq"; 68. const char ynaqchars[] = "ynaq"; 69. const char ynNaqchars[] = "yn#aq"; 70. NEARDATA long yn_number = 0L; 71. 72. const char disclosure_options[] = "iavgco"; 73. 74. #if defined(MICRO) || defined(WIN32) 75. char hackdir[PATHLEN]; /* where rumors, help, record are */ 76. #ifdef MICRO 77. char levels[PATHLEN]; /* where levels are */ 78. #endif 79. #endif /* MICRO || WIN32 */ 80. 81. #ifdef MFLOPPY 82. char permbones[PATHLEN]; /* where permanent copy of bones go */ 83. int ramdisk = FALSE; /* whether to copy bones to levels or not */ 84. int saveprompt = TRUE; 85. const char *alllevels = "levels.*"; 86. const char *allbones = "bones*.*"; 87. #endif 88. 89. struct linfo level_info[MAXLINFO]; 90. 91. NEARDATA struct sinfo program_state; 92. 93. /* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */ 94. const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 }; 95. const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 }; 96. const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 }; 97. 98. NEARDATA schar tbx = 0, tby = 0; /* mthrowu: target */ 99. 100. /* for xname handling of multiple shot missile volleys: 101. number of shots, index of current one, validity check, shoot vs throw */ 102. NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE }; 103. 104. NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */ 105. NEARDATA s_level *sp_levchn; 106. NEARDATA stairway upstair = { 0, 0, { 0, 0 }, 0 }, 107. dnstair = { 0, 0, { 0, 0 }, 0 }; 108. NEARDATA stairway upladder = { 0, 0, { 0, 0 }, 0 }, 109. dnladder = { 0, 0, { 0, 0 }, 0 }; 110. NEARDATA stairway sstairs = { 0, 0, { 0, 0 }, 0 }; 111. NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 112. NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 113. NEARDATA coord inv_pos = { 0, 0 }; 114. 115. NEARDATA boolean defer_see_monsters = FALSE; 116. NEARDATA boolean in_mklev = FALSE; 117. NEARDATA boolean stoned = FALSE; /* done to monsters hit by 'c' */ 118. NEARDATA boolean unweapon = FALSE; 119. NEARDATA boolean mrg_to_wielded = FALSE; 120. /* weapon picked is merged with wielded one */ 121. 122. NEARDATA boolean in_steed_dismounting = FALSE; 123. NEARDATA boolean has_strong_rngseed = FALSE; 124. 125. NEARDATA coord bhitpos = DUMMY; 126. NEARDATA coord doors[DOORMAX] = { DUMMY }; 127. 128. NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY }; 129. NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1]; 130. struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room; 131. 132. dlevel_t level; /* level map */ 133. struct trap *ftrap = (struct trap *) 0; 134. NEARDATA struct monst youmonst = DUMMY; 135. NEARDATA struct context_info context = DUMMY; 136. NEARDATA struct flag flags = DUMMY; 137. #ifdef SYSFLAGS 138. NEARDATA struct sysflag sysflags = DUMMY; 139. #endif 140. NEARDATA struct instance_flags iflags = DUMMY; 141. NEARDATA struct you u = DUMMY; 142. NEARDATA time_t ubirthday = DUMMY; 143. NEARDATA struct u_realtime urealtime = DUMMY; 144. 145. schar lastseentyp[COLNO][ROWNO] = { 146. DUMMY 147. }; /* last seen/touched dungeon typ */ 148. 149. NEARDATA struct obj 150. *invent = (struct obj *) 0, 151. *uwep = (struct obj *) 0, *uarm = (struct obj *) 0, 152. *uswapwep = (struct obj *) 0, 153. *uquiver = (struct obj *) 0, /* quiver */ 154. *uarmu = (struct obj *) 0, /* under-wear, so to speak */ 155. *uskin = (struct obj *) 0, /* dragon armor, if a dragon */ 156. *uarmc = (struct obj *) 0, *uarmh = (struct obj *) 0, 157. *uarms = (struct obj *) 0, *uarmg = (struct obj *) 0, 158. *uarmf = (struct obj *) 0, *uamul = (struct obj *) 0, 159. *uright = (struct obj *) 0, *uleft = (struct obj *) 0, 160. *ublindf = (struct obj *) 0, *uchain = (struct obj *) 0, 161. *uball = (struct obj *) 0; 162. /* some objects need special handling during destruction or placement */ 163. NEARDATA struct obj 164. *current_wand = 0, /* wand currently zapped/applied */ 165. *thrownobj = 0, /* object in flight due to throwing */ 166. *kickedobj = 0; /* object in flight due to kicking */ 167. 168. #ifdef TEXTCOLOR 169. /* 170. * This must be the same order as used for buzz() in zap.c. 171. */ 172. const int zapcolors[NUM_ZAP] = { 173. HI_ZAP, /* 0 - missile */ 174. CLR_ORANGE, /* 1 - fire */ 175. CLR_WHITE, /* 2 - frost */ 176. HI_ZAP, /* 3 - sleep */ 177. CLR_BLACK, /* 4 - death */ 178. CLR_WHITE, /* 5 - lightning */ 179. CLR_YELLOW, /* 6 - poison gas */ 180. CLR_GREEN, /* 7 - acid */ 181. }; 182. #endif /* text color */ 183. 184. const int shield_static[SHIELD_COUNT] = { 185. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */ 186. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 187. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 188. }; 189. 190. NEARDATA struct spell spl_book[MAXSPELL + 1] = { DUMMY }; 191. 192. NEARDATA long moves = 1L, monstermoves = 1L; 193. /* These diverge when player is Fast */ 194. NEARDATA long wailmsg = 0L; 195. 196. /* objects that are moving to another dungeon level */ 197. NEARDATA struct obj *migrating_objs = (struct obj *) 0; 198. /* objects not yet paid for */ 199. NEARDATA struct obj *billobjs = (struct obj *) 0; 200. 201. /* used to zero all elements of a struct obj and a struct monst */ 202. NEARDATA const struct obj zeroobj = DUMMY; 203. NEARDATA const struct monst zeromonst = DUMMY; 204. /* used to zero out union any; initializer deliberately omitted */ 205. NEARDATA const anything zeroany; 206. 207. /* originally from dog.c */ 208. NEARDATA char dogname[PL_PSIZ] = DUMMY; 209. NEARDATA char catname[PL_PSIZ] = DUMMY; 210. NEARDATA char horsename[PL_PSIZ] = DUMMY; 211. char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */ 212. /* monsters that went down/up together with @ */ 213. NEARDATA struct monst *mydogs = (struct monst *) 0; 214. /* monsters that are moving to another dungeon level */ 215. NEARDATA struct monst *migrating_mons = (struct monst *) 0; 216. 217. NEARDATA struct mvitals mvitals[NUMMONS]; 218. NEARDATA long domove_attempting = 0L; 219. NEARDATA long domove_succeeded = 0L; 220. 221. NEARDATA struct c_color_names c_color_names = { 222. "black", "amber", "golden", "light blue", "red", "green", 223. "silver", "blue", "purple", "white", "orange" 224. }; 225. 226. struct menucoloring *menu_colorings = NULL; 227. 228. const char *c_obj_colors[] = { 229. "black", /* CLR_BLACK */ 230. "red", /* CLR_RED */ 231. "green", /* CLR_GREEN */ 232. "brown", /* CLR_BROWN */ 233. "blue", /* CLR_BLUE */ 234. "magenta", /* CLR_MAGENTA */ 235. "cyan", /* CLR_CYAN */ 236. "gray", /* CLR_GRAY */ 237. "transparent", /* no_color */ 238. "orange", /* CLR_ORANGE */ 239. "bright green", /* CLR_BRIGHT_GREEN */ 240. "yellow", /* CLR_YELLOW */ 241. "bright blue", /* CLR_BRIGHT_BLUE */ 242. "bright magenta", /* CLR_BRIGHT_MAGENTA */ 243. "bright cyan", /* CLR_BRIGHT_CYAN */ 244. "white", /* CLR_WHITE */ 245. }; 246. 247. struct c_common_strings c_common_strings = { "Nothing happens.", 248. "That's enough tries!", 249. "That is a silly thing to %s.", 250. "shudder for a moment.", 251. "something", 252. "Something", 253. "You can move again.", 254. "Never mind.", 255. "vision quickly clears.", 256. { "the", "your" } }; 257. 258. /* NOTE: the order of these words exactly corresponds to the 259. order of oc_material values #define'd in objclass.h. */ 260. const char *materialnm[] = { "mysterious", "liquid", "wax", "organic", 261. "flesh", "paper", "cloth", "leather", 262. "wooden", "bone", "dragonhide", "iron", 263. "metal", "copper", "silver", "gold", 264. "platinum", "mithril", "plastic", "glass", 265. "gemstone", "stone" }; 266. 267. /* Vision */ 268. NEARDATA boolean vision_full_recalc = 0; 269. NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */ 270. 271. /* Global windowing data, defined here for multi-window-system support */ 272. NEARDATA winid WIN_MESSAGE = WIN_ERR; 273. NEARDATA winid WIN_STATUS = WIN_ERR; 274. NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; 275. char toplines[TBUFSZ]; 276. /* Windowing stuff that's really tty oriented, but present for all ports */ 277. struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */ 278. 279. char *fqn_prefix[PREFIX_COUNT] = { (char *) 0, (char *) 0, (char *) 0, 280. (char *) 0, (char *) 0, (char *) 0, 281. (char *) 0, (char *) 0, (char *) 0, 282. (char *) 0 }; 283. 284. #ifdef PREFIXES_IN_USE 285. char *fqn_prefix_names[PREFIX_COUNT] = { 286. "hackdir", "leveldir", "savedir", "bonesdir", "datadir", 287. "scoredir", "lockdir", "sysconfdir", "configdir", "troubledir" 288. }; 289. #endif 290. 291. NEARDATA struct savefile_info sfcap = { 292. #ifdef NHSTDC 293. 0x00000000UL 294. #else 295. 0x00000000L 296. #endif 297. #if defined(COMPRESS) || defined(ZLIB_COMP) 298. | SFI1_EXTERNALCOMP 299. #endif 300. #if defined(ZEROCOMP) 301. | SFI1_ZEROCOMP 302. #endif 303. #if defined(RLECOMP) 304. | SFI1_RLECOMP 305. #endif 306. , 307. #ifdef NHSTDC 308. 0x00000000UL, 0x00000000UL 309. #else 310. 0x00000000L, 0x00000000L 311. #endif 312. }; 313. 314. NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = { 315. #ifdef NHSTDC 316. 0x00000000UL 317. #else 318. 0x00000000L 319. #endif 320. #if defined(COMPRESS) || defined(ZLIB_COMP) 321. | SFI1_EXTERNALCOMP 322. #endif 323. #if defined(ZEROCOMP) 324. | SFI1_ZEROCOMP 325. #endif 326. #if defined(RLECOMP) 327. | SFI1_RLECOMP 328. #endif 329. , 330. #ifdef NHSTDC 331. 0x00000000UL, 0x00000000UL 332. #else 333. 0x00000000L, 0x00000000L 334. #endif 335. }; 336. 337. struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0; 338. 339. #ifdef PANICTRACE 340. const char *ARGV0; 341. #endif 342. 343. /* support for lint.h */ 344. unsigned nhUse_dummy = 0; 345. 346. /* dummy routine used to force linkage */ 347. void 348. decl_init() 349. { 350. return; 351. } 352. 353. /*decl.c*/