dumplog message history groundwork
[aNetHack.git] / src / decl.c
blob479c075aae1031d433dbf541d9a852f511edb903
1 /* NetHack 3.6 decl.c $NHDT-Date: 1446975463 2015/11/08 09:37:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #include "hack.h"
7 int NDECL((*afternmv));
8 int NDECL((*occupation));
10 /* from xxxmain.c */
11 const char *hname = 0; /* name of the game (argv[0] of main) */
12 int hackpid = 0; /* current process id */
13 #if defined(UNIX) || defined(VMS)
14 int locknum = 0; /* max num of simultaneous users */
15 #endif
16 #ifdef DEF_PAGER
17 char *catmore = 0; /* default pager */
18 #endif
20 NEARDATA int bases[MAXOCLASSES] = DUMMY;
22 NEARDATA int multi = 0;
23 const char *multi_reason = NULL;
24 NEARDATA int nroom = 0;
25 NEARDATA int nsubroom = 0;
26 NEARDATA int occtime = 0;
28 /* maze limits must be even; masking off lowest bit guarantees that */
29 int x_maze_max = (COLNO - 1) & ~1, y_maze_max = (ROWNO - 1) & ~1;
31 int otg_temp; /* used by object_to_glyph() [otg] */
33 NEARDATA int in_doagain = 0;
36 * The following structure will be initialized at startup time with
37 * the level numbers of some "important" things in the game.
39 struct dgn_topology dungeon_topology = { DUMMY };
41 struct q_score quest_status = DUMMY;
43 NEARDATA int warn_obj_cnt = 0;
44 NEARDATA int smeq[MAXNROFROOMS + 1] = DUMMY;
45 NEARDATA int doorindex = 0;
46 NEARDATA char *save_cm = 0;
48 NEARDATA struct kinfo killer = DUMMY;
49 NEARDATA long done_money = 0;
50 const char *nomovemsg = 0;
51 NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */
52 NEARDATA char pl_character[PL_CSIZ] = DUMMY;
53 NEARDATA char pl_race = '\0';
55 NEARDATA char pl_fruit[PL_FSIZ] = DUMMY;
56 NEARDATA struct fruit *ffruit = (struct fruit *) 0;
58 NEARDATA char tune[6] = DUMMY;
60 const char *occtxt = DUMMY;
61 const char quitchars[] = " \r\n\033";
62 const char vowels[] = "aeiouAEIOU";
63 const char ynchars[] = "yn";
64 const char ynqchars[] = "ynq";
65 const char ynaqchars[] = "ynaq";
66 const char ynNaqchars[] = "yn#aq";
67 NEARDATA long yn_number = 0L;
69 const char disclosure_options[] = "iavgco";
71 #if defined(MICRO) || defined(WIN32)
72 char hackdir[PATHLEN]; /* where rumors, help, record are */
73 #ifdef MICRO
74 char levels[PATHLEN]; /* where levels are */
75 #endif
76 #endif /* MICRO || WIN32 */
78 #ifdef MFLOPPY
79 char permbones[PATHLEN]; /* where permanent copy of bones go */
80 int ramdisk = FALSE; /* whether to copy bones to levels or not */
81 int saveprompt = TRUE;
82 const char *alllevels = "levels.*";
83 const char *allbones = "bones*.*";
84 #endif
86 struct linfo level_info[MAXLINFO];
88 NEARDATA struct sinfo program_state;
90 /* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
91 const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
92 const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
93 const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
95 NEARDATA schar tbx = 0, tby = 0; /* mthrowu: target */
97 /* for xname handling of multiple shot missile volleys:
98 number of shots, index of current one, validity check, shoot vs throw */
99 NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
101 NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
102 NEARDATA s_level *sp_levchn;
103 NEARDATA stairway upstair = { 0, 0, { 0, 0 }, 0 },
104 dnstair = { 0, 0, { 0, 0 }, 0 };
105 NEARDATA stairway upladder = { 0, 0, { 0, 0 }, 0 },
106 dnladder = { 0, 0, { 0, 0 }, 0 };
107 NEARDATA stairway sstairs = { 0, 0, { 0, 0 }, 0 };
108 NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
109 NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
110 NEARDATA coord inv_pos = { 0, 0 };
112 NEARDATA boolean defer_see_monsters = FALSE;
113 NEARDATA boolean in_mklev = FALSE;
114 NEARDATA boolean stoned = FALSE; /* done to monsters hit by 'c' */
115 NEARDATA boolean unweapon = FALSE;
116 NEARDATA boolean mrg_to_wielded = FALSE;
117 /* weapon picked is merged with wielded one */
119 NEARDATA boolean in_steed_dismounting = FALSE;
121 NEARDATA coord bhitpos = DUMMY;
122 NEARDATA coord doors[DOORMAX] = { DUMMY };
124 NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY };
125 NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1];
126 struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
128 dlevel_t level; /* level map */
129 struct trap *ftrap = (struct trap *) 0;
130 NEARDATA struct monst youmonst = DUMMY;
131 NEARDATA struct context_info context = DUMMY;
132 NEARDATA struct flag flags = DUMMY;
133 #ifdef SYSFLAGS
134 NEARDATA struct sysflag sysflags = DUMMY;
135 #endif
136 NEARDATA struct instance_flags iflags = DUMMY;
137 NEARDATA struct you u = DUMMY;
138 NEARDATA time_t ubirthday = DUMMY;
139 NEARDATA struct u_realtime urealtime = DUMMY;
141 schar lastseentyp[COLNO][ROWNO] = {
142 DUMMY
143 }; /* last seen/touched dungeon typ */
145 NEARDATA struct obj
146 *invent = (struct obj *) 0,
147 *uwep = (struct obj *) 0, *uarm = (struct obj *) 0,
148 *uswapwep = (struct obj *) 0,
149 *uquiver = (struct obj *) 0, /* quiver */
150 *uarmu = (struct obj *) 0, /* under-wear, so to speak */
151 *uskin = (struct obj *) 0, /* dragon armor, if a dragon */
152 *uarmc = (struct obj *) 0, *uarmh = (struct obj *) 0,
153 *uarms = (struct obj *) 0, *uarmg = (struct obj *) 0,
154 *uarmf = (struct obj *) 0, *uamul = (struct obj *) 0,
155 *uright = (struct obj *) 0, *uleft = (struct obj *) 0,
156 *ublindf = (struct obj *) 0, *uchain = (struct obj *) 0,
157 *uball = (struct obj *) 0;
158 /* some objects need special handling during destruction or placement */
159 NEARDATA struct obj
160 *current_wand = 0, /* wand currently zapped/applied */
161 *thrownobj = 0, /* object in flight due to throwing */
162 *kickedobj = 0; /* object in flight due to kicking */
164 #ifdef TEXTCOLOR
166 * This must be the same order as used for buzz() in zap.c.
168 const int zapcolors[NUM_ZAP] = {
169 HI_ZAP, /* 0 - missile */
170 CLR_ORANGE, /* 1 - fire */
171 CLR_WHITE, /* 2 - frost */
172 HI_ZAP, /* 3 - sleep */
173 CLR_BLACK, /* 4 - death */
174 CLR_WHITE, /* 5 - lightning */
175 CLR_YELLOW, /* 6 - poison gas */
176 CLR_GREEN, /* 7 - acid */
178 #endif /* text color */
180 const int shield_static[SHIELD_COUNT] = {
181 S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
182 S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
183 S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
186 NEARDATA struct spell spl_book[MAXSPELL + 1] = { DUMMY };
188 NEARDATA long moves = 1L, monstermoves = 1L;
189 /* These diverge when player is Fast */
190 NEARDATA long wailmsg = 0L;
192 /* objects that are moving to another dungeon level */
193 NEARDATA struct obj *migrating_objs = (struct obj *) 0;
194 /* objects not yet paid for */
195 NEARDATA struct obj *billobjs = (struct obj *) 0;
197 /* used to zero all elements of a struct obj and a struct monst */
198 NEARDATA struct obj zeroobj = DUMMY;
199 NEARDATA struct monst zeromonst = DUMMY;
200 /* used to zero out union any; initializer deliberately omitted */
201 NEARDATA anything zeroany;
203 /* originally from dog.c */
204 NEARDATA char dogname[PL_PSIZ] = DUMMY;
205 NEARDATA char catname[PL_PSIZ] = DUMMY;
206 NEARDATA char horsename[PL_PSIZ] = DUMMY;
207 char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */
208 /* monsters that went down/up together with @ */
209 NEARDATA struct monst *mydogs = (struct monst *) 0;
210 /* monsters that are moving to another dungeon level */
211 NEARDATA struct monst *migrating_mons = (struct monst *) 0;
213 NEARDATA struct mvitals mvitals[NUMMONS];
215 NEARDATA struct c_color_names c_color_names = {
216 "black", "amber", "golden", "light blue", "red", "green",
217 "silver", "blue", "purple", "white", "orange"
220 struct menucoloring *menu_colorings = NULL;
222 const char *c_obj_colors[] = {
223 "black", /* CLR_BLACK */
224 "red", /* CLR_RED */
225 "green", /* CLR_GREEN */
226 "brown", /* CLR_BROWN */
227 "blue", /* CLR_BLUE */
228 "magenta", /* CLR_MAGENTA */
229 "cyan", /* CLR_CYAN */
230 "gray", /* CLR_GRAY */
231 "transparent", /* no_color */
232 "orange", /* CLR_ORANGE */
233 "bright green", /* CLR_BRIGHT_GREEN */
234 "yellow", /* CLR_YELLOW */
235 "bright blue", /* CLR_BRIGHT_BLUE */
236 "bright magenta", /* CLR_BRIGHT_MAGENTA */
237 "bright cyan", /* CLR_BRIGHT_CYAN */
238 "white", /* CLR_WHITE */
241 struct c_common_strings c_common_strings = { "Nothing happens.",
242 "That's enough tries!",
243 "That is a silly thing to %s.",
244 "shudder for a moment.",
245 "something",
246 "Something",
247 "You can move again.",
248 "Never mind.",
249 "vision quickly clears.",
250 { "the", "your" } };
252 /* NOTE: the order of these words exactly corresponds to the
253 order of oc_material values #define'd in objclass.h. */
254 const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
255 "flesh", "paper", "cloth", "leather",
256 "wooden", "bone", "dragonhide", "iron",
257 "metal", "copper", "silver", "gold",
258 "platinum", "mithril", "plastic", "glass",
259 "gemstone", "stone" };
261 /* Vision */
262 NEARDATA boolean vision_full_recalc = 0;
263 NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */
265 /* Global windowing data, defined here for multi-window-system support */
266 NEARDATA winid WIN_MESSAGE = WIN_ERR;
267 #ifndef STATUS_VIA_WINDOWPORT
268 NEARDATA winid WIN_STATUS = WIN_ERR;
269 #endif
270 NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
271 char toplines[TBUFSZ];
272 /* Windowing stuff that's really tty oriented, but present for all ports */
273 struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */
275 char *fqn_prefix[PREFIX_COUNT] = { (char *) 0, (char *) 0, (char *) 0,
276 (char *) 0, (char *) 0, (char *) 0,
277 (char *) 0, (char *) 0, (char *) 0,
278 (char *) 0 };
280 #ifdef PREFIXES_IN_USE
281 char *fqn_prefix_names[PREFIX_COUNT] = {
282 "hackdir", "leveldir", "savedir", "bonesdir", "datadir",
283 "scoredir", "lockdir", "sysconfdir", "configdir", "troubledir"
285 #endif
287 NEARDATA struct savefile_info sfcap = {
288 #ifdef NHSTDC
289 0x00000000UL
290 #else
291 0x00000000L
292 #endif
293 #if defined(COMPRESS) || defined(ZLIB_COMP)
294 | SFI1_EXTERNALCOMP
295 #endif
296 #if defined(ZEROCOMP)
297 | SFI1_ZEROCOMP
298 #endif
299 #if defined(RLECOMP)
300 | SFI1_RLECOMP
301 #endif
303 #ifdef NHSTDC
304 0x00000000UL, 0x00000000UL
305 #else
306 0x00000000L, 0x00000000L
307 #endif
310 NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = {
311 #ifdef NHSTDC
312 0x00000000UL
313 #else
314 0x00000000L
315 #endif
316 #if defined(COMPRESS) || defined(ZLIB_COMP)
317 | SFI1_EXTERNALCOMP
318 #endif
319 #if defined(ZEROCOMP)
320 | SFI1_ZEROCOMP
321 #endif
322 #if defined(RLECOMP)
323 | SFI1_RLECOMP
324 #endif
326 #ifdef NHSTDC
327 0x00000000UL, 0x00000000UL
328 #else
329 0x00000000L, 0x00000000L
330 #endif
333 struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0;
335 #ifdef PANICTRACE
336 char *ARGV0;
337 #endif
339 /* support for lint.h */
340 unsigned nhUse_dummy = 0;
342 /* dummy routine used to force linkage */
343 void
344 decl_init()
346 return;
349 /*decl.c*/