OSDN Git Service

import nethack-3.6.0
[jnethack/source.git] / include / flag.h
1 /* NetHack 3.6  flag.h  $NHDT-Date: 1435002669 2015/06/22 19:51:09 $  $NHDT-Branch: master $:$NHDT-Revision: 1.89 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
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.                                     */
8
9 #ifndef FLAG_H
10 #define FLAG_H
11
12 /*
13  * Persistent flags that are saved and restored with the game.
14  *
15  */
16
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     boolean sortloot;        /* sort items alphabetically when looting */
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_YES_WITHOUT_PROMPT '+'
80 #define DISCLOSE_NO_WITHOUT_PROMPT '-'
81     char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various
82                                                       info upon exit */
83     char menu_style;    /* User interface style setting */
84     boolean made_fruit; /* don't easily let the user overflow the number of
85                            fruits */
86
87     /* KMH, role patch -- Variables used during startup.
88      *
89      * If the user wishes to select a role, race, gender, and/or alignment
90      * during startup, the choices should be recorded here.  This
91      * might be specified through command-line options, environmental
92      * variables, a popup dialog box, menus, etc.
93      *
94      * These values are each an index into an array.  They are not
95      * characters or letters, because that limits us to 26 roles.
96      * They are not booleans, because someday someone may need a neuter
97      * gender.  Negative values are used to indicate that the user
98      * hasn't yet specified that particular value.      If you determine
99      * that the user wants a random choice, then you should set an
100      * appropriate random value; if you just left the negative value,
101      * the user would be asked again!
102      *
103      * These variables are stored here because the u structure is
104      * cleared during character initialization, and because the
105      * flags structure is restored for saved games.  Thus, we can
106      * use the same parameters to build the role entry for both
107      * new and restored games.
108      *
109      * These variables should not be referred to after the character
110      * is initialized or restored (specifically, after role_init()
111      * is called).
112      */
113     int initrole;  /* starting role      (index into roles[])   */
114     int initrace;  /* starting race      (index into races[])   */
115     int initgend;  /* starting gender    (index into genders[]) */
116     int initalign; /* starting alignment (index into aligns[])  */
117     int randomall; /* randomly assign everything not specified */
118     int pantheon;  /* deity selection for priest character */
119     /* Items which were in iflags in 3.4.x to preserve savefile compatibility
120      */
121     boolean lootabc;   /* use "a/b/c" rather than "o/i/b" when looting */
122     boolean showrace;  /* show hero glyph by race rather than by role */
123     boolean travelcmd; /* allow travel command */
124     int runmode;       /* update screen display during run moves */
125 };
126
127 /*
128  * System-specific flags that are saved with the game if SYSFLAGS is defined.
129  */
130
131 #if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
132 #define SYSFLAGS
133 #else
134 #if defined(MFLOPPY) || defined(MAC)
135 #define SYSFLAGS
136 #endif
137 #endif
138
139 #ifdef SYSFLAGS
140 struct sysflag {
141     char sysflagsid[10];
142 #ifdef AMIFLUSH
143     boolean altmeta;  /* use ALT keys as META */
144     boolean amiflush; /* kill typeahead */
145 #endif
146 #ifdef AMII_GRAPHICS
147     int numcols;
148     unsigned short
149         amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
150     AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
151 #endif
152 #ifdef OPT_DISPMAP
153     boolean fast_map; /* use optimized, less flexible map display */
154 #endif
155 #ifdef MFLOPPY
156     boolean asksavedisk;
157 #endif
158 #ifdef MAC
159     boolean page_wait; /* put up a --More-- after a page of messages */
160 #endif
161 };
162 #endif
163
164 /*
165  * Flags that are set each time the game is started.
166  * These are not saved with the game.
167  *
168  */
169
170 struct instance_flags {
171     /* stuff that really isn't option or platform related. They are
172      * set and cleared during the game to control the internal
173      * behaviour of various NetHack functions and probably warrant
174      * a structure of their own elsewhere some day.
175      */
176     int in_lava_effects;   /* hack for Boots_off() */
177     int last_msg;          /* indicator of last message player saw */
178     int purge_monsters;    /* # of dead monsters still on fmon list */
179     int override_ID;       /* true to force full identification of objects */
180     int suppress_price;    /* controls doname() for unpaid objects */
181     coord travelcc;        /* coordinates for travel_cache */
182     boolean window_inited; /* true if init_nhwindows() completed */
183     boolean vision_inited; /* true if vision is ready */
184     boolean sanity_check;  /* run sanity checks */
185     boolean mon_polycontrol; /* debug: control monster polymorphs */
186     /* stuff that is related to options and/or user or platform preferences */
187     unsigned msg_history; /* hint: # of top lines to save */
188     int menu_headings;    /* ATR for menu headings */
189     int *opt_booldup;     /* for duplication of boolean opts in config file */
190     int *opt_compdup; /* for duplication of compound opts in config file */
191 #ifdef ALTMETA
192     boolean altmeta; /* Alt-c sends ESC c rather than M-c */
193 #endif
194     boolean cbreak;           /* in cbreak mode, rogue format */
195     boolean deferred_X;       /* deferred entry into explore mode */
196     boolean num_pad;          /* use numbers for movement commands */
197     boolean news;             /* print news */
198     boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */
199     boolean mention_walls;    /* give feedback when bumping walls */
200     boolean menu_tab_sep;     /* Use tabs to separate option menu fields */
201     boolean menu_head_objsym; /* Show obj symbol in menu headings */
202     boolean menu_requested;   /* Flag for overloaded use of 'm' prefix
203                                * on some non-move commands */
204     boolean renameallowed;    /* can change hero name during role selection */
205     boolean renameinprogress; /* we are changing hero name */
206     boolean toptenwin;        /* ending list in window instead of stdout */
207     boolean zerocomp;         /* write zero-compressed save files */
208     boolean rlecomp; /* run-length comp of levels when writing savefile */
209     uchar num_pad_mode;
210     boolean echo;             /* 1 to echo characters */
211     boolean use_menu_color;       /* use color in menus; only if wc_color */
212     boolean use_status_hilites;   /* use color in status line */
213     boolean use_background_glyph; /* use background glyph when appropriate */
214     boolean hilite_pile;          /* mark piles of objects with a hilite */
215 #if 0
216         boolean  DECgraphics;   /* use DEC VT-xxx extended character set */
217         boolean  IBMgraphics;   /* use IBM extended character set */
218 #ifdef MAC_GRAPHICS_ENV
219         boolean  MACgraphics;   /* use Macintosh extended character set, as
220                                    as defined in the special font HackFont */
221 #endif
222 #endif
223     uchar bouldersym; /* symbol for boulder display */
224 #ifdef TTY_GRAPHICS
225     char prevmsg_window; /* type of old message window to use */
226     boolean extmenu;     /* extended commands use menu interface */
227 #endif
228 #ifdef MFLOPPY
229     boolean checkspace; /* check disk space before writing files */
230                         /* (in iflags to allow restore after moving
231                          * to >2GB partition) */
232 #endif
233 #ifdef MICRO
234     boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
235 #endif
236 #if defined(MICRO) || defined(WIN32)
237     boolean rawio; /* whether can use rawio (IOCTL call) */
238 #endif
239 #ifdef MAC_GRAPHICS_ENV
240     boolean MACgraphics; /* use Macintosh extended character set, as
241                             as defined in the special font HackFont */
242     unsigned use_stone;  /* use the stone ppats */
243 #endif
244 #if defined(MSDOS) || defined(WIN32)
245     boolean hassound;     /* has a sound card */
246     boolean usesound;     /* use the sound card */
247     boolean usepcspeaker; /* use the pc speaker */
248     boolean tile_view;
249     boolean over_view;
250     boolean traditional_view;
251 #endif
252 #ifdef MSDOS
253     boolean hasvga; /* has a vga adapter */
254     boolean usevga; /* use the vga adapter */
255     boolean grmode; /* currently in graphics mode */
256 #endif
257 #ifdef LAN_FEATURES
258     boolean lan_mail;         /* mail is initialized */
259     boolean lan_mail_fetched; /* mail is awaiting display */
260 #endif
261     /*
262      * Window capability support.
263      */
264     boolean wc_color;         /* use color graphics                  */
265     boolean wc_hilite_pet;    /* hilight pets                        */
266     boolean wc_ascii_map;     /* show map using traditional ascii    */
267     boolean wc_tiled_map;     /* show map using tiles                */
268     boolean wc_preload_tiles; /* preload tiles into memory           */
269     int wc_tile_width;        /* tile width                          */
270     int wc_tile_height;       /* tile height                         */
271     char *wc_tile_file;       /* name of tile file;overrides default */
272     boolean wc_inverse;       /* use inverse video for some things   */
273     int wc_align_status;      /*  status win at top|bot|right|left   */
274     int wc_align_message;     /* message win at top|bot|right|left   */
275     int wc_vary_msgcount;     /* show more old messages at a time    */
276     char *wc_foregrnd_menu; /* points to foregrnd color name for menu win   */
277     char *wc_backgrnd_menu; /* points to backgrnd color name for menu win   */
278     char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
279     char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
280     char *
281         wc_foregrnd_status; /* points to foregrnd color name for status win */
282     char *
283         wc_backgrnd_status; /* points to backgrnd color name for status win */
284     char *wc_foregrnd_text; /* points to foregrnd color name for text win   */
285     char *wc_backgrnd_text; /* points to backgrnd color name for text win   */
286     char *wc_font_map;      /* points to font name for the map win */
287     char *wc_font_message;  /* points to font name for message win */
288     char *wc_font_status;   /* points to font name for status win  */
289     char *wc_font_menu;     /* points to font name for menu win    */
290     char *wc_font_text;     /* points to font name for text win    */
291     int wc_fontsiz_map;     /* font size for the map win           */
292     int wc_fontsiz_message; /* font size for the message window    */
293     int wc_fontsiz_status;  /* font size for the status window     */
294     int wc_fontsiz_menu;    /* font size for the menu window       */
295     int wc_fontsiz_text;    /* font size for text windows          */
296     int wc_scroll_amount;   /* scroll this amount at scroll_margin */
297     int wc_scroll_margin;   /* scroll map when this far from
298                                     the edge */
299     int wc_map_mode;        /* specify map viewing options, mostly
300                                     for backward compatibility */
301     int wc_player_selection;    /* method of choosing character */
302     boolean wc_splash_screen;   /* display an opening splash screen or not */
303     boolean wc_popup_dialog;    /* put queries in pop up dialogs instead of
304                                         in the message window */
305     boolean wc_eight_bit_input; /* allow eight bit input               */
306     boolean wc_mouse_support;   /* allow mouse support */
307     boolean wc2_fullscreen;     /* run fullscreen */
308     boolean wc2_softkeyboard;   /* use software keyboard */
309     boolean wc2_wraptext;       /* wrap text */
310     boolean wc2_selectsaved;    /* display a menu of user's saved games */
311     boolean wc2_darkgray; /* try to use dark-gray color for black glyphs */
312     boolean cmdassist;    /* provide detailed assistance for some commands */
313     boolean clicklook;    /* allow right-clicking for look */
314     boolean obsolete; /* obsolete options can point at this, it isn't used */
315     struct autopickup_exception *autopickup_exceptions[2];
316 #define AP_LEAVE 0
317 #define AP_GRAB 1
318 #ifdef WIN32
319 #define MAX_ALTKEYHANDLER 25
320     char altkeyhandler[MAX_ALTKEYHANDLER];
321 #endif
322     /* copies of values in struct u, used during detection when the
323        originals are temporarily cleared; kept here rather than
324        locally so that they can be restored during a hangup save */
325     Bitfield(save_uinwater, 1);
326     Bitfield(save_uburied, 1);
327 };
328
329 /*
330  * Old deprecated names
331  */
332 #ifdef TTY_GRAPHICS
333 #define eight_bit_tty wc_eight_bit_input
334 #endif
335 #define use_color wc_color
336 #define hilite_pet wc_hilite_pet
337 #define use_inverse wc_inverse
338 #ifdef MAC_GRAPHICS_ENV
339 #define large_font obsolete
340 #endif
341 #ifdef MAC
342 #define popup_dialog wc_popup_dialog
343 #endif
344 #define preload_tiles wc_preload_tiles
345
346 extern NEARDATA struct flag flags;
347 #ifdef SYSFLAGS
348 extern NEARDATA struct sysflag sysflags;
349 #endif
350 extern NEARDATA struct instance_flags iflags;
351
352 /* last_msg values */
353 #define PLNMSG_UNKNOWN 0             /* arbitrary */
354 #define PLNMSG_ONE_ITEM_HERE 1       /* "you see <single item> here" */
355 #define PLNMSG_TOWER_OF_FLAME 2      /* scroll of fire */
356 #define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */
357 #define PLNMSG_OBJ_GLOWS 4           /* "the <obj> glows <color>" */
358
359 /* runmode options */
360 #define RUN_TPORT 0 /* don't update display until movement stops */
361 #define RUN_LEAP 1  /* update display every 7 steps */
362 #define RUN_STEP 2  /* update display every single step */
363 #define RUN_CRAWL 3 /* walk w/ extra delay after each update */
364
365 /* paranoid confirmation prompting */
366 /* any yes confirmations also require explicit no (or ESC) to reject */
367 #define ParanoidConfirm ((flags.paranoia_bits & PARANOID_CONFIRM) != 0)
368 /* quit: yes vs y for "Really quit?" and "Enter explore mode?" */
369 #define ParanoidQuit ((flags.paranoia_bits & PARANOID_QUIT) != 0)
370 /* die: yes vs y for "Die?" (dying in explore mode or wizard mode) */
371 #define ParanoidDie ((flags.paranoia_bits & PARANOID_DIE) != 0)
372 /* hit: yes vs y for "Save bones?" in wizard mode */
373 #define ParanoidBones ((flags.paranoia_bits & PARANOID_BONES) != 0)
374 /* hit: yes vs y for "Really attack <the peaceful monster>?" */
375 #define ParanoidHit ((flags.paranoia_bits & PARANOID_HIT) != 0)
376 /* pray: ask "Really pray?" (accepts y answer, doesn't require yes),
377    taking over for the old prayconfirm boolean option */
378 #define ParanoidPray ((flags.paranoia_bits & PARANOID_PRAY) != 0)
379 /* remove: remove ('R') and takeoff ('T') commands prompt for an inventory
380    item even when only one accessory or piece of armor is currently worn */
381 #define ParanoidRemove ((flags.paranoia_bits & PARANOID_REMOVE) != 0)
382 /* breakwand: Applying a wand */
383 #define ParanoidBreakwand ((flags.paranoia_bits & PARANOID_BREAKWAND) != 0)
384
385 /* command parsing, mainly dealing with number_pad handling;
386    not saved and restored */
387
388 #ifdef NHSTDC
389 /* forward declaration sufficient to declare pointers */
390 struct func_tab; /* from func_tab.h */
391 #endif
392
393 /* commands[] is used to directly access cmdlist[] instead of looping
394    through it to find the entry for a given input character;
395    move_X is the character used for moving one step in direction X;
396    alphadirchars corresponds to old sdir,
397    dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
398    pcHack_compat and phone_layout only matter when num_pad is on,
399    swap_yz only matters when it's off */
400 struct cmd {
401     unsigned serialno;     /* incremented after each update */
402     boolean num_pad;       /* same as iflags.num_pad except during updates */
403     boolean pcHack_compat; /* for numpad:  affects 5, M-5, and M-0 */
404     boolean phone_layout;  /* inverted keypad:  1,2,3 above, 7,8,9 below */
405     boolean swap_yz;       /* German keyboards; use z to move NW, y to zap */
406     char move_W, move_NW, move_N, move_NE, move_E, move_SE, move_S, move_SW;
407     const char *dirchars;      /* current movement/direction characters */
408     const char *alphadirchars; /* same as dirchars if !numpad */
409     const struct func_tab *commands[256]; /* indexed by input character */
410 };
411
412 extern NEARDATA struct cmd Cmd;
413
414 #endif /* FLAG_H */