Source:NetHack 3.4.3/src/decl.c

From NetHackWiki
Jump to: navigation, search

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

  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. */

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

decl_init[edit]

  1. /* dummy routine used to force linkage */
  2. void
  3. decl_init()
  4. {
  5. return;
  6. }
  7.  
  8. /*decl.c*/