decl.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)decl.h     3.4     2001/12/10      */
00002 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef DECL_H
00006 #define DECL_H
00007 
00008 #define E extern
00009 
00010 E int NDECL((*occupation));
00011 E int NDECL((*afternmv));
00012 
00013 E const char *hname;
00014 E int hackpid;
00015 #if defined(UNIX) || defined(VMS)
00016 E int locknum;
00017 #endif
00018 #ifdef DEF_PAGER
00019 E char *catmore;
00020 #endif  /* DEF_PAGER */
00021 
00022 E char SAVEF[];
00023 #ifdef MICRO
00024 E char SAVEP[];
00025 #endif
00026 
00027 E NEARDATA int bases[MAXOCLASSES];
00028 
00029 E NEARDATA int multi;
00030 E char multi_txt[BUFSZ];
00031 #if 0
00032 E NEARDATA int warnlevel;
00033 #endif
00034 E NEARDATA int nroom;
00035 E NEARDATA int nsubroom;
00036 E NEARDATA int occtime;
00037 
00038 #define WARNCOUNT 6                     /* number of different warning levels */
00039 E uchar warnsyms[WARNCOUNT];
00040 
00041 E int x_maze_max, y_maze_max;
00042 E int otg_temp;
00043 
00044 #ifdef REDO
00045 E NEARDATA int in_doagain;
00046 #endif
00047 
00048 E struct dgn_topology {         /* special dungeon levels for speed */
00049     d_level     d_oracle_level;
00050     d_level     d_bigroom_level;        /* unused */
00051 #ifdef REINCARNATION
00052     d_level     d_rogue_level;
00053 #endif
00054     d_level     d_medusa_level;
00055     d_level     d_stronghold_level;
00056     d_level     d_valley_level;
00057     d_level     d_wiz1_level;
00058     d_level     d_wiz2_level;
00059     d_level     d_wiz3_level;
00060     d_level     d_juiblex_level;
00061     d_level     d_orcus_level;
00062     d_level     d_baalzebub_level;      /* unused */
00063     d_level     d_asmodeus_level;       /* unused */
00064     d_level     d_portal_level;         /* only in goto_level() [do.c] */
00065     d_level     d_sanctum_level;
00066     d_level     d_earth_level;
00067     d_level     d_water_level;
00068     d_level     d_fire_level;
00069     d_level     d_air_level;
00070     d_level     d_astral_level;
00071     xchar       d_tower_dnum;
00072     xchar       d_sokoban_dnum;
00073     xchar       d_mines_dnum, d_quest_dnum;
00074     xchar       d_mall_dnum;
00075     d_level     d_qstart_level, d_qlocate_level, d_nemesis_level;
00076     d_level     d_knox_level;
00077 #ifdef RECORD_ACHIEVE
00078     d_level     d_mineend_level;
00079     d_level     d_sokoend_level;
00080 #endif
00081 #ifdef BLACKMARKET
00082     d_level     d_blackmarket_level;
00083 #endif /* BLACKMARKET */
00084     d_level     d_minetown_level;
00085     d_level     d_town_level;
00086 } dungeon_topology;
00087 /* macros for accesing the dungeon levels by their old names */
00088 #define oracle_level            (dungeon_topology.d_oracle_level)
00089 #define bigroom_level           (dungeon_topology.d_bigroom_level)
00090 #ifdef REINCARNATION
00091 #define rogue_level             (dungeon_topology.d_rogue_level)
00092 #endif
00093 #define medusa_level            (dungeon_topology.d_medusa_level)
00094 #define stronghold_level        (dungeon_topology.d_stronghold_level)
00095 #define valley_level            (dungeon_topology.d_valley_level)
00096 #define wiz1_level              (dungeon_topology.d_wiz1_level)
00097 #define wiz2_level              (dungeon_topology.d_wiz2_level)
00098 #define wiz3_level              (dungeon_topology.d_wiz3_level)
00099 #define juiblex_level           (dungeon_topology.d_juiblex_level)
00100 #define orcus_level             (dungeon_topology.d_orcus_level)
00101 #define baalzebub_level         (dungeon_topology.d_baalzebub_level)
00102 #define asmodeus_level          (dungeon_topology.d_asmodeus_level)
00103 #define portal_level            (dungeon_topology.d_portal_level)
00104 #define sanctum_level           (dungeon_topology.d_sanctum_level)
00105 #define earth_level             (dungeon_topology.d_earth_level)
00106 #define water_level             (dungeon_topology.d_water_level)
00107 #define fire_level              (dungeon_topology.d_fire_level)
00108 #define air_level               (dungeon_topology.d_air_level)
00109 #define astral_level            (dungeon_topology.d_astral_level)
00110 #define tower_dnum              (dungeon_topology.d_tower_dnum)
00111 #define sokoban_dnum            (dungeon_topology.d_sokoban_dnum)
00112 #define mines_dnum              (dungeon_topology.d_mines_dnum)
00113 #define quest_dnum              (dungeon_topology.d_quest_dnum)
00114 #define mall_dnum               (dungeon_topology.d_mall_dnum)
00115 #define qstart_level            (dungeon_topology.d_qstart_level)
00116 #define qlocate_level           (dungeon_topology.d_qlocate_level)
00117 #define nemesis_level           (dungeon_topology.d_nemesis_level)
00118 #define knox_level              (dungeon_topology.d_knox_level)
00119 #ifdef RECORD_ACHIEVE
00120 #define mineend_level           (dungeon_topology.d_mineend_level)
00121 #define sokoend_level           (dungeon_topology.d_sokoend_level)
00122 #endif
00123 #ifdef BLACKMARKET
00124 #define blackmarket_level       (dungeon_topology.d_blackmarket_level)
00125 #endif /* BLACKMARKET */
00126 #define minetown_level          (dungeon_topology.d_minetown_level)
00127 #define town_level              (dungeon_topology.d_town_level)
00128 
00129 E NEARDATA stairway dnstair, upstair;           /* stairs up and down */
00130 #define xdnstair        (dnstair.sx)
00131 #define ydnstair        (dnstair.sy)
00132 #define xupstair        (upstair.sx)
00133 #define yupstair        (upstair.sy)
00134 
00135 E NEARDATA stairway dnladder, upladder;         /* ladders up and down */
00136 #define xdnladder       (dnladder.sx)
00137 #define ydnladder       (dnladder.sy)
00138 #define xupladder       (upladder.sx)
00139 #define yupladder       (upladder.sy)
00140 
00141 E NEARDATA stairway sstairs;
00142 
00143 E NEARDATA dest_area updest, dndest;    /* level-change destination areas */
00144 
00145 E NEARDATA coord inv_pos;
00146 E NEARDATA dungeon dungeons[];
00147 E NEARDATA s_level *sp_levchn;
00148 #define dunlev_reached(x)       (dungeons[(x)->dnum].dunlev_ureached)
00149 
00150 #include "quest.h"
00151 E struct q_score quest_status;
00152 
00153 #include "qtext.h"
00154 E NEARDATA char pl_tutorial[QT_T_MAX-QT_T_FIRST+1];
00155 
00156 E NEARDATA char pl_character[PL_CSIZ];
00157 E NEARDATA char pl_race;                /* character's race */
00158 
00159 E NEARDATA char pl_fruit[PL_FSIZ];
00160 E NEARDATA int current_fruit;
00161 E NEARDATA struct fruit *ffruit;
00162 
00163 E NEARDATA char tune[6];
00164 
00165 #define MAXLINFO (MAXDUNGEON * MAXLEVEL)
00166 E struct linfo level_info[MAXLINFO];
00167 
00168 E NEARDATA struct sinfo {
00169         int gameover;           /* self explanatory? */
00170         int stopprint;          /* inhibit further end of game disclosure */
00171 #if defined(UNIX) || defined(VMS) || defined (__EMX__) || defined(WIN32)
00172         int done_hup;           /* SIGHUP or moral equivalent received
00173                                  * -- no more screen output */
00174 #endif
00175         int something_worth_saving;     /* in case of panic */
00176         int panicking;          /* `panic' is in progress */
00177 #if defined(VMS) || defined(WIN32)
00178         int exiting;            /* an exit handler is executing */
00179 #endif
00180         int in_impossible;
00181 #ifdef PANICLOG
00182         int in_paniclog;
00183 #endif
00184 } program_state;
00185 
00186 E boolean restoring;
00187 
00188 E const char quitchars[];
00189 E const char vowels[];
00190 E const char ynchars[];
00191 E const char ynqchars[];
00192 E const char ynaqchars[];
00193 E const char ynNaqchars[];
00194 E NEARDATA long yn_number;
00195 
00196 E const char disclosure_options[];
00197 
00198 E NEARDATA int smeq[];
00199 E NEARDATA int doorindex;
00200 E NEARDATA char *save_cm;
00201 #define KILLED_BY_AN     0
00202 #define KILLED_BY        1
00203 #define NO_KILLER_PREFIX 2
00204 E NEARDATA int killer_format;
00205 E const char *killer;
00206 E const char *delayed_killer;
00207 #ifdef GOLDOBJ
00208 E long done_money;
00209 #endif
00210 E char killer_buf[BUFSZ];
00211 #ifdef DUMP_LOG
00212 E char dump_fn[];               /* dumpfile name (dump patch) */
00213 #endif
00214 #ifdef WHEREIS_FILE 
00215 E char whereis_real_path[255];
00216 #endif
00217 E const char *configfile;
00218 E NEARDATA char plname[PL_NSIZ];
00219 E NEARDATA char dogname[];
00220 E NEARDATA char catname[];
00221 E NEARDATA char horsename[];
00222 #ifdef EXOTIC_PETS
00223 E NEARDATA char monkeyname[];
00224 E NEARDATA char wolfname[];
00225 E NEARDATA char crocodilename[];
00226 #endif
00227 E char preferred_pet;
00228 E const char *occtxt;                   /* defined when occupation != NULL */
00229 E const char *nomovemsg;
00230 E const char nul[];
00231 E char lock[];
00232 
00233 #ifdef QWERTZ
00234 E const char qykbd_dir[], qzkbd_dir[], ndir[];
00235 E char const *sdir;
00236 #else
00237 E const char sdir[], ndir[];
00238 #endif
00239 E const schar xdir[], ydir[], zdir[];
00240 
00241 E NEARDATA schar tbx, tby;              /* set in mthrowu.c */
00242 
00243 E NEARDATA struct multishot { int n, i; short o; boolean s; } m_shot;
00244 
00245 E NEARDATA struct dig_info {            /* apply.c, hack.c */
00246         int     effort;
00247         d_level level;
00248         coord   pos;
00249         long lastdigtime;
00250         boolean down, chew, warned, quiet;
00251 } digging;
00252 
00253 E NEARDATA long moves, monstermoves;
00254 E NEARDATA long wailmsg;
00255 
00256 E NEARDATA boolean in_mklev;
00257 E NEARDATA boolean stoned;
00258 E NEARDATA boolean unweapon;
00259 E NEARDATA boolean mrg_to_wielded;
00260 E NEARDATA struct obj *current_wand;
00261 
00262 E NEARDATA boolean in_steed_dismounting;
00263 
00264 E const int shield_static[];
00265 
00266 #include "spell.h"
00267 E NEARDATA struct spell spl_book[];     /* sized in decl.c */
00268 
00269 #include "color.h"
00270 #ifdef TEXTCOLOR
00271 E const int zapcolors[];
00272 #endif
00273 
00274 E const char def_oc_syms[MAXOCLASSES];  /* default class symbols */
00275 E uchar oc_syms[MAXOCLASSES];           /* current class symbols */
00276 E const char def_monsyms[MAXMCLASSES];  /* default class symbols */
00277 E uchar monsyms[MAXMCLASSES];           /* current class symbols */
00278 
00279 #include "obj.h"
00280 E NEARDATA struct obj *invent,
00281         *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf,
00282 #ifdef TOURIST
00283         *uarmu,                         /* under-wear, so to speak */
00284 #endif
00285         *uskin, *uamul, *uleft, *uright, *ublindf,
00286         *uwep, *uswapwep, *uquiver;
00287 
00288 E NEARDATA struct obj *uchain;          /* defined only when punished */
00289 E NEARDATA struct obj *uball;
00290 E NEARDATA struct obj *migrating_objs;
00291 E NEARDATA struct obj *billobjs;
00292 E NEARDATA struct obj zeroobj;          /* init'd and defined in decl.c */
00293 
00294 #include "engrave.h"
00295 E struct engr *head_engr;
00296 
00297 #include "you.h"
00298 E NEARDATA struct you u;
00299 
00300 #include "onames.h"
00301 #ifndef PM_H            /* (pm.h has already been included via youprop.h) */
00302 #include "pm.h"
00303 #endif
00304 
00305 
00306 #define PM_BABY_GRAY_DRAGON   PM_BABY_TATZELWORM
00307 #define PM_BABY_SILVER_DRAGON PM_BABY_AMPHITERE
00308 #define PM_BABY_RED_DRAGON    PM_BABY_DRAKEN
00309 #define PM_BABY_WHITE_DRAGON  PM_BABY_LINDWORM
00310 #define PM_BABY_ORANGE_DRAGON PM_BABY_SARKANY
00311 #define PM_BABY_BLACK_DRAGON  PM_BABY_SIRRUSH
00312 #define PM_BABY_BLUE_DRAGON   PM_BABY_LEVIATHAN
00313 #define PM_BABY_GREEN_DRAGON  PM_BABY_WYVERN
00314 /*#define PM_BABY_GOLD_DRAGON   PM_BABY_GOLD_DRAGON*/
00315 #define PM_BABY_YELLOW_DRAGON PM_BABY_GUIVRE
00316 #define PM_GRAY_DRAGON        PM_TATZELWORM
00317 #define PM_SILVER_DRAGON      PM_AMPHITERE
00318 #define PM_RED_DRAGON         PM_DRAKEN
00319 #define PM_WHITE_DRAGON       PM_LINDWORM
00320 #define PM_ORANGE_DRAGON      PM_SARKANY
00321 #define PM_BLACK_DRAGON       PM_SIRRUSH
00322 #define PM_BLUE_DRAGON        PM_LEVIATHAN
00323 #define PM_GREEN_DRAGON       PM_WYVERN
00324 /*#define PM_GOLD_DRAGON        PM_GOLD_DRAGON*/
00325 #define PM_YELLOW_DRAGON      PM_GUIVRE
00326 
00327 #define GRAY_DRAGON_SCALE_MAIL       MAGIC_DRAGON_SCALE_MAIL
00328 #define SILVER_DRAGON_SCALE_MAIL     REFLECTING_DRAGON_SCALE_MAIL
00329 #define RED_DRAGON_SCALE_MAIL        FIRE_DRAGON_SCALE_MAIL
00330 #define WHITE_DRAGON_SCALE_MAIL      ICE_DRAGON_SCALE_MAIL
00331 #define ORANGE_DRAGON_SCALE_MAIL     SLEEP_DRAGON_SCALE_MAIL
00332 #define BLACK_DRAGON_SCALE_MAIL      DISINTEGRATION_DRAGON_SCALE_MA
00333 #define BLUE_DRAGON_SCALE_MAIL       ELECTRIC_DRAGON_SCALE_MAIL
00334 #define GREEN_DRAGON_SCALE_MAIL      POISON_DRAGON_SCALE_MAIL
00335 #define GOLD_DRAGON_SCALE_MAIL       STONE_DRAGON_SCALE_MAIL
00336 #define YELLOW_DRAGON_SCALE_MAIL     ACID_DRAGON_SCALE_MAIL
00337 
00338 #define GRAY_DRAGON_SCALES       MAGIC_DRAGON_SCALES
00339 #define SILVER_DRAGON_SCALES     REFLECTING_DRAGON_SCALES
00340 #define RED_DRAGON_SCALES        FIRE_DRAGON_SCALES
00341 #define WHITE_DRAGON_SCALES      ICE_DRAGON_SCALES
00342 #define ORANGE_DRAGON_SCALES     SLEEP_DRAGON_SCALES
00343 #define BLACK_DRAGON_SCALES      DISINTEGRATION_DRAGON_SCALES
00344 #define BLUE_DRAGON_SCALES       ELECTRIC_DRAGON_SCALES
00345 #define GREEN_DRAGON_SCALES      POISON_DRAGON_SCALES
00346 #define GOLD_DRAGON_SCALES       STONE_DRAGON_SCALES
00347 #define YELLOW_DRAGON_SCALES     ACID_DRAGON_SCALES
00348 
00349 
00350 E NEARDATA struct monst youmonst;       /* init'd and defined in decl.c */
00351 E NEARDATA struct monst *mydogs, *migrating_mons;
00352 
00353 E NEARDATA struct permonst upermonst;   /* init'd in decl.c, 
00354                                          * defined in polyself.c 
00355                                          */
00356 
00357 E NEARDATA struct mvitals {
00358         uchar   born;
00359         uchar   died;
00360         uchar   mvflags;
00361 } mvitals[NUMMONS];
00362 
00363 E NEARDATA struct c_color_names {
00364     const char  *const c_black, *const c_amber, *const c_golden,
00365                 *const c_light_blue,*const c_red, *const c_orange,
00366                 *const c_green, *const c_silver, *const c_blue,
00367                 *const c_purple, *const c_white;
00368 } c_color_names;
00369 #define NH_BLACK                c_color_names.c_black
00370 #define NH_AMBER                c_color_names.c_amber
00371 #define NH_GOLDEN               c_color_names.c_golden
00372 #define NH_LIGHT_BLUE           c_color_names.c_light_blue
00373 #define NH_RED                  c_color_names.c_red
00374 #define NH_ORANGE               c_color_names.c_orange
00375 #define NH_GREEN                c_color_names.c_green
00376 #define NH_SILVER               c_color_names.c_silver
00377 #define NH_BLUE                 c_color_names.c_blue
00378 #define NH_PURPLE               c_color_names.c_purple
00379 #define NH_WHITE                c_color_names.c_white
00380 
00381 /* The names of the colors used for gems, etc. */
00382 E const char *c_obj_colors[];
00383 
00384 E struct c_common_strings {
00385     const char  *const c_nothing_happens, *const c_thats_enough_tries,
00386                 *const c_silly_thing_to, *const c_shudder_for_moment,
00387                 *const c_something, *const c_Something,
00388                 *const c_You_can_move_again,
00389                 *const c_Never_mind, *c_vision_clears,
00390                 *const c_the_your[2];
00391 } c_common_strings;
00392 #define nothing_happens    c_common_strings.c_nothing_happens
00393 #define thats_enough_tries c_common_strings.c_thats_enough_tries
00394 #define silly_thing_to     c_common_strings.c_silly_thing_to
00395 #define shudder_for_moment c_common_strings.c_shudder_for_moment
00396 #define something          c_common_strings.c_something
00397 #define Something          c_common_strings.c_Something
00398 #define You_can_move_again c_common_strings.c_You_can_move_again
00399 #define Never_mind         c_common_strings.c_Never_mind
00400 #define vision_clears      c_common_strings.c_vision_clears
00401 #define the_your           c_common_strings.c_the_your
00402 
00403 /* material strings */
00404 E const char *materialnm[];
00405 
00406 /* Monster name articles */
00407 #define ARTICLE_NONE    0
00408 #define ARTICLE_THE     1
00409 #define ARTICLE_A       2
00410 #define ARTICLE_YOUR    3
00411 
00412 /* Monster name suppress masks */
00413 #define SUPPRESS_IT             0x01
00414 #define SUPPRESS_INVISIBLE      0x02
00415 #define SUPPRESS_HALLUCINATION  0x04
00416 #define SUPPRESS_SADDLE         0x08
00417 #define EXACT_NAME              0x0F
00418 
00419 /* Vision */
00420 E NEARDATA boolean vision_full_recalc;  /* TRUE if need vision recalc */
00421 E NEARDATA char **viz_array;            /* could see/in sight row pointers */
00422 
00423 /* Window system stuff */
00424 E NEARDATA winid WIN_MESSAGE, WIN_STATUS;
00425 E NEARDATA winid WIN_MAP, WIN_INVEN;
00426 E char toplines[];
00427 #ifndef TCAP_H
00428 E struct tc_gbl_data {  /* also declared in tcap.h */
00429     char *tc_AS, *tc_AE;        /* graphics start and end (tty font swapping) */
00430     int   tc_LI,  tc_CO;        /* lines and columns */
00431 } tc_gbl_data;
00432 #define AS tc_gbl_data.tc_AS
00433 #define AE tc_gbl_data.tc_AE
00434 #define LI tc_gbl_data.tc_LI
00435 #define CO tc_gbl_data.tc_CO
00436 #endif
00437 
00438 /* xxxexplain[] is in drawing.c */
00439 E const char * const monexplain[], invisexplain[], * const objexplain[], * const oclass_names[];
00440 
00441 /* Some systems want to use full pathnames for some subsets of file names,
00442  * rather than assuming that they're all in the current directory.  This
00443  * provides all the subclasses that seem reasonable, and sets up for all
00444  * prefixes being null.  Port code can set those that it wants.
00445  */
00446 #define HACKPREFIX      0
00447 #define LEVELPREFIX     1
00448 #define SAVEPREFIX      2
00449 #define BONESPREFIX     3
00450 #define DATAPREFIX      4       /* this one must match hardcoded value in dlb.c */
00451 #define SCOREPREFIX     5
00452 #define LOCKPREFIX      6
00453 #define CONFIGPREFIX    7
00454 #define TROUBLEPREFIX   8
00455 #define PREFIX_COUNT    9
00456 /* used in files.c; xxconf.h can override if needed */
00457 # ifndef FQN_MAX_FILENAME
00458 #define FQN_MAX_FILENAME 512
00459 # endif
00460 
00461 #if defined(NOCWD_ASSUMPTIONS) || defined(VAR_PLAYGROUND)
00462 /* the bare-bones stuff is unconditional above to simplify coding; for
00463  * ports that actually use prefixes, add some more localized things
00464  */
00465 #define PREFIXES_IN_USE
00466 #endif
00467 
00468 E char *fqn_prefix[PREFIX_COUNT];
00469 #ifdef PREFIXES_IN_USE
00470 E char *fqn_prefix_names[PREFIX_COUNT];
00471 #endif
00472 
00473 #ifdef AUTOPICKUP_EXCEPTIONS
00474 struct autopickup_exception {
00475         char *pattern;
00476         boolean grab;
00477         struct autopickup_exception *next;
00478 };
00479 #endif /* AUTOPICKUP_EXCEPTIONS */
00480 
00481 #ifdef RECORD_ACHIEVE
00482 struct u_achieve {
00483         Bitfield(get_bell,1);        /* You have obtained the bell of 
00484                                       * opening */
00485         Bitfield(get_candelabrum,1); /* You have obtained the candelabrum */
00486         Bitfield(get_book,1);        /* You have obtained the book of 
00487                                       * the dead */
00488         Bitfield(enter_gehennom,1);  /* Entered Gehennom (including the 
00489                                       * Valley) by any means */
00490         Bitfield(perform_invocation,1); /* You have performed the invocation
00491                                          * ritual */
00492         Bitfield(get_amulet,1);      /* You have obtained the amulet
00493                                       * of Yendor */
00494         Bitfield(ascended,1);        /* You ascended to demigod[dess]hood.
00495                                       * Not quite the same as 
00496                                       * u.uevent.ascended. */
00497         Bitfield(get_luckstone,1);   /* You obtained the luckstone at the
00498                                       * end of the mines. */
00499         Bitfield(finish_sokoban,1);  /* You obtained the sokoban prize. */
00500         Bitfield(killed_medusa,1);   /* You defeated Medusa. */
00501 };
00502 
00503 E struct u_achieve achieve;
00504 #endif
00505 
00506 #if defined(RECORD_REALTIME) || defined(REALTIME_ON_BOTL)
00507 E struct realtime_data {
00508   time_t realtime;    /* Amount of actual playing time up until the last time
00509                        * the game was restored. */
00510   time_t restoretime; /* The time that the game was started or restored. */
00511   time_t last_displayed_time; /* Last time displayed on the status line */
00512 } realtime_data;
00513 #endif /* RECORD_REALTIME || REALTIME_ON_BOTL */
00514 
00515 #ifdef SIMPLE_MAIL
00516 E int mailckfreq;
00517 #endif
00518 
00519 #ifdef USE_MERSENNE_TWISTER
00520 #include <gsl/gsl_rng.h>
00521 E gsl_rng *rngstate;
00522 #endif
00523 
00524 
00525 #undef E
00526 
00527 #endif /* DECL_H */