Source:NetHack 3.1.0/decl.c

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to decl.c from the source code of NetHack 3.1.0.

Warning! This is the source code from an old release. For newer releases, see 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.1	92/12/11	*/
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.   int NEARDATA bases[MAXOCLASSES] = DUMMY;
21.   
22.   int NEARDATA multi = 0;
23.   int NEARDATA warnlevel = 0;		/* used by movemon and dochugw */
24.   int NEARDATA nroom = 0;
25.   int NEARDATA nsubroom = 0;
26.   int NEARDATA 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.   int NEARDATA 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.   #ifdef MULDGN
42.   #include	"quest.h"
43.   struct q_score	quest_status = DUMMY;
44.   #endif
45.   
46.   int NEARDATA smeq[MAXNROFROOMS+1] = DUMMY;
47.   int NEARDATA doorindex = 0;
48.   
49.   char NEARDATA *save_cm = 0;
50.   int NEARDATA killer_format = 0;
51.   const char NEARDATA *killer = 0;
52.   const char NEARDATA *nomovemsg = 0;
53.   const char NEARDATA nul[40] = DUMMY;		/* contains zeros */
54.   char NEARDATA plname[PL_NSIZ] = DUMMY;		/* player name */
55.   char NEARDATA pl_character[PL_CSIZ] = DUMMY;
56.   
57.   #ifdef TUTTI_FRUTTI
58.   char NEARDATA pl_fruit[PL_FSIZ] = DUMMY;
59.   int NEARDATA current_fruit = 0;
60.   struct fruit NEARDATA *ffruit = (struct fruit *)0;
61.   #endif
62.   
63.   char NEARDATA tune[6] = DUMMY;
64.   
65.   const char NEARDATA *occtxt = DUMMY;
66.   const char NEARDATA quitchars[] = " \r\n\033";
67.   const char NEARDATA vowels[] = "aeiouAEIOU";
68.   const char NEARDATA ynchars[] = "yn";
69.   const char NEARDATA ynqchars[] = "ynq";
70.   const char NEARDATA ynaqchars[] = "ynaq";
71.   const char NEARDATA ynNaqchars[] = "yn#aq";
72.   long NEARDATA yn_number = 0L;
73.   
74.   #ifdef MICRO
75.   char hackdir[PATHLEN];		/* where rumors, help, record are */
76.   char levels[PATHLEN];		/* where levels are */
77.   #endif /* MICRO */
78.   
79.   #define INFOSIZE	MAXLEVEL * MAXDUNGEON
80.   
81.   #ifdef MFLOPPY
82.   char permbones[PATHLEN];	/* where permanent copy of bones go */
83.   int ramdisk = FALSE;		/* whether to copy bones to levels or not */
84.   int saveprompt = TRUE;
85.   struct finfo fileinfo[INFOSIZE];
86.   const char *alllevels = "levels.*";
87.   const char *allbones = "bones*.*";
88.   #else
89.   boolean level_exists[INFOSIZE];
90.   #endif
91.   
92.   #undef INFOSIZE
93.   
94.   /* 'rogue'-like direction commands (cmd.c) */
95.   const char NEARDATA sdir[] = "hykulnjb><";
96.   const char NEARDATA ndir[] = "47896321><";	/* number pad mode */
97.   const schar NEARDATA xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 };
98.   const schar NEARDATA ydir[10] = {  0,-1,-1,-1, 0, 1, 1, 1, 0, 0 };
99.   const schar zdir[10]	      = {  0, 0, 0, 0, 0, 0, 0, 0, 1,-1 };
100.  
101.  schar NEARDATA tbx = 0, NEARDATA tby = 0;	/* mthrowu: target */
102.  int NEARDATA dig_effort = 0;	/* effort expended on current pos */
103.  d_level NEARDATA dig_level = { 0, 0 };
104.  coord NEARDATA dig_pos = DUMMY;
105.  boolean NEARDATA dig_down = FALSE;
106.  
107.  dungeon NEARDATA dungeons[MAXDUNGEON];	/* ini'ed by init_dungeon() */
108.  s_level NEARDATA *sp_levchn;
109.  int NEARDATA done_stopprint = 0;
110.  int NEARDATA done_hup = 0;
111.  stairway NEARDATA upstair = { 0, 0 }, NEARDATA dnstair = { 0, 0 };
112.  stairway NEARDATA upladder = { 0, 0 }, NEARDATA dnladder = { 0, 0 };
113.  stairway NEARDATA sstairs = { 0, 0 };
114.  dest_area NEARDATA updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
115.  dest_area NEARDATA dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
116.  coord NEARDATA inv_pos = { 0, 0 };
117.  
118.  boolean NEARDATA in_mklev = FALSE;
119.  boolean	NEARDATA stoned = FALSE;	/* done to monsters hit by 'c' */
120.  boolean	NEARDATA unweapon = FALSE;
121.  boolean NEARDATA mrg_to_wielded = FALSE;
122.  			 /* weapon picked is merged with wielded one */
123.  
124.  #ifdef KOPS
125.  boolean NEARDATA allow_kops = TRUE;
126.  #endif
127.  
128.  coord NEARDATA bhitpos = DUMMY;
129.  coord NEARDATA doors[DOORMAX] = {DUMMY};
130.  
131.  struct mkroom NEARDATA rooms[(MAXNROFROOMS+1)*2] = {DUMMY};
132.  struct mkroom* NEARDATA subrooms = &rooms[MAXNROFROOMS+1];
133.  struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
134.  
135.  dlevel_t level;		/* level map */
136.  struct trap *ftrap = (struct trap *)0;
137.  struct monst NEARDATA youmonst = DUMMY;
138.  struct flag NEARDATA flags = DUMMY;
139.  struct you NEARDATA u = DUMMY;
140.  
141.  struct obj NEARDATA *invent = (struct obj *)0, 
142.          NEARDATA *uwep = (struct obj *)0, NEARDATA *uarm = (struct obj *)0,
143.  #ifdef TOURIST
144.  	NEARDATA *uarmu = (struct obj *)0, /* under-wear, so to speak */
145.  #endif
146.  #ifdef POLYSELF
147.  	NEARDATA *uskin = (struct obj *)0, /* dragon armor, if a dragon */
148.  #endif
149.  	NEARDATA *uarmc = (struct obj *)0, NEARDATA *uarmh = (struct obj *)0, 
150.          NEARDATA *uarms = (struct obj *)0, NEARDATA *uarmg = (struct obj *)0,
151.          NEARDATA *uarmf = (struct obj *)0, NEARDATA *uamul = (struct obj *)0,
152.  	NEARDATA *uright = (struct obj *)0,
153.          NEARDATA *uleft = (struct obj *)0,
154.          NEARDATA *ublindf = (struct obj *)0,
155.  	NEARDATA *uchain = (struct obj *)0,
156.          NEARDATA *uball = (struct obj *)0;
157.  
158.  #ifdef TEXTCOLOR
159.  /*
160.   *  This must be the same order as used for buzz() in zap.c.
161.   */
162.  const int zapcolors[NUM_ZAP] = {
163.      HI_ZAP,		/* 0 - missile */
164.      ORANGE_COLORED,	/* 1 - fire */
165.      WHITE,		/* 2 - frost */
166.      HI_ZAP,		/* 3 - sleep */
167.      BLACK,		/* 4 - death */
168.      HI_ZAP,		/* 5 - lightning */
169.      YELLOW,		/* 6 - poison gas */
170.      GREEN,		/* 7 - acid */
171.  };
172.  #endif /* text color */
173.  
174.  const int shield_static[SHIELD_COUNT] = {
175.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,	/* 7 per row */
176.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
177.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
178.  };
179.  
180.  struct spell NEARDATA spl_book[MAXSPELL + 1] = {DUMMY};
181.  
182.  long NEARDATA moves = 1L, NEARDATA monstermoves = 1L;
183.  	 /* These diverge when player is Fast */
184.  long NEARDATA wailmsg = 0L;
185.  
186.  /* objects that are moving to another dungeon level */
187.  struct obj NEARDATA *migrating_objs = (struct obj *)0;
188.  /* objects not yet paid for */
189.  struct obj NEARDATA *billobjs = (struct obj *)0;
190.  
191.  /* used to zero all elements of a struct obj */
192.  struct obj NEARDATA zeroobj = DUMMY;
193.  
194.  /* originally from dog.c */
195.  char NEARDATA dogname[63] = DUMMY;
196.  char NEARDATA catname[63] = DUMMY;
197.  char preferred_pet;	/* '\0', 'c', 'd' */
198.  /* monsters that went down/up together with @ */
199.  struct monst NEARDATA *mydogs = (struct monst *)0;
200.  /* monsters that are moving to another dungeon level */
201.  struct monst NEARDATA *migrating_mons = (struct monst *)0;
202.  
203.  struct c_color_names NEARDATA c_color_names = {
204.  	"black", "amber", "golden",
205.  	"light blue", "red", "green",
206.  	"silver", "blue", "purple",
207.  	"white"
208.  };
209.  
210.  struct c_common_strings c_common_strings = {
211.  	"Nothing happens.",		"That's enough tries!",
212.  	"That is a silly thing to %s.",	"shudder for a moment."
213.  };
214.  
215.  /* Vision */
216.  boolean	NEARDATA vision_full_recalc = 0;
217.  char	NEARDATA **viz_array = 0;/* used in cansee() and couldsee() macros */
218.  
219.  /* Global windowing data, defined here for multi-window-system support */
220.  winid NEARDATA WIN_MESSAGE = WIN_ERR, NEARDATA WIN_STATUS = WIN_ERR;
221.  winid NEARDATA WIN_MAP = WIN_ERR, NEARDATA 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.  #ifdef TOURIST
227.  const char NEARDATA *pl_classes = "ABCEHKPRSTVW";
228.  #else
229.  const char NEARDATA *pl_classes = "ABCEHKPRSVW";
230.  #endif
231.  
232.  /* dummy routine used to force linkage */
233.  void
234.  decl_init()
235.  {
236.      return;
237.  }
238.  
239.  /*decl.c*/