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.
This commit is contained in:
Pasi Kallinen
2017-08-06 15:41:31 +03:00
parent 1614f8f5ee
commit 4e05de9bff
6 changed files with 59 additions and 4 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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
};

View File

@@ -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" }
};

View File

@@ -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 */

View File

@@ -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