OSDN Git Service

shrink mine
[nethackexpress/trunk.git] / include / decl.h
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 nroom;
34 E NEARDATA int nsubroom;
35 E NEARDATA int occtime;
36
37 #define WARNCOUNT 6                     /* number of different warning levels */
38 E uchar warnsyms[WARNCOUNT];
39
40 E int x_maze_max, y_maze_max;
41 E int otg_temp;
42
43 #ifdef REDO
44 E NEARDATA int in_doagain;
45 #endif
46
47 E struct dgn_topology {         /* special dungeon levels for speed */
48     d_level     d_oracle_level;
49     d_level     d_bigroom_level;        /* unused */
50 #ifdef REINCARNATION
51     d_level     d_rogue_level;
52 #endif
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 } dungeon_topology;
76 /* macros for accesing the dungeon levels by their old names */
77 #define oracle_level            (dungeon_topology.d_oracle_level)
78 #define bigroom_level           (dungeon_topology.d_bigroom_level)
79 #ifdef REINCARNATION
80 #define rogue_level             (dungeon_topology.d_rogue_level)
81 #endif
82 #define medusa_level            (dungeon_topology.d_medusa_level)
83 #define stronghold_level        (dungeon_topology.d_stronghold_level)
84 #define valley_level            (dungeon_topology.d_valley_level)
85 #define wiz1_level              (dungeon_topology.d_wiz1_level)
86 #define wiz2_level              (dungeon_topology.d_wiz2_level)
87 #define wiz3_level              (dungeon_topology.d_wiz3_level)
88 #define juiblex_level           (dungeon_topology.d_juiblex_level)
89 #define orcus_level             (dungeon_topology.d_orcus_level)
90 #define baalzebub_level         (dungeon_topology.d_baalzebub_level)
91 #define asmodeus_level          (dungeon_topology.d_asmodeus_level)
92 #define portal_level            (dungeon_topology.d_portal_level)
93 #define sanctum_level           (dungeon_topology.d_sanctum_level)
94 #define earth_level             (dungeon_topology.d_earth_level)
95 #define water_level             (dungeon_topology.d_water_level)
96 #define fire_level              (dungeon_topology.d_fire_level)
97 #define air_level               (dungeon_topology.d_air_level)
98 #define astral_level            (dungeon_topology.d_astral_level)
99 #define tower_dnum              (dungeon_topology.d_tower_dnum)
100 #define sokoban_dnum            (dungeon_topology.d_sokoban_dnum)
101 #define mines_dnum              (dungeon_topology.d_mines_dnum)
102 #define quest_dnum              (dungeon_topology.d_quest_dnum)
103 #define qstart_level            (dungeon_topology.d_qstart_level)
104 #define qlocate_level           (dungeon_topology.d_qlocate_level)
105 #define nemesis_level           (dungeon_topology.d_nemesis_level)
106 #define knox_level              (dungeon_topology.d_knox_level)
107
108 E NEARDATA stairway dnstair, upstair;           /* stairs up and down */
109 #define xdnstair        (dnstair.sx)
110 #define ydnstair        (dnstair.sy)
111 #define xupstair        (upstair.sx)
112 #define yupstair        (upstair.sy)
113
114 E NEARDATA stairway dnladder, upladder;         /* ladders up and down */
115 #define xdnladder       (dnladder.sx)
116 #define ydnladder       (dnladder.sy)
117 #define xupladder       (upladder.sx)
118 #define yupladder       (upladder.sy)
119
120 E NEARDATA stairway sstairs;
121
122 E NEARDATA dest_area updest, dndest;    /* level-change destination areas */
123
124 E NEARDATA coord inv_pos;
125 E NEARDATA dungeon dungeons[];
126 E NEARDATA s_level *sp_levchn;
127 #define dunlev_reached(x)       (dungeons[(x)->dnum].dunlev_ureached)
128
129 #include "quest.h"
130 E struct q_score quest_status;
131
132 E NEARDATA char pl_character[PL_CSIZ];
133 E NEARDATA char pl_race;                /* character's race */
134
135 E NEARDATA char pl_fruit[PL_FSIZ];
136 E NEARDATA int current_fruit;
137 E NEARDATA struct fruit *ffruit;
138
139 E NEARDATA char tune[6];
140
141 #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
142 E struct linfo level_info[MAXLINFO];
143
144 E NEARDATA struct sinfo {
145         int gameover;           /* self explanatory? */
146         int stopprint;          /* inhibit further end of game disclosure */
147 #if defined(UNIX) || defined(VMS) || defined (__EMX__) || defined(WIN32)
148         int done_hup;           /* SIGHUP or moral equivalent received
149                                  * -- no more screen output */
150 #endif
151         int something_worth_saving;     /* in case of panic */
152         int panicking;          /* `panic' is in progress */
153 #if defined(VMS) || defined(WIN32)
154         int exiting;            /* an exit handler is executing */
155 #endif
156         int in_impossible;
157 #ifdef PANICLOG
158         int in_paniclog;
159 #endif
160 } program_state;
161
162 E boolean restoring;
163
164 E const char quitchars[];
165 E const char vowels[];
166 E const char ynchars[];
167 E const char ynqchars[];
168 E const char ynaqchars[];
169 E const char ynNaqchars[];
170 E NEARDATA long yn_number;
171
172 E const char disclosure_options[];
173
174 E NEARDATA int smeq[];
175 E NEARDATA int doorindex;
176 E NEARDATA char *save_cm;
177 #define KILLED_BY_AN     0
178 #define KILLED_BY        1
179 #define NO_KILLER_PREFIX 2
180 E NEARDATA int killer_format;
181 E const char *killer;
182 E const char *delayed_killer;
183 #ifdef GOLDOBJ
184 E long done_money;
185 #endif
186 E char killer_buf[BUFSZ];
187 E const char *configfile;
188 E NEARDATA char plname[PL_NSIZ];
189 E NEARDATA char dogname[];
190 E NEARDATA char catname[];
191 E NEARDATA char horsename[];
192 E char preferred_pet;
193 E const char *occtxt;                   /* defined when occupation != NULL */
194 E const char *nomovemsg;
195 E const char nul[];
196 E char lock[];
197
198 E const char sdir[], ndir[];
199 E const schar xdir[], ydir[], zdir[];
200
201 E NEARDATA schar tbx, tby;              /* set in mthrowu.c */
202
203 E NEARDATA struct multishot { int n, i; short o; boolean s; } m_shot;
204
205 E NEARDATA struct dig_info {            /* apply.c, hack.c */
206         int     effort;
207         d_level level;
208         coord   pos;
209         long lastdigtime;
210         boolean down, chew, warned, quiet;
211 } digging;
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 struct obj *current_wand;
221
222 E NEARDATA boolean in_steed_dismounting;
223
224 E const int shield_static[];
225
226 #include "spell.h"
227 E NEARDATA struct spell spl_book[];     /* sized in decl.c */
228
229 #include "color.h"
230 #ifdef TEXTCOLOR
231 E const int zapcolors[];
232 #endif
233
234 E const char def_oc_syms[MAXOCLASSES];  /* default class symbols */
235 E uchar oc_syms[MAXOCLASSES];           /* current class symbols */
236 E const char def_monsyms[MAXMCLASSES];  /* default class symbols */
237 E uchar monsyms[MAXMCLASSES];           /* current class symbols */
238
239 #include "obj.h"
240 E NEARDATA struct obj *invent,
241         *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
242 #ifdef TOURIST
243         *uarmu,                         /* under-wear, so to speak */
244 #endif
245         *uskin, *uamul, *uleft, *uright, *ublindf,
246         *uwep, *uswapwep, *uquiver;
247
248 E NEARDATA struct obj *uchain;          /* defined only when punished */
249 E NEARDATA struct obj *uball;
250 E NEARDATA struct obj *migrating_objs;
251 E NEARDATA struct obj *billobjs;
252 E NEARDATA struct obj zeroobj;          /* init'd and defined in decl.c */
253
254 #include "you.h"
255 E NEARDATA struct you u;
256
257 #include "onames.h"
258 #ifndef PM_H            /* (pm.h has already been included via youprop.h) */
259 #include "pm.h"
260 #endif
261
262 E NEARDATA struct monst youmonst;       /* init'd and defined in decl.c */
263 E NEARDATA struct monst *mydogs, *migrating_mons;
264
265 E NEARDATA struct mvitals {
266         uchar   born;
267         uchar   died;
268         uchar   mvflags;
269 } mvitals[NUMMONS];
270
271 E NEARDATA struct c_color_names {
272     const char  *const c_black, *const c_amber, *const c_golden,
273                 *const c_light_blue,*const c_red, *const c_green,
274                 *const c_silver, *const c_blue, *const c_purple,
275                 *const c_white;
276 } c_color_names;
277 #define NH_BLACK                c_color_names.c_black
278 #define NH_AMBER                c_color_names.c_amber
279 #define NH_GOLDEN               c_color_names.c_golden
280 #define NH_LIGHT_BLUE           c_color_names.c_light_blue
281 #define NH_RED                  c_color_names.c_red
282 #define NH_GREEN                c_color_names.c_green
283 #define NH_SILVER               c_color_names.c_silver
284 #define NH_BLUE                 c_color_names.c_blue
285 #define NH_PURPLE               c_color_names.c_purple
286 #define NH_WHITE                c_color_names.c_white
287
288 /* The names of the colors used for gems, etc. */
289 E const char *c_obj_colors[];
290
291 E struct c_common_strings {
292     const char  *const c_nothing_happens, *const c_thats_enough_tries,
293                 *const c_silly_thing_to, *const c_shudder_for_moment,
294                 *const c_something, *const c_Something,
295                 *const c_You_can_move_again,
296                 *const c_Never_mind, *c_vision_clears,
297                 *const c_the_your[2];
298 } c_common_strings;
299 #define nothing_happens    c_common_strings.c_nothing_happens
300 #define thats_enough_tries c_common_strings.c_thats_enough_tries
301 #define silly_thing_to     c_common_strings.c_silly_thing_to
302 #define shudder_for_moment c_common_strings.c_shudder_for_moment
303 #define something          c_common_strings.c_something
304 #define Something          c_common_strings.c_Something
305 #define You_can_move_again c_common_strings.c_You_can_move_again
306 #define Never_mind         c_common_strings.c_Never_mind
307 #define vision_clears      c_common_strings.c_vision_clears
308 #define the_your           c_common_strings.c_the_your
309
310 /* material strings */
311 E const char *materialnm[];
312
313 /* Monster name articles */
314 #define ARTICLE_NONE    0
315 #define ARTICLE_THE     1
316 #define ARTICLE_A       2
317 #define ARTICLE_YOUR    3
318
319 /* Monster name suppress masks */
320 #define SUPPRESS_IT             0x01
321 #define SUPPRESS_INVISIBLE      0x02
322 #define SUPPRESS_HALLUCINATION  0x04
323 #define SUPPRESS_SADDLE         0x08
324 #define EXACT_NAME              0x0F
325
326 /* Vision */
327 E NEARDATA boolean vision_full_recalc;  /* TRUE if need vision recalc */
328 E NEARDATA char **viz_array;            /* could see/in sight row pointers */
329
330 /* Window system stuff */
331 E NEARDATA winid WIN_MESSAGE, WIN_STATUS;
332 E NEARDATA winid WIN_MAP, WIN_INVEN;
333 E char toplines[];
334 #ifndef TCAP_H
335 E struct tc_gbl_data {  /* also declared in tcap.h */
336     char *tc_AS, *tc_AE;        /* graphics start and end (tty font swapping) */
337     int   tc_LI,  tc_CO;        /* lines and columns */
338 } tc_gbl_data;
339 #define AS tc_gbl_data.tc_AS
340 #define AE tc_gbl_data.tc_AE
341 #define LI tc_gbl_data.tc_LI
342 #define CO tc_gbl_data.tc_CO
343 #endif
344
345 /* xxxexplain[] is in drawing.c */
346 E const char * const monexplain[], invisexplain[], * const objexplain[], * const oclass_names[];
347
348 /* Some systems want to use full pathnames for some subsets of file names,
349  * rather than assuming that they're all in the current directory.  This
350  * provides all the subclasses that seem reasonable, and sets up for all
351  * prefixes being null.  Port code can set those that it wants.
352  */
353 #define HACKPREFIX      0
354 #define LEVELPREFIX     1
355 #define SAVEPREFIX      2
356 #define BONESPREFIX     3
357 #define DATAPREFIX      4       /* this one must match hardcoded value in dlb.c */
358 #define SCOREPREFIX     5
359 #define LOCKPREFIX      6
360 #define CONFIGPREFIX    7
361 #define TROUBLEPREFIX   8
362 #define PREFIX_COUNT    9
363 /* used in files.c; xxconf.h can override if needed */
364 # ifndef FQN_MAX_FILENAME
365 #define FQN_MAX_FILENAME 512
366 # endif
367
368 #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
369 /* the bare-bones stuff is unconditional above to simplify coding; for
370  * ports that actually use prefixes, add some more localized things
371  */
372 #define PREFIXES_IN_USE
373 #endif
374
375 E char *fqn_prefix[PREFIX_COUNT];
376 #ifdef PREFIXES_IN_USE
377 E char *fqn_prefix_names[PREFIX_COUNT];
378 #endif
379
380 #ifdef AUTOPICKUP_EXCEPTIONS
381 struct autopickup_exception {
382         char *pattern;
383         boolean grab;
384         struct autopickup_exception *next;
385 };
386 #endif /* AUTOPICKUP_EXCEPTIONS */
387
388 #undef E
389
390 #endif /* DECL_H */