NHDT->ANH, in most cases
[aNetHack.git] / include / flag.h
blob062e88407245f1376e7d4a1c781fd95d179ba481
1 /* NetHack 3.6 flag.h $ANH-Date: 1461102045 2016/04/19 21:40:45 $ $ANH-Branch: master $:$ANH-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 boolean getloc_limitview;
198 boolean getloc_usemenu;
199 coord travelcc; /* coordinates for travel_cache */
200 boolean window_inited; /* true if init_nhwindows() completed */
201 boolean vision_inited; /* true if vision is ready */
202 boolean sanity_check; /* run sanity checks */
203 boolean mon_polycontrol; /* debug: control monster polymorphs */
204 boolean in_dumplog; /* doing the dumplog right now? */
206 /* stuff that is related to options and/or user or platform preferences
208 unsigned msg_history; /* hint: # of top lines to save */
209 int getpos_coords; /* show coordinates when getting cursor position */
210 int menu_headings; /* ATR for menu headings */
211 int *opt_booldup; /* for duplication of boolean opts in config file */
212 int *opt_compdup; /* for duplication of compound opts in conf file */
213 #ifdef ALTMETA
214 boolean altmeta; /* Alt-c sends ESC c rather than M-c */
215 #endif
216 boolean cbreak; /* in cbreak mode, rogue format */
217 boolean deferred_X; /* deferred entry into explore mode */
218 boolean num_pad; /* use numbers for movement commands */
219 boolean news; /* print news */
220 boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
221 boolean mention_walls; /* give feedback when bumping walls */
222 boolean menu_tab_sep; /* Use tabs to separate option menu fields */
223 boolean menu_head_objsym; /* Show obj symbol in menu headings */
224 boolean menu_overlay; /* Draw menus over the map */
225 boolean menu_requested; /* Flag for overloaded use of 'm' prefix
226 * on some non-move commands */
227 boolean renameallowed; /* can change hero name during role selection */
228 boolean renameinprogress; /* we are changing hero name */
229 boolean toptenwin; /* ending list in window instead of stdout */
230 boolean zerocomp; /* write zero-compressed save files */
231 boolean rlecomp; /* run-length comp of levels when writing savefile */
232 uchar num_pad_mode;
233 boolean echo; /* 1 to echo characters */
234 boolean use_menu_color; /* use color in menus; only if wc_color */
235 boolean use_status_hilites; /* use color in status line */
236 boolean status_updates; /* allow updates to bottom status lines */
237 boolean use_background_glyph; /* use background glyph when appropriate */
238 boolean hilite_pile; /* mark piles of objects with a hilite */
239 boolean autodescribe; /* autodescribe mode in getpos() */
240 #if 0
241 boolean DECgraphics; /* use DEC VT-xxx extended character set */
242 boolean IBMgraphics; /* use IBM extended character set */
243 #ifdef MAC_GRAPHICS_ENV
244 boolean MACgraphics; /* use Macintosh extended character set, as
245 as defined in the special font HackFont */
246 #endif
247 #endif
248 uchar bouldersym; /* symbol for boulder display */
249 #ifdef TTY_GRAPHICS
250 char prevmsg_window; /* type of old message window to use */
251 boolean extmenu; /* extended commands use menu interface */
252 #endif
253 #ifdef MFLOPPY
254 boolean checkspace; /* check disk space before writing files */
255 /* (in iflags to allow restore after moving
256 * to >2GB partition) */
257 #endif
258 #ifdef MICRO
259 boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
260 #endif
261 #if defined(MICRO) || defined(WIN32)
262 boolean rawio; /* whether can use rawio (IOCTL call) */
263 #endif
264 #ifdef MAC_GRAPHICS_ENV
265 boolean MACgraphics; /* use Macintosh extended character set, as
266 as defined in the special font HackFont */
267 unsigned use_stone; /* use the stone ppats */
268 #endif
269 #if defined(MSDOS) || defined(WIN32)
270 boolean hassound; /* has a sound card */
271 boolean usesound; /* use the sound card */
272 boolean usepcspeaker; /* use the pc speaker */
273 boolean tile_view;
274 boolean over_view;
275 boolean traditional_view;
276 #endif
277 #ifdef MSDOS
278 boolean hasvga; /* has a vga adapter */
279 boolean usevga; /* use the vga adapter */
280 boolean hasvesa; /* has a VESA-capable VGA adapter */
281 boolean usevesa; /* use the VESA-capable VGA adapter */
282 boolean grmode; /* currently in graphics mode */
283 #endif
284 #ifdef LAN_FEATURES
285 boolean lan_mail; /* mail is initialized */
286 boolean lan_mail_fetched; /* mail is awaiting display */
287 #endif
288 #ifdef TTY_TILES_ESCCODES
289 boolean vt_tiledata; /* output console codes for tile support in TTY */
290 #endif
291 boolean wizweight; /* display weight of everything in wizard mode */
294 * Window capability support.
296 boolean wc_color; /* use color graphics */
297 boolean wc_hilite_pet; /* hilight pets */
298 boolean wc_ascii_map; /* show map using traditional ascii */
299 boolean wc_tiled_map; /* show map using tiles */
300 boolean wc_preload_tiles; /* preload tiles into memory */
301 int wc_tile_width; /* tile width */
302 int wc_tile_height; /* tile height */
303 char *wc_tile_file; /* name of tile file;overrides default */
304 boolean wc_inverse; /* use inverse video for some things */
305 int wc_align_status; /* status win at top|bot|right|left */
306 int wc_align_message; /* message win at top|bot|right|left */
307 int wc_vary_msgcount; /* show more old messages at a time */
308 char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */
309 char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
310 char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
311 char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
312 char *
313 wc_foregrnd_status; /* points to foregrnd color name for status win */
314 char *
315 wc_backgrnd_status; /* points to backgrnd color name for status win */
316 char *wc_foregrnd_text; /* points to foregrnd color name for text win */
317 char *wc_backgrnd_text; /* points to backgrnd color name for text win */
318 char *wc_font_map; /* points to font name for the map win */
319 char *wc_font_message; /* points to font name for message win */
320 char *wc_font_status; /* points to font name for status win */
321 char *wc_font_menu; /* points to font name for menu win */
322 char *wc_font_text; /* points to font name for text win */
323 int wc_fontsiz_map; /* font size for the map win */
324 int wc_fontsiz_message; /* font size for the message window */
325 int wc_fontsiz_status; /* font size for the status window */
326 int wc_fontsiz_menu; /* font size for the menu window */
327 int wc_fontsiz_text; /* font size for text windows */
328 int wc_scroll_amount; /* scroll this amount at scroll_margin */
329 int wc_scroll_margin; /* scroll map when this far from
330 the edge */
331 int wc_map_mode; /* specify map viewing options, mostly
332 for backward compatibility */
333 int wc_player_selection; /* method of choosing character */
334 boolean wc_splash_screen; /* display an opening splash screen or not */
335 boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
336 in the message window */
337 boolean wc_eight_bit_input; /* allow eight bit input */
338 boolean wc_mouse_support; /* allow mouse support */
339 boolean wc2_fullscreen; /* run fullscreen */
340 boolean wc2_softkeyboard; /* use software keyboard */
341 boolean wc2_wraptext; /* wrap text */
342 boolean wc2_selectsaved; /* display a menu of user's saved games */
343 boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
344 boolean cmdassist; /* provide detailed assistance for some commands */
345 boolean clicklook; /* allow right-clicking for look */
346 boolean obsolete; /* obsolete options can point at this, it isn't used */
347 struct autopickup_exception *autopickup_exceptions[2];
348 #define AP_LEAVE 0
349 #define AP_GRAB 1
350 #ifdef WIN32
351 #define MAX_ALTKEYHANDLER 25
352 char altkeyhandler[MAX_ALTKEYHANDLER];
353 #endif
354 /* copies of values in struct u, used during detection when the
355 originals are temporarily cleared; kept here rather than
356 locally so that they can be restored during a hangup save */
357 Bitfield(save_uswallow, 1);
358 Bitfield(save_uinwater, 1);
359 Bitfield(save_uburied, 1);
363 * Old deprecated names
365 #ifdef TTY_GRAPHICS
366 #define eight_bit_tty wc_eight_bit_input
367 #endif
368 #define use_color wc_color
369 #define hilite_pet wc_hilite_pet
370 #define use_inverse wc_inverse
371 #ifdef MAC_GRAPHICS_ENV
372 #define large_font obsolete
373 #endif
374 #ifdef MAC
375 #define popup_dialog wc_popup_dialog
376 #endif
377 #define preload_tiles wc_preload_tiles
379 extern NEARDATA struct flag flags;
380 #ifdef SYSFLAGS
381 extern NEARDATA struct sysflag sysflags;
382 #endif
383 extern NEARDATA struct instance_flags iflags;
385 /* last_msg values
386 * Usage:
387 * pline("some message");
388 * pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
389 * iflags.last_msg = PLNMSG_some_message;
390 * and subsequent code can adjust the next message if it is affected
391 * by some_message. The next message will clear iflags.last_msg.
393 enum plnmsg_types {
394 PLNMSG_UNKNOWN = 0, /* arbitrary */
395 PLNMSG_ONE_ITEM_HERE, /* "you see <single item> here" */
396 PLNMSG_TOWER_OF_FLAME, /* scroll of fire */
397 PLNMSG_CAUGHT_IN_EXPLOSION, /* explode() feedback */
398 PLNMSG_OBJ_GLOWS, /* "the <obj> glows <color>" */
399 PLNMSG_OBJNAM_ONLY /* xname/doname only, for #tip */
402 /* runmode options */
403 enum runmode_types {
404 RUN_TPORT = 0, /* don't update display until movement stops */
405 RUN_LEAP, /* update display every 7 steps */
406 RUN_STEP, /* update display every single step */
407 RUN_CRAWL /* walk w/ extra delay after each update */
410 /* paranoid confirmation prompting */
411 /* any yes confirmations also require explicit no (or ESC) to reject */
412 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
413 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
414 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
415 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
416 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
417 /* hit: yes vs y for "Save bones?" in wizard mode */
418 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
419 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
420 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
421 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
422 taking over for the old prayconfirm boolean option */
423 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
424 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
425 item even when only one accessory or piece of armor is currently worn */
426 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
427 /* breakwand: Applying a wand */
428 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
430 /* command parsing, mainly dealing with number_pad handling;
431 not saved and restored */
433 #ifdef NHSTDC
434 /* forward declaration sufficient to declare pointers */
435 struct ext_func_tab; /* from func_tab.h */
436 #endif
438 /* special key functions */
439 enum nh_keyfunc {
440 NHKF_ESC = 0,
441 NHKF_DOAGAIN,
443 NHKF_REQMENU,
445 /* run ... clicklook need to be in a continuous block */
446 NHKF_RUN,
447 NHKF_RUN2,
448 NHKF_RUSH,
449 NHKF_FIGHT,
450 NHKF_FIGHT2,
451 NHKF_NOPICKUP,
452 NHKF_RUN_NOPICKUP,
453 NHKF_DOINV,
454 NHKF_TRAVEL,
455 NHKF_CLICKLOOK,
457 NHKF_REDRAW,
458 NHKF_REDRAW2,
459 NHKF_GETDIR_SELF,
460 NHKF_GETDIR_SELF2,
461 NHKF_GETDIR_HELP,
462 NHKF_COUNT,
463 NHKF_GETPOS_SELF,
464 NHKF_GETPOS_PICK,
465 NHKF_GETPOS_PICK_Q, /* quick */
466 NHKF_GETPOS_PICK_O, /* once */
467 NHKF_GETPOS_PICK_V, /* verbose */
468 NHKF_GETPOS_SHOWVALID,
469 NHKF_GETPOS_AUTODESC,
470 NHKF_GETPOS_MON_NEXT,
471 NHKF_GETPOS_MON_PREV,
472 NHKF_GETPOS_OBJ_NEXT,
473 NHKF_GETPOS_OBJ_PREV,
474 NHKF_GETPOS_DOOR_NEXT,
475 NHKF_GETPOS_DOOR_PREV,
476 NHKF_GETPOS_UNEX_NEXT,
477 NHKF_GETPOS_UNEX_PREV,
478 NHKF_GETPOS_INTERESTING_NEXT,
479 NHKF_GETPOS_INTERESTING_PREV,
480 NHKF_GETPOS_HELP,
481 NHKF_GETPOS_MENU,
482 NHKF_GETPOS_LIMITVIEW,
484 NUM_NHKF
487 enum gloctypes {
488 GLOC_MONS = 0,
489 GLOC_OBJS,
490 GLOC_DOOR,
491 GLOC_EXPLORE,
492 GLOC_INTERESTING,
494 NUM_GLOCS
497 /* commands[] is used to directly access cmdlist[] instead of looping
498 through it to find the entry for a given input character;
499 move_X is the character used for moving one step in direction X;
500 alphadirchars corresponds to old sdir,
501 dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
502 pcHack_compat and phone_layout only matter when num_pad is on,
503 swap_yz only matters when it's off */
504 struct cmd {
505 unsigned serialno; /* incremented after each update */
506 boolean num_pad; /* same as iflags.num_pad except during updates */
507 boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
508 boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
509 boolean swap_yz; /* QWERTZ keyboards; use z to move NW, y to zap */
510 char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
511 const char *dirchars; /* current movement/direction characters */
512 const char *alphadirchars; /* same as dirchars if !numpad */
513 const struct ext_func_tab *commands[256]; /* indexed by input character */
514 char spkeys[NUM_NHKF];
517 extern NEARDATA struct cmd Cmd;
519 #endif /* FLAG_H */