Source:NetHack 3.3.0/decl.c

Below is the full text to decl.c from the source code of NetHack 3.3.0. To link to a particular line, write [[NetHack 3.3.0/decl.c#line123 ]], for example.

Warning! This is the source code from an old release. For the latest release, see Source code

1.   /*	SCCS Id: @(#)decl.c	3.3	99/05/07	*/ 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.  NEARDATA int warnlevel = 0;		/* used by movemon and dochugw */ 24.  NEARDATA int nroom = 0; 25.  NEARDATA int nsubroom = 0; 26.  NEARDATA int occtime = 0; 27.   28.   int x_maze_max, y_maze_max;	/* initialized in main, used in mkmaze.c */ 29.  int otg_temp;			/* used by object_to_glyph [otg] */ 30.   31.   #ifdef REDO 32.  NEARDATA int in_doagain = 0; 33.  #endif 34.   35.   /*  36.    *	The following structure will be initialized at startup time with 37.   *	the level numbers of some "important" things in the game. 38.   */  39.   struct dgn_topology dungeon_topology = {DUMMY}; 40.   41.   #include "quest.h"  42. struct q_score	quest_status = DUMMY; 43.   44.   NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY; 45.  NEARDATA int doorindex = 0; 46.   47.   NEARDATA char *save_cm = 0; 48.  NEARDATA int killer_format = 0; 49.  const char *killer = 0; 50.  const char *nomovemsg = 0; 51.  const char nul[40] = DUMMY;			/* contains zeros */ 52.  NEARDATA char plname[PL_NSIZ] = DUMMY;		/* player name */ 53.  NEARDATA char pl_character[PL_CSIZ] = DUMMY; 54.  NEARDATA char pl_race = '\0'; 55.   56.   NEARDATA char pl_fruit[PL_FSIZ] = DUMMY; 57.  NEARDATA int current_fruit = 0; 58.  NEARDATA struct fruit *ffruit = (struct fruit *)0; 59.   60.   NEARDATA char tune[6] = DUMMY; 61.   62.   const char *occtxt = DUMMY; 63.  const char quitchars[] = " \r\n\033"; 64.  const char vowels[] = "aeiouAEIOU"; 65.  const char ynchars[] = "yn"; 66.  const char ynqchars[] = "ynq"; 67.  const char ynaqchars[] = "ynaq"; 68.  const char ynNaqchars[] = "yn#aq"; 69.  NEARDATA long yn_number = 0L; 70.   71.   #ifdef MICRO 72.  char hackdir[PATHLEN];		/* where rumors, help, record are */ 73.  char levels[PATHLEN];		/* where levels are */ 74.  #endif /* MICRO */ 75.   76.    77.   #ifdef MFLOPPY 78.  char permbones[PATHLEN];	/* where permanent copy of bones go */ 79.  int ramdisk = FALSE;		/* whether to copy bones to levels or not */ 80.  int saveprompt = TRUE; 81.  const char *alllevels = "levels.*"; 82.  const char *allbones = "bones*.*"; 83.  #endif 84.   85.   struct linfo level_info[MAXLINFO]; 86.   87.   NEARDATA struct sinfo program_state; 88.   89.   /* 'rogue'-like direction commands (cmd.c) */ 90.  const char sdir[] = "hykulnjb><"; 91.  const char ndir[] = "47896321><";	/* number pad mode */ 92.  const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 }; 93.  const schar ydir[10] = {  0,-1,-1,-1, 0, 1, 1, 1, 0, 0 }; 94.  const schar zdir[10] = {  0, 0, 0, 0, 0, 0, 0, 0, 1,-1 }; 95.   96.   NEARDATA schar tbx = 0, tby = 0;	/* mthrowu: target */ 97.   98.   NEARDATA struct dig_info digging; 99.   100.  NEARDATA dungeon dungeons[MAXDUNGEON];	/* ini'ed by init_dungeon */ 101. NEARDATA s_level *sp_levchn; 102. NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 }; 103. NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 }; 104. NEARDATA stairway sstairs = { 0, 0 }; 105. NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 106. NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 }; 107. NEARDATA coord inv_pos = { 0, 0 }; 108.  109.  NEARDATA boolean in_mklev = FALSE; 110. NEARDATA boolean stoned = FALSE;	/* done to monsters hit by 'c' */ 111. NEARDATA boolean unweapon = FALSE; 112. NEARDATA boolean mrg_to_wielded = FALSE; 113. 			 /* weapon picked is merged with wielded one */ 114. NEARDATA struct obj *current_wand = 0;	/* wand currently zapped/applied */ 115.  116.  NEARDATA boolean in_steed_dismounting = FALSE; 117.  118.  NEARDATA coord bhitpos = DUMMY; 119. NEARDATA coord doors[DOORMAX] = {DUMMY}; 120.  121.  NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2] = {DUMMY}; 122. NEARDATA struct mkroom* subrooms = &rooms[MAXNROFROOMS+1]; 123. struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room; 124.  125.  dlevel_t level;		/* level map */ 126. struct trap *ftrap = (struct trap *)0; 127. NEARDATA struct monst youmonst = DUMMY; 128. NEARDATA struct flag flags = DUMMY; 129. NEARDATA struct instance_flags iflags = DUMMY; 130. NEARDATA struct you u = DUMMY; 131.  132.  NEARDATA struct obj *invent = (struct obj *)0, 133. 	*uwep = (struct obj *)0, *uarm = (struct obj *)0, 134. 	*uswapwep = (struct obj *)0, 135. 	*uquiver = (struct obj *)0, /* quiver */ 136. #ifdef TOURIST 137. 	*uarmu = (struct obj *)0, /* under-wear, so to speak */ 138. #endif 139. 	*uskin = (struct obj *)0, /* dragon armor, if a dragon */ 140. 	*uarmc = (struct obj *)0, *uarmh = (struct obj *)0, 141. 	*uarms = (struct obj *)0, *uarmg = (struct obj *)0, 142. 	*uarmf = (struct obj *)0, *uamul = (struct obj *)0, 143. 	*uright = (struct obj *)0, 144. 	*uleft = (struct obj *)0, 145. 	*ublindf = (struct obj *)0, 146. 	*uchain = (struct obj *)0, 147. 	*uball = (struct obj *)0; 148.  149.  #ifdef TEXTCOLOR 150. /*  151.   *  This must be the same order as used for buzz in zap.c.  152. */ 153.  const int zapcolors[NUM_ZAP] = { 154.     HI_ZAP,		/* 0 - missile */ 155.     CLR_ORANGE,		/* 1 - fire */ 156.     CLR_WHITE,		/* 2 - frost */ 157.     HI_ZAP,		/* 3 - sleep */ 158.     CLR_BLACK,		/* 4 - death */ 159.     CLR_WHITE,		/* 5 - lightning */ 160.     CLR_YELLOW,		/* 6 - poison gas */ 161.     CLR_GREEN,		/* 7 - acid */ 162. };  163.  #endif /* text color */ 164.  165.  const int shield_static[SHIELD_COUNT] = { 166.     S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,	/* 7 per row */ 167.     S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 168.     S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, 169. };  170.   171.  NEARDATA struct spell spl_book[MAXSPELL + 1] = {DUMMY}; 172.  173.  NEARDATA long moves = 1L, monstermoves = 1L; 174. 	 /* These diverge when player is Fast */ 175. NEARDATA long wailmsg = 0L; 176.  177.  /* objects that are moving to another dungeon level */ 178. NEARDATA struct obj *migrating_objs = (struct obj *)0; 179. /* objects not yet paid for */ 180. NEARDATA struct obj *billobjs = (struct obj *)0; 181.  182.  /* used to zero all elements of a struct obj */ 183. NEARDATA struct obj zeroobj = DUMMY; 184.  185.  /* monster pronouns, index is return value of gender(mtmp) */ 186. const char *he[3]  = { "he",  "she", "it" }; 187. const char *him[3] = { "him", "her", "it" }; 188. const char *his[3] = { "his", "her", "its" }; 189.  190.  /* originally from dog.c */ 191. NEARDATA char dogname[PL_PSIZ] = DUMMY; 192. NEARDATA char catname[PL_PSIZ] = DUMMY; 193. NEARDATA char horsename[PL_PSIZ] = DUMMY; 194. char preferred_pet;	/* '\0', 'c', 'd' */ 195. /* monsters that went down/up together with @ */ 196. NEARDATA struct monst *mydogs = (struct monst *)0; 197. /* monsters that are moving to another dungeon level */ 198. NEARDATA struct monst *migrating_mons = (struct monst *)0; 199.  200.  NEARDATA struct mvitals mvitals[NUMMONS]; 201.  202.  NEARDATA struct c_color_names c_color_names = { 203. 	"black", "amber", "golden", 204. 	"light blue", "red", "green", 205. 	"silver", "blue", "purple", 206. 	"white" 207. };  208.   209.  struct c_common_strings c_common_strings = { 210. 	"Nothing happens.",		"That's enough tries!", 211. 	"That is a silly thing to %s.",	"shudder for a moment.", 212. 	"something", "Something", "You can move again." 213. };  214.   215.  /* Vision */ 216. NEARDATA boolean vision_full_recalc = 0; 217. NEARDATA char	 **viz_array = 0;/* used in cansee and couldsee macros */ 218.  219.  /* Global windowing data, defined here for multi-window-system support */ 220. NEARDATA winid WIN_MESSAGE = WIN_ERR, WIN_STATUS = WIN_ERR; 221. NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR; 222. char toplines[BUFSZ]; 223. /* Windowing stuff that's really tty oriented, but present for all ports */ 224. struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 };	/* AS,AE, LI,CO */ 225.  226.  /* dummy routine used to force linkage */ 227. void 228. decl_init 229. {  230.      return; 231. }  232.   233.  /*decl.c*/