Source:NetHack 3.2.0/decl.c

From NetHackWiki
(Redirected from NetHack 3.2.0/decl.c)
Jump to navigation Jump to search

Below is the full text to decl.c from the source code of NetHack 3.2.0. To link to a particular line, write [[NetHack 3.2.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.

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