Files
nethack/include/flag.h
nethack.rankin 0076d5fc00 number_pad:3,4,-1 (trunk only)
Add support requested by a user for number_pad:3 to use a phone-style
keypad layout where 1,2,3 are on the top row and 7,8,9 on the bottom,
opposite of the adding machine layout adopted by computer keyboards.  Also
number_pad:4 combines that with the number_pad:2 hack to give different
behavior for the 5 key (also meta-5 and meta-0).  And number_pad:-1 is a
rather absurd way to support German keyboards which have y and z keys
swapped, avoiding the need to add a new option for that.  With it, z moves
upper-left and y zaps wands, with corresponding swap of the upper case,
control, and meta variations of those two letters.  (There is a "German
keyboard patch" for this floating around the net, but it implements a
compile time configuration setting which results in hard-coded behavior
for those keys.  This implementation lets it be toggled on or off at will.)

     There's more here, intended to ultimately simplify rhack() quite a
bit.  Most of that isn't finished yet.  However, the part that is done
should produce same run-time behavior as before.  I hope....

     iflags.num_pad and iflags.num_pad_mode should now be viewed as opaque
items used for communicating dynamically updated option settings to the
core only.  Ports and/or interfaces which feel inclined to peek at them
should switch to Cmd.num_pad,&c instead.  (I've made that switch for a
couple of places which would have stopped compiling due to sdir and ndir
going away, and for vms+tty where I could directly test the change(s),
possibly plus one or two places which got heldover over from my earlier
attempt that did try to update all of them.  Ports which haven't made the
change yet ought to continue to work as-is though.)

     Eventually ports/interfaces which implement alternate ways to invoke
commands (pull down menus or extra keyboard buttons or whatever) should be
able to scan Cmd.commands[] to figure out which input characters trigger
which nethack functions.  The ones that currently use hardcoded key lists
will probably need to migrate before any dynamic key binding functionality
gets implemented.  (Which may never happen; it's definitely not on my own
to-do list.)  Cmd.serialno is intended to be the way for them figure out
when the commands have been changed (which right now only happens when 'O'
is used to alter the number_pad setting); perhaps a new interface callback
would be better suited for communicating this.

     It may be necessary to rearrange header inclusion so that func_tab.h
