Source:Decl.c

Below is the full text to src/decl.c from NetHack 3.4.3. To link to a particular line, write [[decl.c#line123 ]], for example. 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. 7.   int NDECL((*afternmv)); 8.   int NDECL((*occupation)); 9.    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 19.   20.   NEARDATA int bases[MAXOCLASSES] = DUMMY; 21.   22.   NEARDATA int multi = 0; 23.  #if 0 24.  NEARDATA int warnlevel = 0;		/* used by movemon and dochugw */ 25.  #endif 26.  NEARDATA int nroom = 0; 27.  NEARDATA int nsubroom = 0; 28.  NEARDATA int occtime = 0; 29.   30.   int x_maze_max, y_maze_max;	/* initialized in main, used in mkmaze.c */ 31.  int otg_temp;			/* used by object_to_glyph [otg] */ 32.   33.   #ifdef REDO 34.  NEARDATA 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.   */  41.   struct dgn_topology dungeon_topology = {DUMMY}; 42.   43.   #include "quest.h"  44. struct q_score	quest_status = DUMMY; 45.   46.   NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY; 47.  NEARDATA int doorindex = 0; 48.   49.   NEARDATA char *save_cm = 0; 50.  NEARDATA int killer_format = 0; 51.  const char *killer = 0; 52.  const char *delayed_killer = 0; 53.  #ifdef GOLDOBJ 54.  NEARDATA long done_money = 0; 55.  #endif 56.  char killer_buf[BUFSZ] = DUMMY; 57.  const char *nomovemsg = 0; 58.  const char nul[40] = DUMMY;			/* contains zeros */ 59.  NEARDATA char plname[PL_NSIZ] = DUMMY;		/* player name */ 60.  NEARDATA char pl_character[PL_CSIZ] = DUMMY; 61.  NEARDATA char pl_race = '\0'; 62.   63.   NEARDATA char pl_fruit[PL_FSIZ] = DUMMY; 64.  NEARDATA int current_fruit = 0; 65.  NEARDATA struct fruit *ffruit = (struct fruit *)0; 66.   67.   NEARDATA char tune[6] = DUMMY; 68.   69.   const char *occtxt = DUMMY; 70.  const char quitchars[] = " \r\n\033"; 71.  const char vowels[] = "aeiouAEIOU"; 72.  const char ynchars[] = "yn"; 73.  const char ynqchars[] = "ynq"; 74.  const char ynaqchars[] = "ynaq"; 75.  const char ynNaqchars[] = "yn#aq"; 76.  NEARDATA long yn_number = 0L; 77.   78.   const char disclosure_options[] = "iavgc"; 79.   80.   #if defined(MICRO) || defined(WIN32) 81.  char hackdir[PATHLEN];		/* where rumors, help, record are */ 82.  # ifdef MICRO 83.  char levels[PATHLEN];		/* where levels are */ 84.  # endif 85.  #endif /* MICRO || WIN32 */ 86.   87.    88.   #ifdef MFLOPPY 89.  char permbones[PATHLEN];	/* where permanent copy of bones go */ 90.  int ramdisk = FALSE;		/* whether to copy bones to levels or not */ 91.  int saveprompt = TRUE; 92.  const char *alllevels = "levels.*"; 93.  const char *allbones = "bones*.*"; 94.  #endif 95.   96.   struct linfo level_info[MAXLINFO]; 97.   98.   NEARDATA struct sinfo program_state; 99.   100.  /* 'rogue'-like direction commands (cmd.c) */ 101. const char sdir[] = "hykulnjb><"; 102. const char ndir[] = "47896321><";	/* number pad mode */ 103. const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 }; 104. const schar ydir[10] = {  0,-1,-1,-1, 0, 1, 1, 1, 0, 0 }; 105. const schar zdir[10] = {  0, 0, 0, 0, 0, 0, 0, 0, 1,-1 }; 106.  107.  NEARDATA 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 */ 111. NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE }; 112.  113.  NEARDATA struct dig_info digging; 114.  115.  NEARDATA dungeon dungeons[MAXDUNGEON];	/* ini'ed by init_dungeon */ 116. NEARDATA s_level *sp_levchn; 117. NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 }; 118. NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 }; 119. NEARDATA stairway sstairs = { 0, 0 }; 120. NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 121. NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 122. NEARDATA coord inv_pos = { 0, 0 }; 123.  124.  NEARDATA boolean in_mklev = FALSE; 125. NEARDATA boolean stoned = FALSE;	/* done to monsters hit by 'c' */ 126. NEARDATA boolean unweapon = FALSE; 127. NEARDATA boolean mrg_to_wielded = FALSE; 128. 			 /* weapon picked is merged with wielded one */ 129. NEARDATA struct obj *current_wand = 0;	/* wand currently zapped/applied */ 130.  131.  NEARDATA boolean in_steed_dismounting = FALSE; 132.  133.  NEARDATA coord bhitpos = DUMMY; 134. NEARDATA coord doors[DOORMAX] = {DUMMY}; 135.  136.  NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2] = {DUMMY}; 137. NEARDATA struct mkroom* subrooms = &rooms[MAXNROFROOMS+1]; 138. struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room; 139.  140.  dlevel_t level;		/* level map */ 141. struct trap *ftrap = (struct trap *)0; 142. NEARDATA struct monst youmonst = DUMMY; 143. NEARDATA struct flag flags = DUMMY; 144. NEARDATA struct instance_flags iflags = DUMMY; 145. NEARDATA struct you u = DUMMY; 146.  147.  NEARDATA 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. */ 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 */ 177. };  178.  #endif /* text color */ 179.  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, 184. };  185.   186.  NEARDATA struct spell spl_book[MAXSPELL + 1] = {DUMMY}; 187.  188.  NEARDATA long moves = 1L, monstermoves = 1L; 189. 	 /* These diverge when player is Fast */ 190. NEARDATA long wailmsg = 0L; 191.  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; 196.  197.  /* used to zero all elements of a struct obj */ 198. NEARDATA struct obj zeroobj = DUMMY; 199.  200.  /* originally from dog.c */ 201. NEARDATA char dogname[PL_PSIZ] = DUMMY; 202. NEARDATA char catname[PL_PSIZ] = DUMMY; 203. NEARDATA char horsename[PL_PSIZ] = DUMMY; 204. char preferred_pet;	/* '\0', 'c', 'd', 'n' (none) */ 205. /* monsters that went down/up together with @ */ 206. NEARDATA struct monst *mydogs = (struct monst *)0; 207. /* monsters that are moving to another dungeon level */ 208. NEARDATA struct monst *migrating_mons = (struct monst *)0; 209.  210.  NEARDATA struct mvitals mvitals[NUMMONS]; 211.  212.  NEARDATA struct c_color_names c_color_names = { 213. 	"black", "amber", "golden", 214. 	"light blue", "red", "green", 215. 	"silver", "blue", "purple", 216. 	"white" 217. };  218.   219.  const 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.   238.  struct 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. */ 247. const 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 */ 255. NEARDATA boolean vision_full_recalc = 0; 256. NEARDATA char	 **viz_array = 0;/* used in cansee and couldsee macros */ 257.  258.  /* Global windowing data, defined here for multi-window-system support */ 259. NEARDATA winid WIN_MESSAGE = WIN_ERR, WIN_STATUS = WIN_ERR; 260. NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; 261. char toplines[TBUFSZ]; 262. /* Windowing stuff that's really tty oriented, but present for all ports */ 263. struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 };	/* AS,AE, LI,CO */ 264.  265.  char *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 269. char *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 */ 275. void 276. decl_init 277. {  278.      return; 279. }  280.   281.  /*decl.c*/