fix 'crash when reviving shopkeeper'
[aNetHack.git] / include / flag.h
blob4136070aba52a0aa45f8128b798402aa1611a723
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_SCREEN 's'
178 struct instance_flags {
179 /* stuff that really isn't option or platform related. They are
180 * set and cleared during the game to control the internal
181 * behaviour of various NetHack functions and probably warrant
182 * a structure of their own elsewhere some day.
184 int in_lava_effects; /* hack for Boots_off() */
185 int last_msg; /* indicator of last message player saw */
186 int purge_monsters; /* # of dead monsters still on fmon list */
187 int override_ID; /* true to force full identification of objects */
188 int suppress_price; /* controls doname() for unpaid objects */
189 int terrainmode; /* for getpos()'s autodescribe when #terrain is active */
190 #define TER_MAP 0x01
191 #define TER_TRP 0x02
192 #define TER_OBJ 0x04
193 #define TER_MON 0x08
194 coord travelcc; /* coordinates for travel_cache */
195 boolean window_inited; /* true if init_nhwindows() completed */
196 boolean vision_inited; /* true if vision is ready */
197 boolean sanity_check; /* run sanity checks */
198 boolean mon_polycontrol; /* debug: control monster polymorphs */
200 /* stuff that is related to options and/or user or platform preferences
202 unsigned msg_history; /* hint: # of top lines to save */
203 int getpos_coords; /* show coordinates when getting cursor position */
204 int menu_headings; /* ATR for menu headings */
205 int *opt_booldup; /* for duplication of boolean opts in config file */
206 int *opt_compdup; /* for duplication of compound opts in conf file */
207 #ifdef ALTMETA
208 boolean altmeta; /* Alt-c sends ESC c rather than M-c */
209 #endif
210 boolean cbreak; /* in cbreak mode, rogue format */
211 boolean deferred_X; /* deferred entry into explore mode */
212 boolean num_pad; /* use numbers for movement commands */
213 boolean news; /* print news */
214 boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
215 boolean mention_walls; /* give feedback when bumping walls */
216 boolean menu_tab_sep; /* Use tabs to separate option menu fields */
217 boolean menu_head_objsym; /* Show obj symbol in menu headings */
218 boolean menu_overlay; /* Draw menus over the map */
219 boolean menu_requested; /* Flag for overloaded use of 'm' prefix
220 * on some non-move commands */
221 boolean renameallowed; /* can change hero name during role selection */
222 boolean renameinprogress; /* we are changing hero name */
223 boolean toptenwin; /* ending list in window instead of stdout */
224 boolean zerocomp; /* write zero-compressed save files */
225 boolean rlecomp; /* run-length comp of levels when writing savefile */
226 uchar num_pad_mode;
227 boolean echo; /* 1 to echo characters */
228 boolean use_menu_color; /* use color in menus; only if wc_color */
229 boolean use_status_hilites; /* use color in status line */
230 boolean use_background_glyph; /* use background glyph when appropriate */
231 boolean hilite_pile; /* mark piles of objects with a hilite */
232 boolean autodescribe; /* autodescribe mode in getpos() */
233 #if 0
234 boolean DECgraphics; /* use DEC VT-xxx extended character set */
235 boolean IBMgraphics; /* use IBM extended character set */
236 #ifdef MAC_GRAPHICS_ENV
237 boolean MACgraphics; /* use Macintosh extended character set, as
238 as defined in the special font HackFont */
239 #endif
240 #endif
241 uchar bouldersym; /* symbol for boulder display */
242 #ifdef TTY_GRAPHICS
243 char prevmsg_window; /* type of old message window to use */
244 boolean extmenu; /* extended commands use menu interface */
245 #endif
246 #ifdef MFLOPPY
247 boolean checkspace; /* check disk space before writing files */
248 /* (in iflags to allow restore after moving
249 * to >2GB partition) */
250 #endif
251 #ifdef MICRO
252 boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
253 #endif
254 #if defined(MICRO) || defined(WIN32)
255 boolean rawio; /* whether can use rawio (IOCTL call) */
256 #endif
257 #ifdef MAC_GRAPHICS_ENV
258 boolean MACgraphics; /* use Macintosh extended character set, as
259 as defined in the special font HackFont */
260 unsigned use_stone; /* use the stone ppats */
261 #endif
262 #if defined(MSDOS) || defined(WIN32)
263 boolean hassound; /* has a sound card */
264 boolean usesound; /* use the sound card */
265 boolean usepcspeaker; /* use the pc speaker */
266 boolean tile_view;
267 boolean over_view;
268 boolean traditional_view;
269 #endif
270 #ifdef MSDOS
271 boolean hasvga; /* has a vga adapter */
272 boolean usevga; /* use the vga adapter */
273 boolean hasvesa; /* has a VESA-capable VGA adapter */
274 boolean usevesa; /* use the VESA-capable VGA adapter */
275 boolean grmode; /* currently in graphics mode */
276 #endif
277 #ifdef LAN_FEATURES
278 boolean lan_mail; /* mail is initialized */
279 boolean lan_mail_fetched; /* mail is awaiting display */
280 #endif
281 #ifdef TTY_TILES_ESCCODES
282 boolean vt_tiledata; /* output console codes for tile support in TTY */
283 #endif
284 boolean wizweight; /* display weight of everything in wizard mode */
287 * Window capability support.
289 boolean wc_color; /* use color graphics */
290 boolean wc_hilite_pet; /* hilight pets */
291 boolean wc_ascii_map; /* show map using traditional ascii */
292 boolean wc_tiled_map; /* show map using tiles */
293 boolean wc_preload_tiles; /* preload tiles into memory */
294 int wc_tile_width; /* tile width */
295 int wc_tile_height; /* tile height */
296 char *wc_tile_file; /* name of tile file;overrides default */
297 boolean wc_inverse; /* use inverse video for some things */
298 int wc_align_status; /* status win at top|bot|right|left */
299 int wc_align_message; /* message win at top|bot|right|left */
300 int wc_vary_msgcount; /* show more old messages at a time */
301 char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */
302 char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
303 char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
304 char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
305 char *
306 wc_foregrnd_status; /* points to foregrnd color name for status win */
307 char *
308 wc_backgrnd_status; /* points to backgrnd color name for status win */
309 char *wc_foregrnd_text; /* points to foregrnd color name for text win */
310 char *wc_backgrnd_text; /* points to backgrnd color name for text win */
311 char *wc_font_map; /* points to font name for the map win */
312 char *wc_font_message; /* points to font name for message win */
313 char *wc_font_status; /* points to font name for status win */
314 char *wc_font_menu; /* points to font name for menu win */
315 char *wc_font_text; /* points to font name for text win */
316 int wc_fontsiz_map; /* font size for the map win */
317 int wc_fontsiz_message; /* font size for the message window */
318 int wc_fontsiz_status; /* font size for the status window */
319 int wc_fontsiz_menu; /* font size for the menu window */
320 int wc_fontsiz_text; /* font size for text windows */
321 int wc_scroll_amount; /* scroll this amount at scroll_margin */
322 int wc_scroll_margin; /* scroll map when this far from
323 the edge */
324 int wc_map_mode; /* specify map viewing options, mostly
325 for backward compatibility */
326 int wc_player_selection; /* method of choosing character */
327 boolean wc_splash_screen; /* display an opening splash screen or not */
328 boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
329 in the message window */
330 boolean wc_eight_bit_input; /* allow eight bit input */
331 boolean wc_mouse_support; /* allow mouse support */
332 boolean wc2_fullscreen; /* run fullscreen */
333 boolean wc2_softkeyboard; /* use software keyboard */
334 boolean wc2_wraptext; /* wrap text */
335 boolean wc2_selectsaved; /* display a menu of user's saved games */
336 boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
337 boolean cmdassist; /* provide detailed assistance for some commands */
338 boolean clicklook; /* allow right-clicking for look */
339 boolean obsolete; /* obsolete options can point at this, it isn't used */
340 struct autopickup_exception *autopickup_exceptions[2];
341 #define AP_LEAVE 0
342 #define AP_GRAB 1
343 #ifdef WIN32
344 #define MAX_ALTKEYHANDLER 25
345 char altkeyhandler[MAX_ALTKEYHANDLER];
346 #endif
347 /* copies of values in struct u, used during detection when the
348 originals are temporarily cleared; kept here rather than
349 locally so that they can be restored during a hangup save */
350 Bitfield(save_uinwater, 1);
351 Bitfield(save_uburied, 1);
355 * Old deprecated names
357 #ifdef TTY_GRAPHICS
358 #define eight_bit_tty wc_eight_bit_input
359 #endif
360 #define use_color wc_color
361 #define hilite_pet wc_hilite_pet
362 #define use_inverse wc_inverse
363 #ifdef MAC_GRAPHICS_ENV
364 #define large_font obsolete
365 #endif
366 #ifdef MAC
367 #define popup_dialog wc_popup_dialog
368 #endif
369 #define preload_tiles wc_preload_tiles
371 extern NEARDATA struct flag flags;
372 #ifdef SYSFLAGS
373 extern NEARDATA struct sysflag sysflags;
374 #endif
375 extern NEARDATA struct instance_flags iflags;
377 /* last_msg values */
378 #define PLNMSG_UNKNOWN 0 /* arbitrary */
379 #define PLNMSG_ONE_ITEM_HERE 1 /* "you see <single item> here" */
380 #define PLNMSG_TOWER_OF_FLAME 2 /* scroll of fire */
381 #define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */
382 #define PLNMSG_OBJ_GLOWS 4 /* "the <obj> glows <color>" */
383 /* Usage:
384 * pline("some message");
385 * pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
386 * iflags.last_msg = PLNMSG_some_message;
387 * and subsequent code can adjust the next message if it is affected
388 * by some_message. The next message will clear iflags.last_msg.
391 /* runmode options */
392 #define RUN_TPORT 0 /* don't update display until movement stops */
393 #define RUN_LEAP 1 /* update display every 7 steps */
394 #define RUN_STEP 2 /* update display every single step */
395 #define RUN_CRAWL 3 /* walk w/ extra delay after each update */
397 /* paranoid confirmation prompting */
398 /* any yes confirmations also require explicit no (or ESC) to reject */
399 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
400 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
401 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
402 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
403 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
404 /* hit: yes vs y for "Save bones?" in wizard mode */
405 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
406 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
407 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
408 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
409 taking over for the old prayconfirm boolean option */
410 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
411 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
412 item even when only one accessory or piece of armor is currently worn */
413 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
414 /* breakwand: Applying a wand */
415 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
417 /* command parsing, mainly dealing with number_pad handling;
418 not saved and restored */
420 #ifdef NHSTDC
421 /* forward declaration sufficient to declare pointers */
422 struct func_tab; /* from func_tab.h */
423 #endif
425 /* commands[] is used to directly access cmdlist[] instead of looping
426 through it to find the entry for a given input character;
427 move_X is the character used for moving one step in direction X;
428 alphadirchars corresponds to old sdir,
429 dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
430 pcHack_compat and phone_layout only matter when num_pad is on,
431 swap_yz only matters when it's off */
432 struct cmd {
433 unsigned serialno; /* incremented after each update */
434 boolean num_pad; /* same as iflags.num_pad except during updates */
435 boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
436 boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
437 boolean swap_yz; /* German keyboards; use z to move NW, y to zap */
438 char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
439 const char *dirchars; /* current movement/direction characters */
440 const char *alphadirchars; /* same as dirchars if !numpad */
441 const struct func_tab *commands[256]; /* indexed by input character */
444 extern NEARDATA struct cmd Cmd;
446 #endif /* FLAG_H */