Source:NetHack 3.6.0/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.0. To link to a particular line, write [[Source:NetHack 3.6.0/src/decl.c#line123]], for example.

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.

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

decl_init

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