Source:NetHack 3.6.2/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.2. To link to a particular line, write [[Source:NetHack 3.6.2/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: 1547025154 2019/01/09 09:12:34 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.147 $ */
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. } c_common_strings;
307. #define nothing_happens c_common_strings.c_nothing_happens
308. #define thats_enough_tries c_common_strings.c_thats_enough_tries
309. #define silly_thing_to c_common_strings.c_silly_thing_to
310. #define shudder_for_moment c_common_strings.c_shudder_for_moment
311. #define something c_common_strings.c_something
312. #define Something c_common_strings.c_Something
313. #define You_can_move_again c_common_strings.c_You_can_move_again
314. #define Never_mind c_common_strings.c_Never_mind
315. #define vision_clears c_common_strings.c_vision_clears
316. #define the_your c_common_strings.c_the_your
317. 
318. /* material strings */
319. E const char *materialnm[];
320. 
321. /* Monster name articles */
322. #define ARTICLE_NONE 0
323. #define ARTICLE_THE 1
324. #define ARTICLE_A 2
325. #define ARTICLE_YOUR 3
326. 
327. /* Monster name suppress masks */
328. #define SUPPRESS_IT 0x01
329. #define SUPPRESS_INVISIBLE 0x02
330. #define SUPPRESS_HALLUCINATION 0x04
331. #define SUPPRESS_SADDLE 0x08
332. #define EXACT_NAME 0x0F
333. #define SUPPRESS_NAME 0x10
334. 
335. /* Vision */
336. E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */
337. E NEARDATA char **viz_array;           /* could see/in sight row pointers */
338. 
339. /* Window system stuff */
340. E NEARDATA winid WIN_MESSAGE;
341. E NEARDATA winid WIN_STATUS;
342. E NEARDATA winid WIN_MAP, WIN_INVEN;
343. 
344. /* pline (et al) for a single string argument (suppress compiler warning) */
345. #define pline1(cstr) pline("%s", cstr)
346. #define Your1(cstr) Your("%s", cstr)
347. #define You1(cstr) You("%s", cstr)
348. #define verbalize1(cstr) verbalize("%s", cstr)
349. #define You_hear1(cstr) You_hear("%s", cstr)
350. #define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
351. #define panic1(cstr) panic("%s", cstr)
352. 
353. E char toplines[];
354. #ifndef TCAP_H
355. E struct tc_gbl_data {   /* also declared in tcap.h */
356.     char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */
357.     int tc_LI, tc_CO;    /* lines and columns */
358. } tc_gbl_data;
359. #define AS tc_gbl_data.tc_AS
360. #define AE tc_gbl_data.tc_AE
361. #define LI tc_gbl_data.tc_LI
362. #define CO tc_gbl_data.tc_CO
363. #endif
364. 
365. /* xxxexplain[] is in drawing.c */
366. E const char *const monexplain[], invisexplain[], *const oclass_names[];
367. 
368. /* Some systems want to use full pathnames for some subsets of file names,
369.  * rather than assuming that they're all in the current directory.  This
370.  * provides all the subclasses that seem reasonable, and sets up for all
371.  * prefixes being null.  Port code can set those that it wants.
372.  */
373. #define HACKPREFIX 0
374. #define LEVELPREFIX 1
375. #define SAVEPREFIX 2
376. #define BONESPREFIX 3
377. #define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */
378. #define SCOREPREFIX 5
379. #define LOCKPREFIX 6
380. #define SYSCONFPREFIX 7
381. #define CONFIGPREFIX 8
382. #define TROUBLEPREFIX 9
383. #define PREFIX_COUNT 10
384. /* used in files.c; xxconf.h can override if needed */
385. #ifndef FQN_MAX_FILENAME
386. #define FQN_MAX_FILENAME 512
387. #endif
388. 
389. #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
390. /* the bare-bones stuff is unconditional above to simplify coding; for
391.  * ports that actually use prefixes, add some more localized things
392.  */
393. #define PREFIXES_IN_USE
394. #endif
395. 
396. E char *fqn_prefix[PREFIX_COUNT];
397. #ifdef PREFIXES_IN_USE
398. E char *fqn_prefix_names[PREFIX_COUNT];
399. #endif
400. 
401. E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
402. 
403. struct opvar {
404.     xchar spovartyp; /* one of SPOVAR_foo */
405.     union {
406.         char *str;
407.         long l;
408.     } vardata;
409. };
410. 
411. struct autopickup_exception {
412.     struct nhregex *regex;
413.     char *pattern;
414.     boolean grab;
415.     struct autopickup_exception *next;
416. };
417. 
418. struct plinemsg_type {
419.     xchar msgtype;  /* one of MSGTYP_foo */
420.     struct nhregex *regex;
421.     char *pattern;
422.     struct plinemsg_type *next;
423. };
424. 
425. #define MSGTYP_NORMAL   0
426. #define MSGTYP_NOREP    1
427. #define MSGTYP_NOSHOW   2
428. #define MSGTYP_STOP     3
429. /* bitmask for callers of hide_unhide_msgtypes() */
430. #define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
431. 
432. E struct plinemsg_type *plinemsg_types;
433. 
434. #ifdef PANICTRACE
435. E const char *ARGV0;
436. #endif
437. 
438. enum earlyarg {ARG_DEBUG, ARG_VERSION
439. #ifdef WIN32
440.     ,ARG_WINDOWS
441. #endif
442. };
443. 
444. struct early_opt {
445.     enum earlyarg e;
446.     const char *name;
447.     int minlength;
448.     boolean valallowed;
449. };
450. 
451. #undef E
452. 
453. #endif /* DECL_H */