Source:NetHack 3.6.6/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.6. To link to a particular line, write [[Source:NetHack 3.6.6/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: 1573869062 2019/11/16 01:51:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.149 $ */ 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. * (They're only used in mapglyph.c so probably shouldn't be here.) 172. */ 173. const int zapcolors[NUM_ZAP] = { 174. HI_ZAP, /* 0 - missile */ 175. CLR_ORANGE, /* 1 - fire */ 176. CLR_WHITE, /* 2 - frost */ 177. HI_ZAP, /* 3 - sleep */ 178. CLR_BLACK, /* 4 - death */ 179. CLR_WHITE, /* 5 - lightning */ 180. /* 3.6.3: poison gas zap used to be yellow and acid zap was green, 181. which conflicted with the corresponding dragon colors */ 182. CLR_GREEN, /* 6 - poison gas */ 183. CLR_YELLOW, /* 7 - acid */ 184. }; 185. #endif /* text color */ 186. 187. const int shield_static[SHIELD_COUNT] = { 188. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */ 189. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 190. S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 191. }; 192. 193. NEARDATA struct spell spl_book[MAXSPELL + 1] = { DUMMY }; 194. 195. NEARDATA long moves = 1L, monstermoves = 1L; 196. /* These diverge when player is Fast */ 197. NEARDATA long wailmsg = 0L; 198. 199. /* objects that are moving to another dungeon level */ 200. NEARDATA struct obj *migrating_objs = (struct obj *) 0; 201. /* objects not yet paid for */ 202. NEARDATA struct obj *billobjs = (struct obj *) 0; 203. 204. /* used to zero all elements of a struct obj and a struct monst */ 205. NEARDATA const struct obj zeroobj = DUMMY; 206. NEARDATA const struct monst zeromonst = DUMMY; 207. /* used to zero out union any; initializer deliberately omitted */ 208. NEARDATA const anything zeroany; 209. 210. /* originally from dog.c */ 211. NEARDATA char dogname[PL_PSIZ] = DUMMY; 212. NEARDATA char catname[PL_PSIZ] = DUMMY; 213. NEARDATA char horsename[PL_PSIZ] = DUMMY; 214. char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */ 215. /* monsters that went down/up together with @ */ 216. NEARDATA struct monst *mydogs = (struct monst *) 0; 217. /* monsters that are moving to another dungeon level */ 218. NEARDATA struct monst *migrating_mons = (struct monst *) 0; 219. NEARDATA struct autopickup_exception *apelist = 220. (struct autopickup_exception *)0; 221. 222. NEARDATA struct mvitals mvitals[NUMMONS]; 223. NEARDATA long domove_attempting = 0L; 224. NEARDATA long domove_succeeded = 0L; 225. 226. NEARDATA struct c_color_names c_color_names = { 227. "black", "amber", "golden", "light blue", "red", "green", 228. "silver", "blue", "purple", "white", "orange" 229. }; 230. 231. struct menucoloring *menu_colorings = NULL; 232. 233. const char *c_obj_colors[] = { 234. "black", /* CLR_BLACK */ 235. "red", /* CLR_RED */ 236. "green", /* CLR_GREEN */ 237. "brown", /* CLR_BROWN */ 238. "blue", /* CLR_BLUE */ 239. "magenta", /* CLR_MAGENTA */ 240. "cyan", /* CLR_CYAN */ 241. "gray", /* CLR_GRAY */ 242. "transparent", /* no_color */ 243. "orange", /* CLR_ORANGE */ 244. "bright green", /* CLR_BRIGHT_GREEN */ 245. "yellow", /* CLR_YELLOW */ 246. "bright blue", /* CLR_BRIGHT_BLUE */ 247. "bright magenta", /* CLR_BRIGHT_MAGENTA */ 248. "bright cyan", /* CLR_BRIGHT_CYAN */ 249. "white", /* CLR_WHITE */ 250. }; 251. 252. struct c_common_strings c_common_strings = { "Nothing happens.", 253. "That's enough tries!", 254. "That is a silly thing to %s.", 255. "shudder for a moment.", 256. "something", 257. "Something", 258. "You can move again.", 259. "Never mind.", 260. "vision quickly clears.", 261. { "the", "your" }, 262. { "mon", "you" } }; 263. 264. /* NOTE: the order of these words exactly corresponds to the 265. order of oc_material values #define'd in objclass.h. */ 266. const char *materialnm[] = { "mysterious", "liquid", "wax", "organic", 267. "flesh", "paper", "cloth", "leather", 268. "wooden", "bone", "dragonhide", "iron", 269. "metal", "copper", "silver", "gold", 270. "platinum", "mithril", "plastic", "glass", 271. "gemstone", "stone" }; 272. 273. /* Vision */ 274. NEARDATA boolean vision_full_recalc = 0; 275. NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */ 276. 277. /* Global windowing data, defined here for multi-window-system support */ 278. NEARDATA winid WIN_MESSAGE = WIN_ERR; 279. NEARDATA winid WIN_STATUS = WIN_ERR; 280. NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; 281. char toplines[TBUFSZ]; 282. /* Windowing stuff that's really tty oriented, but present for all ports */ 283. struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */ 284. 285. char *fqn_prefix[PREFIX_COUNT] = { (char *) 0, (char *) 0, (char *) 0, 286. (char *) 0, (char *) 0, (char *) 0, 287. (char *) 0, (char *) 0, (char *) 0, 288. (char *) 0 }; 289. #ifdef WIN32 290. boolean fqn_prefix_locked[PREFIX_COUNT] = { FALSE, FALSE, FALSE, 291. FALSE, FALSE, FALSE, 292. FALSE, FALSE, FALSE, 293. FALSE }; 294. #endif 295. 296. #ifdef PREFIXES_IN_USE 297. const char *fqn_prefix_names[PREFIX_COUNT] = { 298. "hackdir", "leveldir", "savedir", "bonesdir", "datadir", 299. "scoredir", "lockdir", "sysconfdir", "configdir", "troubledir" 300. }; 301. #endif 302. 303. NEARDATA struct savefile_info sfcap = { 304. #ifdef NHSTDC 305. 0x00000000UL 306. #else 307. 0x00000000L 308. #endif 309. #if defined(COMPRESS) || defined(ZLIB_COMP) 310. | SFI1_EXTERNALCOMP 311. #endif 312. #if defined(ZEROCOMP) 313. | SFI1_ZEROCOMP 314. #endif 315. #if defined(RLECOMP) 316. | SFI1_RLECOMP 317. #endif 318. , 319. #ifdef NHSTDC 320. 0x00000000UL, 0x00000000UL 321. #else 322. 0x00000000L, 0x00000000L 323. #endif 324. }; 325. 326. NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = { 327. #ifdef NHSTDC 328. 0x00000000UL 329. #else 330. 0x00000000L 331. #endif 332. #if defined(COMPRESS) || defined(ZLIB_COMP) 333. | SFI1_EXTERNALCOMP 334. #endif 335. #if defined(ZEROCOMP) 336. | SFI1_ZEROCOMP 337. #endif 338. #if defined(RLECOMP) 339. | SFI1_RLECOMP 340. #endif 341. , 342. #ifdef NHSTDC 343. 0x00000000UL, 0x00000000UL 344. #else 345. 0x00000000L, 0x00000000L 346. #endif 347. }; 348. 349. struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0; 350. 351. #ifdef PANICTRACE 352. const char *ARGV0; 353. #endif 354. 355. /* support for lint.h */ 356. unsigned nhUse_dummy = 0; 357. 358. /* dummy routine used to force linkage */ 359. void 360. decl_init() 361. { 362. return; 363. } 364. 365. /*decl.c*/