From: kmhugo Date: Sun, 31 Mar 2002 06:27:27 +0000 (+0000) Subject: lootabc and showrace options X-Git-Tag: MOVE2GIT~2845 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e60327b019659cc1ec608387d2f9e11a3eefa51;p=nethack lootabc and showrace options Replace "feature_toggle" implementation with an easier-to-understand boolean option called "lootabc". Provide "showrace", an option to display the hero by race glyph rather than by role glyph. Document the above. Remove some obsolete Mac options. --- diff --git a/dat/opthelp b/dat/opthelp index c287b1107..e152235a4 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -17,6 +17,7 @@ IBMgraphics use IBM extended characters for the dungeon [FALSE] ignintr ignore interrupt signal, including breaks [FALSE] legacy print introductory message [TRUE] lit_corridor show a dark corridor as lit if in sight [FALSE] +lootabc use a/b/c rather than o/i/b when looting [FALSE] mail enable the mail daemon [TRUE] null allow nulls to be sent to your terminal [TRUE] try turning this option off (forcing NetHack to use its own @@ -29,6 +30,7 @@ pushweapon when wielding a new weapon, put your previously rawio allow the use of raw I/O [FALSE] rest_on_space count the space bar as a rest character [FALSE] safe_pet prevent you from (knowingly) attacking your pet(s) [TRUE] +showrace show yourself by your race rather than by role [FALSE] silent don't use your terminal's bell sound [TRUE] sortpack group similar kinds of objects in inventory [TRUE] sound enable messages about what your character hears [TRUE] diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 0b0271d7a..491ed44d5 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1804,6 +1804,9 @@ Display an introductory message when starting the game (default on). .lp lit_corridor Show corridor squares seen by night vision or a light source held by your character as lit (default off). +.lp lootabc +Use the old `a', `b', and `c' keyboard shortcuts when +looting, rather than the mnemonics `o', `i', and `b' (default off). .lp "mail " Enable mail delivery during the game (default on). .lp "male " @@ -1980,6 +1983,10 @@ Control what parts of the score list you are shown at the end (ex. letter of each category (`t', `a', or `o') is necessary. .lp showexp Show your accumulated experience points on bottom line (default off). +.lp showrace +Display yourself as the glyph for your race, rather than the glyph +for your role (default off). Note that this setting affects only +the appearance of the display, not the way the game treats you. .lp showscore Show your approximate accumulated score on bottom line (default off). .lp "silent " diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index b3ced9efe..594f6a7ba 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -27,7 +27,7 @@ \begin{document} % % input file: guidebook.mn -% $Revision$ $Date$ +% $Revision: 1.37 $ $Date: 2002/03/23 20:03:20 $ % %.ds h0 " %.ds h1 %.ds h2 \% @@ -2235,6 +2235,10 @@ Display an introductory message when starting the game (default on). Show corridor squares seen by night vision or a light source held by your character as lit (default off). %.lp +\item[\ib{lootabc}] +Use the old `{\tt a}', `{\tt b}', and `{\tt c}' keyboard shortcuts when +looting, rather than the mnemonics `{\tt o}', `{\tt i}', and `{\tt b}' (default off). +%.lp \item[\ib{mail}] Enable mail delivery during the game (default on). %.lp @@ -2431,6 +2435,11 @@ letter of each category (`{\tt t}', `{\tt a}' or `{\tt o}') is necessary. \item[\ib{showexp}] Show your accumulated experience points on bottom line (default off). %.lp +\item[\ib{showrace}] +Display yourself as the glyph for your race, rather than the glyph +for your role (default off). Note that this setting affects only +the appearance of the display, not the way the game treats you. +%.lp \item[\ib{showscore}] Show your approximate accumulated score on bottom line (default off). %.lp diff --git a/include/decl.h b/include/decl.h index dcec14aa9..717a23fdd 100644 --- a/include/decl.h +++ b/include/decl.h @@ -370,28 +370,6 @@ E char *fqn_prefix[PREFIX_COUNT]; E char *fqn_prefix_names[PREFIX_COUNT]; #endif -/* - * Feature toggles - * - * The following provide a way to offer two different - * behaviours for a game interface feature, and allow - * the player to toggle the alternate behaviour on. - * The feature_name fields stored in the feature_toggles[] - * array can be specified in an OPTIONS=feature_toggle:value1 value2 - * statement in the config file. - */ - -E unsigned long toggled_features; - -E struct features_that_toggle { - char *feature_name; - unsigned long feature_bit; -} feature_toggles[]; - -#define TOGGLE_INVALID 0 -#define TOGGLE_LOOT_MENU_SELECTORS 1 /* index in feature_toogle_list[] */ -#define LAST_FEATURE_TOGGLE 1 - #undef E #endif /* DECL_H */ diff --git a/include/display.h b/include/display.h index fa458ba1b..7b7559726 100644 --- a/include/display.h +++ b/include/display.h @@ -314,10 +314,12 @@ #define ridden_monnum_to_glyph(mnum) ((int) (mnum) + GLYPH_RIDDEN_OFF) #define petnum_to_glyph(mnum) ((int) (mnum) + GLYPH_PET_OFF) -/* The hero's glyph when seen as a monster. Could also be... - * mon_to_glyph(Upolyd || Race_if(PM_HUMAN) ? u.umonnum : urace.malenum) +/* The hero's glyph when seen as a monster. */ -#define hero_glyph monnum_to_glyph(u.umonnum) +#define hero_glyph \ + monnum_to_glyph((Upolyd || !iflags.showrace) ? u.umonnum : \ + (flags.female && urace.femalenum != NON_PM) ? urace.femalenum : \ + urace.malenum) /* diff --git a/include/extern.h b/include/extern.h index b9bb78d20..572980753 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1353,7 +1353,6 @@ E char *FDECL(nh_getenv, (const char *)); E void FDECL(set_duplicate_opt_detection, (int)); E void FDECL(set_wc_option_mod_status, (unsigned long, int)); E void FDECL(set_option_mod_status, (char *, int)); -E boolean FDECL(feature_toggle, (int)); /* ### pager.c ### */ diff --git a/include/flag.h b/include/flag.h index ddc607080..c1445f03e 100644 --- a/include/flag.h +++ b/include/flag.h @@ -252,6 +252,10 @@ struct instance_flags { boolean wc_large_font; /* draw in larger fonts (say, 12pt instead of 9pt) */ boolean wc_eight_bit_input; /* allow eight bit input */ + + /* Items which belong in flags, but are here to allow save 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 */ }; /* diff --git a/src/decl.c b/src/decl.c index 08d6b57bd..69988fe86 100644 --- a/src/decl.c +++ b/src/decl.c @@ -271,21 +271,6 @@ char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir", "lockdir", "configdir" }; #endif -/* - * The following provide a way to offer two different - * behaviours for a game interface feature, and allow - * the player to toggle the alternate behaviour on. - * The strings in the feature_toggles[] array can be - * specified in an OPTIONS=feature_toggle:value1 value2 - * statement in the config file. - */ -unsigned long toggled_features = 0L; - -struct features_that_toggle feature_toggles[] = { - {(char *)0, 0x00000000L}, /* 0 = TOGGLE_INVALID */ - {"loot_menu_selectors", 0x00000001L}, /* 1 = TOGGLE_LOOT_MENU_SELECTORS */ -}; - /* dummy routine used to force linkage */ void decl_init() diff --git a/src/options.c b/src/options.c index e8ce17a3d..1fe7a565d 100644 --- a/src/options.c +++ b/src/options.c @@ -106,6 +106,7 @@ static struct Bool_Opt {"large_font", &iflags.wc_large_font, FALSE, SET_IN_FILE}, /*WC*/ {"legacy", &flags.legacy, TRUE, DISP_IN_GAME}, {"lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME}, + {"lootabc", &iflags.lootabc, FALSE, SET_IN_GAME}, #ifdef MAC_GRAPHICS_ENV {"Macgraphics", &iflags.MACgraphics, TRUE, SET_IN_GAME}, #else @@ -161,6 +162,7 @@ static struct Bool_Opt #else {"showexp", (boolean *)0, FALSE, SET_IN_FILE}, #endif + {"showrace", &iflags.showrace, FALSE, SET_IN_GAME}, #ifdef SCORE_ON_BOTL {"showscore", &flags.showscore, FALSE, SET_IN_GAME}, #else @@ -202,10 +204,6 @@ static struct Comp_Opt 8, DISP_IN_GAME }, { "align_message", "message window alignment", 20, DISP_IN_GAME }, /*WC*/ { "align_status", "status window alignment", 20, DISP_IN_GAME }, /*WC*/ -#ifdef MAC - { "background", "the color of the background (black or white)", - 6, SET_IN_FILE }, -#endif { "boulder", "the symbol to use for displaying boulders", 1, SET_IN_GAME }, { "catname", "the name of your (first) cat (e.g., catname:Tabby)", @@ -219,7 +217,6 @@ static struct Comp_Opt MAXDCHARS+1, SET_IN_FILE }, { "effects", "the symbols to use in drawing special effects", MAXECHARS+1, SET_IN_FILE }, - { "feature_toggle", "alternate feature behaviour", 79, SET_IN_FILE }, { "font_map", "the font to use in the map window", 40, DISP_IN_GAME }, /*WC*/ { "font_menu", "the font to use in menus", 40, DISP_IN_GAME }, /*WC*/ { "font_message", "the font to use in the message window", @@ -297,9 +294,6 @@ static struct Comp_Opt { "tile_file", "name of tile file", 70, DISP_IN_GAME}, /*WC*/ { "traps", "the symbols to use in drawing traps", MAXTCHARS+1, SET_IN_FILE }, -#ifdef MAC - {"use_stone", "use stone background patterns", 8, SET_IN_FILE }, -#endif { "vary_msgcount", "show more old messages at a time", 20, DISP_IN_GAME }, /*WC*/ #ifdef MSDOS { "video", "method of video updating", 20, SET_IN_FILE }, @@ -1042,43 +1036,6 @@ boolean tinitial, tfrom_file; return; } - fullname = "feature_toggle"; - if (match_optname(opts, fullname, 11, TRUE)) { - char buf[BUFSZ]; - char *feature; - boolean matched = FALSE; - if (!(op = string_for_opt(opts, FALSE))) - return; - if (!negated) { - boolean has_badfield = FALSE; - char badfields[BUFSZ]; - buf[BUFSZ-1] = '\0'; - - Strcpy(badfields, "feature_toggle:"); - (void)strncpy(buf, op, BUFSZ - 1); - (void)mungspaces(buf); - feature = strtok(buf, " \n"); - while(feature && *feature && *feature != ' ') { - matched = FALSE; - for (num = 1; num <= LAST_FEATURE_TOGGLE; num++) { - if (!strcmpi(feature, feature_toggles[num].feature_name)) { - toggled_features |= feature_toggles[num].feature_bit; - matched = TRUE; - } - } - if (!matched) { - if (has_badfield) Strcat(badfields, " "); - Strcat(badfields, feature); - has_badfield = TRUE; - } - feature = strtok((char *)0, " \n"); - } - if (has_badfield) badoption(badfields); - } else - bad_negation(fullname, FALSE); - return; - } - fullname = "horsename"; if (match_optname(opts, fullname, 5, TRUE)) { if (negated) bad_negation(fullname, FALSE); @@ -1169,30 +1126,6 @@ boolean tinitial, tfrom_file; return; } #ifdef CHANGE_COLOR -#ifdef MAC - fullname = "use_stone"; - if (match_optname(opts, fullname, 6, TRUE)) { - op = string_for_env_opt(fullname, opts, negated); - if ((negated && !op) || (!negated && op)) { - iflags.use_stone = negated ? 0 : atoi(op); - } else if (negated) bad_negation(fullname, TRUE); - return; - } - - fullname = "background"; - if (match_optname(opts, fullname, 5,TRUE)) - { - if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) - { - if (!strncmpi (op, "white", 5)) - change_background (1); - else if (!strncmpi (op, "black", 5)) - change_background (0); - } - return; - } -#endif - if (match_optname(opts, "palette", 3, TRUE) # ifdef MAC || match_optname(opts, "hicolor", 3, TRUE) @@ -2103,10 +2036,9 @@ goodfruit: vision_recalc(2); /* shut down vision */ vision_full_recalc = 1; /* delayed recalc */ } - else if ((boolopt[i].addr) == &iflags.use_inverse) { - need_redraw = TRUE; - } - else if ((boolopt[i].addr) == &iflags.hilite_pet) { + else if ((boolopt[i].addr) == &iflags.use_inverse || + (boolopt[i].addr) == &iflags.showrace || + (boolopt[i].addr) == &iflags.hilite_pet) { need_redraw = TRUE; } #ifdef TEXTCOLOR @@ -3287,16 +3219,6 @@ char *op; return 1; } -boolean -feature_toggle(ftidx) -int ftidx; -{ - if (ftidx > 0 && ftidx <= LAST_FEATURE_TOGGLE) { - if (toggled_features & feature_toggles[ftidx].feature_bit) - return TRUE; - } - return FALSE; -} #endif /* OPTION_LISTS_ONLY */ /*options.c*/ diff --git a/src/pickup.c b/src/pickup.c index 9256a47aa..42978c9f7 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2202,10 +2202,8 @@ struct obj *obj; menu_item *pick_list; char buf[BUFSZ]; int n; - char oldmenu[3] = {'a', 'b', 'c'}, newmenu[3] = {'o', 'i', 'b'}; - char *menuselector = newmenu; + char *menuselector = iflags.lootabc ? "abc" : "oib"; - if (feature_toggle(TOGGLE_LOOT_MENU_SELECTORS)) menuselector = oldmenu; any.a_void = 0; win = create_nhwindow(NHW_MENU); start_menu(win);