Source:SLASH'EM 0.0.7E7F2/decl.c

From NetHackWiki
Revision as of 23:12, 27 June 2024 by Furey (talk | contribs) (Change particular-line instructions to our Source: filename. Fix wording on "source code for vanilla nethack".)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Below is the full text to decl.c from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/decl.c#line123]], for example.

Source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

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.   NEARDATA boolean multi_one = FALSE;	/* used by dofire() and throw_the_obj() */
24.   #if 0
25.   NEARDATA int warnlevel = 0;		/* used by movemon and dochugw */
26.   #endif
27.   NEARDATA int nroom = 0;
28.   NEARDATA int nsubroom = 0;
29.   NEARDATA int occtime = 0;
30.   
31.   int x_maze_max, y_maze_max;	/* initialized in main, used in mkmaze.c */
32.   int otg_temp;			/* used by object_to_glyph() [otg] */
33.   
34.   #ifdef REDO
35.   NEARDATA int in_doagain = 0;
36.   #endif
37.   
38.   /*
39.    *	The following structure will be initialized at startup time with
40.    *	the level numbers of some "important" things in the game.
41.    */
42.   struct dgn_topology dungeon_topology = {DUMMY};
43.   
44.   #include "quest.h"
45.   struct q_score	quest_status = DUMMY;
46.   
47.   NEARDATA int smeq[MAXNROFROOMS+1] = DUMMY;
48.   NEARDATA int doorindex = 0;
49.   
50.   NEARDATA char *save_cm = 0;
51.   NEARDATA int killer_format = 0;
52.   const char *killer = 0;
53.   const char *delayed_killer = 0;
54.   #ifdef GOLDOBJ
55.   NEARDATA long done_money = 0;
56.   #endif
57.   char killer_buf[BUFSZ] = DUMMY;
58.   const char *nomovemsg = 0;
59.   const char nul[40] = DUMMY;			/* contains zeros */
60.   NEARDATA char plname[PL_NSIZ] = DUMMY;		/* player name */
61.   NEARDATA char pl_character[PL_CSIZ] = DUMMY;
62.   NEARDATA char pl_race = '\0';
63.   
64.   NEARDATA char pl_fruit[PL_FSIZ] = DUMMY;
65.   NEARDATA int current_fruit = 0;
66.   NEARDATA struct fruit *ffruit = (struct fruit *)0;
67.   
68.   NEARDATA char tune[6] = DUMMY;
69.   
70.   const char *occtxt = DUMMY;
71.   const char quitchars[] = " \r\n\033";
72.   const char vowels[] = "aeiouAEIOU";
73.   const char ynchars[] = "yn";
74.   const char ynqchars[] = "ynq";
75.   const char ynaqchars[] = "ynaq";
76.   const char ynNaqchars[] = "yn#aq";
77.   NEARDATA long yn_number = 0L;
78.   
79.   const char disclosure_options[] = "iavgc";
80.   
81.   #if defined(MICRO) || defined(WIN32)
82.   char hackdir[PATHLEN];		/* where rumors, help, record are */
83.   # ifdef MICRO
84.   char levels[PATHLEN];		/* where levels are */
85.   # endif
86.   #endif /* MICRO || WIN32 */
87.   
88.   
89.   #ifdef MFLOPPY
90.   char permbones[PATHLEN];	/* where permanent copy of bones go */
91.   int ramdisk = FALSE;		/* whether to copy bones to levels or not */
92.   int saveprompt = TRUE;
93.   const char *alllevels = "levels.*";
94.   const char *allbones = "bones*.*";
95.   #endif
96.   
97.   struct linfo level_info[MAXLINFO];
98.   
99.   NEARDATA struct sinfo program_state;
100.  
101.  /* 'rogue'-like direction commands (cmd.c) */
102.  const char sdir[] = "hykulnjb><";
103.  const char ndir[] = "47896321><";	/* number pad mode */
104.  const schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 };
105.  const schar ydir[10] = {  0,-1,-1,-1, 0, 1, 1, 1, 0, 0 };
106.  const schar zdir[10] = {  0, 0, 0, 0, 0, 0, 0, 0, 1,-1 };
107.  
108.  NEARDATA schar tbx = 0, tby = 0;	/* mthrowu: target */
109.  
110.  /* for xname handling of multiple shot missile volleys:
111.     number of shots, index of current one, validity check, shoot vs throw */
112.  NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
113.  
114.  NEARDATA struct dig_info digging;
115.  
116.  NEARDATA dungeon dungeons[MAXDUNGEON];	/* ini'ed by init_dungeon() */
117.  NEARDATA s_level *sp_levchn;
118.  NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 };
119.  NEARDATA stairway upladder = { 0, 0 }, dnladder = { 0, 0 };
120.  NEARDATA stairway sstairs = { 0, 0 };
121.  NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
122.  NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
123.  NEARDATA coord inv_pos = { 0, 0 };
124.  
125.  NEARDATA boolean defer_see_monsters = FALSE;
126.  NEARDATA boolean in_mklev = FALSE;
127.  NEARDATA boolean stoned = FALSE;	/* done to monsters hit by 'c' */
128.  NEARDATA boolean unweapon = FALSE;
129.  NEARDATA boolean mrg_to_wielded = FALSE;
130.  			 /* weapon picked is merged with wielded one */
131.  NEARDATA struct obj *current_wand = 0;	/* wand currently zapped/applied */
132.  
133.  NEARDATA boolean in_steed_dismounting = FALSE;
134.  
135.  NEARDATA coord bhitpos = DUMMY;
136.  NEARDATA struct door doors[DOORMAX] = {DUMMY};
137.  
138.  NEARDATA struct mkroom rooms[(MAXNROFROOMS+1)*2] = {DUMMY};
139.  NEARDATA struct mkroom* subrooms = &rooms[MAXNROFROOMS+1];
140.  struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
141.  
142.  dlevel_t level;		/* level map */
143.  struct trap *ftrap = (struct trap *)0;
144.  NEARDATA struct monst youmonst = DUMMY;
145.  NEARDATA struct permonst upermonst = DUMMY;
146.  NEARDATA struct flag flags = DUMMY;
147.  NEARDATA struct instance_flags iflags = DUMMY;
148.  NEARDATA struct you u = DUMMY;
149.  
150.  NEARDATA struct obj *invent = (struct obj *)0,
151.  	*uwep = (struct obj *)0, *uarm = (struct obj *)0,
152.  	*uswapwep = (struct obj *)0,
153.  	*uquiver = (struct obj *)0, /* quiver */
154.  #ifdef TOURIST
155.  	*uarmu = (struct obj *)0, /* under-wear, so to speak */
156.  #endif
157.  	*uskin = (struct obj *)0, /* dragon armor, if a dragon */
158.  	*uarmc = (struct obj *)0, *uarmh = (struct obj *)0,
159.  	*uarms = (struct obj *)0, *uarmg = (struct obj *)0,
160.  	*uarmf = (struct obj *)0, *uamul = (struct obj *)0,
161.  	*uright = (struct obj *)0,
162.  	*uleft = (struct obj *)0,
163.  	*ublindf = (struct obj *)0,
164.  #ifdef STEED
165.  	*usaddle = (struct obj *)0,
166.  #endif
167.  	*uchain = (struct obj *)0,
168.  	*uball = (struct obj *)0;
169.  
170.  #ifdef TEXTCOLOR
171.  /*
172.   *  This must be the same order as used for buzz() in zap.c.
173.   */
174.  const int zapcolors[NUM_ZAP] = {
175.      HI_ZAP,		/* 0 - missile */
176.      CLR_ORANGE,		/* 1 - fire */
177.      CLR_WHITE,		/* 2 - frost */
178.      HI_ZAP,		/* 3 - sleep */
179.      CLR_BLACK,		/* 4 - death */
180.      CLR_WHITE,		/* 5 - lightning */
181.      CLR_YELLOW,		/* 6 - poison gas */
182.      CLR_GREEN,		/* 7 - acid */
183.  };
184.  #endif /* text color */
185.  
186.  const int shield_static[SHIELD_COUNT] = {
187.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,	/* 7 per row */
188.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
189.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
190.  };
191.  
192.  NEARDATA struct spell spl_book[MAXSPELL + 1] = {DUMMY};
193.  
194.  NEARDATA struct tech tech_list[MAXTECH + 1] = {DUMMY};
195.  
196.  NEARDATA long moves = 1L, monstermoves = 1L;
197.  	 /* These diverge when player is Fast or Very_fast */
198.  NEARDATA long wailmsg = 0L;
199.  
200.  /* objects that are moving to another dungeon level */
201.  NEARDATA struct obj *migrating_objs = (struct obj *)0;
202.  /* objects not yet paid for */
203.  NEARDATA struct obj *billobjs = (struct obj *)0;
204.  
205.  /* used to zero all elements of a struct obj */
206.  NEARDATA struct obj zeroobj = DUMMY;
207.  
208.  /* used as an address returned by getobj() */
209.  NEARDATA struct obj thisplace = DUMMY;
210.  
211.  /* originally from dog.c */
212.  NEARDATA char dogname[PL_PSIZ] = DUMMY;
213.  NEARDATA char catname[PL_PSIZ] = DUMMY;
214.  NEARDATA char ghoulname[PL_PSIZ] = DUMMY;
215.  NEARDATA char horsename[PL_PSIZ] = DUMMY;
216.  NEARDATA char wolfname[PL_PSIZ] = DUMMY;
217.  #if 0
218.  NEARDATA char batname[PL_PSIZ] = DUMMY;
219.  NEARDATA char snakename[PL_PSIZ] = DUMMY;
220.  NEARDATA char ratname[PL_PSIZ] = DUMMY;
221.  NEARDATA char badgername[PL_PSIZ] = DUMMY;
222.  NEARDATA char reddragonname[PL_PSIZ] = DUMMY;
223.  NEARDATA char whitedragonname[PL_PSIZ] = DUMMY;
224.  #endif
225.  char preferred_pet;	/* '\0', 'c', 'd', 'n' (none) */
226.  /* monsters that went down/up together with @ */
227.  NEARDATA struct monst *mydogs = (struct monst *)0;
228.  /* monsters that are moving to another dungeon level */
229.  NEARDATA struct monst *migrating_mons = (struct monst *)0;
230.  
231.  NEARDATA struct mvitals mvitals[NUMMONS];
232.  
233.  NEARDATA struct c_color_names c_color_names = {
234.  	"black", "amber", "golden",
235.  	"light blue", "red", "green",
236.  	"silver", "blue", "purple",
237.  	"white"
238.  };
239.  
240.  const char *c_obj_colors[] = {
241.  	"black",		/* CLR_BLACK */
242.  	"red",			/* CLR_RED */
243.  	"green",		/* CLR_GREEN */
244.  	"brown",		/* CLR_BROWN */
245.  	"blue",			/* CLR_BLUE */
246.  	"magenta",		/* CLR_MAGENTA */
247.  	"cyan",			/* CLR_CYAN */
248.  	"gray",			/* CLR_GRAY */
249.  	"transparent",		/* no_color */
250.  	"orange",		/* CLR_ORANGE */
251.  	"bright green",		/* CLR_BRIGHT_GREEN */
252.  	"yellow",		/* CLR_YELLOW */
253.  	"bright blue",		/* CLR_BRIGHT_BLUE */
254.  	"bright magenta",	/* CLR_BRIGHT_MAGENTA */
255.  	"bright cyan",		/* CLR_BRIGHT_CYAN */
256.  	"white",		/* CLR_WHITE */
257.  };
258.  
259.  #ifdef MENU_COLOR
260.  struct menucoloring *menu_colorings = 0;
261.  #endif
262.  
263.  struct c_common_strings c_common_strings = {
264.  	"Nothing happens.",		"That's enough tries!",
265.  	"That is a silly thing to %s.",	"shudder for a moment.",
266.  	"something", "Something", "You can move again.", "Never mind.",
267.  	"vision quickly clears.", {"the", "your"}
268.  };
269.  
270.  /* NOTE: the order of these words exactly corresponds to the
271.     order of oc_material values #define'd in objclass.h. */
272.  const char *materialnm[] = {
273.  	"mysterious", "liquid", "wax", "organic", "flesh",
274.  	"paper", "cloth", "leather", "wooden", "bone", "dragonhide",
275.  	"iron", "metal", "copper", "silver", "gold", "platinum", "mithril",
276.  	"plastic", "glass", "gemstone", "stone"
277.  };
278.  
279.  /* Vision */
280.  NEARDATA boolean vision_full_recalc = 0;
281.  NEARDATA char	 **viz_array = 0;/* used in cansee() and couldsee() macros */
282.  
283.  /* Global windowing data, defined here for multi-window-system support */
284.  NEARDATA winid WIN_MESSAGE = WIN_ERR, WIN_STATUS = WIN_ERR;
285.  NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
286.  char toplines[TBUFSZ];
287.  /* Windowing stuff that's really tty oriented, but present for all ports */
288.  struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 };	/* AS,AE, LI,CO */
289.  
290.  struct authentication authentication = { "", "" };
291.  
292.  struct tileset tilesets[MAXNOTILESETS];
293.  int no_tilesets = 0;
294.  struct tileset def_tilesets[] = {
295.  #if defined(X11_GRAPHICS) || defined(QT_GRAPHICS) || defined(GTK_GRAPHICS) || \
296.      defined(GNOME_GRAPHICS) || defined(GL_GRAPHICS) || defined(SDL_GRAPHICS)
297.      { "Small tiles", "x11tiles", 0 },
298.      { "Big tiles", "x11bigtiles", TILESET_TRANSPARENT },
299.  #endif
300.  #if defined(GTK_GRAPHICS)
301.      { "Big 3D tiles", "x11big3dtiles", TILESET_TRANSPARENT | TILESET_PSEUDO3D },
302.  #endif
303.  #if defined(GEM_GRAPHICS)
304.      { "Monochrome tiles", "nh2.img", 0 },
305.      { "Colour tiles", "nh16.img", 0 },
306.  #endif
307.  #if defined(MSDOS)
308.      { "Planer style tiles", "slashem1.tib", 0 },
309.  #endif
310.  #if defined(ALLEG_FX)
311.      { "Small tiles", "slam16.bmp", 0 },
312.      { "Big tiles", "slam32.bmp", TILESET_TRANSPARENT },
313.      { "Big 3D tiles", "slam3D.bmp", TILESET_TRANSPARENT | TILESET_PSEUDO3D },
314.  #endif
315.      { "", "", 0, }
316.  };
317.  
318.  char tileset[PL_PSIZ] = DUMMY;
319.  
320.  char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0,
321.  				(char *)0, (char *)0, (char *)0, (char *)0, (char *)0 };
322.  
323.  #ifdef PREFIXES_IN_USE
324.  char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir",
325.  					"bonesdir", "datadir", "scoredir",
326.  					"lockdir", "configdir", "troubledir" };
327.  #endif
328.  
329.  /* dummy routine used to force linkage */
330.  void
331.  decl_init()
332.  {
333.      return;
334.  }
335.  
336.  /*decl.c*/