From: Pasi Kallinen Date: Sun, 6 Aug 2017 12:41:31 +0000 (+0300) Subject: Add whatis_moveskip option to change fast-moving cursor X-Git-Tag: NetHack-3.6.1_RC01~433 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e05de9bff4028926850edf219e6fb2637a71cea;p=nethack Add whatis_moveskip option to change fast-moving cursor Previously the "fast-moving" when getting a target location was always by 8 units. If this option is on, fast-moving will instead skip the same map glyphs. This should be much more useful for blind players. --- diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 7b70d6dfa..9805e32c0 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2948,6 +2948,11 @@ key. When getting a location on the map, and using a key to cycle through next and previous targets, use a menu instead to pick a target. (default off) +.lp whatis_moveskip +When getting a location on the map, and using shifted movement keys or +meta-digit keys to fast-move, instead of moving 8 units at a time, +move by skipping the same glyphs. +(default off) .lp windowtype Select which windowing system to use, such as ``tty'' or ``X11'' (default depends on version). @@ -3259,6 +3264,8 @@ When asked for a location, the key to go to next closest object. Default is 'o'. When asked for a location, the key to go to previous closest object. Default is 'O'. .lp getpos.menu When asked for a location, and using one of the next or previous keys to cycle through targets, toggle showing a menu instead. Default is '!'. +.lp getpos.moveskip +When asked for a location, and using the shifted movement keys or meta-digit keys to fast-move around, move by skipping the same glyphs instead of by 8 units. Default is '*'. .lp getpos.filter When asked for a location, change the filtering mode when using one of the next or previous keys to cycle through targets. Toggles between no filtering, in view @@ -3746,6 +3753,9 @@ relative to your character. .lp whatis_filter:area When targeting with cursor, filter possible locations so only those in the same area (eg. same room, or same corridor) are considered. +.lp whatis_moveskip +When targeting with cursor and using fast-move, skip the same glyphs instead +of moving 8 units at a time. .lp nostatus_updates Prevent updates to the status lines at the bottom of the screen, if your screen-reader reads those lines. The same information can be diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index 7162b909c..c09cc7d1e 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -3587,6 +3587,12 @@ When getting a location on the map, and using a key to cycle through next and previous targets, use a menu instead to pick a target. (default off) %.lp +\item[\ib{whatis\verb+_+moveskip}] +When getting a location on the map, and using shifted movement keys or +meta-digit keys to fast-move, instead of moving 8 units at a time, +move by skipping the same glyphs. +(default off) +%.lp \item[\ib{windowtype}] Select which windowing system to use, such as ``{\tt tty}'' or ``{\tt X11}'' (default depends on version). @@ -3991,6 +3997,9 @@ When asked for a location, the key to go to previous closest object. Default is \item{\bb{getpos.menu}} When asked for a location, and using one of the next or previous keys to cycle through targets, toggle showing a menu instead. Default is '{\tt !}'. %.lp +\item{\bb{getpos.moveskip}} +When asked for a location, and using the shifted movement keys or meta-digit keys to fast-move around, move by skipping the same glyphs instead of by 8 units. Default is ``{\tt *}''. +%.lp \item{\bb{getpos.filter}} When asked for a location, change the filtering mode when using one of the next or previous keys to cycle through targets. Toggles between no filtering, in view only, and in the same area only. Default is '{\tt "}'. %.lp @@ -4555,6 +4564,10 @@ relative to your character. When targeting with cursor, filter possible locations so only those in the same area (eg. same room, or same corridor) are considered. %.lp +\item[\ib{whatis\verb+_+moveskip}] +When targeting with cursor and using fast-move, skip the same glyphs instead +of moving 8 units at a time. +%.lp \item[\ib{nostatus\verb+_+updates}] Prevent updates to the status lines at the bottom of the screen, if your screen-reader reads those lines. The same information can be diff --git a/include/flag.h b/include/flag.h index 6d5e438b5..ac3844fc3 100644 --- a/include/flag.h +++ b/include/flag.h @@ -204,6 +204,7 @@ struct instance_flags { boolean getloc_travelmode; int getloc_filter; /* GFILTER_foo */ boolean getloc_usemenu; + boolean getloc_moveskip; coord travelcc; /* coordinates for travel_cache */ boolean window_inited; /* true if init_nhwindows() completed */ boolean vision_inited; /* true if vision is ready */ @@ -496,6 +497,7 @@ enum nh_keyfunc { NHKF_GETPOS_HELP, NHKF_GETPOS_MENU, NHKF_GETPOS_LIMITVIEW, + NHKF_GETPOS_MOVESKIP, NUM_NHKF }; diff --git a/src/cmd.c b/src/cmd.c index 53a800bd9..cd7faedc8 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -3749,6 +3749,7 @@ struct { { NHKF_GETPOS_INTERESTING_PREV, 'A', "getpos.all.prev" }, { NHKF_GETPOS_HELP, '?', "getpos.help" }, { NHKF_GETPOS_LIMITVIEW, '"', "getpos.filter" }, + { NHKF_GETPOS_MOVESKIP, '*', "getpos.moveskip" }, { NHKF_GETPOS_MENU, '!', "getpos.menu" } }; diff --git a/src/do_name.c b/src/do_name.c index 16818c0d9..7dec3fb7d 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -90,13 +90,17 @@ const char *goal; char sbuf[BUFSZ]; boolean doing_what_is; winid tmpwin = create_nhwindow(NHW_MENU); + const char *const fastmovemode[2] = { "8 units at a time", + "skipping same glyphs" }; Sprintf(sbuf, "Use '%c', '%c', '%c', '%c' to move the cursor to %s.", /* hjkl */ Cmd.move_W, Cmd.move_S, Cmd.move_N, Cmd.move_E, goal); putstr(tmpwin, 0, sbuf); - putstr(tmpwin, 0, - "Use 'H', 'J', 'K', 'L' to move the cursor 8 units at a time."); + Sprintf(sbuf, + "Use 'H', 'J', 'K', 'L' to fast-move the cursor, %s.", + fastmovemode[iflags.getloc_moveskip]); + putstr(tmpwin, 0, sbuf); putstr(tmpwin, 0, "Or enter a background symbol (ex. '<')."); Sprintf(sbuf, "Use '%s' to move the cursor on yourself.", visctrl(Cmd.spkeys[NHKF_GETPOS_SELF])); @@ -129,6 +133,11 @@ const char *goal; visctrl(Cmd.spkeys[NHKF_GETPOS_INTERESTING_PREV]), GLOC_INTERESTING); } + Sprintf(sbuf, "Use '%s' to change fast-move mode to %s.", + visctrl(Cmd.spkeys[NHKF_GETPOS_MOVESKIP]), + fastmovemode[!iflags.getloc_moveskip]); + putstr(tmpwin, 0, sbuf); + Sprintf(sbuf, "Use '%s' to toggle menu listing for possible targets.", visctrl(Cmd.spkeys[NHKF_GETPOS_MENU])); putstr(tmpwin, 0, sbuf); @@ -720,8 +729,23 @@ const char *goal; } else if (Cmd.alphadirchars[i] == lowc((char) c) || (Cmd.num_pad && Cmd.dirchars[i] == (c & 0177))) { /* a shifted movement letter or Meta-digit */ - dx = 8 * xdir[i]; - dy = 8 * ydir[i]; + if (iflags.getloc_moveskip) { + /* skip same glyphs */ + int glyph = glyph_at(cx, cy); + + dx = xdir[i]; + dy = ydir[i]; + while (isok(cx + dx, cy + dy) + && glyph == glyph_at(cx + dx, cy + dy) + && isok(cx + dx+xdir[i], cy+dy+ydir[i]) + && glyph == glyph_at(cx + dx+xdir[i], cy + dy+ydir[i])) { + dx += xdir[i]; + dy += ydir[i]; + } + } else { + dx = 8 * xdir[i]; + dy = 8 * ydir[i]; + } } else continue; @@ -801,6 +825,10 @@ const char *goal; cx = u.ux; cy = u.uy; goto nxtc; + } else if (c == Cmd.spkeys[NHKF_GETPOS_MOVESKIP]) { + iflags.getloc_moveskip = !iflags.getloc_moveskip; + pline("%skipping over similar terrain when fastmoving the cursor.", + iflags.getloc_moveskip ? "S" : "Not s"); } else if ((cp = index(mMoOdDxX, c)) != 0) { /* 'm|M', 'o|O', &c */ /* nearest or farthest monster or object or door or unexplored */ int gtmp = (int) (cp - mMoOdDxX), /* 0..7 */ diff --git a/src/options.c b/src/options.c index e4c878dd0..0bfacc09d 100644 --- a/src/options.c +++ b/src/options.c @@ -233,6 +233,7 @@ static struct Bool_Opt { { "vt_tiledata", (boolean *) 0, FALSE, SET_IN_FILE }, #endif { "whatis_menu", &iflags.getloc_usemenu, FALSE, SET_IN_GAME }, + { "whatis_moveskip", &iflags.getloc_moveskip, FALSE, SET_IN_GAME }, { "wizweight", &iflags.wizweight, FALSE, SET_IN_WIZGAME }, { "wraptext", &iflags.wc2_wraptext, FALSE, SET_IN_GAME }, #ifdef ZEROCOMP