Source:NetHack 3.6.1/include/decl.h

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

Below is the full text to decl.h from the source code of NetHack 3.6.1. To link to a particular line, write [[Source:NetHack 3.6.1/include/decl.h#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.

  1.  /* NetHack 3.6  decl.h  $NHDT-Date: 1496531104 2017/06/03 23:05:04 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.82 $ */
  2.  /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3.  /*-Copyright (c) Michael Allison, 2007. */
  4.  /* NetHack may be freely redistributed.  See license for details. */
  5.  
  6.  #ifndef DECL_H
  7.  #define DECL_H
  8.  
  9.  #define E extern
  10.  
  11.  E int NDECL((*occupation));
  12.  E int NDECL((*afternmv));
  13.  
  14.  E const char *hname;
  15.  E int hackpid;
  16.  #if defined(UNIX) || defined(VMS)
  17.  E int locknum;
  18.  #endif
  19.  #ifdef DEF_PAGER
  20.  E char *catmore;
  21.  #endif /* DEF_PAGER */
  22.  
  23.  E char SAVEF[];
  24.  #ifdef MICRO
  25.  E char SAVEP[];
  26.  #endif
  27.  
  28.  E NEARDATA int bases[MAXOCLASSES];
  29.  
  30.  E NEARDATA int multi;
  31.  E const char *multi_reason;
  32.  E NEARDATA int nroom;
  33.  E NEARDATA int nsubroom;
  34.  E NEARDATA int occtime;
  35.  
  36.  #define WARNCOUNT 6 /* number of different warning levels */
  37.  E nhsym warnsyms[WARNCOUNT];
  38.  E NEARDATA int warn_obj_cnt; /* count of monsters meeting criteria */
  39.  
  40.  E int x_maze_max, y_maze_max;
  41.  E int otg_temp;
  42.  
  43.  E NEARDATA int in_doagain;
  44.  
  45.  E struct dgn_topology { /* special dungeon levels for speed */
  46.      d_level d_oracle_level;
  47.      d_level d_bigroom_level; /* unused */
  48.      d_level d_rogue_level;
  49.      d_level d_medusa_level;
  50.      d_level d_stronghold_level;
  51.      d_level d_valley_level;
  52.      d_level d_wiz1_level;
  53.      d_level d_wiz2_level;
  54.      d_level d_wiz3_level;
  55.      d_level d_juiblex_level;
  56.      d_level d_orcus_level;
  57.      d_level d_baalzebub_level; /* unused */
  58.      d_level d_asmodeus_level;  /* unused */
  59.      d_level d_portal_level;    /* only in goto_level() [do.c] */
  60.      d_level d_sanctum_level;
  61.      d_level d_earth_level;
  62.      d_level d_water_level;
  63.      d_level d_fire_level;
  64.      d_level d_air_level;
  65.      d_level d_astral_level;
  66.      xchar d_tower_dnum;
  67.      xchar d_sokoban_dnum;
  68.      xchar d_mines_dnum, d_quest_dnum;
  69.      d_level d_qstart_level, d_qlocate_level, d_nemesis_level;
  70.      d_level d_knox_level;
  71.      d_level d_mineend_level;
  72.      d_level d_sokoend_level;
  73.  } dungeon_topology;
  74.  /* macros for accessing the dungeon levels by their old names */
  75.  /* clang-format off */
  76.  #define oracle_level            (dungeon_topology.d_oracle_level)
  77.  #define bigroom_level           (dungeon_topology.d_bigroom_level)
  78.  #define rogue_level             (dungeon_topology.d_rogue_level)
  79.  #define medusa_level            (dungeon_topology.d_medusa_level)
  80.  #define stronghold_level        (dungeon_topology.d_stronghold_level)
  81.  #define valley_level            (dungeon_topology.d_valley_level)
  82.  #define wiz1_level              (dungeon_topology.d_wiz1_level)
  83.  #define wiz2_level              (dungeon_topology.d_wiz2_level)
  84.  #define wiz3_level              (dungeon_topology.d_wiz3_level)
  85.  #define juiblex_level           (dungeon_topology.d_juiblex_level)
  86.  #define orcus_level             (dungeon_topology.d_orcus_level)
  87.  #define baalzebub_level         (dungeon_topology.d_baalzebub_level)
  88.  #define asmodeus_level          (dungeon_topology.d_asmodeus_level)
  89.  #define portal_level            (dungeon_topology.d_portal_level)
  90.  #define sanctum_level           (dungeon_topology.d_sanctum_level)
  91.  #define earth_level             (dungeon_topology.d_earth_level)
  92.  #define water_level             (dungeon_topology.d_water_level)
  93.  #define fire_level              (dungeon_topology.d_fire_level)
  94.  #define air_level               (dungeon_topology.d_air_level)
  95.  #define astral_level            (dungeon_topology.d_astral_level)
  96.  #define tower_dnum              (dungeon_topology.d_tower_dnum)
  97.  #define sokoban_dnum            (dungeon_topology.d_sokoban_dnum)
  98.  #define mines_dnum              (dungeon_topology.d_mines_dnum)
  99.  #define quest_dnum              (dungeon_topology.d_quest_dnum)
  100.  #define qstart_level            (dungeon_topology.d_qstart_level)
  101.  #define qlocate_level           (dungeon_topology.d_qlocate_level)
  102.  #define nemesis_level           (dungeon_topology.d_nemesis_level)
  103.  #define knox_level              (dungeon_topology.d_knox_level)
  104.  #define mineend_level           (dungeon_topology.d_mineend_level)
  105.  #define sokoend_level           (dungeon_topology.d_sokoend_level)
  106.  /* clang-format on */
  107.  
  108.  E NEARDATA stairway dnstair, upstair; /* stairs up and down */
  109.  #define xdnstair (dnstair.sx)
  110.  #define ydnstair (dnstair.sy)
  111.  #define xupstair (upstair.sx)
  112.  #define yupstair (upstair.sy)
  113.  
  114.  E NEARDATA stairway dnladder, upladder; /* ladders up and down */
  115.  #define xdnladder (dnladder.sx)
  116.  #define ydnladder (dnladder.sy)
  117.  #define xupladder (upladder.sx)
  118.  #define yupladder (upladder.sy)
  119.  
  120.  E NEARDATA stairway sstairs;
  121.  
  122.  E NEARDATA dest_area updest, dndest; /* level-change destination areas */
  123.  
  124.  E NEARDATA coord inv_pos;
  125.  E NEARDATA dungeon dungeons[];
  126.  E NEARDATA s_level *sp_levchn;
  127.  #define dunlev_reached(x) (dungeons[(x)->dnum].dunlev_ureached)
  128.  
  129.  #include "quest.h"
  130.  E struct q_score quest_status;
  131.  
  132.  E NEARDATA char pl_character[PL_CSIZ];
  133.  E NEARDATA char pl_race; /* character's race */
  134.  
  135.  E NEARDATA char pl_fruit[PL_FSIZ];
  136.  E NEARDATA struct fruit *ffruit;
  137.  
  138.  E NEARDATA char tune[6];
  139.  
  140.  #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
  141.  E struct linfo level_info[MAXLINFO];
  142.  
  143.  E NEARDATA struct sinfo {
  144.      int gameover;  /* self explanatory? */
  145.      int stopprint; /* inhibit further end of game disclosure */
  146.  #ifdef HANGUPHANDLING
  147.      volatile int done_hup; /* SIGHUP or moral equivalent received
  148.                              * -- no more screen output */
  149.      int preserve_locks;    /* don't remove level files prior to exit */
  150.  #endif
  151.      int something_worth_saving; /* in case of panic */
  152.      int panicking;              /* `panic' is in progress */
  153.      int exiting;                /* an exit handler is executing */
  154.      int in_moveloop;
  155.      int in_impossible;
  156.  #ifdef PANICLOG
  157.      int in_paniclog;
  158.  #endif
  159.      int wizkit_wishing;
  160.  } program_state;
  161.  
  162.  E boolean restoring;
  163.  
  164.  E const char quitchars[];
  165.  E const char vowels[];
  166.  E const char ynchars[];
  167.  E const char ynqchars[];
  168.  E const char ynaqchars[];
  169.  E const char ynNaqchars[];
  170.  E NEARDATA long yn_number;
  171.  
  172.  E const char disclosure_options[];
  173.  
  174.  E NEARDATA int smeq[];
  175.  E NEARDATA int doorindex;
  176.  E NEARDATA char *save_cm;
  177.  
  178.  E NEARDATA struct kinfo {
  179.      struct kinfo *next; /* chain of delayed killers */
  180.      int id;             /* uprop keys to ID a delayed killer */
  181.      int format;         /* one of the killer formats */
  182.  #define KILLED_BY_AN 0
  183.  #define KILLED_BY 1
  184.  #define NO_KILLER_PREFIX 2
  185.      char name[BUFSZ]; /* actual killer name */
  186.  } killer;
  187.  
  188.  E long done_money;
  189.  E NEARDATA char plname[PL_NSIZ];
  190.  E NEARDATA char dogname[];
  191.  E NEARDATA char catname[];
  192.  E NEARDATA char horsename[];
  193.  E char preferred_pet;
  194.  E const char *occtxt; /* defined when occupation != NULL */
  195.  E const char *nomovemsg;
  196.  E char lock[];
  197.  
  198.  E const schar xdir[], ydir[], zdir[];
  199.  
  200.  E NEARDATA schar tbx, tby; /* set in mthrowu.c */
  201.  
  202.  E NEARDATA struct multishot {
  203.      int n, i;
  204.      short o;
  205.      boolean s;
  206.  } m_shot;
  207.  
  208.  E NEARDATA long moves, monstermoves;
  209.  E NEARDATA long wailmsg;
  210.  
  211.  E NEARDATA boolean in_mklev;
  212.  E NEARDATA boolean stoned;
  213.  E NEARDATA boolean unweapon;
  214.  E NEARDATA boolean mrg_to_wielded;
  215.  E NEARDATA boolean defer_see_monsters;
  216.  
  217.  E NEARDATA boolean in_steed_dismounting;
  218.  
  219.  E const int shield_static[];
  220.  
  221.  #include "spell.h"
  222.  E NEARDATA struct spell spl_book[]; /* sized in decl.c */
  223.  
  224.  #include "color.h"
  225.  #ifdef TEXTCOLOR
  226.  E const int zapcolors[];
  227.  #endif
  228.  
  229.  E const struct class_sym def_oc_syms[MAXOCLASSES]; /* default class symbols */
  230.  E uchar oc_syms[MAXOCLASSES];                      /* current class symbols */
  231.  E const struct class_sym def_monsyms[MAXMCLASSES]; /* default class symbols */
  232.  E uchar monsyms[MAXMCLASSES];                      /* current class symbols */
  233.  
  234.  #include "obj.h"
  235.  E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
  236.      *uarmu, /* under-wear, so to speak */
  237.      *uskin, *uamul, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver;
  238.  
  239.  E NEARDATA struct obj *uchain; /* defined only when punished */
  240.  E NEARDATA struct obj *uball;
  241.  E NEARDATA struct obj *migrating_objs;
  242.  E NEARDATA struct obj *billobjs;
  243.  E NEARDATA struct obj *current_wand, *thrownobj, *kickedobj;
  244.  
  245.  E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */
  246.  
  247.  E NEARDATA anything zeroany;   /* init'd and defined in decl.c */
  248.  
  249.  #include "you.h"
  250.  E NEARDATA struct you u;
  251.  E NEARDATA time_t ubirthday;
  252.  E NEARDATA struct u_realtime urealtime;
  253.  
  254.  #include "onames.h"
  255.  #ifndef PM_H /* (pm.h has already been included via youprop.h) */
  256.  #include "pm.h"
  257.  #endif
  258.  
  259.  E NEARDATA struct monst zeromonst; /* for init of new or temp monsters */
  260.  E NEARDATA struct monst youmonst; /* monster details when hero is poly'd */
  261.  E NEARDATA struct monst *mydogs, *migrating_mons;
  262.  
  263.  E NEARDATA struct mvitals {
  264.      uchar born;
  265.      uchar died;
  266.      uchar mvflags;
  267.  } mvitals[NUMMONS];
  268.  
  269.  E NEARDATA struct c_color_names {
  270.      const char *const c_black, *const c_amber, *const c_golden,
  271.          *const c_light_blue, *const c_red, *const c_green, *const c_silver,
  272.          *const c_blue, *const c_purple, *const c_white, *const c_orange;
  273.  } c_color_names;
  274.  #define NH_BLACK c_color_names.c_black
  275.  #define NH_AMBER c_color_names.c_amber
  276.  #define NH_GOLDEN c_color_names.c_golden
  277.  #define NH_LIGHT_BLUE c_color_names.c_light_blue
  278.  #define NH_RED c_color_names.c_red
  279.  #define NH_GREEN c_color_names.c_green
  280.  #define NH_SILVER c_color_names.c_silver
  281.  #define NH_BLUE c_color_names.c_blue
  282.  #define NH_PURPLE c_color_names.c_purple
  283.  #define NH_WHITE c_color_names.c_white
  284.  #define NH_ORANGE c_color_names.c_orange
  285.  
  286.  /* The names of the colors used for gems, etc. */
  287.  E const char *c_obj_colors[];
  288.  
  289.  E struct c_common_strings {
  290.      const char *const c_nothing_happens, *const c_thats_enough_tries,
  291.          *const c_silly_thing_to, *const c_shudder_for_moment,
  292.          *const c_something, *const c_Something, *const c_You_can_move_again,
  293.          *const c_Never_mind, *c_vision_clears, *const c_the_your[2];
  294.  } c_common_strings;
  295.  #define nothing_happens c_common_strings.c_nothing_happens
  296.  #define thats_enough_tries c_common_strings.c_thats_enough_tries
  297.  #define silly_thing_to c_common_strings.c_silly_thing_to
  298.  #define shudder_for_moment c_common_strings.c_shudder_for_moment
  299.  #define something c_common_strings.c_something
  300.  #define Something c_common_strings.c_Something
  301.  #define You_can_move_again c_common_strings.c_You_can_move_again
  302.  #define Never_mind c_common_strings.c_Never_mind
  303.  #define vision_clears c_common_strings.c_vision_clears
  304.  #define the_your c_common_strings.c_the_your
  305.  
  306.  /* material strings */
  307.  E const char *materialnm[];
  308.  
  309.  /* Monster name articles */
  310.  #define ARTICLE_NONE 0
  311.  #define ARTICLE_THE 1
  312.  #define ARTICLE_A 2
  313.  #define ARTICLE_YOUR 3
  314.  
  315.  /* Monster name suppress masks */
  316.  #define SUPPRESS_IT 0x01
  317.  #define SUPPRESS_INVISIBLE 0x02
  318.  #define SUPPRESS_HALLUCINATION 0x04
  319.  #define SUPPRESS_SADDLE 0x08
  320.  #define EXACT_NAME 0x0F
  321.  #define SUPPRESS_NAME 0x10
  322.  
  323.  /* Vision */
  324.  E NEARDATA boolean vision_full_recalc; /* TRUE if need vision recalc */
  325.  E NEARDATA char **viz_array;           /* could see/in sight row pointers */
  326.  
  327.  /* Window system stuff */
  328.  E NEARDATA winid WIN_MESSAGE;
  329.  E NEARDATA winid WIN_STATUS;
  330.  E NEARDATA winid WIN_MAP, WIN_INVEN;
  331.  
  332.  /* pline (et al) for a single string argument (suppress compiler warning) */
  333.  #define pline1(cstr) pline("%s", cstr)
  334.  #define Your1(cstr) Your("%s", cstr)
  335.  #define You1(cstr) You("%s", cstr)
  336.  #define verbalize1(cstr) verbalize("%s", cstr)
  337.  #define You_hear1(cstr) You_hear("%s", cstr)
  338.  #define Sprintf1(buf, cstr) Sprintf(buf, "%s", cstr)
  339.  #define panic1(cstr) panic("%s", cstr)
  340.  
  341.  E char toplines[];
  342.  #ifndef TCAP_H
  343.  E struct tc_gbl_data {   /* also declared in tcap.h */
  344.      char *tc_AS, *tc_AE; /* graphics start and end (tty font swapping) */
  345.      int tc_LI, tc_CO;    /* lines and columns */
  346.  } tc_gbl_data;
  347.  #define AS tc_gbl_data.tc_AS
  348.  #define AE tc_gbl_data.tc_AE
  349.  #define LI tc_gbl_data.tc_LI
  350.  #define CO tc_gbl_data.tc_CO
  351.  #endif
  352.  
  353.  /* xxxexplain[] is in drawing.c */
  354.  E const char *const monexplain[], invisexplain[], *const oclass_names[];
  355.  
  356.  /* Some systems want to use full pathnames for some subsets of file names,
  357.   * rather than assuming that they're all in the current directory.  This
  358.   * provides all the subclasses that seem reasonable, and sets up for all
  359.   * prefixes being null.  Port code can set those that it wants.
  360.   */
  361.  #define HACKPREFIX 0
  362.  #define LEVELPREFIX 1
  363.  #define SAVEPREFIX 2
  364.  #define BONESPREFIX 3
  365.  #define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */
  366.  #define SCOREPREFIX 5
  367.  #define LOCKPREFIX 6
  368.  #define SYSCONFPREFIX 7
  369.  #define CONFIGPREFIX 8
  370.  #define TROUBLEPREFIX 9
  371.  #define PREFIX_COUNT 10
  372.  /* used in files.c; xxconf.h can override if needed */
  373.  #ifndef FQN_MAX_FILENAME
  374.  #define FQN_MAX_FILENAME 512
  375.  #endif
  376.  
  377.  #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
  378.  /* the bare-bones stuff is unconditional above to simplify coding; for
  379.   * ports that actually use prefixes, add some more localized things
  380.   */
  381.  #define PREFIXES_IN_USE
  382.  #endif
  383.  
  384.  E char *fqn_prefix[PREFIX_COUNT];
  385.  #ifdef PREFIXES_IN_USE
  386.  E char *fqn_prefix_names[PREFIX_COUNT];
  387.  #endif
  388.  
  389.  E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
  390.  
  391.  struct opvar {
  392.      xchar spovartyp; /* one of SPOVAR_foo */
  393.      union {
  394.          char *str;
  395.          long l;
  396.      } vardata;
  397.  };
  398.  
  399.  struct autopickup_exception {
  400.      struct nhregex *regex;
  401.      char *pattern;
  402.      boolean grab;
  403.      struct autopickup_exception *next;
  404.  };
  405.  
  406.  struct plinemsg_type {
  407.      xchar msgtype;  /* one of MSGTYP_foo */
  408.      struct nhregex *regex;
  409.      char *pattern;
  410.      struct plinemsg_type *next;
  411.  };
  412.  
  413.  #define MSGTYP_NORMAL   0
  414.  #define MSGTYP_NOREP    1
  415.  #define MSGTYP_NOSHOW   2
  416.  #define MSGTYP_STOP     3
  417.  /* bitmask for callers of hide_unhide_msgtypes() */
  418.  #define MSGTYP_MASK_REP_SHOW ((1 << MSGTYP_NOREP) | (1 << MSGTYP_NOSHOW))
  419.  
  420.  E struct plinemsg_type *plinemsg_types;
  421.  
  422.  #ifdef PANICTRACE
  423.  E const char *ARGV0;
  424.  #endif
  425.  
  426.  enum earlyarg {ARG_DEBUG, ARG_VERSION};
  427.  
  428.  struct early_opt {
  429.      enum earlyarg e;
  430.      const char *name;
  431.      int minlength;
  432.      boolean valallowed;
  433.  };
  434.  
  435.  #undef E
  436.  
  437.  #endif /* DECL_H */