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