1 /*	SCCS Id: @(#)decl.h	3.4	2001/12/10	*/
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 #ifndef DECL_H
6 #define DECL_H
7 
8 #define E extern
9 
10 E int NDECL((*occupation));
11 E int NDECL((*afternmv));
12 
13 E const char *hname;
14 E int hackpid;
15 #if defined(UNIX) || defined(VMS)
16 E int locknum;
17 #endif
18 #ifdef DEF_PAGER
19 E char *catmore;
20 #endif	/* DEF_PAGER */
21 
22 E char SAVEF[];
23 #ifdef MICRO
24 E char SAVEP[];
25 #endif
26 
27 E NEARDATA int bases[MAXOCLASSES];
28 
29 E NEARDATA int multi;
30 #if 0
31 E NEARDATA int warnlevel;
32 #endif
33 E NEARDATA int lastuse;
34 E NEARDATA int nextuse;
35 E NEARDATA int nroom;
36 E NEARDATA int nsubroom;
37 E NEARDATA int occtime;
38 
39 #define WARNCOUNT 6			/* number of different warning levels */
40 E uchar warnsyms[WARNCOUNT];
41 
42 E int x_maze_max, y_maze_max;
43 E int otg_temp;
44 
45 #ifdef REDO
46 E NEARDATA int in_doagain;
47 #endif
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 #ifdef REINCARNATION
53     d_level	d_rogue_level;
54 #endif
55     d_level	d_medusa_level;
56     d_level     d_mineend_level;
57     d_level	d_stronghold_level;
58     d_level	d_valley_level;
59     d_level	d_wiz1_level;
60     d_level	d_wiz2_level;
61     d_level	d_wiz3_level;
62     d_level	d_juiblex_level;
63     d_level	d_orcus_level;
64     d_level	d_baalzebub_level;	/* unused */
65     d_level     d_demogorgon_level;      /* unused */
66     d_level     d_dispater_level;      /* unused */
67     d_level     d_geryon_level;      /* unused */
68     d_level     d_yeenoghu_level;      /* unused */
69     d_level	d_asmodeus_level;	/* unused */
70     d_level	d_portal_level;		/* only in goto_level() [do.c] */
71     d_level	d_sanctum_level;
72     d_level	d_earth_level;
73     d_level	d_water_level;
74     d_level	d_fire_level;
75     d_level	d_air_level;
76     d_level	d_astral_level;
77     xchar	d_tower_dnum;
78     xchar	d_sokoban_dnum;
79     xchar	d_mines_dnum, d_quest_dnum;
80     xchar       d_spiders_dnum;
81     d_level	d_lawful_quest_level;
82     d_level	d_neutral_quest_level;
83     d_level	d_chaotic_quest_level;
84     d_level	d_qstart_level, d_qlocate_level, d_nemesis_level;
85     d_level	d_knox_level;
86 #ifdef BLACKMARKET
87     d_level     d_blackmarket_level;
88 #endif /* BLACKMARKET */
89 } dungeon_topology;
90 /* macros for accesing the dungeon levels by their old names */
91 #define oracle_level		(dungeon_topology.d_oracle_level)
92 #define bigroom_level		(dungeon_topology.d_bigroom_level)
93 #ifdef REINCARNATION
94 #define rogue_level		(dungeon_topology.d_rogue_level)
95 #endif
96 #define medusa_level		(dungeon_topology.d_medusa_level)
97 #define stronghold_level	(dungeon_topology.d_stronghold_level)
98 #define valley_level		(dungeon_topology.d_valley_level)
99 #define mineend_level           (dungeon_topology.d_mineend_level)
100 #define wiz1_level		(dungeon_topology.d_wiz1_level)
101 #define wiz2_level		(dungeon_topology.d_wiz2_level)
102 #define wiz3_level		(dungeon_topology.d_wiz3_level)
103 #define juiblex_level		(dungeon_topology.d_juiblex_level)
104 #define orcus_level		(dungeon_topology.d_orcus_level)
105 #define baalzebub_level		(dungeon_topology.d_baalzebub_level)
106 #define yeenoghu_level          (dungeon_topology.d_yeenoghu_level)
107 #define geryon_level            (dungeon_topology.d_geryon_level)
108 #define dispater_level          (dungeon_topology.d_dispater_level)
109 #define demogorgon_level        (dungeon_topology.d_demogorgon_level)
110 #define asmodeus_level		(dungeon_topology.d_asmodeus_level)
111 #define portal_level		(dungeon_topology.d_portal_level)
112 #define sanctum_level		(dungeon_topology.d_sanctum_level)
113 #define earth_level		(dungeon_topology.d_earth_level)
114 #define water_level		(dungeon_topology.d_water_level)
115 #define fire_level		(dungeon_topology.d_fire_level)
116 #define air_level		(dungeon_topology.d_air_level)
117 #define astral_level		(dungeon_topology.d_astral_level)
118 #define tower_dnum		(dungeon_topology.d_tower_dnum)
119 #define sokoban_dnum		(dungeon_topology.d_sokoban_dnum)
120 #define mines_dnum		(dungeon_topology.d_mines_dnum)
121 #define quest_dnum		(dungeon_topology.d_quest_dnum)
122 #define qstart_level		(dungeon_topology.d_qstart_level)
123 #define qlocate_level		(dungeon_topology.d_qlocate_level)
124 #define nemesis_level		(dungeon_topology.d_nemesis_level)
125 #define knox_level		(dungeon_topology.d_knox_level)
126 #define spiders_dnum		(dungeon_topology.d_spiders_dnum)
127 #define lawful_quest_level	(dungeon_topology.d_lawful_quest_level)
128 #define neutral_quest_level	(dungeon_topology.d_neutral_quest_level)
129 #define chaotic_quest_level	(dungeon_topology.d_chaotic_quest_level)
130 #ifdef BLACKMARKET
131 #define blackmarket_level	(dungeon_topology.d_blackmarket_level)
132 #endif /* BLACKMARKET */
133 
134 E NEARDATA stairway dnstair, upstair;		/* stairs up and down */
135 #define xdnstair	(dnstair.sx)
136 #define ydnstair	(dnstair.sy)
137 #define xupstair	(upstair.sx)
138 #define yupstair	(upstair.sy)
139 
140 E NEARDATA stairway dnladder, upladder;		/* ladders up and down */
141 #define xdnladder	(dnladder.sx)
142 #define ydnladder	(dnladder.sy)
143 #define xupladder	(upladder.sx)
144 #define yupladder	(upladder.sy)
145 
146 E NEARDATA stairway sstairs;
147 
148 E NEARDATA dest_area updest, dndest;	/* level-change destination areas */
149 
150 E NEARDATA coord inv_pos;
151 E NEARDATA dungeon dungeons[];
152 E NEARDATA s_level *sp_levchn;
153 #define dunlev_reached(x)	(dungeons[(x)->dnum].dunlev_ureached)
154 
155 #include "quest.h"
156 E struct q_score quest_status;
157 
158 E NEARDATA char pl_fruit[PL_FSIZ];
159 E NEARDATA int current_fruit;
160 E NEARDATA struct fruit *ffruit;
161 
162 E NEARDATA char tune[6];
163 
164 #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
165 E struct linfo level_info[MAXLINFO];
166 
167 E NEARDATA struct sinfo {
168 	int gameover;		/* self explanatory? */
169 	int stopprint;		/* inhibit further end of game disclosure */
170 #if defined(UNIX) || defined(VMS) || defined (__EMX__) || defined(WIN32)
171 	int done_hup;		/* SIGHUP or moral equivalent received
172 				 * -- no more screen output */
173 #endif
174 	int something_worth_saving;	/* in case of panic */
175 	int panicking;		/* `panic' is in progress */
176 #if defined(VMS) || defined(WIN32)
177 	int exiting;		/* an exit handler is executing */
178 #endif
179 	int in_impossible;
180 #ifdef PANICLOG
181 	int in_paniclog;
182 #endif
183 } program_state;
184 
185 E boolean restoring;
186 
187 E const char quitchars[];
188 E const char vowels[];
189 E const char ynchars[];
190 E const char ynqchars[];
191 E const char ynaqchars[];
192 E const char ynNaqchars[];
193 E NEARDATA long yn_number;
194 
195 E const char disclosure_options[];
196 
197 E NEARDATA int smeq[];
198 E NEARDATA int doorindex;
199 E NEARDATA char *save_cm;
200 #define KILLED_BY_AN	 0
201 #define KILLED_BY	 1
202 #define NO_KILLER_PREFIX 2
203 E NEARDATA int killer_format;
204 E const char *killer;
205 E const char *delayed_killer;
206 #ifdef GOLDOBJ
207 E long done_money;
208 #endif
209 E char killer_buf[BUFSZ];
210 #ifdef DUMP_LOG
211 E char dump_fn[];		/* dumpfile name (dump patch) */
212 #endif
213 E const char *configfile;
214 E NEARDATA char plname[PL_NSIZ];
215 E NEARDATA char dogname[];
216 E NEARDATA char catname[];
217 E NEARDATA char ghoulname[];
218 E NEARDATA char horsename[];
219 E NEARDATA char wolfname[];
220 #if 0
221 E NEARDATA char batname[];
222 E NEARDATA char snakename[];
223 E NEARDATA char ratname[];
224 E NEARDATA char badgername[];
225 E NEARDATA char reddragonname[];
226 E NEARDATA char whitedragonname[];
227 #endif
228 E char preferred_pet;
229 E const char *occtxt;			/* defined when occupation != NULL */
230 E const char *nomovemsg;
231 E const char nul[];
232 E char lock[];
233 
234 E const char sdir[], ndir[];
235 E const schar xdir[], ydir[], zdir[];
236 
237 E NEARDATA schar tbx, tby;		/* set in mthrowu.c */
238 
239 E NEARDATA struct multishot { int n, i; short o; boolean s; } m_shot;
240 
241 E NEARDATA struct dig_info {		/* apply.c, hack.c */
242 	int	effort;
243 	d_level level;
244 	coord	pos;
245 	long lastdigtime;
246 	boolean down, chew, warned, quiet;
247 } digging;
248 
249 E NEARDATA long moves, monstermoves;
250 E NEARDATA long wailmsg;
251 
252 E NEARDATA boolean in_mklev;
253 E NEARDATA boolean stoned;
254 E NEARDATA boolean unweapon;
255 E NEARDATA boolean mrg_to_wielded;
256 E NEARDATA struct obj *current_wand;
257 E NEARDATA boolean defer_see_monsters;
258 
259 E NEARDATA boolean in_steed_dismounting;
260 
261 E const int shield_static[];
262 
263 
264 /*** Objects ***/
265 #include "obj.h"
266 
267 E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
268 #ifdef TOURIST
269 	*uarmu,				/* under-wear, so to speak */
270 #endif
271 #ifdef STEED
272 	*usaddle,
273 #endif
274 	*uskin, *uamul, *uleft, *uright, *ublindf,
275 	*uwep, *uswapwep, *uquiver;
276 
277 E NEARDATA struct obj *uchain;		/* defined only when punished */
278 E NEARDATA struct obj *uball;
279 E NEARDATA struct obj *migrating_objs;
280 E NEARDATA struct obj *billobjs;
281 E NEARDATA struct obj zeroobj;		/* init'd and defined in decl.c */
282 E NEARDATA struct obj thisplace;	/* init'd and defined in decl.c */
283 
284 #include "spell.h"
285 E NEARDATA struct spell spl_book[];	/* sized in decl.c */
286 
287 #ifndef TECH_H
288 #include "tech.h"
289 #endif
290 E NEARDATA struct tech tech_list[];     /* sized in decl.c */
291 
292 
293 /*** The player ***/
294 E NEARDATA char pl_character[PL_CSIZ];
295 E NEARDATA char pl_race;		/* character's race */
296 /* KMH, role patch -- more maintainable when declared as an array */
297 E const char pl_classes[];
298 
299 #include "you.h"
300 #include "onames.h"
301 
302 E NEARDATA struct you u;
303 E NEARDATA struct Role urole;
304 
305 
306 /*** Monsters ***/
307 #ifndef PM_H
308 #include "pm.h"
309 #endif
310 
311 E NEARDATA struct permonst playermon, *uasmon;
312 					/* also decl'd extern in permonst.h */
313 					/* init'd in monst.c */
314 
315 E NEARDATA struct monst youmonst;	/* init'd and defined in decl.c */
316 E NEARDATA struct monst *mydogs, *migrating_mons;
317 
318 E NEARDATA struct permonst upermonst;	/* init'd in decl.c,
319 					 * defined in polyself.c
320 					 */
321 
322 E NEARDATA struct mvitals {
323 	uchar	born;
324 	uchar	died;
325 	uchar	mvflags;
326 #ifdef EATEN_MEMORY
327 	uchar	eaten;		/* WAC -- eaten memory */
328 #endif
329 } mvitals[NUMMONS];
330 
331 
332 /* The names of the colors used for gems, etc. */
333 E const char *c_obj_colors[];
334 
335 E struct c_common_strings {
336     const char	*const c_nothing_happens, *const c_thats_enough_tries,
337 		*const c_silly_thing_to, *const c_shudder_for_moment,
338 		*const c_something, *const c_Something,
339 		*const c_You_can_move_again,
340 		*const c_Never_mind, *c_vision_clears,
341 		*const c_the_your[2];
342 } c_common_strings;
343 #define nothing_happens    c_common_strings.c_nothing_happens
344 #define thats_enough_tries c_common_strings.c_thats_enough_tries
345 #define silly_thing_to	   c_common_strings.c_silly_thing_to
346 #define shudder_for_moment c_common_strings.c_shudder_for_moment
347 #define something	   c_common_strings.c_something
348 #define Something	   c_common_strings.c_Something
349 #define You_can_move_again c_common_strings.c_You_can_move_again
350 #define Never_mind	   c_common_strings.c_Never_mind
351 #define vision_clears	   c_common_strings.c_vision_clears
352 #define the_your	   c_common_strings.c_the_your
353 
354 E const char no_elbow_room[];
355 
356 /* material strings */
357 E const char *materialnm[];
358 
359 /* Monster name articles */
360 #define ARTICLE_NONE	0
361 #define ARTICLE_THE	1
362 #define ARTICLE_A	2
363 #define ARTICLE_YOUR	3
364 
365 /* Monster name suppress masks */
366 #define SUPPRESS_IT		0x01
367 #define SUPPRESS_INVISIBLE	0x02
368 #define SUPPRESS_HALLUCINATION  0x04
369 #define SUPPRESS_SADDLE		0x08
370 #define EXACT_NAME		0x0F
371 
372 
373 /*** Vision ***/
374 E NEARDATA boolean vision_full_recalc;	/* TRUE if need vision recalc */
375 E NEARDATA char **viz_array;		/* could see/in sight row pointers */
376 
377 
378 /*** Window system stuff ***/
379 #include "color.h"
380 #ifdef TEXTCOLOR
381 E const int zapcolors[];
382 #endif
383 
384 E const char def_oc_syms[MAXOCLASSES];	/* default class symbols */
385 E uchar oc_syms[MAXOCLASSES];		/* current class symbols */
386 E const char def_monsyms[MAXMCLASSES];	/* default class symbols */
387 E uchar monsyms[MAXMCLASSES];		/* current class symbols */
388 
389 E NEARDATA struct c_color_names {
390     const char	*const c_black, *const c_amber, *const c_golden,
391 		*const c_light_blue,*const c_red, *const c_green,
392 		*const c_silver, *const c_blue, *const c_purple,
393 		*const c_white;
394 } c_color_names;
395 #define NH_BLACK		c_color_names.c_black
396 #define NH_AMBER		c_color_names.c_amber
397 #define NH_GOLDEN		c_color_names.c_golden
398 #define NH_LIGHT_BLUE		c_color_names.c_light_blue
399 #define NH_RED			c_color_names.c_red
400 #define NH_GREEN		c_color_names.c_green
401 #define NH_SILVER		c_color_names.c_silver
402 #define NH_BLUE			c_color_names.c_blue
403 #define NH_PURPLE		c_color_names.c_purple
404 #define NH_WHITE		c_color_names.c_white
405 
406 E NEARDATA winid WIN_MESSAGE, WIN_STATUS;
407 E NEARDATA winid WIN_MAP, WIN_INVEN;
408 E char toplines[];
409 #ifndef TCAP_H
410 E struct tc_gbl_data {	/* also declared in tcap.h */
411     char *tc_AS, *tc_AE;	/* graphics start and end (tty font swapping) */
412     int   tc_LI,  tc_CO;	/* lines and columns */
413 } tc_gbl_data;
414 #define AS tc_gbl_data.tc_AS
415 #define AE tc_gbl_data.tc_AE
416 #define LI tc_gbl_data.tc_LI
417 #define CO tc_gbl_data.tc_CO
418 #endif
419 
420 E struct authentication {
421     char prog[BUFSZ];
422     char args[BUFSZ];
423 } authentication;
424 
425 #define MAXNOTILESETS		20
426 #ifndef TILESET_MAX_FILENAME
427 #define TILESET_MAX_FILENAME	256
428 #endif
429 
430 #define TILESET_TRANSPARENT	1
431 #define TILESET_PSEUDO3D	2
432 
433 E struct tileset {
434     char name[PL_PSIZ];
435     char file[TILESET_MAX_FILENAME];
436     unsigned long flags;
437     void *data;				/* For windowing port's use */
438 } tilesets[MAXNOTILESETS];
439 E int no_tilesets;
440 E struct tileset def_tilesets[];
441 E char tileset[PL_PSIZ];
442 
443 /* xxxexplain[] is in drawing.c */
444 E const char * const monexplain[], invisexplain[], * const objexplain[], * const oclass_names[];
445 
446 /* Some systems want to use full pathnames for some subsets of file names,
447  * rather than assuming that they're all in the current directory.  This
448  * provides all the subclasses that seem reasonable, and sets up for all
449  * prefixes being null.  Port code can set those that it wants.
450  */
451 #define HACKPREFIX	0
452 #define LEVELPREFIX	1
453 #define SAVEPREFIX	2
454 #define BONESPREFIX	3
455 #define DATAPREFIX	4	/* this one must match hardcoded value in dlb.c */
456 #define SCOREPREFIX	5
457 #define LOCKPREFIX	6
458 #define CONFIGPREFIX	7
459 #define TROUBLEPREFIX	8
460 #define PREFIX_COUNT	9
461 /* used in files.c; xxconf.h can override if needed */
462 # ifndef FQN_MAX_FILENAME
463 #define FQN_MAX_FILENAME 512
464 # endif
465 
466 #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
467 /* the bare-bones stuff is unconditional above to simplify coding; for
468  * ports that actually use prefixes, add some more localized things
469  */
470 #define PREFIXES_IN_USE
471 #endif
472 
473 E char *fqn_prefix[PREFIX_COUNT];
474 #ifdef PREFIXES_IN_USE
475 E char *fqn_prefix_names[PREFIX_COUNT];
476 #endif
477 
478 
479 #ifdef AUTOPICKUP_EXCEPTIONS
480 struct autopickup_exception {
481 	char *pattern;
482 	boolean grab;
483 	struct autopickup_exception *next;
484 };
485 #endif /* AUTOPICKUP_EXCEPTIONS */
486 
487 #undef E
488 
489 #endif /* DECL_H */
490