1/* SCCS Id: @(#)decl.c 3.2 2001/12/10 */ 2/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3/* NetHack may be freely redistributed. See license for details. */ 4 5#include "hack.h" 6 7int NDECL((*afternmv)); 8int NDECL((*occupation)); 9 10/* from xxxmain.c */ 11const char *hname = 0; /* name of the game (argv[0] of main) */ 12int hackpid = 0; /* current process id */ 13#if defined(UNIX) || defined(VMS) 14int locknum = 0; /* max num of simultaneous users */ 15#endif 16#ifdef DEF_PAGER 17char *catmore = 0; /* default pager */ 18#endif 19 20NEARDATA int bases[MAXOCLASSES] = DUMMY; 21 22NEARDATA int multi = 0; 23#if 0 24NEARDATA int warnlevel = 0; /* used by movemon and dochugw */ 25#endif 26NEARDATA int nroom = 0; 27NEARDATA int nsubroom = 0; 28NEARDATA int occtime = 0; 29 30int x_maze_max, y_maze_max; /* initialized in main, used in mkmaze.c */ 31int otg_temp; /* used by object_to_glyph() [otg] */ 32 33#ifdef REDO 34NEARDATA int in_doagain = 0; 35#endif 36 37/* 38 * The following structure will be initialized at startup time with 39 * the level numbers of some "important" things in the game. 40 */ 41struct dgn_topology dungeon_topology = {DUMMY}; 42 43#include "quest.h" 44struct q_score quest_status = DUMMY; 45 46NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY; 47NEARDATA int doorindex = 0; 48 49NEARDATA char *save_cm = 0; 50NEARDATA int killer_format = 0; 51const char *killer = 0; 52const char *delayed_killer = 0; 53#ifdef GOLDOBJ 54NEARDATA long done_money = 0; 55#endif 56char killer_buf[BUFSZ] = DUMMY; 57const char *nomovemsg = 0; 58const char nul[40] = DUMMY; /* contains zeros */ 59NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */ 60NEARDATA char pl_character[PL_CSIZ] = DUMMY; 61NEARDATA char pl_race = '\0'; 62 63NEARDATA char pl_fruit[PL_FSIZ] = DUMMY; 64NEARDATA int current_fruit = 0; 65NEARDATA struct fruit *ffruit = (struct fruit *)0; 66 67NEARDATA char tune[6] = DUMMY; 68 69const char *occtxt = DUMMY; 70const char quitchars[] = " \r\n\033"; 71const char vowels[] = "aeiouAEIOU"; 72const char ynchars[] = "yn"; 73const char ynqchars[] = "ynq"; 74const char ynaqchars[] = "ynaq"; 75const char ynNaqchars[] = "yn#aq"; 76NEARDATA long yn_number = 0L; 77 78const char disclosure_options[] = "iavgc"; 79 80#if defined(MICRO) || defined(WIN32) 81char hackdir[PATHLEN]; /* where rumors, help, record are */ 82# ifdef MICRO 83char levels[PATHLEN]; /* where levels are */ 84# endif 85#endif /* MICRO || WIN32 */ 86 87 88#ifdef MFLOPPY 89char permbones[PATHLEN]; /* where permanent copy of bones go */ 90int ramdisk = FALSE; /* whether to copy bones to levels or not */ 91int saveprompt = TRUE; 92const char *alllevels = "levels.*"; 93const char *allbones = "bones*.*"; 94#endif 95 96struct linfo level_info[MAXLINFO]; 97 98NEARDATA struct sinfo program_state; 99 100/* 'rogue'-like direction commands (cmd.c) */ 101const char sdir[] = "hykulnjb><"; 102const char ndir[] = "47896321><"; /* number pad mode */ 103const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 }; 104const schar ydir[10] = { 0,-1,-1,-1, 0, 1, 1, 1, 0, 0 }; 105const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1,-1 }; 106 107NEARDATA schar tbx = 0, tby = 0; /* mthrowu: target */ 108 109/* for xname handling of multiple shot missile volleys: 110 number of shots, index of current one, validity check, shoot vs throw */ 111NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE }; 112 113NEARDATA struct dig_info digging; 114 115NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */ 116NEARDATA s_level *sp_levchn; 117NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 }; 118NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 }; 119NEARDATA stairway sstairs = { 0, 0 }; 120NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 121NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 122NEARDATA coord inv_pos = { 0, 0 }; 123 124NEARDATA boolean in_mklev = FALSE; 125NEARDATA boolean stoned = FALSE; /* done to monsters hit by 'c' */ 126NEARDATA boolean unweapon = FALSE; 127NEARDATA boolean mrg_to_wielded = FALSE; 128 /* weapon picked is merged with wielded one */ 129NEARDATA struct obj *current_wand = 0; /* wand currently zapped/applied */ 130 131NEARDATA boolean in_steed_dismounting = FALSE; 132 133NEARDATA coord bhitpos = DUMMY; 134NEARDATA coord doors[DOORMAX] = {DUMMY}; 135 136NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2] = {DUMMY}; 137NEARDATA struct mkroom* subrooms = &rooms[MAXNROFROOMS+1]; 138struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room; 139 140dlevel_t level; /* level map */ 141struct trap *ftrap = (struct trap *)0; 142NEARDATA struct monst youmonst = DUMMY; 143NEARDATA struct flag flags = DUMMY; 144NEARDATA struct instance_flags iflags = DUMMY; 145NEARDATA struct you u = DUMMY; 146 147NEARDATA struct obj *invent = (struct obj *)0, 148 *uwep = (struct obj *)0, *uarm = (struct obj *)0, 149 *uswapwep = (struct obj *)0, 150 *uquiver = (struct obj *)0, /* quiver */ 151#ifdef TOURIST 152 *uarmu = (struct obj *)0, /* under-wear, so to speak */ 153#endif 154 *uskin = (struct obj *)0, /* dragon armor, if a dragon */ 155 *uarmc = (struct obj *)0, *uarmh = (struct obj *)0, 156 *uarms = (struct obj *)0, *uarmg = (struct obj *)0, 157 *uarmf = (struct obj *)0, *uamul = (struct obj *)0, 158 *uright = (struct obj *)0, 159 *uleft = (struct obj *)0, 160 *ublindf = (struct obj *)0, 161 *uchain = (struct obj *)0, 162 *uball = (struct obj *)0; 163 164#ifdef TEXTCOLOR 165/* 166 * This must be the same order as used for buzz() in zap.c. 167 */ 168const 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 */ 177}; 178#endif /* text color */ 179 180const 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, 184}; 185 186NEARDATA struct spell spl_book[MAXSPELL + 1] = {DUMMY}; 187 188NEARDATA long moves = 1L, monstermoves = 1L; 189 /* These diverge when player is Fast */ 190NEARDATA long wailmsg = 0L; 191 192/* objects that are moving to another dungeon level */ 193NEARDATA struct obj *migrating_objs = (struct obj *)0; 194/* objects not yet paid for */ 195NEARDATA struct obj *billobjs = (struct obj *)0; 196 197/* used to zero all elements of a struct obj */ 198NEARDATA struct obj zeroobj = DUMMY; 199 200/* originally from dog.c */ 201NEARDATA char dogname[PL_PSIZ] = DUMMY; 202NEARDATA char catname[PL_PSIZ] = DUMMY; 203NEARDATA char horsename[PL_PSIZ] = DUMMY; 204char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */ 205/* monsters that went down/up together with @ */ 206NEARDATA struct monst *mydogs = (struct monst *)0; 207/* monsters that are moving to another dungeon level */ 208NEARDATA struct monst *migrating_mons = (struct monst *)0; 209 210NEARDATA struct mvitals mvitals[NUMMONS]; 211 212NEARDATA struct c_color_names c_color_names = { 213 "black", "amber", "golden", 214 "light blue", "red", "green", 215 "silver", "blue", "purple", 216 "white" 217}; 218 219const char *c_obj_colors[] = { 220 "black", /* CLR_BLACK */ 221 "red", /* CLR_RED */ 222 "green", /* CLR_GREEN */ 223 "brown", /* CLR_BROWN */ 224 "blue", /* CLR_BLUE */ 225 "magenta", /* CLR_MAGENTA */ 226 "cyan", /* CLR_CYAN */ 227 "gray", /* CLR_GRAY */ 228 "transparent", /* no_color */ 229 "orange", /* CLR_ORANGE */ 230 "bright green", /* CLR_BRIGHT_GREEN */ 231 "yellow", /* CLR_YELLOW */ 232 "bright blue", /* CLR_BRIGHT_BLUE */ 233 "bright magenta", /* CLR_BRIGHT_MAGENTA */ 234 "bright cyan", /* CLR_BRIGHT_CYAN */ 235 "white", /* CLR_WHITE */ 236}; 237 238struct c_common_strings c_common_strings = { 239 "Nothing happens.", "That's enough tries!", 240 "That is a silly thing to %s.", "shudder for a moment.", 241 "something", "Something", "You can move again.", "Never mind.", 242 "vision quickly clears.", {"the", "your"} 243}; 244 245/* NOTE: the order of these words exactly corresponds to the 246 order of oc_material values #define'd in objclass.h. */ 247const char *materialnm[] = { 248 "mysterious", "liquid", "wax", "organic", "flesh", 249 "paper", "cloth", "leather", "wooden", "bone", "dragonhide", 250 "iron", "metal", "copper", "silver", "gold", "platinum", "mithril", 251 "plastic", "glass", "gemstone", "stone" 252}; 253 254/* Vision */ 255NEARDATA boolean vision_full_recalc = 0; 256NEARDATA char **viz_array = 0;/* used in cansee() and couldsee() macros */ 257 258/* Global windowing data, defined here for multi-window-system support */ 259NEARDATA winid WIN_MESSAGE = WIN_ERR, WIN_STATUS = WIN_ERR; 260NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; 261char toplines[TBUFSZ]; 262/* Windowing stuff that's really tty oriented, but present for all ports */ 263struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 }; /* AS,AE, LI,CO */ 264 265char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0, 266 (char *)0, (char *)0, (char *)0, (char *)0, (char *)0 }; 267 268#ifdef PREFIXES_IN_USE 269char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir", 270 "bonesdir", "datadir", "scoredir", 271 "lockdir", "configdir", "troubledir" }; 272#endif 273 274/* dummy routine used to force linkage */ 275void 276decl_init() 277{ 278 return; 279} 280 281/*decl.c*/ 282