gets included before flag.h (and/or struct cmd gets moved from the latter
to the former--but then func_tab.h would be needed in a bunch of places
which don't currently use it) to support some pre-ANSI compilers.  And the
command initialization might need to be moved to somewhere earlier than
init_options() at some point if port/interface initialization starts caring
about it.
2005-11-26 02:32:49 +00:00

341 lines
14 KiB
C

/* SCCS Id: @(#)flag.h 3.5 2005/11/19 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/* If you change the flag structure make sure you increment EDITLEVEL in */
/* patchlevel.h if needed. Changing the instance_flags structure does */
/* not require incrementing EDITLEVEL. */
#ifndef FLAG_H
#define FLAG_H
/*
* Persistent flags that are saved and restored with the game.
*
*/
struct flag {
boolean acoustics; /* allow dungeon sound messages */
boolean autodig; /* MRKR: Automatically dig */
boolean autoquiver; /* Automatically fill quiver */
boolean beginner;
boolean biff; /* enable checking for mail */
boolean confirm; /* confirm before hitting tame monsters */
boolean debug; /* in debugging mode */
#define wizard flags.debug
boolean end_own; /* list all own scores */
boolean explore; /* in exploration mode */
#define discover flags.explore
boolean female;
boolean friday13; /* it's Friday the 13th */
boolean help; /* look in data file for info about stuff */
boolean ignintr; /* ignore interrupts */
boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */
boolean invlet_constant; /* let objects keep their inventory symbol */
boolean legacy; /* print game entry "story" */
boolean lit_corridor; /* show a dark corr as lit if it is in sight */
boolean nap; /* `timed_delay' option for display effects */
boolean null; /* OK to send nulls to the terminal */
boolean perm_invent; /* keep full inventories up until dismissed */
boolean pickup; /* whether you pickup or move and look */
boolean pushweapon; /* When wielding, push old weapon into second slot */
boolean rest_on_space; /* space means rest */
boolean safe_dog; /* give complete protection to the dog */
boolean showexp; /* show experience points */
boolean showscore; /* show score */
boolean silent; /* whether the bell rings or not */
boolean sortpack; /* sorted inventory */
boolean sparkle; /* show "resisting" special FX (Scott Bigham) */
boolean standout; /* use standout for --More-- */
boolean time; /* display elapsed 'time' */
boolean tombstone; /* print tombstone */
boolean toptenwin; /* ending list in window instead of stdout */
boolean verbose; /* max battle info */
boolean prayconfirm; /* confirm before praying */
int end_top, end_around; /* describe desired score list */
unsigned moonphase;
unsigned long suppress_alert;
#define NEW_MOON 0
#define FULL_MOON 4
int pickup_burden; /* maximum burden before prompt */
char inv_order[MAXOCLASSES];
char pickup_types[MAXOCLASSES];
#define NUM_DISCLOSURE_OPTIONS 5
#define DISCLOSE_PROMPT_DEFAULT_YES 'y'
#define DISCLOSE_PROMPT_DEFAULT_NO 'n'
#define DISCLOSE_YES_WITHOUT_PROMPT '+'
#define DISCLOSE_NO_WITHOUT_PROMPT '-'
char end_disclose[NUM_DISCLOSURE_OPTIONS + 1]; /* disclose various info
upon exit */
char menu_style; /* User interface style setting */
/* KMH, role patch -- Variables used during startup.
*
* If the user wishes to select a role, race, gender, and/or alignment
* during startup, the choices should be recorded here. This
* might be specified through command-line options, environmental
* variables, a popup dialog box, menus, etc.
*
* These values are each an index into an array. They are not
* characters or letters, because that limits us to 26 roles.
* They are not booleans, because someday someone may need a neuter
* gender. Negative values are used to indicate that the user
* hasn't yet specified that particular value. If you determine
* that the user wants a random choice, then you should set an
* appropriate random value; if you just left the negative value,
* the user would be asked again!
*
* These variables are stored here because the u structure is
* cleared during character initialization, and because the
* flags structure is restored for saved games. Thus, we can
* use the same parameters to build the role entry for both
* new and restored games.
*
* These variables should not be referred to after the character
* is initialized or restored (specifically, after role_init()
* is called).
*/
int initrole; /* starting role (index into roles[]) */
int initrace; /* starting race (index into races[]) */
int initgend; /* starting gender (index into genders[]) */
int initalign; /* starting alignment (index into aligns[]) */
int randomall; /* randomly assign everything not specified */
int pantheon; /* deity selection for priest character */
/* Items which were in iflags in 3.4.x to preserve savefile compatibility */
boolean lootabc; /* use "a/b/c" rather than "o/i/b" when looting */
boolean showrace; /* show hero glyph by race rather than by role */
boolean travelcmd; /* allow travel command */
int runmode; /* update screen display during run moves */
};
/*
* System-specific flags that are saved with the game if SYSFLAGS is defined.
*/
#if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
#define SYSFLAGS
#else
#if defined(MFLOPPY) || defined(MAC)
#define SYSFLAGS
#endif
#endif
#ifdef SYSFLAGS
struct sysflag {
char sysflagsid[10];
#ifdef AMIFLUSH
boolean altmeta; /* use ALT keys as META */
boolean amiflush; /* kill typeahead */
#endif
#ifdef AMII_GRAPHICS
int numcols;
unsigned short amii_dripens[ 20 ]; /* DrawInfo Pens currently there are 13 in v39 */
AMII_COLOR_TYPE amii_curmap[ AMII_MAXCOLORS ]; /* colormap */
#endif
#ifdef OPT_DISPMAP
boolean fast_map; /* use optimized, less flexible map display */
#endif
#ifdef MFLOPPY
boolean asksavedisk;
#endif
#ifdef MAC
boolean page_wait; /* put up a --More-- after a page of messages */
#endif
};
#endif
/*
* Flags that are set each time the game is started.
* These are not saved with the game.
*
*/
struct instance_flags {
boolean cbreak; /* in cbreak mode, rogue format */
boolean DECgraphics; /* use DEC VT-xxx extended character set */
boolean echo; /* 1 to echo characters */
boolean IBMgraphics; /* use IBM extended character set */
unsigned msg_history; /* hint: # of top lines to save */
boolean num_pad; /* use numbers for movement commands */
boolean news; /* print news */
boolean window_inited; /* true if init_nhwindows() completed */
boolean vision_inited; /* true if vision is ready */
boolean menu_tab_sep; /* Use tabs to separate option menu fields */
boolean menu_requested; /* Flag for overloaded use of 'm' prefix
* on some non-move commands */
boolean zerocomp; /* write zero-compressed save files */
boolean rlecomp; /* run-length comp of levels when writing savefile */
uchar num_pad_mode;
int menu_headings; /* ATR for menu headings */
int purge_monsters; /* # of dead monsters still on fmon list */
int *opt_booldup; /* for duplication of boolean opts in config file */
int *opt_compdup; /* for duplication of compound opts in config file */
uchar bouldersym; /* symbol for boulder display */
coord travelcc; /* coordinates for travel_cache */
#ifdef WIZARD
boolean sanity_check; /* run sanity checks */
boolean mon_polycontrol; /* debug: control monster polymorphs */
#endif
#ifdef TTY_GRAPHICS
char prevmsg_window; /* type of old message window to use */
boolean extmenu; /* extended commands use menu interface */
#endif
#ifdef MFLOPPY
boolean checkspace; /* check disk space before writing files */
/* (in iflags to allow restore after moving
* to >2GB partition) */
#endif
#ifdef MICRO
boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
#endif
#if defined(MICRO) || defined(WIN32)
boolean rawio; /* whether can use rawio (IOCTL call) */
#endif
#ifdef MAC_GRAPHICS_ENV
boolean MACgraphics; /* use Macintosh extended character set, as
as defined in the special font HackFont */
unsigned use_stone; /* use the stone ppats */
#endif
#if defined(MSDOS) || defined(WIN32)
boolean hassound; /* has a sound card */
boolean usesound; /* use the sound card */
boolean usepcspeaker; /* use the pc speaker */
boolean tile_view;
boolean over_view;
boolean traditional_view;
#endif
#ifdef MSDOS
boolean hasvga; /* has a vga adapter */
boolean usevga; /* use the vga adapter */
boolean grmode; /* currently in graphics mode */
#endif
#ifdef LAN_FEATURES
boolean lan_mail; /* mail is initialized */
boolean lan_mail_fetched; /* mail is awaiting display */
#endif
/*
* Window capability support.
*/
boolean wc_color; /* use color graphics */
boolean wc_hilite_pet; /* hilight pets */
boolean wc_ascii_map; /* show map using traditional ascii */
boolean wc_tiled_map; /* show map using tiles */
boolean wc_preload_tiles; /* preload tiles into memory */
int wc_tile_width; /* tile width */
int wc_tile_height; /* tile height */
char *wc_tile_file; /* name of tile file;overrides default */
boolean wc_inverse; /* use inverse video for some things */
int wc_align_status; /* status win at top|bot|right|left */
int wc_align_message; /* message win at top|bot|right|left */
int wc_vary_msgcount; /* show more old messages at a time */
char *wc_foregrnd_menu; /* points to foregrnd color name for menu win */
char *wc_backgrnd_menu; /* points to backgrnd color name for menu win */
char *wc_foregrnd_message; /* points to foregrnd color name for msg win */
char *wc_backgrnd_message; /* points to backgrnd color name for msg win */
char *wc_foregrnd_status; /* points to foregrnd color name for status win */
char *wc_backgrnd_status; /* points to backgrnd color name for status win */
char *wc_foregrnd_text; /* points to foregrnd color name for text win */
char *wc_backgrnd_text; /* points to backgrnd color name for text win */
char *wc_font_map; /* points to font name for the map win */
char *wc_font_message; /* points to font name for message win */
char *wc_font_status; /* points to font name for status win */
char *wc_font_menu; /* points to font name for menu win */
char *wc_font_text; /* points to font name for text win */
int wc_fontsiz_map; /* font size for the map win */
int wc_fontsiz_message; /* font size for the message window */
int wc_fontsiz_status; /* font size for the status window */
int wc_fontsiz_menu; /* font size for the menu window */
int wc_fontsiz_text; /* font size for text windows */
int wc_scroll_amount; /* scroll this amount at scroll_margin */
int wc_scroll_margin; /* scroll map when this far from
the edge */
int wc_map_mode; /* specify map viewing options, mostly
for backward compatibility */
int wc_player_selection; /* method of choosing character */
boolean wc_splash_screen; /* display an opening splash screen or not */
boolean wc_popup_dialog; /* put queries in pop up dialogs instead of
in the message window */
boolean wc_eight_bit_input; /* allow eight bit input */
boolean wc_mouse_support; /* allow mouse support */
boolean wc2_fullscreen; /* run fullscreen */
boolean wc2_softkeyboard; /* use software keyboard */
boolean wc2_wraptext; /* wrap text */
boolean wc2_selectsaved; /* display a menu of user's saved games */
boolean cmdassist; /* provide detailed assistance for some commands */
boolean clicklook; /* allow right-clicking for look */
boolean obsolete; /* obsolete options can point at this, it isn't used */
#ifdef AUTOPICKUP_EXCEPTIONS
struct autopickup_exception *autopickup_exceptions[2];
#define AP_LEAVE 0
#define AP_GRAB 1
#endif
#ifdef WIN32CON
#define MAX_ALTKEYHANDLER 25
char altkeyhandler[MAX_ALTKEYHANDLER];
#endif
};
/*
* Old deprecated names
*/
#ifdef TTY_GRAPHICS
#define eight_bit_tty wc_eight_bit_input
#endif
#ifdef TEXTCOLOR
#define use_color wc_color
#endif
#define hilite_pet wc_hilite_pet
#define use_inverse wc_inverse
#ifdef MAC_GRAPHICS_ENV
#define large_font obsolete
#endif
#ifdef MAC
#define popup_dialog wc_popup_dialog
#endif
#define preload_tiles wc_preload_tiles
extern NEARDATA struct flag flags;
#ifdef SYSFLAGS
extern NEARDATA struct sysflag sysflags;
#endif
extern NEARDATA struct instance_flags iflags;
/* runmode options */
#define RUN_TPORT 0 /* don't update display until movement stops */
#define RUN_LEAP 1 /* update display every 7 steps */
#define RUN_STEP 2 /* update display every single step */
#define RUN_CRAWL 3 /* walk w/ extra delay after each update */
/* command parsing, mainly dealing with number_pad handling;
not saved and restored */
#ifdef NHSTDC
/* forward declaration sufficient to declare pointers */
struct func_tab; /* from func_tab.h */
#endif
/* commands[] is used to directly access cmdlist[] instead of looping
through it to find the entry for a given input character;
move_X is the character used for moving one step in direction X;
alphadirchars corresponds to old sdir,
dirchars corresponds to ``iflags.num_pad ? ndir : sdir'';
pcHack_compat and phone_layout only matter when num_pad is on,
swap_yz only matters when it's off */
struct cmd {
unsigned serialno; /* incremented after each update */
boolean num_pad; /* same as iflags.num_pad except during updates */
boolean pcHack_compat; /* for numpad: affects 5, M-5, and M-0 */
boolean phone_layout; /* inverted keypad: 1,2,3 above, 7,8,9 below */
boolean swap_yz; /* German keyboads; use z to move NW, y to zap */
char move_W, move_NW, move_N, move_NE,
move_E, move_SE, move_S, move_SW;
const char *dirchars; /* current movement/direction characters */
const char *alphadirchars; /* same as dirchars if !numpad */
const struct func_tab *commands[256]; /* indexed by input character */
};
extern NEARDATA struct cmd Cmd;
#endif /* FLAG_H */