1 /* NetHack 3.6 flag.h $NHDT-Date: 1514071158 2017/12/23 23:19:18 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.132 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2006. */
4 /* NetHack may be freely redistributed. See license for details. */
6 /* If you change the flag structure make sure you increment EDITLEVEL in */
7 /* patchlevel.h if needed. Changing the instance_flags structure does */
8 /* not require incrementing EDITLEVEL. */
14 * Persistent flags that are saved and restored with the game.
19 boolean acoustics; /* allow dungeon sound messages */
20 boolean autodig; /* MRKR: Automatically dig */
21 boolean autoquiver; /* Automatically fill quiver */
22 boolean autoopen; /* open doors by walking into them */
24 boolean biff; /* enable checking for mail */
25 boolean bones; /* allow saving/loading bones */
26 boolean confirm; /* confirm before hitting tame monsters */
27 boolean dark_room; /* show shadows in lit rooms */
28 boolean debug; /* in debugging mode */
29 #define wizard flags.debug
30 boolean end_own; /* list all own scores */
31 boolean explore; /* in exploration mode */
32 #define discover flags.explore
34 boolean friday13; /* it's Friday the 13th */
35 boolean help; /* look in data file for info about stuff */
36 boolean ignintr; /* ignore interrupts */
37 boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */
38 boolean invlet_constant; /* let objects keep their inventory symbol */
39 boolean legacy; /* print game entry "story" */
40 boolean lit_corridor; /* show a dark corr as lit if it is in sight */
41 boolean nap; /* `timed_delay' option for display effects */
42 boolean null; /* OK to send nulls to the terminal */
43 boolean perm_invent; /* keep full inventories up until dismissed */
44 boolean pickup; /* whether you pickup or move and look */
45 boolean pickup_thrown; /* auto-pickup items you threw */
46 boolean pushweapon; /* When wielding, push old weapon into second slot */
47 boolean rest_on_space; /* space means rest */
48 boolean safe_dog; /* give complete protection to the dog */
49 boolean showexp; /* show experience points */
50 boolean showscore; /* show score */
51 boolean silent; /* whether the bell rings or not */
53 * 'sortloot' originally took a True/False value but was changed
54 * to use a letter instead. 3.6.0 was released without changing its
55 * type from 'boolean' to 'char'. A compiler was smart enough to
56 * complain that assigning any of the relevant letters was not 0 or 1
57 * so not appropriate for boolean (by a configuration which used
58 * SKIP_BOOLEAN to bypass nethack's 'boolean' and use a C++-compatible
59 * one). So the type was changed to 'xchar', which is guaranteed to
60 * match the size of 'boolean' (this guarantee only applies for the
61 * !SKIP_BOOLEAN config, unfortunately). Since xchar does not match
62 * actual use, the type was later changed to 'char'. But that would
63 * break 3.6.0 savefile compatibility for configurations which typedef
64 * 'schar' to 'short int' instead of to 'char'. (Needed by pre-ANSI
65 * systems that use unsigned characters without a way to force them
66 * to be signed.) So, the type has been changed back to 'xchar' for
69 * TODO: change to 'char' (and move out of this block of booleans,
70 * and get rid of these comments...) once 3.6.0 savefile compatibility
74 /* this is the normal configuration; assigning a character constant
75 for a normal letter to an 'xchar' variable should always work even
76 if 'char' is unsigned since character constants are actually 'int'
77 and letters are within the range where signedness shouldn't matter */
78 xchar sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */
80 /* with SKIP_BOOLEAN, we have no idea what underlying type is being
81 used, other than it isn't 'xchar' (although its size might match
82 that) or a bitfield (because it must be directly addressable);
83 it's probably either 'char' for compactness or 'int' for access,
84 but we don't know which and it might be something else anyway;
85 flip a coin here and guess 'char' for compactness */
86 char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */
88 boolean sortpack; /* sorted inventory */
89 boolean sparkle; /* show "resisting" special FX (Scott Bigham) */
90 boolean standout; /* use standout for --More-- */
91 boolean time; /* display elapsed 'time' */
92 boolean tombstone; /* print tombstone */
93 boolean verbose; /* max battle info */
94 int end_top, end_around; /* describe desired score list */
96 unsigned long suppress_alert;
99 unsigned paranoia_bits; /* alternate confirmation prompting */
100 #define PARANOID_CONFIRM 0x0001
101 #define PARANOID_QUIT 0x0002
102 #define PARANOID_DIE 0x0004
103 #define PARANOID_BONES 0x0008
104 #define PARANOID_HIT 0x0010
105 #define PARANOID_PRAY 0x0020
106 #define PARANOID_REMOVE 0x0040
107 #define PARANOID_BREAKWAND 0x0080
108 #define PARANOID_WERECHANGE 0x0100
109 int pickup_burden; /* maximum burden before prompt */
110 int pile_limit; /* controls feedback when walking over objects */
111 char inv_order[MAXOCLASSES];
112 char pickup_types[MAXOCLASSES];
113 #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */
114 #define DISCLOSE_PROMPT_DEFAULT_YES 'y'
115 #define DISCLOSE_PROMPT_DEFAULT_NO 'n'
116 #define DISCLOSE_PROMPT_DEFAULT_SPECIAL '?' /* v, default a */
117 #define DISCLOSE_YES_WITHOUT_PROMPT '+'
118 #define DISCLOSE_NO_WITHOUT_PROMPT '-'
119 #define DISCLOSE_SPECIAL_WITHOUT_PROMPT '#' /* v, use a */
120 char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various
122 char menu_style; /* User interface style setting */
123 boolean made_fruit; /* don't easily let the user overflow the number of
126 /* KMH, role patch -- Variables used during startup.
128 * If the user wishes to select a role, race, gender, and/or alignment
129 * during startup, the choices should be recorded here. This
130 * might be specified through command-line options, environmental
131 * variables, a popup dialog box, menus, etc.
133 * These values are each an index into an array. They are not
134 * characters or letters, because that limits us to 26 roles.
135 * They are not booleans, because someday someone may need a neuter
136 * gender. Negative values are used to indicate that the user
137 * hasn't yet specified that particular value. If you determine
138 * that the user wants a random choice, then you should set an
139 * appropriate random value; if you just left the negative value,
140 * the user would be asked again!
142 * These variables are stored here because the u structure is
143 * cleared during character initialization, and because the
144 * flags structure is restored for saved games. Thus, we can
145 * use the same parameters to build the role entry for both
146 * new and restored games.
148 * These variables should not be referred to after the character
149 * is initialized or restored (specifically, after role_init()
152 int initrole; /* starting role (index into roles[]) */
153 int initrace; /* starting race (index into races[]) */
154 int initgend; /* starting gender (index into genders[]) */
155 int initalign; /* starting alignment (index into aligns[]) */
156 int randomall; /* randomly assign everything not specified */
157 int pantheon; /* deity selection for priest character */
158 /* Items which were in iflags in 3.4.x to preserve savefile compatibility
160 boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
161 boolean showrace; /* show hero glyph by race rather than by role */
162 boolean travelcmd; /* allow travel command */
163 int runmode; /* update screen display during run moves */
167 * System-specific flags that are saved with the game if SYSFLAGS is defined.
170 #if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
173 #if defined(MFLOPPY) || defined(MAC)
182 boolean altmeta; /* use ALT keys as META */
183 boolean amiflush; /* kill typeahead */
188 amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
189 AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
192 boolean fast_map; /* use optimized, less flexible map display */
198 boolean page_wait; /* put up a --More-- after a page of messages */
204 * Flags that are set each time the game is started.
205 * These are not saved with the game.
209 /* values for iflags.getpos_coords */
210 #define GPCOORDS_NONE 'n'
211 #define GPCOORDS_MAP 'm'
212 #define GPCOORDS_COMPASS 'c'
213 #define GPCOORDS_COMFULL 'f'
214 #define GPCOORDS_SCREEN 's'
216 enum getloc_filters {
224 struct instance_flags {
225 /* stuff that really isn't option or platform related. They are
226 * set and cleared during the game to control the internal
227 * behaviour of various NetHack functions and probably warrant
228 * a structure of their own elsewhere some day.
230 boolean defer_plname; /* X11 hack: askname() might not set plname */
231 boolean herecmd_menu; /* use menu when mouseclick on yourself */
232 boolean invis_goldsym; /* gold symbol is ' '? */
233 int parse_config_file_src; /* hack for parse_config_line() */
234 int in_lava_effects; /* hack for Boots_off() */
235 int last_msg; /* indicator of last message player saw */
236 int purge_monsters; /* # of dead monsters still on fmon list */
237 int override_ID; /* true to force full identification of objects */
238 int suppress_price; /* controls doname() for unpaid objects */
239 int terrainmode; /* for getpos()'s autodescribe when #terrain is active */
244 #define TER_DETECT 0x10 /* detect_foo magic rather than #terrain */
245 boolean getloc_travelmode;
246 int getloc_filter; /* GFILTER_foo */
247 boolean getloc_usemenu;
248 boolean getloc_moveskip;
249 coord travelcc; /* coordinates for travel_cache */
250 boolean window_inited; /* true if init_nhwindows() completed */
251 boolean vision_inited; /* true if vision is ready */
252 boolean sanity_check; /* run sanity checks */
253 boolean mon_polycontrol; /* debug: control monster polymorphs */
254 boolean in_dumplog; /* doing the dumplog right now? */
255 boolean in_parse; /* is a command being parsed? */
257 /* stuff that is related to options and/or user or platform preferences
259 unsigned msg_history; /* hint: # of top lines to save */
260 int getpos_coords; /* show coordinates when getting cursor position */
261 int menu_headings; /* ATR for menu headings */
262 int *opt_booldup; /* for duplication of boolean opts in config file */
263 int *opt_compdup; /* for duplication of compound opts in conf file */
265 boolean altmeta; /* Alt-c sends ESC c rather than M-c */
267 boolean autodescribe; /* autodescribe mode in getpos() */
268 boolean cbreak; /* in cbreak mode, rogue format */
269 boolean deferred_X; /* deferred entry into explore mode */
270 boolean echo; /* 1 to echo characters */
271 boolean force_invmenu; /* always menu when handling inventory */
272 /* FIXME: goldX belongs in flags, but putting it in iflags avoids
273 breaking 3.6.[01] save files */
274 boolean goldX; /* for BUCX filtering, whether gold is X or U */
275 boolean hilite_pile; /* mark piles of objects with a hilite */
276 boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
277 boolean mention_walls; /* give feedback when bumping walls */
278 boolean menu_head_objsym; /* Show obj symbol in menu headings */
279 boolean menu_overlay; /* Draw menus over the map */
280 boolean menu_requested; /* Flag for overloaded use of 'm' prefix
281 * on some non-move commands */
282 boolean menu_tab_sep; /* Use tabs to separate option menu fields */
283 boolean news; /* print news */
284 boolean num_pad; /* use numbers for movement commands */
285 boolean renameallowed; /* can change hero name during role selection */
286 boolean renameinprogress; /* we are changing hero name */
287 boolean status_updates; /* allow updates to bottom status lines;
288 * disable to avoid excessive noise when using
289 * a screen reader (use ^X to review status) */
290 boolean toptenwin; /* ending list in window instead of stdout */
291 boolean use_background_glyph; /* use background glyph when appropriate */
292 boolean use_menu_color; /* use color in menus; only if wc_color */
293 #ifdef STATUS_HILITES
294 long hilite_delta; /* number of moves to leave a temp hilite lit */
295 long unhilite_deadline; /* time when oldest temp hilite should be unlit */
297 boolean zerocomp; /* write zero-compressed save files */
298 boolean rlecomp; /* alternative to zerocomp; run-length encoding
299 * compression of levels when writing savefile */
301 #if 0 /* XXXgraphics superseded by symbol sets */
302 boolean DECgraphics; /* use DEC VT-xxx extended character set */
303 boolean IBMgraphics; /* use IBM extended character set */
304 #ifdef MAC_GRAPHICS_ENV
305 boolean MACgraphics; /* use Macintosh extended character set, as
306 as defined in the special font HackFont */
309 uchar bouldersym; /* symbol for boulder display */
311 char prevmsg_window; /* type of old message window to use */
312 boolean extmenu; /* extended commands use menu interface */
315 boolean checkspace; /* check disk space before writing files */
316 /* (in iflags to allow restore after moving
317 * to >2GB partition) */
320 boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
322 #if defined(MICRO) || defined(WIN32)
323 boolean rawio; /* whether can use rawio (IOCTL call) */
325 #ifdef MAC_GRAPHICS_ENV
326 boolean MACgraphics; /* use Macintosh extended character set, as
327 as defined in the special font HackFont */
328 unsigned use_stone; /* use the stone ppats */
330 #if defined(MSDOS) || defined(WIN32)
331 boolean hassound; /* has a sound card */
332 boolean usesound; /* use the sound card */
333 boolean usepcspeaker; /* use the pc speaker */
336 boolean traditional_view;
339 boolean hasvga; /* has a vga adapter */
340 boolean usevga; /* use the vga adapter */
341 boolean hasvesa; /* has a VESA-capable VGA adapter */
342 boolean usevesa; /* use the VESA-capable VGA adapter */
343 boolean grmode; /* currently in graphics mode */
346 boolean lan_mail; /* mail is initialized */
347 boolean lan_mail_fetched; /* mail is awaiting display */
349 #ifdef TTY_TILES_ESCCODES
350 boolean vt_tiledata; /* output console codes for tile support in TTY */
352 boolean wizweight; /* display weight of everything in wizard mode */
355 * Window capability support.
357 boolean wc_color; /* use color graphics */
358 boolean wc_hilite_pet; /* hilight pets */
359 boolean wc_ascii_map; /* show map using traditional ascii */
360 boolean wc_tiled_map; /* show map using tiles */
361 boolean wc_preload_tiles; /* preload tiles into memory */
362 int wc_tile_width; /* tile width */
363 int wc_tile_height; /* tile height */
364 char *wc_tile_file; /* name of tile file;overrides default */
365 boolean wc_inverse; /* use inverse video for some things */
366 int wc_align_status; /* status win at top|bot|right|left */
367 int wc_align_message; /* message win at top|bot|right|left */
368 int wc_vary_msgcount; /* show more old messages at a time */
369 char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */
370 char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
371 char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
372 char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
374 wc_foregrnd_status; /* points to foregrnd color name for status win */
376 wc_backgrnd_status; /* points to backgrnd color name for status win */
377 char *wc_foregrnd_text; /* points to foregrnd color name for text win */
378 char *wc_backgrnd_text; /* points to backgrnd color name for text win */
379 char *wc_font_map; /* points to font name for the map win */
380 char *wc_font_message; /* points to font name for message win */
381 char *wc_font_status; /* points to font name for status win */
382 char *wc_font_menu; /* points to font name for menu win */
383 char *wc_font_text; /* points to font name for text win */
384 int wc_fontsiz_map; /* font size for the map win */
385 int wc_fontsiz_message; /* font size for the message window */
386 int wc_fontsiz_status; /* font size for the status window */
387 int wc_fontsiz_menu; /* font size for the menu window */
388 int wc_fontsiz_text; /* font size for text windows */
389 int wc_scroll_amount; /* scroll this amount at scroll_margin */
390 int wc_scroll_margin; /* scroll map when this far from the edge */
391 int wc_map_mode; /* specify map viewing options, mostly
392 * for backward compatibility */
393 int wc_player_selection; /* method of choosing character */
394 boolean wc_splash_screen; /* display an opening splash screen or not */
395 boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
396 * in the message window */
397 boolean wc_eight_bit_input; /* allow eight bit input */
398 boolean wc_mouse_support; /* allow mouse support */
399 boolean wc2_fullscreen; /* run fullscreen */
400 boolean wc2_softkeyboard; /* use software keyboard */
401 boolean wc2_wraptext; /* wrap text */
402 boolean wc2_selectsaved; /* display a menu of user's saved games */
403 boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
404 boolean wc2_hitpointbar; /* show graphical bar representing hit points */
405 boolean cmdassist; /* provide detailed assistance for some commands */
406 boolean clicklook; /* allow right-clicking for look */
407 boolean obsolete; /* obsolete options can point at this, it isn't used */
408 struct autopickup_exception *autopickup_exceptions[2];
412 #define MAX_ALTKEYHANDLER 25
413 char altkeyhandler[MAX_ALTKEYHANDLER];
415 /* copies of values in struct u, used during detection when the
416 originals are temporarily cleared; kept here rather than
417 locally so that they can be restored during a hangup save */
418 Bitfield(save_uswallow, 1);
419 Bitfield(save_uinwater, 1);
420 Bitfield(save_uburied, 1);
421 /* item types used to acomplish "special achievements"; find the target
422 object and you'll be flagged as having achieved something... */
423 short mines_prize_type; /* luckstone */
424 short soko_prize_type1; /* bag of holding or */
425 short soko_prize_type2; /* amulet of reflection */
429 * Old deprecated names
432 #define eight_bit_tty wc_eight_bit_input
434 #define use_color wc_color
435 #define hilite_pet wc_hilite_pet
436 #define use_inverse wc_inverse
437 #ifdef MAC_GRAPHICS_ENV
438 #define large_font obsolete
441 #define popup_dialog wc_popup_dialog
443 #define preload_tiles wc_preload_tiles
445 extern NEARDATA struct flag flags;
447 extern NEARDATA struct sysflag sysflags;
449 extern NEARDATA struct instance_flags iflags;
453 * pline("some message");
454 * pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
455 * iflags.last_msg = PLNMSG_some_message;
456 * and subsequent code can adjust the next message if it is affected
457 * by some_message. The next message will clear iflags.last_msg.
460 PLNMSG_UNKNOWN = 0, /* arbitrary */
461 PLNMSG_ONE_ITEM_HERE, /* "you see <single item> here" */
462 PLNMSG_TOWER_OF_FLAME, /* scroll of fire */
463 PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */
464 PLNMSG_OBJ_GLOWS, /* "the <obj> glows <color>" */
465 PLNMSG_OBJNAM_ONLY /* xname/doname only, for #tip */
468 /* runmode options */
470 RUN_TPORT = 0, /* don't update display until movement stops */
471 RUN_LEAP, /* update display every 7 steps */
472 RUN_STEP, /* update display every single step */
473 RUN_CRAWL /* walk w/ extra delay after each update */
476 /* paranoid confirmation prompting */
477 /* any yes confirmations also require explicit no (or ESC) to reject */
478 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
479 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
480 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
481 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
482 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
483 /* hit: yes vs y for "Save bones?" in wizard mode */
484 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
485 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
486 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
487 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
488 taking over for the old prayconfirm boolean option */
489 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
490 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
491 item even when only one accessory or piece of armor is currently worn */
492 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
493 /* breakwand: Applying a wand */
494 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
495 /* werechange: accepting randomly timed werecreature change to transform
496 from human to creature or vice versa while having polymorph control */
497 #define ParanoidWerechange ((flags.paranoia_bits & PARANOID_WERECHANGE) != 0)
499 /* command parsing, mainly dealing with number_pad handling;
500 not saved and restored */
503 /* forward declaration sufficient to declare pointers */
504 struct ext_func_tab; /* from func_tab.h */
507 /* special key functions */
514 /* run ... clicklook need to be in a continuous block */
534 NHKF_GETPOS_PICK_Q, /* quick */
535 NHKF_GETPOS_PICK_O, /* once */
536 NHKF_GETPOS_PICK_V, /* verbose */
537 NHKF_GETPOS_SHOWVALID,
538 NHKF_GETPOS_AUTODESC,
539 NHKF_GETPOS_MON_NEXT,
540 NHKF_GETPOS_MON_PREV,
541 NHKF_GETPOS_OBJ_NEXT,
542 NHKF_GETPOS_OBJ_PREV,
543 NHKF_GETPOS_DOOR_NEXT,
544 NHKF_GETPOS_DOOR_PREV,
545 NHKF_GETPOS_UNEX_NEXT,
546 NHKF_GETPOS_UNEX_PREV,
547 NHKF_GETPOS_INTERESTING_NEXT,
548 NHKF_GETPOS_INTERESTING_PREV,
549 NHKF_GETPOS_VALID_NEXT,
550 NHKF_GETPOS_VALID_PREV,
553 NHKF_GETPOS_LIMITVIEW,
554 NHKF_GETPOS_MOVESKIP,
570 /* commands[] is used to directly access cmdlist[] instead of looping
571 through it to find the entry for a given input character;
572 move_X is the character used for moving one step in direction X;
573 alphadirchars corresponds to old sdir,
574 dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
575 pcHack_compat and phone_layout only matter when num_pad is on,
576 swap_yz only matters when it's off */
578 unsigned serialno; /* incremented after each update */
579 boolean num_pad; /* same as iflags.num_pad except during updates */
580 boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
581 boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
582 boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
583 char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
584 const char *dirchars; /* current movement/direction characters */
585 const char *alphadirchars; /* same as dirchars if !numpad */
586 const struct ext_func_tab *commands[256]; /* indexed by input character */
587 char spkeys[NUM_NHKF];
590 extern NEARDATA struct cmd Cmd;