Fandom

Wikihack

Source:NetHack 3.4.0/decl.c

2,034pages on
this wiki
Add New Page
Talk0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

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

The NetHack General Public License applies to screenshots, source code and other content from NetHack.
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.   #ifdef MICRO
81.   char hackdir[PATHLEN];		/* where rumors, help, record are */
82.   char levels[PATHLEN];		/* where levels are */
83.   #endif /* MICRO */
84.   
85.   
86.   #ifdef MFLOPPY
87.   char permbones[PATHLEN];	/* where permanent copy of bones go */
88.   int ramdisk = FALSE;		/* whether to copy bones to levels or not */
89.   int saveprompt = TRUE;
90.   const char *alllevels = "levels.*";
91.   const char *allbones = "bones*.*";
92.   #endif
93.   
94.   struct linfo level_info[MAXLINFO];
95.   
96.   NEARDATA struct sinfo program_state;
97.   
98.   /* 'rogue'-like direction commands (cmd.c) */
99.   const char sdir[] = "hykulnjb><";
100.  const char ndir[] = "47896321><";	/* number pad mode */
101.  const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 };
102.  const schar ydir[10] = {  0,-1,-1,-1, 0, 1, 1, 1, 0, 0 };
103.  const schar zdir[10] = {  0, 0, 0, 0, 0, 0, 0, 0, 1,-1 };
104.  
105.  NEARDATA schar tbx = 0, tby = 0;	/* mthrowu: target */
106.  
107.  /* for xname handling of multiple shot missile volleys:
108.     number of shots, index of current one, validity check, shoot vs throw */
109.  NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
110.  
111.  NEARDATA struct dig_info digging;
112.  
113.  NEARDATA dungeon dungeons[MAXDUNGEON];	/* ini'ed by init_dungeon() */
114.  NEARDATA s_level *sp_levchn;
115.  NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 };
116.  NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 };
117.  NEARDATA stairway sstairs = { 0, 0 };
118.  NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
119.  NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
120.  NEARDATA coord inv_pos = { 0, 0 };
121.  
122.  NEARDATA boolean in_mklev = FALSE;
123.  NEARDATA boolean stoned = FALSE;	/* done to monsters hit by 'c' */
124.  NEARDATA boolean unweapon = FALSE;
125.  NEARDATA boolean mrg_to_wielded = FALSE;
126.  			 /* weapon picked is merged with wielded one */
127.  NEARDATA struct obj *current_wand = 0;	/* wand currently zapped/applied */
128.  
129.  NEARDATA boolean in_steed_dismounting = FALSE;
130.  
131.  NEARDATA coord bhitpos = DUMMY;
132.  NEARDATA coord doors[DOORMAX] = {DUMMY};
133.  
134.  NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2] = {DUMMY};
135.  NEARDATA struct mkroom* subrooms = &rooms[MAXNROFROOMS+1];
136.  struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
137.  
138.  dlevel_t level;		/* level map */
139.  struct trap *ftrap = (struct trap *)0;
140.  NEARDATA struct monst youmonst = DUMMY;
141.  NEARDATA struct flag flags = DUMMY;
142.  NEARDATA struct instance_flags iflags = DUMMY;
143.  NEARDATA struct you u = DUMMY;
144.  
145.  NEARDATA struct obj *invent = (struct obj *)0,
146.  	*uwep = (struct obj *)0, *uarm = (struct obj *)0,
147.  	*uswapwep = (struct obj *)0,
148.  	*uquiver = (struct obj *)0, /* quiver */
149.  #ifdef TOURIST
150.  	*uarmu = (struct obj *)0, /* under-wear, so to speak */
151.  #endif
152.  	*uskin = (struct obj *)0, /* dragon armor, if a dragon */
153.  	*uarmc = (struct obj *)0, *uarmh = (struct obj *)0,
154.  	*uarms = (struct obj *)0, *uarmg = (struct obj *)0,
155.  	*uarmf = (struct obj *)0, *uamul = (struct obj *)0,
156.  	*uright = (struct obj *)0,
157.  	*uleft = (struct obj *)0,
158.  	*ublindf = (struct obj *)0,
159.  	*uchain = (struct obj *)0,
160.  	*uball = (struct obj *)0;
161.  
162.  #ifdef TEXTCOLOR
163.  /*
164.   *  This must be the same order as used for buzz() in zap.c.
165.   */
166.  const int zapcolors[NUM_ZAP] = {
167.      HI_ZAP,		/* 0 - missile */
168.      CLR_ORANGE,		/* 1 - fire */
169.      CLR_WHITE,		/* 2 - frost */
170.      HI_ZAP,		/* 3 - sleep */
171.      CLR_BLACK,		/* 4 - death */
172.      CLR_WHITE,		/* 5 - lightning */
173.      CLR_YELLOW,		/* 6 - poison gas */
174.      CLR_GREEN,		/* 7 - acid */
175.  };
176.  #endif /* text color */
177.  
178.  const int shield_static[SHIELD_COUNT] = {
179.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,	/* 7 per row */
180.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
181.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
182.  };
183.  
184.  NEARDATA struct spell spl_book[MAXSPELL + 1] = {DUMMY};
185.  
186.  NEARDATA long moves = 1L, monstermoves = 1L;
187.  	 /* These diverge when player is Fast */
188.  NEARDATA long wailmsg = 0L;
189.  
190.  /* objects that are moving to another dungeon level */
191.  NEARDATA struct obj *migrating_objs = (struct obj *)0;
192.  /* objects not yet paid for */
193.  NEARDATA struct obj *billobjs = (struct obj *)0;
194.  
195.  /* used to zero all elements of a struct obj */
196.  NEARDATA struct obj zeroobj = DUMMY;
197.  
198.  /* originally from dog.c */
199.  NEARDATA char dogname[PL_PSIZ] = DUMMY;
200.  NEARDATA char catname[PL_PSIZ] = DUMMY;
201.  NEARDATA char horsename[PL_PSIZ] = DUMMY;
202.  char preferred_pet;	/* '\0', 'c', 'd', 'n' (none) */
203.  /* monsters that went down/up together with @ */
204.  NEARDATA struct monst *mydogs = (struct monst *)0;
205.  /* monsters that are moving to another dungeon level */
206.  NEARDATA struct monst *migrating_mons = (struct monst *)0;
207.  
208.  NEARDATA struct mvitals mvitals[NUMMONS];
209.  
210.  NEARDATA struct c_color_names c_color_names = {
211.  	"black", "amber", "golden",
212.  	"light blue", "red", "green",
213.  	"silver", "blue", "purple",
214.  	"white"
215.  };
216.  
217.  const char *c_obj_colors[] = {
218.  	"black",		/* CLR_BLACK */
219.  	"red",			/* CLR_RED */
220.  	"green",		/* CLR_GREEN */
221.  	"brown",		/* CLR_BROWN */
222.  	"blue",			/* CLR_BLUE */
223.  	"magenta",		/* CLR_MAGENTA */
224.  	"cyan",			/* CLR_CYAN */
225.  	"gray",			/* CLR_GRAY */
226.  	"transparent",		/* no_color */
227.  	"orange",		/* CLR_ORANGE */
228.  	"bright green",		/* CLR_BRIGHT_GREEN */
229.  	"yellow",		/* CLR_YELLOW */
230.  	"bright blue",		/* CLR_BRIGHT_BLUE */
231.  	"bright magenta",	/* CLR_BRIGHT_MAGENTA */
232.  	"bright cyan",		/* CLR_BRIGHT_CYAN */
233.  	"white",		/* CLR_WHITE */
234.  };
235.  
236.  struct c_common_strings c_common_strings = {
237.  	"Nothing happens.",		"That's enough tries!",
238.  	"That is a silly thing to %s.",	"shudder for a moment.",
239.  	"something", "Something", "You can move again.", "Never mind.",
240.  	"vision quickly clears."
241.  };
242.  
243.  /* NOTE: the order of these words exactly corresponds to the
244.     order of oc_material values #define'd in objclass.h. */
245.  const char *materialnm[] = {
246.  	"mysterious", "liquid", "wax", "organic", "flesh",
247.  	"paper", "cloth", "leather", "wooden", "bone", "dragonhide",
248.  	"iron", "metal", "copper", "silver", "gold", "platinum", "mithril",
249.  	"plastic", "glass", "gemstone", "stone"
250.  };
251.  
252.  /* Vision */
253.  NEARDATA boolean vision_full_recalc = 0;
254.  NEARDATA char	 **viz_array = 0;/* used in cansee() and couldsee() macros */
255.  
256.  /* Global windowing data, defined here for multi-window-system support */
257.  NEARDATA winid WIN_MESSAGE = WIN_ERR, WIN_STATUS = WIN_ERR;
258.  NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
259.  char toplines[TBUFSZ];
260.  /* Windowing stuff that's really tty oriented, but present for all ports */
261.  struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 };	/* AS,AE, LI,CO */
262.  
263.  char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0,
264.  				(char *)0, (char *)0, (char *)0, (char *)0 };
265.  
266.  #ifdef PREFIXES_IN_USE
267.  char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir",
268.  					"bonesdir", "datadir", "scoredir",
269.  					"lockdir", "configdir" };
270.  #endif
271.  			
272.  /* dummy routine used to force linkage */
273.  void
274.  decl_init()
275.  {
276.      return;
277.  }
278.  
279.  /*decl.c*/

Also on Fandom

Random Wiki