Source:NetHack 3.6.1/src/decl.c

From NetHackWiki
(Redirected from Decl.c)
Jump to: navigation, search

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

Top of file

  1.  /* NetHack 3.6	decl.c	$NHDT-Date: 1446975463 2015/11/08 09:37:43 $  $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /*-Copyright (c) Michael Allison, 2009. */
  4.  /* 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.  
  2.  #include "hack.h"
  3.  
  4.  int NDECL((*afternmv));
  5.  int NDECL((*occupation));
  6.  
  7.  /* from xxxmain.c */
  8.  const char *hname = 0; /* name of the game (argv[0] of main) */
  9.  int hackpid = 0;       /* current process id */
  10.  #if defined(UNIX) || defined(VMS)
  11.  int locknum = 0; /* max num of simultaneous users */
  12.  #endif
  13.  #ifdef DEF_PAGER
  14.  char *catmore = 0; /* default pager */
  15.  #endif
  16.  
  17.  NEARDATA int bases[MAXOCLASSES] = DUMMY;
  18.  
  19.  NEARDATA int multi = 0;
  20.  const char *multi_reason = NULL;
  21.  NEARDATA int nroom = 0;
  22.  NEARDATA int nsubroom = 0;
  23.  NEARDATA int occtime = 0;
  24.  
  25.  /* maze limits must be even; masking off lowest bit guarantees that */
  26.  int x_maze_max = (COLNO - 1) & ~1, y_maze_max = (ROWNO - 1) & ~1;
  27.  
  28.  int otg_temp; /* used by object_to_glyph() [otg] */
  29.  
  30.  NEARDATA int in_doagain = 0;
  31.  
  32.  /*
  33.   *      The following structure will be initialized at startup time with
  34.   *      the level numbers of some "important" things in the game.
  35.   */
  36.  struct dgn_topology dungeon_topology = { DUMMY };
  37.  
  38.  struct q_score quest_status = DUMMY;
  39.  
  40.  NEARDATA int warn_obj_cnt = 0;
  41.  NEARDATA int smeq[MAXNROFROOMS + 1] = DUMMY;
  42.  NEARDATA int doorindex = 0;
  43.  NEARDATA char *save_cm = 0;
  44.  
  45.  NEARDATA struct kinfo killer = DUMMY;
  46.  NEARDATA long done_money = 0;
  47.  const char *nomovemsg = 0;
  48.  NEARDATA char plname[PL_NSIZ] = DUMMY; /* player name */
  49.  NEARDATA char pl_character[PL_CSIZ] = DUMMY;
  50.  NEARDATA char pl_race = '\0';
  51.  
  52.  NEARDATA char pl_fruit[PL_FSIZ] = DUMMY;
  53.  NEARDATA struct fruit *ffruit = (struct fruit *) 0;
  54.  
  55.  NEARDATA char tune[6] = DUMMY;
  56.  
  57.  const char *occtxt = DUMMY;
  58.  const char quitchars[] = " \r\n\033";
  59.  const char vowels[] = "aeiouAEIOU";
  60.  const char ynchars[] = "yn";
  61.  const char ynqchars[] = "ynq";
  62.  const char ynaqchars[] = "ynaq";
  63.  const char ynNaqchars[] = "yn#aq";
  64.  NEARDATA long yn_number = 0L;
  65.  
  66.  const char disclosure_options[] = "iavgco";
  67.  
  68.  #if defined(MICRO) || defined(WIN32)
  69.  char hackdir[PATHLEN]; /* where rumors, help, record are */
  70.  #ifdef MICRO
  71.  char levels[PATHLEN]; /* where levels are */
  72.  #endif
  73.  #endif /* MICRO || WIN32 */
  74.  
  75.  #ifdef MFLOPPY
  76.  char permbones[PATHLEN]; /* where permanent copy of bones go */
  77.  int ramdisk = FALSE;     /* whether to copy bones to levels or not */
  78.  int saveprompt = TRUE;
  79.  const char *alllevels = "levels.*";
  80.  const char *allbones = "bones*.*";
  81.  #endif
  82.  
  83.  struct linfo level_info[MAXLINFO];
  84.  
  85.  NEARDATA struct sinfo program_state;
  86.  
  87.  /* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
  88.  const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
  89.  const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
  90.  const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
  91.  
  92.  NEARDATA schar tbx = 0, tby = 0; /* mthrowu: target */
  93.  
  94.  /* for xname handling of multiple shot missile volleys:
  95.     number of shots, index of current one, validity check, shoot vs throw */
  96.  NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
  97.  
  98.  NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
  99.  NEARDATA s_level *sp_levchn;
  100.  NEARDATA stairway upstair = { 0, 0, { 0, 0 }, 0 },
  101.                    dnstair = { 0, 0, { 0, 0 }, 0 };
  102.  NEARDATA stairway upladder = { 0, 0, { 0, 0 }, 0 },
  103.                    dnladder = { 0, 0, { 0, 0 }, 0 };
  104.  NEARDATA stairway sstairs = { 0, 0, { 0, 0 }, 0 };
  105.  NEARDATA dest_area updest = { 0, 0, 0, 0, 0, 0, 0, 0 };
  106.  NEARDATA dest_area dndest = { 0, 0, 0, 0, 0, 0, 0, 0 };
  107.  NEARDATA coord inv_pos = { 0, 0 };
  108.  
  109.  NEARDATA boolean defer_see_monsters = FALSE;
  110.  NEARDATA boolean in_mklev = FALSE;
  111.  NEARDATA boolean stoned = FALSE; /* done to monsters hit by 'c' */
  112.  NEARDATA boolean unweapon = FALSE;
  113.  NEARDATA boolean mrg_to_wielded = FALSE;
  114.  /* weapon picked is merged with wielded one */
  115.  
  116.  NEARDATA boolean in_steed_dismounting = FALSE;
  117.  
  118.  NEARDATA coord bhitpos = DUMMY;
  119.  NEARDATA coord doors[DOORMAX] = { DUMMY };
  120.  
  121.  NEARDATA struct mkroom rooms[(MAXNROFROOMS + 1) * 2] = { DUMMY };
  122.  NEARDATA struct mkroom *subrooms = &rooms[MAXNROFROOMS + 1];
  123.  struct mkroom *upstairs_room, *dnstairs_room, *sstairs_room;
  124.  
  125.  dlevel_t level; /* level map */
  126.  struct trap *ftrap = (struct trap *) 0;
  127.  NEARDATA struct monst youmonst = DUMMY;
  128.  NEARDATA struct context_info context = DUMMY;
  129.  NEARDATA struct flag flags = DUMMY;
  130.  #ifdef SYSFLAGS
  131.  NEARDATA struct sysflag sysflags = DUMMY;
  132.  #endif
  133.  NEARDATA struct instance_flags iflags = DUMMY;
  134.  NEARDATA struct you u = DUMMY;
  135.  NEARDATA time_t ubirthday = DUMMY;
  136.  NEARDATA struct u_realtime urealtime = DUMMY;
  137.  
  138.  schar lastseentyp[COLNO][ROWNO] = {
  139.      DUMMY
  140.  }; /* last seen/touched dungeon typ */
  141.  
  142.  NEARDATA struct obj
  143.      *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.          *uarmu = (struct obj *) 0,     /* under-wear, so to speak */
  148.              *uskin = (struct obj *) 0, /* dragon armor, if a dragon */
  149.                  *uarmc = (struct obj *) 0, *uarmh = (struct obj *) 0,
  150.      *uarms = (struct obj *) 0, *uarmg = (struct obj *) 0,
  151.      *uarmf = (struct obj *) 0, *uamul = (struct obj *) 0,
  152.      *uright = (struct obj *) 0, *uleft = (struct obj *) 0,
  153.      *ublindf = (struct obj *) 0, *uchain = (struct obj *) 0,
  154.      *uball = (struct obj *) 0;
  155.  /* some objects need special handling during destruction or placement */
  156.  NEARDATA struct obj
  157.      *current_wand = 0,  /* wand currently zapped/applied */
  158.      *thrownobj = 0,     /* object in flight due to throwing */
  159.      *kickedobj = 0;     /* object in flight due to kicking */
  160.  
  161.  #ifdef TEXTCOLOR
  162.  /*
  163.   *  This must be the same order as used for buzz() in zap.c.
  164.   */
  165.  const int zapcolors[NUM_ZAP] = {
  166.      HI_ZAP,     /* 0 - missile */
  167.      CLR_ORANGE, /* 1 - fire */
  168.      CLR_WHITE,  /* 2 - frost */
  169.      HI_ZAP,     /* 3 - sleep */
  170.      CLR_BLACK,  /* 4 - death */
  171.      CLR_WHITE,  /* 5 - lightning */
  172.      CLR_YELLOW, /* 6 - poison gas */
  173.      CLR_GREEN,  /* 7 - acid */
  174.  };
  175.  #endif /* text color */
  176.  
  177.  const int shield_static[SHIELD_COUNT] = {
  178.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, /* 7 per row */
  179.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
  180.      S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4,
  181.  };
  182.  
  183.  NEARDATA struct spell spl_book[MAXSPELL + 1] = { DUMMY };
  184.  
  185.  NEARDATA long moves = 1L, monstermoves = 1L;
  186.  /* These diverge when player is Fast */
  187.  NEARDATA long wailmsg = 0L;
  188.  
  189.  /* objects that are moving to another dungeon level */
  190.  NEARDATA struct obj *migrating_objs = (struct obj *) 0;
  191.  /* objects not yet paid for */
  192.  NEARDATA struct obj *billobjs = (struct obj *) 0;
  193.  
  194.  /* used to zero all elements of a struct obj and a struct monst */
  195.  NEARDATA struct obj zeroobj = DUMMY;
  196.  NEARDATA struct monst zeromonst = DUMMY;
  197.  /* used to zero out union any; initializer deliberately omitted */
  198.  NEARDATA anything zeroany;
  199.  
  200.  /* originally from dog.c */
  201.  NEARDATA char dogname[PL_PSIZ] = DUMMY;
  202.  NEARDATA char catname[PL_PSIZ] = DUMMY;
  203.  NEARDATA char horsename[PL_PSIZ] = DUMMY;
  204.  char preferred_pet; /* '\0', 'c', 'd', 'n' (none) */
  205.  /* monsters that went down/up together with @ */
  206.  NEARDATA struct monst *mydogs = (struct monst *) 0;
  207.  /* monsters that are moving to another dungeon level */
  208.  NEARDATA struct monst *migrating_mons = (struct monst *) 0;
  209.  
  210.  NEARDATA struct mvitals mvitals[NUMMONS];
  211.  
  212.  NEARDATA struct c_color_names c_color_names = {
  213.      "black",  "amber", "golden", "light blue", "red",   "green",
  214.      "silver", "blue",  "purple", "white",      "orange"
  215.  };
  216.  
  217.  struct menucoloring *menu_colorings = NULL;
  218.  
  219.  const char *c_obj_colors[] = {
  220.      "black",          /* CLR_BLACK */
  221.      "red",            /* CLR_RED */
  222.      "green",          /* CLR_GREEN */
  223.      "brown",          /* CLR_BROWN */
  224.      "blue",           /* CLR_BLUE */
  225.      "magenta",        /* CLR_MAGENTA */
  226.      "cyan",           /* CLR_CYAN */
  227.      "gray",           /* CLR_GRAY */
  228.      "transparent",    /* no_color */
  229.      "orange",         /* CLR_ORANGE */
  230.      "bright green",   /* CLR_BRIGHT_GREEN */
  231.      "yellow",         /* CLR_YELLOW */
  232.      "bright blue",    /* CLR_BRIGHT_BLUE */
  233.      "bright magenta", /* CLR_BRIGHT_MAGENTA */
  234.      "bright cyan",    /* CLR_BRIGHT_CYAN */
  235.      "white",          /* CLR_WHITE */
  236.  };
  237.  
  238.  struct c_common_strings c_common_strings = { "Nothing happens.",
  239.                                               "That's enough tries!",
  240.                                               "That is a silly thing to %s.",
  241.                                               "shudder for a moment.",
  242.                                               "something",
  243.                                               "Something",
  244.                                               "You can move again.",
  245.                                               "Never mind.",
  246.                                               "vision quickly clears.",
  247.                                               { "the", "your" } };
  248.  
  249.  /* NOTE: the order of these words exactly corresponds to the
  250.     order of oc_material values #define'd in objclass.h. */
  251.  const char *materialnm[] = { "mysterious", "liquid",  "wax",        "organic",
  252.                               "flesh",      "paper",   "cloth",      "leather",
  253.                               "wooden",     "bone",    "dragonhide", "iron",
  254.                               "metal",      "copper",  "silver",     "gold",
  255.                               "platinum",   "mithril", "plastic",    "glass",
  256.                               "gemstone",   "stone" };
  257.  
  258.  /* Vision */
  259.  NEARDATA boolean vision_full_recalc = 0;
  260.  NEARDATA char **viz_array = 0; /* used in cansee() and couldsee() macros */
  261.  
  262.  /* Global windowing data, defined here for multi-window-system support */
  263.  NEARDATA winid WIN_MESSAGE = WIN_ERR;
  264.  NEARDATA winid WIN_STATUS = WIN_ERR;
  265.  NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
  266.  char toplines[TBUFSZ];
  267.  /* Windowing stuff that's really tty oriented, but present for all ports */
  268.  struct tc_gbl_data tc_gbl_data = { 0, 0, 0, 0 }; /* AS,AE, LI,CO */
  269.  
  270.  char *fqn_prefix[PREFIX_COUNT] = { (char *) 0, (char *) 0, (char *) 0,
  271.                                     (char *) 0, (char *) 0, (char *) 0,
  272.                                     (char *) 0, (char *) 0, (char *) 0,
  273.                                     (char *) 0 };
  274.  
  275.  #ifdef PREFIXES_IN_USE
  276.  char *fqn_prefix_names[PREFIX_COUNT] = {
  277.      "hackdir",  "leveldir", "savedir",    "bonesdir",  "datadir",
  278.      "scoredir", "lockdir",  "sysconfdir", "configdir", "troubledir"
  279.  };
  280.  #endif
  281.  
  282.  NEARDATA struct savefile_info sfcap = {
  283.  #ifdef NHSTDC
  284.      0x00000000UL
  285.  #else
  286.      0x00000000L
  287.  #endif
  288.  #if defined(COMPRESS) || defined(ZLIB_COMP)
  289.          | SFI1_EXTERNALCOMP
  290.  #endif
  291.  #if defined(ZEROCOMP)
  292.          | SFI1_ZEROCOMP
  293.  #endif
  294.  #if defined(RLECOMP)
  295.          | SFI1_RLECOMP
  296.  #endif
  297.      ,
  298.  #ifdef NHSTDC
  299.      0x00000000UL, 0x00000000UL
  300.  #else
  301.      0x00000000L, 0x00000000L
  302.  #endif
  303.  };
  304.  
  305.  NEARDATA struct savefile_info sfrestinfo, sfsaveinfo = {
  306.  #ifdef NHSTDC
  307.      0x00000000UL
  308.  #else
  309.      0x00000000L
  310.  #endif
  311.  #if defined(COMPRESS) || defined(ZLIB_COMP)
  312.          | SFI1_EXTERNALCOMP
  313.  #endif
  314.  #if defined(ZEROCOMP)
  315.          | SFI1_ZEROCOMP
  316.  #endif
  317.  #if defined(RLECOMP)
  318.          | SFI1_RLECOMP
  319.  #endif
  320.      ,
  321.  #ifdef NHSTDC
  322.      0x00000000UL, 0x00000000UL
  323.  #else
  324.      0x00000000L, 0x00000000L
  325.  #endif
  326.  };
  327.  
  328.  struct plinemsg_type *plinemsg_types = (struct plinemsg_type *) 0;
  329.  
  330.  #ifdef PANICTRACE
  331.  const char *ARGV0;
  332.  #endif
  333.  
  334.  /* support for lint.h */
  335.  unsigned nhUse_dummy = 0;
  336.  
  337.  /* dummy routine used to force linkage */
  338.  void
  339.  decl_init()
  340.  {
  341.      return;
  342.  }
  343.  
  344.  /*decl.c*/