Source:NetHack 3.6.6/include/decl.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to decl.h from the source code of NetHack 3.6.6. To link to a particular line, write [[Source:NetHack 3.6.6/include/decl.h#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.h  $NHDT-Date: 1573869061 2019/11/16 01:51:01 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */
2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3. /*-Copyright (c) Michael Allison, 2007. */
4. /* NetHack may be freely redistributed.  See license for details. */
5. 
6. #ifndef DECL_H
7. #define DECL_H
8. 
9. #define E extern
10. 
11. E int NDECL((*occupation));
12. E int NDECL((*afternmv));
13. 
14. E const char *hname;
15. E int hackpid;
16. #if defined(UNIX) || defined(VMS)
17. E int locknum;
18. #endif
19. #ifdef DEF_PAGER
20. E char *catmore;
21. #endif /* DEF_PAGER */
22. 
23. E char SAVEF[];
24. #ifdef MICRO
25. E char SAVEP[];
26. #endif
27. 
28. /* max size of a windowtype option */
29. #define WINTYPELEN 16
30. E char chosen_windowtype[WINTYPELEN];
31. 
32. E NEARDATA int bases[MAXOCLASSES];
33. 
34. E NEARDATA int multi;
35. E const char *multi_reason;
36. E NEARDATA int nroom;
37. E NEARDATA int nsubroom;
38. E NEARDATA int occtime;
39. 
40. #define WARNCOUNT 6 /* number of different warning levels */
41. E nhsym warnsyms[WARNCOUNT];
42. E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */
43. 
44. E int x_maze_max, y_maze_max;
45. E int otg_temp;
46. 
47. E NEARDATA int in_doagain;
48. 
49. E struct dgn_topology { /* special dungeon levels for speed */
50.     d_level d_oracle_level;
51.     d_level d_bigroom_level; /* unused */
52.     d_level d_rogue_level;
53.     d_level d_medusa_level;
54.     d_level d_stronghold_level;
55.     d_level d_valley_level;
56.     d_level d_wiz1_level;
57.     d_level d_wiz2_level;
58.     d_level d_wiz3_level;
59.     d_level d_juiblex_level;
60.     d_level d_orcus_level;
61.     d_level d_baalzebub_level; /* unused */
62.     d_level d_asmodeus_level;  /* unused */
63.     d_level d_portal_level;    /* only in goto_level() [do.c] */
64.     d_level d_sanctum_level;
65.     d_level d_earth_level;
66.     d_level d_water_level;
67.     d_level d_fire_level;
68.     d_level d_air_level;
69.     d_level d_astral_level;
70.     xchar d_tower_dnum;
71.     xchar d_sokoban_dnum;
72.     xchar d_mines_dnum, d_quest_dnum;
73.     d_level d_qstart_level, d_qlocate_level, d_nemesis_level;
74.     d_level d_knox_level;
75.     d_level d_mineend_level;
76.     d_level d_sokoend_level;
77. } dungeon_topology;
78. /* macros for accessing the dungeon levels by their old names */
79. /* clang-format off */
80. #define oracle_level            (dungeon_topology.d_oracle_level)
81. #define bigroom_level           (dungeon_topology.d_bigroom_level)
82. #define rogue_level             (dungeon_topology.d_rogue_level)
83. #define medusa_level            (dungeon_topology.d_medusa_level)
84. #define stronghold_level        (dungeon_topology.d_stronghold_level)
85. #define valley_level            (dungeon_topology.d_valley_level)
86. #define wiz1_level              (dungeon_topology.d_wiz1_level)
87. #define wiz2_level              (dungeon_topology.d_wiz2_level)
88. #define wiz3_level              (dungeon_topology.d_wiz3_level)
89. #define juiblex_level           (dungeon_topology.d_juiblex_level)
90. #define orcus_level             (dungeon_topology.d_orcus_level)
91. #define baalzebub_level         (dungeon_topology.d_baalzebub_level)
92. #define asmodeus_level          (dungeon_topology.d_asmodeus_level)
93. #define portal_level            (dungeon_topology.d_portal_level)
94. #define sanctum_level           (dungeon_topology.d_sanctum_level)
95. #define earth_level             (dungeon_topology.d_earth_level)
96. #define water_level             (dungeon_topology.d_water_level)
97. #define fire_level              (dungeon_topology.d_fire_level)
98. #define air_level               (dungeon_topology.d_air_level)
99. #define astral_level            (dungeon_topology.d_astral_level)
100. #define tower_dnum              (dungeon_topology.d_tower_dnum)
101. #define sokoban_dnum            (dungeon_topology.d_sokoban_dnum)
102. #define mines_dnum              (dungeon_topology.d_mines_dnum)
103. #define quest_dnum              (dungeon_topology.d_quest_dnum)
104. #define qstart_level            (dungeon_topology.d_qstart_level)
105. #define qlocate_level           (dungeon_topology.d_qlocate_level)
106. #define nemesis_level           (dungeon_topology.d_nemesis_level)
107. #define knox_level              (dungeon_topology.d_knox_level)
108. #define mineend_level           (dungeon_topology.d_mineend_level)
109. #define sokoend_level           (dungeon_topology.d_sokoend_level)
110. /* clang-format on */
111. 
112. E NEARDATA stairway dnstair, upstair; /* stairs up and down */
113. #define xdnstair (dnstair.sx)
114. #define ydnstair (dnstair.sy)
115. #define xupstair (upstair.sx)
116. #define yupstair (upstair.sy)
117. 
118. E NEARDATA stairway dnladder, upladder; /* ladders up and down */
119. #define xdnladder (dnladder.sx)
120. #define ydnladder (dnladder.sy)
121. #define xupladder (upladder.sx)
122. #define yupladder (upladder.sy)
123. 
124. E NEARDATA stairway sstairs;
125. 
126. E NEARDATA dest_area updest, dndest; /* level-change destination areas */
127. 
128. E NEARDATA coord inv_pos;
129. E NEARDATA dungeon dungeons[];
130. E NEARDATA s_level *sp_levchn;
131. #define dunlev_reached(x) (dungeons[(x)->dnum].dunlev_ureached)
132. 
133. #include "quest.h"
134. E struct q_score quest_status;
135. 
136. E NEARDATA char pl_character[PL_CSIZ];
137. E NEARDATA char pl_race; /* character's race */
138. 
139. E NEARDATA char pl_fruit[PL_FSIZ];
140. E NEARDATA struct fruit *ffruit;
141. 
142. E NEARDATA char tune[6];
143. 
144. #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
145. E struct linfo level_info[MAXLINFO];
146. 
147. E NEARDATA struct sinfo {
148.     int gameover;  /* self explanatory? */
149.     int stopprint; /* inhibit further end of game disclosure */
150. #ifdef HANGUPHANDLING
151.     volatile int done_hup; /* SIGHUP or moral equivalent received
152.                             * -- no more screen output */
153.     int preserve_locks;    /* don't remove level files prior to exit */
154. #endif
155.     int something_worth_saving; /* in case of panic */
156.     int panicking;              /* `panic' is in progress */
157.     int exiting;                /* an exit handler is executing */
158.     int in_moveloop;
159.     int in_impossible;
160. #ifdef PANICLOG
161.     int in_paniclog;
162. #endif
163.     int wizkit_wishing;
164. } program_state;
165. 
166. E boolean restoring;
167. E boolean ransacked;
168. 
169. E const char quitchars[];
170. E const char vowels[];
171. E const char ynchars[];
172. E const char ynqchars[];
173. E const char ynaqchars[];
174. E const char ynNaqchars[];
175. E NEARDATA long yn_number;
176. 
177. E const char disclosure_options[];
178. 
179. E NEARDATA int smeq[];
180. E NEARDATA int doorindex;
181. E NEARDATA char *save_cm;
182. 
183. E NEARDATA struct kinfo {
184.     struct kinfo *next; /* chain of delayed killers */
185.     int id;             /* uprop keys to ID a delayed killer */
186.     int format;         /* one of the killer formats */
187. #define KILLED_BY_AN 0
188. #define KILLED_BY 1
189. #define NO_KILLER_PREFIX 2
190.     char name[BUFSZ]; /* actual killer name */
191. } killer;
192. 
193. E long done_money;
194. E NEARDATA char plname[PL_NSIZ];
195. E NEARDATA char dogname[];
196. E NEARDATA char catname[];
197. E NEARDATA char horsename[];
198. E char preferred_pet;
199. E const char *occtxt; /* defined when occupation != NULL */
200. E const char *nomovemsg;
201. E char lock[];
202. 
203. E const schar xdir[], ydir[], zdir[];
204. 
205. E NEARDATA schar tbx, tby; /* set in mthrowu.c */
206. 
207. E NEARDATA struct multishot {
208.     int n, i;
209.     short o;
210.     boolean s;
211. } m_shot;
212. 
213. E NEARDATA long moves, monstermoves;
214. E NEARDATA long wailmsg;
215. 
216. E NEARDATA boolean in_mklev;
217. E NEARDATA boolean stoned;
218. E NEARDATA boolean unweapon;
219. E NEARDATA boolean mrg_to_wielded;
220. E NEARDATA boolean defer_see_monsters;
221. 
222. E NEARDATA boolean in_steed_dismounting;
223. E NEARDATA boolean has_strong_rngseed;
224. 
225. E const int shield_static[];
226. 
227. #include "spell.h"
228. E NEARDATA struct spell spl_book[]; /* sized in decl.c */
229. 
230. #include "color.h"
231. #ifdef TEXTCOLOR
232. E const int zapcolors[];
233. #endif
234. 
235. E const struct class_sym def_oc_syms[MAXOCLASSES]; /* default class symbols */
236. E uchar oc_syms[MAXOCLASSES];                      /* current class symbols */
237. E const struct class_sym def_monsyms[MAXMCLASSES]; /* default class symbols */
238. E uchar monsyms[MAXMCLASSES];                      /* current class symbols */
239. 
240. #include "obj.h"
241. E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
242.     *uarmu, /* under-wear, so to speak */
243.     *uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver;
244. 
245. E NEARDATA struct obj *uchain; /* defined only when punished */
246. E NEARDATA struct obj *uball;
247. E NEARDATA struct obj *migrating_objs;
248. E NEARDATA struct obj *billobjs;
249. E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
250. 
251. E NEARDATA const struct obj zeroobj; /* for init; also, &zeroobj is used
252.                                       * as special value */
253. 
254. E NEARDATA const anything zeroany;   /* init'd and defined in decl.c */
255. 
256. #include "you.h"
257. E NEARDATA struct you u;
258. E NEARDATA time_t ubirthday;
259. E NEARDATA struct u_realtime urealtime;
260. 
261. #include "onames.h"
262. #ifndef PM_H /* (pm.h has already been included via youprop.h) */
263. #include "pm.h"
264. #endif
265. 
266. E NEARDATA const struct monst zeromonst; /* for init of new or temp monsters */
267. E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */
268. E NEARDATA struct monst *mydogs, *migrating_mons;
269. 
270. E NEARDATA struct mvitals {
271.     uchar born;
272.     uchar died;
273.     uchar mvflags;
274. } mvitals[NUMMONS];
275. 
276. E NEARDATA long domove_attempting;
277. E NEARDATA long domove_succeeded;
278. #define DOMOVE_WALK         0x00000001
279. #define DOMOVE_RUSH         0x00000002
280. 
281. E NEARDATA struct c_color_names {
282.     const char *const c_black, *const c_amber, *const c_golden,
283.         *const c_light_blue, *const c_red, *const c_green, *const c_silver,
284.         *const c_blue, *const c_purple, *const c_white, *const c_orange;
285. } c_color_names;
286. #define NH_BLACK c_color_names.c_black
287. #define NH_AMBER c_color_names.c_amber
288. #define NH_GOLDEN c_color_names.c_golden
289. #define NH_LIGHT_BLUE c_color_names.c_light_blue
290. #define NH_RED c_color_names.c_red
291. #define NH_GREEN c_color_names.c_green
292. #define NH_SILVER c_color_names.c_silver
293. #define NH_BLUE c_color_names.c_blue
294. #define NH_PURPLE c_color_names.c_purple
295. #define NH_WHITE c_color_names.c_white
296. #define NH_ORANGE c_color_names.c_orange
297. 
298. /* The names of the colors used for gems, etc. */
299. E const char *c_obj_colors[];
300. 
301. E struct c_common_strings {
302.     const char *const c_nothing_happens, *const c_thats_enough_tries,
303.         *const c_silly_thing_to, *const c_shudder_for_moment,
304.         *const c_something, *const c_Something, *const c_You_can_move_again,
305.         *const c_Never_mind, *c_vision_clears, *const c_the_your[2],
306.         *const c_fakename[2];
307. } c_common_strings;
308. #define nothing_happens c_common_strings.c_nothing_happens
309. #define thats_enough_tries c_common_strings.c_thats_enough_tries
310. #define silly_thing_to c_common_strings.c_silly_thing_to
311. #define shudder_for_moment c_common_strings.c_shudder_for_moment
312. #define something c_common_strings.c_something
313. #define Something c_common_strings.c_Something
314. #define You_can_move_again c_common_strings.c_You_can_move_again
315. #define Never_mind c_common_strings.c_Never_mind
316. #define vision_clears c_common_strings.c_vision_clears
317. #define the_your c_common_strings.c_the_your
318. /* fakename[] used occasionally so vtense() won't be fooled by an assigned
319.    name ending in 's' */
320. #define fakename c_common_strings.c_fakename
321. 
322. /* material strings */
323. E const char *materialnm[];
324. 
325. /* Monster name articles */
326. #define ARTICLE_NONE 0
327. #define ARTICLE_THE 1
328. #define ARTICLE_A 2
329. #define ARTICLE_YOUR 3
330. 
331. /* Monster name suppress masks */
332. #define SUPPRESS_IT 0x01
333. #define SUPPRESS_INVISIBLE 0x02
334. #define SUPPRESS_HALLUCINATION 0x04
335. #define SUPPRESS_SADDLE 0x08
336. #define EXACT_NAME 0x0F
337. #define SUPPRESS_NAME 0x10
338. 
339. /* Vision */
340. E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */
341. E NEARDATA char **viz_array;           /* could see/in sight row pointers */
342. 
343. /* Window system stuff */
344. E NEARDATA winid WIN_MESSAGE;
345. E NEARDATA winid WIN_STATUS;
346. E NEARDATA winid WIN_MAP, WIN_INVEN;
347. 
348. /* pline (et al) for a single string argument (suppress compiler warning) */
349. #define pline1(cstr) pline("%s", cstr)
350. #define Your1(cstr) Your("%s", cstr)
351. #define You1(cstr) You("%s", cstr)
352. #define verbalize1(cstr) verbalize("%s", cstr)
353. #define You_hear1(cstr) You_hear("%s", cstr)
354. #define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
355. #define panic1(cstr) panic("%s", cstr)
356. 
357. E char toplines[];
358. #ifndef TCAP_H
359. E struct tc_gbl_data {   /* also declared in tcap.h */
360.     char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */
361.     int tc_LI, tc_CO;    /* lines and columns */
362. } tc_gbl_data;
363. #define AS tc_gbl_data.tc_AS
364. #define AE tc_gbl_data.tc_AE
365. #define LI tc_gbl_data.tc_LI
366. #define CO tc_gbl_data.tc_CO
367. #endif
368. 
369. /* xxxexplain[] is in drawing.c */
370. E const char *const monexplain[], invisexplain[], *const oclass_names[];
371. 
372. /* Some systems want to use full pathnames for some subsets of file names,
373.  * rather than assuming that they're all in the current directory.  This
374.  * provides all the subclasses that seem reasonable, and sets up for all
375.  * prefixes being null.  Port code can set those that it wants.
376.  */
377. #define HACKPREFIX 0
378. #define LEVELPREFIX 1
379. #define SAVEPREFIX 2
380. #define BONESPREFIX 3
381. #define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */
382. #define SCOREPREFIX 5
383. #define LOCKPREFIX 6
384. #define SYSCONFPREFIX 7
385. #define CONFIGPREFIX 8
386. #define TROUBLEPREFIX 9
387. #define PREFIX_COUNT 10
388. /* used in files.c; xxconf.h can override if needed */
389. #ifndef FQN_MAX_FILENAME
390. #define FQN_MAX_FILENAME 512
391. #endif
392. 
393. #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
394. /* the bare-bones stuff is unconditional above to simplify coding; for
395.  * ports that actually use prefixes, add some more localized things
396.  */
397. #define PREFIXES_IN_USE
398. #endif
399. 
400. E char *fqn_prefix[PREFIX_COUNT];
401. #ifdef WIN32
402. E boolean fqn_prefix_locked[PREFIX_COUNT];
403. #endif
404. #ifdef PREFIXES_IN_USE
405. E const char *fqn_prefix_names[PREFIX_COUNT];
406. #endif
407. 
408. E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
409. 
410. struct opvar {
411.     xchar spovartyp; /* one of SPOVAR_foo */
412.     union {
413.         char *str;
414.         long l;
415.     } vardata;
416. };
417. 
418. struct autopickup_exception {
419.     struct nhregex *regex;
420.     char *pattern;
421.     boolean grab;
422.     struct autopickup_exception *next;
423. };
424. E struct autopickup_exception *apelist;
425. 
426. struct plinemsg_type {
427.     xchar msgtype;  /* one of MSGTYP_foo */
428.     struct nhregex *regex;
429.     char *pattern;
430.     struct plinemsg_type *next;
431. };
432. 
433. #define MSGTYP_NORMAL   0
434. #define MSGTYP_NOREP    1
435. #define MSGTYP_NOSHOW   2
436. #define MSGTYP_STOP     3
437. /* bitmask for callers of hide_unhide_msgtypes() */
438. #define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
439. 
440. E struct plinemsg_type *plinemsg_types;
441. 
442. enum bcargs {override_restriction = -1};
443. struct breadcrumbs {
444.     const char *funcnm;
445.     int linenum;
446.     boolean in_effect;
447. };
448. 
449. #ifdef PANICTRACE
450. E const char *ARGV0;
451. #endif
452. 
453. enum earlyarg {ARG_DEBUG, ARG_VERSION, ARG_SHOWPATHS
454. #ifdef WIN32
455.     ,ARG_WINDOWS
456. #endif
457. };
458. 
459. struct early_opt {
460.     enum earlyarg e;
461.     const char *name;
462.     int minlength;
463.     boolean valallowed;
464. };
465. 
466. #undef E
467. 
468. #endif /* DECL_H */