OSDN Git Service

fix #48255
[jnethack/source.git] / include / flag.h
1 /* NetHack 3.6  flag.h  $NHDT-Date: 1574900824 2019/11/28 00:27:04 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.160 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Michael Allison, 2006. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
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.                                     */
9
10 #ifndef FLAG_H
11 #define FLAG_H
12
13 /*
14  * Persistent flags that are saved and restored with the game.
15  *
16  */
17
18 struct flag {
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 */
23     boolean beginner;
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
33     boolean female;
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 p__obsolete;     /* [3.6.2: perm_invent moved to iflags] */
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 */
52     /* The story so far:
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
67      * 3.6.x.
68      *
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
71      * eventually ends.
72      */
73 #ifndef SKIP_BOOLEAN
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) */
79 #else
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) */
87 #endif
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 */
95     unsigned moonphase;
96     unsigned long suppress_alert;
97 #define NEW_MOON 0
98 #define FULL_MOON 4
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 #define PARANOID_EATING     0x0200
110     int pickup_burden; /* maximum burden before prompt */
111     int pile_limit;    /* controls feedback when walking over objects */
112     char inv_order[MAXOCLASSES];
113     char pickup_types[MAXOCLASSES];
114 #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */
115 #define DISCLOSE_PROMPT_DEFAULT_YES 'y'
116 #define DISCLOSE_PROMPT_DEFAULT_NO 'n'
117 #define DISCLOSE_PROMPT_DEFAULT_SPECIAL '?' /* v, default a */
118 #define DISCLOSE_YES_WITHOUT_PROMPT '+'
119 #define DISCLOSE_NO_WITHOUT_PROMPT '-'
120 #define DISCLOSE_SPECIAL_WITHOUT_PROMPT '#' /* v, use a */
121     char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various
122                                                       info upon exit */
123     char menu_style;    /* User interface style setting */
124     boolean made_fruit; /* don't easily let the user overflow the number of
125                            fruits */
126
127     /* KMH, role patch -- Variables used during startup.
128      *
129      * If the user wishes to select a role, race, gender, and/or alignment
130      * during startup, the choices should be recorded here.  This
131      * might be specified through command-line options, environmental
132      * variables, a popup dialog box, menus, etc.
133      *
134      * These values are each an index into an array.  They are not
135      * characters or letters, because that limits us to 26 roles.
136      * They are not booleans, because someday someone may need a neuter
137      * gender.  Negative values are used to indicate that the user
138      * hasn't yet specified that particular value.  If you determine
139      * that the user wants a random choice, then you should set an
140      * appropriate random value; if you just left the negative value,
141      * the user would be asked again!
142      *
143      * These variables are stored here because the u structure is
144      * cleared during character initialization, and because the
145      * flags structure is restored for saved games.  Thus, we can
146      * use the same parameters to build the role entry for both
147      * new and restored games.
148      *
149      * These variables should not be referred to after the character
150      * is initialized or restored (specifically, after role_init()
151      * is called).
152      */
153     int initrole;  /* starting role      (index into roles[])   */
154     int initrace;  /* starting race      (index into races[])   */
155     int initgend;  /* starting gender    (index into genders[]) */
156     int initalign; /* starting alignment (index into aligns[])  */
157     int randomall; /* randomly assign everything not specified */
158     int pantheon;  /* deity selection for priest character */
159     /* Items which were in iflags in 3.4.x to preserve savefile compatibility
160      */
161     boolean lootabc;   /* use "a/b/c" rather than "o/i/b" when looting */
162     boolean showrace;  /* show hero glyph by race rather than by role */
163     boolean travelcmd; /* allow travel command */
164     int runmode;       /* update screen display during run moves */
165 };
166
167 /*
168  * System-specific flags that are saved with the game if SYSFLAGS is defined.
169  */
170
171 #if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
172 #define SYSFLAGS
173 #else
174 #if defined(MFLOPPY) || defined(MAC)
175 #define SYSFLAGS
176 #endif
177 #endif
178
179 #ifdef SYSFLAGS
180 struct sysflag {
181     char sysflagsid[10];
182 #ifdef AMIFLUSH
183     boolean altmeta;  /* use ALT keys as META */
184     boolean amiflush; /* kill typeahead */
185 #endif
186 #ifdef AMII_GRAPHICS
187     int numcols;
188     unsigned short
189         amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
190     AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
191 #endif
192 #ifdef OPT_DISPMAP
193     boolean fast_map; /* use optimized, less flexible map display */
194 #endif
195 #ifdef MFLOPPY
196     boolean asksavedisk;
197 #endif
198 #ifdef MAC
199     boolean page_wait; /* put up a --More-- after a page of messages */
200 #endif
201 };
202 #endif
203
204 /*
205  * Flags that are set each time the game is started.
206  * These are not saved with the game.
207  *
208  */
209
210 /* values for iflags.getpos_coords */
211 #define GPCOORDS_NONE    'n'
212 #define GPCOORDS_MAP     'm'
213 #define GPCOORDS_COMPASS 'c'
214 #define GPCOORDS_COMFULL 'f'
215 #define GPCOORDS_SCREEN  's'
216
217 enum getloc_filters {
218     GFILTER_NONE = 0,
219     GFILTER_VIEW,
220     GFILTER_AREA,
221
222     NUM_GFILTER
223 };
224
225 #ifdef WIN32
226 enum windows_key_handling {
227     no_keyhandling,
228     default_keyhandling,
229     ray_keyhandling,
230     nh340_keyhandling
231 };
232 #endif
233
234 struct debug_flags {
235     boolean test;
236 #ifdef TTY_GRAPHICS
237     boolean ttystatus;
238 #endif
239 #ifdef WIN32
240     boolean immediateflips;
241 #endif
242 };
243
244 struct instance_flags {
245     /* stuff that really isn't option or platform related. They are
246      * set and cleared during the game to control the internal
247      * behaviour of various NetHack functions and probably warrant
248      * a structure of their own elsewhere some day.
249      */
250     boolean debug_fuzzer;  /* fuzz testing */
251     boolean defer_plname;  /* X11 hack: askname() might not set plname */
252     boolean herecmd_menu;  /* use menu when mouseclick on yourself */
253     boolean invis_goldsym; /* gold symbol is ' '? */
254     int at_midnight;       /* only valid during end of game disclosure */
255     int at_night;          /* also only valid during end of game disclosure */
256     int failing_untrap;    /* move_into_trap() -> spoteffects() -> dotrap() */
257     int in_lava_effects;   /* hack for Boots_off() */
258     int last_msg;          /* indicator of last message player saw */
259     int override_ID;       /* true to force full identification of objects */
260     int parse_config_file_src;  /* hack for parse_config_line() */
261     int purge_monsters;    /* # of dead monsters still on fmon list */
262     int suppress_price;    /* controls doname() for unpaid objects */
263     int terrainmode; /* for getpos()'s autodescribe when #terrain is active */
264 #define TER_MAP    0x01
265 #define TER_TRP    0x02
266 #define TER_OBJ    0x04
267 #define TER_MON    0x08
268 #define TER_DETECT 0x10    /* detect_foo magic rather than #terrain */
269     boolean getloc_travelmode;
270     int getloc_filter;     /* GFILTER_foo */
271     boolean getloc_usemenu;
272     boolean getloc_moveskip;
273     coord travelcc;        /* coordinates for travel_cache */
274     boolean trav_debug;    /* display travel path (#if DEBUG only) */
275     boolean window_inited; /* true if init_nhwindows() completed */
276     boolean vision_inited; /* true if vision is ready */
277     boolean sanity_check;  /* run sanity checks */
278     boolean mon_polycontrol; /* debug: control monster polymorphs */
279     boolean in_dumplog;    /* doing the dumplog right now? */
280     boolean in_parse;      /* is a command being parsed? */
281      /* suppress terminate during options parsing, for --showpaths */
282     boolean initoptions_noterminate;
283
284     /* stuff that is related to options and/or user or platform preferences
285      */
286     unsigned msg_history; /* hint: # of top lines to save */
287     int getpos_coords;    /* show coordinates when getting cursor position */
288     int menu_headings;    /* ATR for menu headings */
289     int *opt_booldup;     /* for duplication of boolean opts in config file */
290     int *opt_compdup;     /* for duplication of compound opts in conf file */
291 #ifdef ALTMETA
292     boolean altmeta;      /* Alt-c sends ESC c rather than M-c */
293 #endif
294     boolean autodescribe;     /* autodescribe mode in getpos() */
295     boolean cbreak;           /* in cbreak mode, rogue format */
296     boolean deferred_X;       /* deferred entry into explore mode */
297     boolean echo;             /* 1 to echo characters */
298     boolean force_invmenu;    /* always menu when handling inventory */
299     /* FIXME: goldX belongs in flags, but putting it in iflags avoids
300        breaking 3.6.[01] save files */
301     boolean goldX;            /* for BUCX filtering, whether gold is X or U */
302     boolean hilite_pile;      /* mark piles of objects with a hilite */
303     boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
304     boolean mention_walls;    /* give feedback when bumping walls */
305     boolean menu_head_objsym; /* Show obj symbol in menu headings */
306     boolean menu_overlay;     /* Draw menus over the map */
307     boolean menu_requested;   /* Flag for overloaded use of 'm' prefix
308                                * on some non-move commands */
309     boolean menu_tab_sep;     /* Use tabs to separate option menu fields */
310     boolean news;             /* print news */
311     boolean num_pad;          /* use numbers for movement commands */
312     boolean perm_invent;      /* keep full inventories up until dismissed */
313     boolean renameallowed;    /* can change hero name during role selection */
314     boolean renameinprogress; /* we are changing hero name */
315     boolean status_updates;   /* allow updates to bottom status lines;
316                                * disable to avoid excessive noise when using
317                                * a screen reader (use ^X to review status) */
318     boolean toptenwin;        /* ending list in window instead of stdout */
319     boolean use_background_glyph; /* use background glyph when appropriate */
320     boolean use_menu_color;   /* use color in menus; only if wc_color */
321 #ifdef STATUS_HILITES
322     long hilite_delta;     /* number of moves to leave a temp hilite lit */
323     long unhilite_deadline; /* time when oldest temp hilite should be unlit */
324 #endif
325     boolean zerocomp;         /* write zero-compressed save files */
326     boolean rlecomp;          /* alternative to zerocomp; run-length encoding
327                                * compression of levels when writing savefile */
328     uchar num_pad_mode;
329     boolean cursesgraphics;     /* Use portable curses extended characters */
330 #if 0   /* XXXgraphics superseded by symbol sets */
331     boolean  DECgraphics;       /* use DEC VT-xxx extended character set */
332     boolean  IBMgraphics;       /* use IBM extended character set */
333 #ifdef MAC_GRAPHICS_ENV
334     boolean  MACgraphics;       /* use Macintosh extended character set, as
335                                    as defined in the special font HackFont */
336 #endif
337 #endif
338     uchar bouldersym; /* symbol for boulder display */
339     char prevmsg_window; /* type of old message window to use */
340     boolean extmenu;     /* extended commands use menu interface */
341 #ifdef MFLOPPY
342     boolean checkspace; /* check disk space before writing files */
343                         /* (in iflags to allow restore after moving
344                          * to >2GB partition) */
345 #endif
346 #ifdef MICRO
347     boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
348 #endif
349 #if defined(MICRO) || defined(WIN32)
350     boolean rawio; /* whether can use rawio (IOCTL call) */
351 #endif
352 #ifdef MAC_GRAPHICS_ENV
353     boolean MACgraphics; /* use Macintosh extended character set, as
354                             as defined in the special font HackFont */
355     unsigned use_stone;  /* use the stone ppats */
356 #endif
357 #if defined(MSDOS) || defined(WIN32)
358     boolean hassound;     /* has a sound card */
359     boolean usesound;     /* use the sound card */
360     boolean usepcspeaker; /* use the pc speaker */
361     boolean tile_view;
362     boolean over_view;
363     boolean traditional_view;
364 #endif
365 #ifdef MSDOS
366     boolean hasvga; /* has a vga adapter */
367     boolean usevga; /* use the vga adapter */
368     boolean hasvesa; /* has a VESA-capable VGA adapter */
369     boolean usevesa; /* use the VESA-capable VGA adapter */
370     boolean grmode; /* currently in graphics mode */
371 #endif
372 #ifdef LAN_FEATURES
373     boolean lan_mail;         /* mail is initialized */
374     boolean lan_mail_fetched; /* mail is awaiting display */
375 #endif
376 #ifdef TTY_TILES_ESCCODES
377     boolean vt_tiledata;     /* output console codes for tile support in TTY */
378 #endif
379     boolean clicklook;       /* allow right-clicking for look */
380     boolean cmdassist;       /* provide detailed assistance for some comnds */
381     boolean time_botl;       /* context.botl for 'time' (moves) only */
382     boolean wizweight;       /* display weight of everything in wizard mode */
383     /*
384      * Window capability support.
385      */
386     boolean wc_color;         /* use color graphics                  */
387     boolean wc_hilite_pet;    /* hilight pets                        */
388     boolean wc_ascii_map;     /* show map using traditional ascii    */
389     boolean wc_tiled_map;     /* show map using tiles                */
390     boolean wc_preload_tiles; /* preload tiles into memory           */
391     int wc_tile_width;        /* tile width                          */
392     int wc_tile_height;       /* tile height                         */
393     char *wc_tile_file;       /* name of tile file;overrides default */
394     boolean wc_inverse;       /* use inverse video for some things   */
395     int wc_align_status;      /*  status win at top|bot|right|left   */
396     int wc_align_message;     /* message win at top|bot|right|left   */
397     int wc_vary_msgcount;     /* show more old messages at a time    */
398     char *wc_foregrnd_menu; /* points to foregrnd color name for menu win   */
399     char *wc_backgrnd_menu; /* points to backgrnd color name for menu win   */
400     char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
401     char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
402     char *wc_foregrnd_status; /* points to foregrnd color name for status   */
403     char *wc_backgrnd_status; /* points to backgrnd color name for status   */
404     char *wc_foregrnd_text; /* points to foregrnd color name for text win   */
405     char *wc_backgrnd_text; /* points to backgrnd color name for text win   */
406     char *wc_font_map;      /* points to font name for the map win */
407     char *wc_font_message;  /* points to font name for message win */
408     char *wc_font_status;   /* points to font name for status win  */
409     char *wc_font_menu;     /* points to font name for menu win    */
410     char *wc_font_text;     /* points to font name for text win    */
411     int wc_fontsiz_map;     /* font size for the map win           */
412     int wc_fontsiz_message; /* font size for the message window    */
413     int wc_fontsiz_status;  /* font size for the status window     */
414     int wc_fontsiz_menu;    /* font size for the menu window       */
415     int wc_fontsiz_text;    /* font size for text windows          */
416     int wc_scroll_amount;   /* scroll this amount at scroll_margin */
417     int wc_scroll_margin;   /* scroll map when this far from the edge */
418     int wc_map_mode;        /* specify map viewing options, mostly
419                              * for backward compatibility */
420     int wc_player_selection;    /* method of choosing character */
421     boolean wc_splash_screen;   /* display an opening splash screen or not */
422     boolean wc_popup_dialog;    /* put queries in pop up dialogs instead of
423                                  * in the message window */
424     boolean wc_eight_bit_input; /* allow eight bit input               */
425     boolean wc2_fullscreen;     /* run fullscreen */
426     boolean wc2_softkeyboard;   /* use software keyboard */
427     boolean wc2_wraptext;       /* wrap text */
428     boolean wc2_selectsaved;    /* display a menu of user's saved games */
429     boolean wc2_darkgray;    /* try to use dark-gray color for black glyphs */
430     boolean wc2_hitpointbar;  /* show graphical bar representing hit points */
431     boolean wc2_guicolor;       /* allow colours in gui (outside map) */
432     int wc_mouse_support;       /* allow mouse support */
433     int wc2_term_cols;          /* terminal width, in characters */
434     int wc2_term_rows;          /* terminal height, in characters */
435     int wc2_statuslines;        /* default = 2, curses can handle 3 */
436     int wc2_windowborders;      /* display borders on NetHack windows */
437     int wc2_petattr;            /* text attributes for pet */
438 #ifdef WIN32
439 #define MAX_ALTKEYHANDLING 25
440     char altkeyhandling[MAX_ALTKEYHANDLING];
441     enum windows_key_handling key_handling;
442 #endif
443     /* copies of values in struct u, used during detection when the
444        originals are temporarily cleared; kept here rather than
445        locally so that they can be restored during a hangup save */
446     Bitfield(save_uswallow, 1);
447     Bitfield(save_uinwater, 1);
448     Bitfield(save_uburied, 1);
449     /* item types used to acomplish "special achievements"; find the target
450        object and you'll be flagged as having achieved something... */
451     short mines_prize_type;     /* luckstone */
452     short soko_prize_type1;     /* bag of holding or    */
453     short soko_prize_type2;     /* amulet of reflection */
454     struct debug_flags debug;
455     boolean windowtype_locked;  /* windowtype can't change from configfile */
456     boolean windowtype_deferred; /* pick a windowport and store it in
457                                     chosen_windowport[], but do not switch to
458                                     it in the midst of options processing */
459     genericptr_t returning_missile; /* 'struct obj *'; Mjollnir or aklys */
460     boolean obsolete;  /* obsolete options can point at this, it isn't used */
461 };
462
463 /*
464  * Old deprecated names
465  */
466 #ifdef TTY_GRAPHICS
467 #define eight_bit_tty wc_eight_bit_input
468 #endif
469 #define use_color wc_color
470 #define hilite_pet wc_hilite_pet
471 #define use_inverse wc_inverse
472 #ifdef MAC_GRAPHICS_ENV
473 #define large_font obsolete
474 #endif
475 #ifdef MAC
476 #define popup_dialog wc_popup_dialog
477 #endif
478 #define preload_tiles wc_preload_tiles
479
480 extern NEARDATA struct flag flags;
481 #ifdef SYSFLAGS
482 extern NEARDATA struct sysflag sysflags;
483 #endif
484 extern NEARDATA struct instance_flags iflags;
485
486 /* last_msg values
487  * Usage:
488  *  pline("some message");
489  *    pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
490  *  iflags.last_msg = PLNMSG_some_message;
491  * and subsequent code can adjust the next message if it is affected
492  * by some_message.  The next message will clear iflags.last_msg.
493  */
494 enum plnmsg_types {
495     PLNMSG_UNKNOWN = 0,         /* arbitrary */
496     PLNMSG_ONE_ITEM_HERE,       /* "you see <single item> here" */
497     PLNMSG_TOWER_OF_FLAME,      /* scroll of fire */
498     PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */
499     PLNMSG_OBJ_GLOWS,           /* "the <obj> glows <color>" */
500     PLNMSG_OBJNAM_ONLY,         /* xname/doname only, for #tip */
501     PLNMSG_OK_DONT_DIE          /* overriding death in explore/wizard mode */
502 };
503
504 /* runmode options */
505 enum runmode_types {
506     RUN_TPORT = 0, /* don't update display until movement stops */
507     RUN_LEAP,      /* update display every 7 steps */
508     RUN_STEP,      /* update display every single step */
509     RUN_CRAWL      /* walk w/ extra delay after each update */
510 };
511
512 /* paranoid confirmation prompting */
513 /* any yes confirmations also require explicit no (or ESC) to reject */
514 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
515 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
516 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
517 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
518 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
519 /* hit: yes vs y for "Save bones?" in wizard mode */
520 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
521 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
522 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
523 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
524    taking over for the old prayconfirm boolean option */
525 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
526 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
527    item even when only one accessory or piece of armor is currently worn */
528 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
529 /* breakwand: Applying a wand */
530 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
531 /* werechange: accepting randomly timed werecreature change to transform
532    from human to creature or vice versa while having polymorph control */
533 #define ParanoidWerechange ((flags.paranoia_bits & PARANOID_WERECHANGE) != 0)
534 /* continue eating: prompt given _after_first_bite_ when eating something
535    while satiated */
536 #define ParanoidEating ((flags.paranoia_bits & PARANOID_EATING) != 0)
537
538 /* command parsing, mainly dealing with number_pad handling;
539    not saved and restored */
540
541 #ifdef NHSTDC
542 /* forward declaration sufficient to declare pointers */
543 struct ext_func_tab; /* from func_tab.h */
544 #endif
545
546 /* special key functions */
547 enum nh_keyfunc {
548     NHKF_ESC = 0,
549     NHKF_DOAGAIN,
550
551     NHKF_REQMENU,
552
553     /* run ... clicklook need to be in a continuous block */
554     NHKF_RUN,
555     NHKF_RUN2,
556     NHKF_RUSH,
557     NHKF_FIGHT,
558     NHKF_FIGHT2,
559     NHKF_NOPICKUP,
560     NHKF_RUN_NOPICKUP,
561     NHKF_DOINV,
562     NHKF_TRAVEL,
563     NHKF_CLICKLOOK,
564
565     NHKF_REDRAW,
566     NHKF_REDRAW2,
567     NHKF_GETDIR_SELF,
568     NHKF_GETDIR_SELF2,
569     NHKF_GETDIR_HELP,
570     NHKF_COUNT,
571     NHKF_GETPOS_SELF,
572     NHKF_GETPOS_PICK,
573     NHKF_GETPOS_PICK_Q,  /* quick */
574     NHKF_GETPOS_PICK_O,  /* once */
575     NHKF_GETPOS_PICK_V,  /* verbose */
576     NHKF_GETPOS_SHOWVALID,
577     NHKF_GETPOS_AUTODESC,
578     NHKF_GETPOS_MON_NEXT,
579     NHKF_GETPOS_MON_PREV,
580     NHKF_GETPOS_OBJ_NEXT,
581     NHKF_GETPOS_OBJ_PREV,
582     NHKF_GETPOS_DOOR_NEXT,
583     NHKF_GETPOS_DOOR_PREV,
584     NHKF_GETPOS_UNEX_NEXT,
585     NHKF_GETPOS_UNEX_PREV,
586     NHKF_GETPOS_INTERESTING_NEXT,
587     NHKF_GETPOS_INTERESTING_PREV,
588     NHKF_GETPOS_VALID_NEXT,
589     NHKF_GETPOS_VALID_PREV,
590     NHKF_GETPOS_HELP,
591     NHKF_GETPOS_MENU,
592     NHKF_GETPOS_LIMITVIEW,
593     NHKF_GETPOS_MOVESKIP,
594
595     NUM_NHKF
596 };
597
598 enum gloctypes {
599     GLOC_MONS = 0,
600     GLOC_OBJS,
601     GLOC_DOOR,
602     GLOC_EXPLORE,
603     GLOC_INTERESTING,
604     GLOC_VALID,
605
606     NUM_GLOCS
607 };
608
609 /* commands[] is used to directly access cmdlist[] instead of looping
610    through it to find the entry for a given input character;
611    move_X is the character used for moving one step in direction X;
612    alphadirchars corresponds to old sdir,
613    dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
614    pcHack_compat and phone_layout only matter when num_pad is on,
615    swap_yz only matters when it's off */
616 struct cmd {
617     unsigned serialno;     /* incremented after each update */
618     boolean num_pad;       /* same as iflags.num_pad except during updates */
619     boolean pcHack_compat; /* for numpad:  affects 5, M-5, and M-0 */
620     boolean phone_layout;  /* inverted keypad:  1,2,3 above, 7,8,9 below */
621     boolean swap_yz;       /* QWERTZ keyboards; use z to move NW, y to zap */
622     char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
623     const char *dirchars;      /* current movement/direction characters */
624     const char *alphadirchars; /* same as dirchars if !numpad */
625     const struct ext_func_tab *commands[256]; /* indexed by input character */
626     char spkeys[NUM_NHKF];
627 };
628
629 extern NEARDATA struct cmd Cmd;
630
631 #endif /* FLAG_H */