Accessibility: Pick travel/cursor targets from a menu
[aNetHack.git] / include / flag.h
blob642c680be03fb2baadcec6dd31e8fc971dcc33af
1 /* NetHack 3.6 flag.h $NHDT-Date: 1461102045 2016/04/19 21:40:45 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.103 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* If you change the flag structure make sure you increment EDITLEVEL in */
6 /* patchlevel.h if needed. Changing the instance_flags structure does */
7 /* not require incrementing EDITLEVEL. */
9 #ifndef FLAG_H
10 #define FLAG_H
13 * Persistent flags that are saved and restored with the game.
17 struct flag {
18 boolean acoustics; /* allow dungeon sound messages */
19 boolean autodig; /* MRKR: Automatically dig */
20 boolean autoquiver; /* Automatically fill quiver */
21 boolean autoopen; /* open doors by walking into them */
22 boolean beginner;
23 boolean biff; /* enable checking for mail */
24 boolean bones; /* allow saving/loading bones */
25 boolean confirm; /* confirm before hitting tame monsters */
26 boolean dark_room; /* show shadows in lit rooms */
27 boolean debug; /* in debugging mode */
28 #define wizard flags.debug
29 boolean end_own; /* list all own scores */
30 boolean explore; /* in exploration mode */
31 #define discover flags.explore
32 boolean female;
33 boolean friday13; /* it's Friday the 13th */
34 boolean help; /* look in data file for info about stuff */
35 boolean ignintr; /* ignore interrupts */
36 boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */
37 boolean invlet_constant; /* let objects keep their inventory symbol */
38 boolean legacy; /* print game entry "story" */
39 boolean lit_corridor; /* show a dark corr as lit if it is in sight */
40 boolean nap; /* `timed_delay' option for display effects */
41 boolean null; /* OK to send nulls to the terminal */
42 boolean perm_invent; /* keep full inventories up until dismissed */
43 boolean pickup; /* whether you pickup or move and look */
44 boolean pickup_thrown; /* auto-pickup items you threw */
45 boolean pushweapon; /* When wielding, push old weapon into second slot */
46 boolean rest_on_space; /* space means rest */
47 boolean safe_dog; /* give complete protection to the dog */
48 boolean showexp; /* show experience points */
49 boolean showscore; /* show score */
50 boolean silent; /* whether the bell rings or not */
51 char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */
52 boolean sortpack; /* sorted inventory */
53 boolean sparkle; /* show "resisting" special FX (Scott Bigham) */
54 boolean standout; /* use standout for --More-- */
55 boolean time; /* display elapsed 'time' */
56 boolean tombstone; /* print tombstone */
57 boolean verbose; /* max battle info */
58 int end_top, end_around; /* describe desired score list */
59 unsigned moonphase;
60 unsigned long suppress_alert;
61 #define NEW_MOON 0
62 #define FULL_MOON 4
63 int paranoia_bits; /* alternate confirmation prompting */
64 #define PARANOID_CONFIRM 0x01
65 #define PARANOID_QUIT 0x02
66 #define PARANOID_DIE 0x04
67 #define PARANOID_BONES 0x08
68 #define PARANOID_HIT 0x10
69 #define PARANOID_PRAY 0x20
70 #define PARANOID_REMOVE 0x40
71 #define PARANOID_BREAKWAND 0x80
72 int pickup_burden; /* maximum burden before prompt */
73 int pile_limit; /* controls feedback when walking over objects */
74 char inv_order[MAXOCLASSES];
75 char pickup_types[MAXOCLASSES];
76 #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */
77 #define DISCLOSE_PROMPT_DEFAULT_YES 'y'
78 #define DISCLOSE_PROMPT_DEFAULT_NO 'n'
79 #define DISCLOSE_PROMPT_DEFAULT_SPECIAL '?' /* v, default a */
80 #define DISCLOSE_YES_WITHOUT_PROMPT '+'
81 #define DISCLOSE_NO_WITHOUT_PROMPT '-'
82 #define DISCLOSE_SPECIAL_WITHOUT_PROMPT '#' /* v, use a */
83 char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various
84 info upon exit */
85 char menu_style; /* User interface style setting */
86 boolean made_fruit; /* don't easily let the user overflow the number of
87 fruits */
89 /* KMH, role patch -- Variables used during startup.
91 * If the user wishes to select a role, race, gender, and/or alignment
92 * during startup, the choices should be recorded here. This
93 * might be specified through command-line options, environmental
94 * variables, a popup dialog box, menus, etc.
96 * These values are each an index into an array. They are not
97 * characters or letters, because that limits us to 26 roles.
98 * They are not booleans, because someday someone may need a neuter
99 * gender. Negative values are used to indicate that the user
100 * hasn't yet specified that particular value. If you determine
101 * that the user wants a random choice, then you should set an
102 * appropriate random value; if you just left the negative value,
103 * the user would be asked again!
105 * These variables are stored here because the u structure is
106 * cleared during character initialization, and because the
107 * flags structure is restored for saved games. Thus, we can
108 * use the same parameters to build the role entry for both
109 * new and restored games.
111 * These variables should not be referred to after the character
112 * is initialized or restored (specifically, after role_init()
113 * is called).
115 int initrole; /* starting role (index into roles[]) */
116 int initrace; /* starting race (index into races[]) */
117 int initgend; /* starting gender (index into genders[]) */
118 int initalign; /* starting alignment (index into aligns[]) */
119 int randomall; /* randomly assign everything not specified */
120 int pantheon; /* deity selection for priest character */
121 /* Items which were in iflags in 3.4.x to preserve savefile compatibility
123 boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
124 boolean showrace; /* show hero glyph by race rather than by role */
125 boolean travelcmd; /* allow travel command */
126 int runmode; /* update screen display during run moves */
130 * System-specific flags that are saved with the game if SYSFLAGS is defined.
133 #if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
134 #define SYSFLAGS
135 #else
136 #if defined(MFLOPPY) || defined(MAC)
137 #define SYSFLAGS
138 #endif
139 #endif
141 #ifdef SYSFLAGS
142 struct sysflag {
143 char sysflagsid[10];
144 #ifdef AMIFLUSH
145 boolean altmeta; /* use ALT keys as META */
146 boolean amiflush; /* kill typeahead */
147 #endif
148 #ifdef AMII_GRAPHICS
149 int numcols;
150 unsigned short
151 amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
152 AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
153 #endif
154 #ifdef OPT_DISPMAP
155 boolean fast_map; /* use optimized, less flexible map display */
156 #endif
157 #ifdef MFLOPPY
158 boolean asksavedisk;
159 #endif
160 #ifdef MAC
161 boolean page_wait; /* put up a --More-- after a page of messages */
162 #endif
164 #endif
167 * Flags that are set each time the game is started.
168 * These are not saved with the game.
172 /* values for iflags.getpos_coords */
173 #define GPCOORDS_NONE 'n'
174 #define GPCOORDS_MAP 'm'
175 #define GPCOORDS_COMPASS 'c'
176 #define GPCOORDS_COMFULL 'f'
177 #define GPCOORDS_SCREEN 's'
179 struct instance_flags {
180 /* stuff that really isn't option or platform related. They are
181 * set and cleared during the game to control the internal
182 * behaviour of various NetHack functions and probably warrant
183 * a structure of their own elsewhere some day.
185 int in_lava_effects; /* hack for Boots_off() */
186 int last_msg; /* indicator of last message player saw */
187 int purge_monsters; /* # of dead monsters still on fmon list */
188 int override_ID; /* true to force full identification of objects */
189 int suppress_price; /* controls doname() for unpaid objects */
190 int terrainmode; /* for getpos()'s autodescribe when #terrain is active */
191 #define TER_MAP 0x01
192 #define TER_TRP 0x02
193 #define TER_OBJ 0x04
194 #define TER_MON 0x08
195 #define TER_DETECT 0x10 /* detect_foo magic rather than #terrain */
196 boolean getloc_travelmode;
197 coord travelcc; /* coordinates for travel_cache */
198 boolean window_inited; /* true if init_nhwindows() completed */
199 boolean vision_inited; /* true if vision is ready */
200 boolean sanity_check; /* run sanity checks */
201 boolean mon_polycontrol; /* debug: control monster polymorphs */
203 /* stuff that is related to options and/or user or platform preferences
205 unsigned msg_history; /* hint: # of top lines to save */
206 int getpos_coords; /* show coordinates when getting cursor position */
207 int menu_headings; /* ATR for menu headings */
208 int *opt_booldup; /* for duplication of boolean opts in config file */
209 int *opt_compdup; /* for duplication of compound opts in conf file */
210 #ifdef ALTMETA
211 boolean altmeta; /* Alt-c sends ESC c rather than M-c */
212 #endif
213 boolean cbreak; /* in cbreak mode, rogue format */
214 boolean deferred_X; /* deferred entry into explore mode */
215 boolean num_pad; /* use numbers for movement commands */
216 boolean news; /* print news */
217 boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
218 boolean mention_walls; /* give feedback when bumping walls */
219 boolean menu_tab_sep; /* Use tabs to separate option menu fields */
220 boolean menu_head_objsym; /* Show obj symbol in menu headings */
221 boolean menu_overlay; /* Draw menus over the map */
222 boolean menu_requested; /* Flag for overloaded use of 'm' prefix
223 * on some non-move commands */
224 boolean renameallowed; /* can change hero name during role selection */
225 boolean renameinprogress; /* we are changing hero name */
226 boolean toptenwin; /* ending list in window instead of stdout */
227 boolean zerocomp; /* write zero-compressed save files */
228 boolean rlecomp; /* run-length comp of levels when writing savefile */
229 uchar num_pad_mode;
230 boolean echo; /* 1 to echo characters */
231 boolean use_menu_color; /* use color in menus; only if wc_color */
232 boolean use_status_hilites; /* use color in status line */
233 boolean use_background_glyph; /* use background glyph when appropriate */
234 boolean hilite_pile; /* mark piles of objects with a hilite */
235 boolean autodescribe; /* autodescribe mode in getpos() */
236 #if 0
237 boolean DECgraphics; /* use DEC VT-xxx extended character set */
238 boolean IBMgraphics; /* use IBM extended character set */
239 #ifdef MAC_GRAPHICS_ENV
240 boolean MACgraphics; /* use Macintosh extended character set, as
241 as defined in the special font HackFont */
242 #endif
243 #endif
244 uchar bouldersym; /* symbol for boulder display */
245 #ifdef TTY_GRAPHICS
246 char prevmsg_window; /* type of old message window to use */
247 boolean extmenu; /* extended commands use menu interface */
248 #endif
249 #ifdef MFLOPPY
250 boolean checkspace; /* check disk space before writing files */
251 /* (in iflags to allow restore after moving
252 * to >2GB partition) */
253 #endif
254 #ifdef MICRO
255 boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
256 #endif
257 #if defined(MICRO) || defined(WIN32)
258 boolean rawio; /* whether can use rawio (IOCTL call) */
259 #endif
260 #ifdef MAC_GRAPHICS_ENV
261 boolean MACgraphics; /* use Macintosh extended character set, as
262 as defined in the special font HackFont */
263 unsigned use_stone; /* use the stone ppats */
264 #endif
265 #if defined(MSDOS) || defined(WIN32)
266 boolean hassound; /* has a sound card */
267 boolean usesound; /* use the sound card */
268 boolean usepcspeaker; /* use the pc speaker */
269 boolean tile_view;
270 boolean over_view;
271 boolean traditional_view;
272 #endif
273 #ifdef MSDOS
274 boolean hasvga; /* has a vga adapter */
275 boolean usevga; /* use the vga adapter */
276 boolean hasvesa; /* has a VESA-capable VGA adapter */
277 boolean usevesa; /* use the VESA-capable VGA adapter */
278 boolean grmode; /* currently in graphics mode */
279 #endif
280 #ifdef LAN_FEATURES
281 boolean lan_mail; /* mail is initialized */
282 boolean lan_mail_fetched; /* mail is awaiting display */
283 #endif
284 #ifdef TTY_TILES_ESCCODES
285 boolean vt_tiledata; /* output console codes for tile support in TTY */
286 #endif
287 boolean wizweight; /* display weight of everything in wizard mode */
290 * Window capability support.
292 boolean wc_color; /* use color graphics */
293 boolean wc_hilite_pet; /* hilight pets */
294 boolean wc_ascii_map; /* show map using traditional ascii */
295 boolean wc_tiled_map; /* show map using tiles */
296 boolean wc_preload_tiles; /* preload tiles into memory */
297 int wc_tile_width; /* tile width */
298 int wc_tile_height; /* tile height */
299 char *wc_tile_file; /* name of tile file;overrides default */
300 boolean wc_inverse; /* use inverse video for some things */
301 int wc_align_status; /* status win at top|bot|right|left */
302 int wc_align_message; /* message win at top|bot|right|left */
303 int wc_vary_msgcount; /* show more old messages at a time */
304 char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */
305 char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
306 char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
307 char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
308 char *
309 wc_foregrnd_status; /* points to foregrnd color name for status win */
310 char *
311 wc_backgrnd_status; /* points to backgrnd color name for status win */
312 char *wc_foregrnd_text; /* points to foregrnd color name for text win */
313 char *wc_backgrnd_text; /* points to backgrnd color name for text win */
314 char *wc_font_map; /* points to font name for the map win */
315 char *wc_font_message; /* points to font name for message win */
316 char *wc_font_status; /* points to font name for status win */
317 char *wc_font_menu; /* points to font name for menu win */
318 char *wc_font_text; /* points to font name for text win */
319 int wc_fontsiz_map; /* font size for the map win */
320 int wc_fontsiz_message; /* font size for the message window */
321 int wc_fontsiz_status; /* font size for the status window */
322 int wc_fontsiz_menu; /* font size for the menu window */
323 int wc_fontsiz_text; /* font size for text windows */
324 int wc_scroll_amount; /* scroll this amount at scroll_margin */
325 int wc_scroll_margin; /* scroll map when this far from
326 the edge */
327 int wc_map_mode; /* specify map viewing options, mostly
328 for backward compatibility */
329 int wc_player_selection; /* method of choosing character */
330 boolean wc_splash_screen; /* display an opening splash screen or not */
331 boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
332 in the message window */
333 boolean wc_eight_bit_input; /* allow eight bit input */
334 boolean wc_mouse_support; /* allow mouse support */
335 boolean wc2_fullscreen; /* run fullscreen */
336 boolean wc2_softkeyboard; /* use software keyboard */
337 boolean wc2_wraptext; /* wrap text */
338 boolean wc2_selectsaved; /* display a menu of user's saved games */
339 boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
340 boolean cmdassist; /* provide detailed assistance for some commands */
341 boolean clicklook; /* allow right-clicking for look */
342 boolean obsolete; /* obsolete options can point at this, it isn't used */
343 struct autopickup_exception *autopickup_exceptions[2];
344 #define AP_LEAVE 0
345 #define AP_GRAB 1
346 #ifdef WIN32
347 #define MAX_ALTKEYHANDLER 25
348 char altkeyhandler[MAX_ALTKEYHANDLER];
349 #endif
350 /* copies of values in struct u, used during detection when the
351 originals are temporarily cleared; kept here rather than
352 locally so that they can be restored during a hangup save */
353 Bitfield(save_uswallow, 1);
354 Bitfield(save_uinwater, 1);
355 Bitfield(save_uburied, 1);
359 * Old deprecated names
361 #ifdef TTY_GRAPHICS
362 #define eight_bit_tty wc_eight_bit_input
363 #endif
364 #define use_color wc_color
365 #define hilite_pet wc_hilite_pet
366 #define use_inverse wc_inverse
367 #ifdef MAC_GRAPHICS_ENV
368 #define large_font obsolete
369 #endif
370 #ifdef MAC
371 #define popup_dialog wc_popup_dialog
372 #endif
373 #define preload_tiles wc_preload_tiles
375 extern NEARDATA struct flag flags;
376 #ifdef SYSFLAGS
377 extern NEARDATA struct sysflag sysflags;
378 #endif
379 extern NEARDATA struct instance_flags iflags;
381 /* last_msg values */
382 #define PLNMSG_UNKNOWN 0 /* arbitrary */
383 #define PLNMSG_ONE_ITEM_HERE 1 /* "you see <single item> here" */
384 #define PLNMSG_TOWER_OF_FLAME 2 /* scroll of fire */
385 #define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */
386 #define PLNMSG_OBJ_GLOWS 4 /* "the <obj> glows <color>" */
387 #define PLNMSG_OBJNAM_ONLY 5 /* xname/doname only, for #tip */
388 /* Usage:
389 * pline("some message");
390 * pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
391 * iflags.last_msg = PLNMSG_some_message;
392 * and subsequent code can adjust the next message if it is affected
393 * by some_message. The next message will clear iflags.last_msg.
396 /* runmode options */
397 #define RUN_TPORT 0 /* don't update display until movement stops */
398 #define RUN_LEAP 1 /* update display every 7 steps */
399 #define RUN_STEP 2 /* update display every single step */
400 #define RUN_CRAWL 3 /* walk w/ extra delay after each update */
402 /* paranoid confirmation prompting */
403 /* any yes confirmations also require explicit no (or ESC) to reject */
404 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
405 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
406 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
407 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
408 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
409 /* hit: yes vs y for "Save bones?" in wizard mode */
410 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
411 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
412 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
413 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
414 taking over for the old prayconfirm boolean option */
415 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
416 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
417 item even when only one accessory or piece of armor is currently worn */
418 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
419 /* breakwand: Applying a wand */
420 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
422 /* command parsing, mainly dealing with number_pad handling;
423 not saved and restored */
425 #ifdef NHSTDC
426 /* forward declaration sufficient to declare pointers */
427 struct ext_func_tab; /* from func_tab.h */
428 #endif
430 /* special key functions */
431 enum nh_keyfunc {
432 NHKF_ESC = 0,
433 NHKF_DOAGAIN,
435 NHKF_REQMENU,
437 /* run ... clicklook need to be in a continuous block */
438 NHKF_RUN,
439 NHKF_RUN2,
440 NHKF_RUSH,
441 NHKF_FIGHT,
442 NHKF_FIGHT2,
443 NHKF_NOPICKUP,
444 NHKF_RUN_NOPICKUP,
445 NHKF_DOINV,
446 NHKF_TRAVEL,
447 NHKF_CLICKLOOK,
449 NHKF_REDRAW,
450 NHKF_REDRAW2,
451 NHKF_GETDIR_SELF,
452 NHKF_GETDIR_SELF2,
453 NHKF_GETDIR_HELP,
454 NHKF_COUNT,
455 NHKF_GETPOS_SELF,
456 NHKF_GETPOS_PICK,
457 NHKF_GETPOS_PICK_Q, /* quick */
458 NHKF_GETPOS_PICK_O, /* once */
459 NHKF_GETPOS_PICK_V, /* verbose */
460 NHKF_GETPOS_SHOWVALID,
461 NHKF_GETPOS_AUTODESC,
462 NHKF_GETPOS_MON_NEXT,
463 NHKF_GETPOS_MON_PREV,
464 NHKF_GETPOS_OBJ_NEXT,
465 NHKF_GETPOS_OBJ_PREV,
466 NHKF_GETPOS_DOOR_NEXT,
467 NHKF_GETPOS_DOOR_PREV,
468 NHKF_GETPOS_UNEX_NEXT,
469 NHKF_GETPOS_UNEX_PREV,
470 NHKF_GETPOS_HELP,
471 NHKF_GETPOS_MENU,
472 NHKF_GETPOS_MENU_FOV,
474 NUM_NHKF
477 /* commands[] is used to directly access cmdlist[] instead of looping
478 through it to find the entry for a given input character;
479 move_X is the character used for moving one step in direction X;
480 alphadirchars corresponds to old sdir,
481 dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
482 pcHack_compat and phone_layout only matter when num_pad is on,
483 swap_yz only matters when it's off */
484 struct cmd {
485 unsigned serialno; /* incremented after each update */
486 boolean num_pad; /* same as iflags.num_pad except during updates */
487 boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
488 boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
489 boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
490 char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
491 const char *dirchars; /* current movement/direction characters */
492 const char *alphadirchars; /* same as dirchars if !numpad */
493 const struct ext_func_tab *commands[256]; /* indexed by input character */
494 char spkeys[NUM_NHKF];
497 extern NEARDATA struct cmd Cmd;
499 #endif /* FLAG_H */