whatis_coord - rename 'getpos_coord' option
Rename the option for adding coordinates to autodescribe feedback for the '/' and ';' commands from 'getpos_coord' to 'whatis_coord', after the '/' command that uses it instead of after the internal routine that implements it. The 'whatis' name was only in dat/hh as far as I could find, so this changes it to 'what-is' and also updates dat/help and the Guidebook to mention the name too. Add a 'screen' choice to the option to show coordinates as row,column rather than x,y or compass direction(s). Revise the /m, /M, /o, /O operations of 'what-is' to honor the whatis_coord option (mostly; a value of 'none' gets overridden by 'map' to force coordinates). Also, update the description of the functionality of the '/' command in the Guidebook. The .mn version is tested, the .tex one isn't.
This commit is contained in:
6
dat/help
6
dat/help
@@ -77,8 +77,10 @@ b j n 1 2 3 g<dir>: run in direction <dir> until something
|
||||
Commands:
|
||||
NetHack knows the following commands:
|
||||
? Help menu.
|
||||
/ Tell what a symbol represents. You may choose to specify
|
||||
a location or give a symbol argument.
|
||||
/ What-is, tell what a symbol represents. You may choose to
|
||||
specify a location or give a symbol argument. Enabling the
|
||||
autodescribe option will give information about the symbol
|
||||
at each location you move the cursor onto.
|
||||
& Tell what a command does.
|
||||
< Go up a staircase (if you are standing on it).
|
||||
> Go down a staircase (if you are standing on it).
|
||||
|
||||
2
dat/hh
2
dat/hh
@@ -28,7 +28,7 @@ S save save the game (to be continued later) and exit
|
||||
! sh escape to some SHELL (if allowed)
|
||||
^Z suspend suspend the game (independent of your current suspend char)
|
||||
O options set options
|
||||
/ whatis tell what a map symbol represents
|
||||
/ what-is tell what a map symbol represents
|
||||
\ known display list of what's been discovered
|
||||
v version display version number
|
||||
V history display game history
|
||||
|
||||
@@ -157,6 +157,13 @@ suppress_alert disable various version-specific warnings about changes
|
||||
for the 'Q' command that quitting is now done via #quit
|
||||
(e.g., use suppress_alert:3.3.1 to stop that and any other
|
||||
notifications added in that version or earlier) default: [(none)]
|
||||
whatis_coord controls whether to include map coordinates when autodescribe
|
||||
is active for the '/' and ';' commands. Value is the first
|
||||
letter of one of
|
||||
compass -- ('east' or '3s' or '2n,4w')
|
||||
map -- <x,y> (map column x=0 is not used)
|
||||
screen -- [row,column] (row is offset to match tty usage)
|
||||
none -- no coordinates shown; default: [n]
|
||||
|
||||
Compound options which may be set only on startup are:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
.ds vr "NetHack 3.6
|
||||
.ds f0 "\*(vr
|
||||
.ds f1
|
||||
.ds f2 "December 16, 2015
|
||||
.ds f2 "January 18, 2016
|
||||
.\" labeled paragraph start (should be part of tmac.n, but I don't want to
|
||||
.\" make changes to that file)
|
||||
.\" .PS word
|
||||
@@ -476,7 +476,8 @@ helpful texts. Here are the commands for your reference:
|
||||
.lp ?
|
||||
Help menu: display one of several help texts available.
|
||||
.lp /
|
||||
Tell what a symbol represents. You may choose to specify a location
|
||||
The ``what-is'' command, to
|
||||
tell what a symbol represents. You may choose to specify a location
|
||||
or type a symbol (or even a whole word) to explain.
|
||||
Specifying a location is done by moving the cursor to a particular spot
|
||||
on the map and then pressing one of `.', `,', `;',
|
||||
@@ -485,14 +486,31 @@ conditionally check for ``More info?'' depending upon whether the
|
||||
.op help
|
||||
option is on, and then you will be asked to pick another location;
|
||||
`,' will explain the symbol but skip any additional
|
||||
information; `;' will skip additional info and also not bother asking
|
||||
information, then let you pick another location;
|
||||
`;' will skip additional info and also not bother asking
|
||||
you to choose another location to examine; `:' will show additional
|
||||
info, if any, without asking for confirmation. When picking a location,
|
||||
pressing the ESC key will terminate this command, or pressing `?'
|
||||
will give a brief reminder about how it works.
|
||||
.pg
|
||||
.lp ""
|
||||
If the
|
||||
.op autodescribe
|
||||
option is on, a short description of what you see at each location is
|
||||
shown as you move the cursor. Typing `#' while picking a location will
|
||||
toggle that option on or off.
|
||||
The
|
||||
.op whatis_coord
|
||||
option controls whether the short description includes map coordinates.
|
||||
.lp ""
|
||||
Specifying a name rather than a location
|
||||
always gives any additional information available about that name.
|
||||
.lp ""
|
||||
You may also request a description of nearby monsters,
|
||||
all monsters currently displayed, nearby objects, or all objects.
|
||||
The
|
||||
.op whatis_coord
|
||||
option controls which format of map coordinate is included with their
|
||||
descriptions.
|
||||
.lp &
|
||||
Tell what a command does.
|
||||
.lp <
|
||||
@@ -1995,7 +2013,9 @@ exclude that alignment from being picked randomly.
|
||||
Cannot be set with the `O' command. Persistent.
|
||||
.lp autodescribe
|
||||
Automatically describe the terrain under cursor when asked to get a location
|
||||
on the map.
|
||||
on the map. The
|
||||
.op whatis_coord
|
||||
option controls whether the description includes map coordinates.
|
||||
.lp autodig
|
||||
Automatically dig if you are wielding a digging tool and moving into a place
|
||||
that can be dug (default false). Persistent.
|
||||
@@ -2125,11 +2145,6 @@ The default is to randomly pick an appropriate gender.
|
||||
If you prefix a `!' or ``no'' to the value, you can
|
||||
exclude that gender from being picked randomly.
|
||||
Cannot be set with the `O' command. Persistent.
|
||||
.lp getpos_coord
|
||||
When using the `/' command to look around on the map with
|
||||
``autodescribe'' on, display coordinates after the description.
|
||||
The value specified should be the first letter of one of the following:
|
||||
compass, map, or none. Default is none.
|
||||
.lp "help "
|
||||
If more information is available for an object looked at
|
||||
with the `/' command, ask if you want to see it (default on). Turning help
|
||||
@@ -2514,6 +2529,27 @@ prevent the game from attempting unintended moves if you make inadvertent
|
||||
mouse clicks on the map window. Persistent.
|
||||
.lp verbose
|
||||
Provide more commentary during the game (default on). Persistent.
|
||||
.lp whatis_coord
|
||||
When using the `/' or `;' commands to look around on the map with
|
||||
.op autodescribe
|
||||
on, display coordinates after the description.
|
||||
Also works in other situations where you are asked to pick a location.
|
||||
.lp ""
|
||||
The possibile settings are:
|
||||
.sd
|
||||
.si
|
||||
.CC c "compass ('east' or '3s' or '2n,4w');"
|
||||
.CC m "map <x,y> (map column x=0 is not used);"
|
||||
.CC s "screen [row,column] (row is offset to match tty usage);"
|
||||
.CC n "none (no coordinates shown) [default]."
|
||||
.ei
|
||||
.ed
|
||||
.lp ""
|
||||
The
|
||||
.op whatis_coord
|
||||
option is also used with
|
||||
the `/m', `/M', `/o', and `/O' sub-commands of `/',
|
||||
where the `none' setting is overridden with `map'.
|
||||
.lp windowtype
|
||||
Select which windowing system to use, such as ``tty'' or ``X11''
|
||||
(default depends on version).
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
%.au
|
||||
\author{Original version - Eric S. Raymond\\
|
||||
(Edited and expanded for 3.6 by Mike Stephenson and others)}
|
||||
\date{December 16, 2015}
|
||||
\date{January 18, 2016}
|
||||
|
||||
\maketitle
|
||||
|
||||
@@ -586,24 +586,44 @@ helpful texts. Here are the commands for your reference:
|
||||
Help menu: display one of several help texts available.
|
||||
%.lp
|
||||
\item[\tb{/}]
|
||||
Tell what a symbol represents. You may choose to specify a location
|
||||
The {\tt what-is} command, to
|
||||
tell what a symbol represents. You may choose to specify a location
|
||||
or type a symbol (or even a whole word) to explain.
|
||||
Specifying a location is done by moving the cursor to a particular spot
|
||||
on the map and then pressing one of `{\tt .}', `{\tt ,}', `{\tt ;}',
|
||||
or `{\tt :}'. `{\tt .}' will explain the symbol at the chosen location,
|
||||
information, then let you pick another location;
|
||||
conditionally check for ``{\tt More info?}'' depending upon whether the
|
||||
{\it help\/}
|
||||
`{\it help\/}'
|
||||
option is on, and then you will be asked to pick another location;
|
||||
`{\tt ,}' will explain the symbol but skip any additional
|
||||
information; `{\tt ;}' will skip additional info and also not bother asking
|
||||
`{\tt ;}' will skip additional info and also not bother asking
|
||||
you to choose another location to examine; `{\tt :}' will show additional
|
||||
info, if any, without asking for confirmation. When picking a location,
|
||||
pressing the {\tt ESC} key will terminate this command, or pressing `{\tt ?}'
|
||||
will give a brief reminder about how it works.
|
||||
|
||||
%.pg
|
||||
%.lp ""
|
||||
If the
|
||||
{\it autodescribe\/}
|
||||
option is on, a short description of what you see at each location is
|
||||
shown as you move the cursor. Typing `{\tt #}' while picking a location will
|
||||
toggle that option on or off.
|
||||
The
|
||||
{\it whatis\verb+_+coord\/}
|
||||
option controls whether the short description includes map coordinates.
|
||||
|
||||
%.lp ""
|
||||
Specifying a name rather than a location
|
||||
always gives any additional information available about that name.
|
||||
|
||||
%.lp ""
|
||||
You may also request a description of nearby monsters,
|
||||
all monsters currently displayed, nearby objects, or all objects.
|
||||
The
|
||||
{\it whatis\verb+_+coord\/}
|
||||
option controls which format of map coordinate is included with their
|
||||
descriptions.
|
||||
%.lp
|
||||
\item[\tb{\&}]
|
||||
Tell what a command does.
|
||||
@@ -802,7 +822,7 @@ choices but will accept an accessory and attempt to put that on.)
|
||||
Repeat previous message.\\
|
||||
%.lp ""
|
||||
Subsequent {\tt \^{}P}'s repeat earlier messages.
|
||||
The behavior can be varied via the {\it msg\verb+_+window} option.
|
||||
The behavior can be varied via the {\it msg\verb+_+window\/} option.
|
||||
%.lp
|
||||
\item[\tb{q}]
|
||||
Quaff (drink) something (potion, water, etc).
|
||||
@@ -2407,7 +2427,9 @@ Cannot be set with the `{\tt O}' command. Persistent.
|
||||
%.lp
|
||||
\item[\ib{autodescribe}]
|
||||
Automatically describe the terrain under cursor when asked to get a location
|
||||
on the map.
|
||||
on the map. The
|
||||
{\it whatis\verb+_+coord\/}
|
||||
option controls whether the description includes map coordinates.
|
||||
%.lp
|
||||
\item[\ib{autodig}]
|
||||
Automatically dig if you are wielding a digging tool and moving into a place
|
||||
@@ -2548,7 +2570,7 @@ Name a fruit after something you enjoy eating (ex.\ ``{\tt fruit:mango}'')
|
||||
{\it NetHack\/} uses from time to time. You should set this to something you
|
||||
find more appetizing than slime mold. Apples, oranges, pears, bananas, and
|
||||
melons already exist in {\it NetHack}, so don't use those.
|
||||
%.Ip
|
||||
%.lp
|
||||
\item[\ib{gender}]
|
||||
Your starting gender ({\tt gender:male} or {\tt gender:female}).
|
||||
You may specify just the first letter. Although you can
|
||||
@@ -2559,12 +2581,6 @@ If you prefix `{\tt !}' or ``{\tt no}'' to the value, you can
|
||||
exclude that gender from being picked randomly.
|
||||
Cannot be set with the `{\tt O}' command. Persistent.
|
||||
%.lp
|
||||
\item[\ib{getpos\verb+_+coord}]
|
||||
When using the `{\tt /}' command to look around on the map with
|
||||
``{\tt autodescribe}'' on, display coordinates after the description.
|
||||
The value specified should be the first letter of one of the following:
|
||||
compass, map, or none. Default is none.
|
||||
%.lp
|
||||
\item[\ib{help}]
|
||||
If more information is available for an object looked at
|
||||
with the `{\tt /}' command, ask if you want to see it (default on).
|
||||
@@ -3015,6 +3031,32 @@ mouse clicks on the map window. Persistent.
|
||||
\item[\ib{verbose}]
|
||||
Provide more commentary during the game (default on). Persistent.
|
||||
%.lp
|
||||
\item[\ib{whatis\verb+_+coord}]
|
||||
When using the `{\tt /}' or `{\tt ;}' commands to look around on the map with
|
||||
``{\tt autodescribe}''
|
||||
on, display coordinates after the description.
|
||||
Also works in other situations where you are asked to pick a location.
|
||||
|
||||
%.lp ""
|
||||
The possibile settings are:
|
||||
|
||||
%.sd
|
||||
%.si
|
||||
{\tt c} --- \verb#compass ('east' or '3s' or '2n,4w')#;
|
||||
{\tt m} --- \verb#map <x,y> (map column x=0 is not used)#;
|
||||
{\tt s} --- \verb#screen [row,column] (row is offset to match tty usage)#;
|
||||
{\tt n} --- \verb#none (no coordinates shown) [default]#.
|
||||
%.ei
|
||||
%.ed
|
||||
|
||||
%.lp ""
|
||||
+The
|
||||
{\it whatis\verb+_+coord\/}
|
||||
option is also used with
|
||||
the `{\tt /m}', `{\tt /M}', `{\tt /o}', and `{\tt /O}' sub-commands
|
||||
of `{\tt /}',
|
||||
where the `{\it none\/}' setting is overridden with `{\it map}'.
|
||||
%.lp
|
||||
\item[\ib{windowtype}]
|
||||
Select which windowing system to use, such as ``{\tt tty}'' or ``{\tt X11}''
|
||||
(default depends on version).
|
||||
|
||||
3796
doc/Guidebook.txt
3796
doc/Guidebook.txt
File diff suppressed because it is too large
Load Diff
@@ -368,6 +368,7 @@ E void NDECL(heal_legs);
|
||||
|
||||
/* ### do_name.c ### */
|
||||
|
||||
E char *FDECL(coord_desc, (int, int, char *, CHAR_P));
|
||||
E int FDECL(getpos, (coord *, BOOLEAN_P, const char *));
|
||||
E void FDECL(getpos_sethilite, (void (*f)(int)));
|
||||
E void FDECL(new_mname, (struct monst *, int));
|
||||
|
||||
@@ -171,6 +171,7 @@ struct sysflag {
|
||||
#define GPCOORDS_NONE 'n'
|
||||
#define GPCOORDS_MAP 'm'
|
||||
#define GPCOORDS_COMPASS 'c'
|
||||
#define GPCOORDS_SCREEN 's'
|
||||
|
||||
struct instance_flags {
|
||||
/* stuff that really isn't option or platform related. They are
|
||||
|
||||
@@ -64,6 +64,10 @@ const char *goal;
|
||||
if (getpos_hilitefunc)
|
||||
putstr(tmpwin, 0, "Use $ to display valid locations.");
|
||||
putstr(tmpwin, 0, "Use # to toggle automatic description.");
|
||||
if (iflags.cmdassist) /* assisting the '/' command, I suppose... */
|
||||
putstr(tmpwin, 0, (iflags.getpos_coords == GPCOORDS_NONE)
|
||||
? "(Set 'whatis_coord' option to include coordinates with '#' text.)"
|
||||
: "(Reset 'whatis_coord' option to omit coordinates from '#' text.)");
|
||||
/* disgusting hack; the alternate selection characters work for any
|
||||
getpos call, but they only matter for dowhatis (and doquickwhatis) */
|
||||
doing_what_is = (goal == what_is_an_unknown_object);
|
||||
@@ -184,32 +188,61 @@ int dx, dy;
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* coordinate formatting for 'whatis_coord' option */
|
||||
char *
|
||||
coord_desc(x, y, outbuf, cmode)
|
||||
int x, y;
|
||||
char *outbuf, cmode;
|
||||
{
|
||||
static char screen_fmt[16]; /* [12] suffices: "[%02d,%02d]" */
|
||||
int dx, dy;
|
||||
|
||||
outbuf[0] = '\0';
|
||||
switch (cmode) {
|
||||
default:
|
||||
break;
|
||||
case GPCOORDS_COMPASS:
|
||||
/* "east", "3s", "2n,4w" */
|
||||
dx = x - u.ux;
|
||||
dy = y - u.uy;
|
||||
Sprintf(outbuf, "(%s)", dxdy_to_dist_descr(dx, dy));
|
||||
break;
|
||||
case GPCOORDS_MAP: /* x,y */
|
||||
/* upper left corner of map is <1,0>;
|
||||
with default COLNO,ROWNO lower right corner is <79,20> */
|
||||
Sprintf(outbuf, "<%d,%d>", x, y);
|
||||
break;
|
||||
case GPCOORDS_SCREEN: /* y+2,x */
|
||||
/* for normal map sizes, force a fixed-width formatting so that
|
||||
/m, /M, /o, and /O output lines up cleanly; map sizes bigger
|
||||
than Nx999 or 999xM will still work, but not line up like normal
|
||||
when displayed in a column setting */
|
||||
if (!*screen_fmt)
|
||||
Sprintf(screen_fmt, "[%%%sd,%%%sd]",
|
||||
(ROWNO - 1 + 2 < 100) ? "02" : "03",
|
||||
(COLNO - 1 < 100) ? "02" : "03");
|
||||
/* map line 0 is screen row 2;
|
||||
map column 0 isn't used, map column 1 is screen column 1 */
|
||||
Sprintf(outbuf, screen_fmt, y + 2, x);
|
||||
break;
|
||||
}
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
STATIC_OVL void
|
||||
auto_describe(cx, cy)
|
||||
int cx, cy;
|
||||
{
|
||||
coord cc;
|
||||
int sym = 0, dx, dy;
|
||||
int sym = 0;
|
||||
char tmpbuf[BUFSZ];
|
||||
const char *firstmatch = "unknown";
|
||||
|
||||
cc.x = cx;
|
||||
cc.y = cy;
|
||||
if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch)) {
|
||||
tmpbuf[0] = '\0';
|
||||
switch (iflags.getpos_coords) {
|
||||
default:
|
||||
break;
|
||||
case GPCOORDS_COMPASS:
|
||||
dx = cc.x - u.ux;
|
||||
dy = cc.y - u.uy;
|
||||
Sprintf(tmpbuf, " (%s)", dxdy_to_dist_descr(dx, dy));
|
||||
break;
|
||||
case GPCOORDS_MAP:
|
||||
Sprintf(tmpbuf, " (%d,%d)", cc.x, cc.y);
|
||||
break;
|
||||
}
|
||||
pline("%s%s", firstmatch, tmpbuf);
|
||||
(void) coord_desc(cx, cy, tmpbuf, iflags.getpos_coords);
|
||||
pline("%s%s%s", firstmatch, *tmpbuf ? " " : "", tmpbuf);
|
||||
curs(WIN_MAP, cx, cy);
|
||||
flush_screen(0);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,6 @@ static struct Comp_Opt {
|
||||
DISP_IN_GAME }, /*WC*/
|
||||
{ "fruit", "the name of a fruit you enjoy eating", PL_FSIZ, SET_IN_GAME },
|
||||
{ "gender", "your starting gender (male or female)", 8, DISP_IN_GAME },
|
||||
{ "getpos_coord", "show coordinates when getting cursor position", 1, SET_IN_GAME },
|
||||
{ "horsename", "the name of your (first) horse (e.g., horsename:Silver)",
|
||||
PL_PSIZ, DISP_IN_GAME },
|
||||
{ "map_mode", "map display mode under Windows", 20, DISP_IN_GAME }, /*WC*/
|
||||
@@ -377,6 +376,9 @@ static struct Comp_Opt {
|
||||
{ "roguesymset",
|
||||
"load a set of rogue display symbols from the symbols file", 70,
|
||||
SET_IN_GAME },
|
||||
#ifdef WIN32
|
||||
{ "subkeyvalue", "override keystroke value", 7, SET_IN_FILE },
|
||||
#endif
|
||||
{ "suppress_alert", "suppress alerts about version-specific features", 8,
|
||||
SET_IN_GAME },
|
||||
{ "tile_width", "width of tiles", 20, DISP_IN_GAME }, /*WC*/
|
||||
@@ -395,9 +397,8 @@ static struct Comp_Opt {
|
||||
{ "videoshades", "gray shades to map to black/gray/white", 32,
|
||||
DISP_IN_GAME },
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
{ "subkeyvalue", "override keystroke value", 7, SET_IN_FILE },
|
||||
#endif
|
||||
{ "whatis_coord", "show coordinates when auto-describing cursor position",
|
||||
1, SET_IN_GAME },
|
||||
{ "windowcolors", "the foreground/background colors of windows", /*WC*/
|
||||
80, DISP_IN_GAME },
|
||||
{ "windowtype", "windowing system to use", WINTYPELEN, DISP_IN_GAME },
|
||||
@@ -2348,7 +2349,7 @@ boolean tinitial, tfrom_file;
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "getpos_coord";
|
||||
fullname = "whatis_coord";
|
||||
if (match_optname(opts, fullname, 6, TRUE)) {
|
||||
if (duplicate)
|
||||
complain_about_duplicate(opts, 1);
|
||||
@@ -2356,11 +2357,13 @@ boolean tinitial, tfrom_file;
|
||||
iflags.getpos_coords = GPCOORDS_NONE;
|
||||
return;
|
||||
} else if ((op = string_for_env_opt(fullname, opts, FALSE)) != 0) {
|
||||
if (tolower(*op) == GPCOORDS_NONE
|
||||
|| tolower(*op) == GPCOORDS_COMPASS
|
||||
|| tolower(*op) == GPCOORDS_MAP) {
|
||||
iflags.getpos_coords = tolower(*op);
|
||||
} else
|
||||
static char gpcoords[] = { GPCOORDS_NONE, GPCOORDS_COMPASS,
|
||||
GPCOORDS_MAP, GPCOORDS_SCREEN, '\0' };
|
||||
char c = lowc(*op);
|
||||
|
||||
if (c && index(gpcoords, c))
|
||||
iflags.getpos_coords = c;
|
||||
else
|
||||
badoption(opts);
|
||||
}
|
||||
return;
|
||||
@@ -4042,24 +4045,55 @@ boolean setinitial, setfromfile;
|
||||
free((genericptr_t) mode_pick);
|
||||
}
|
||||
destroy_nhwindow(tmpwin);
|
||||
} else if (!strcmp("getpos_coord", optname)) {
|
||||
} else if (!strcmp("whatis_coord", optname)) {
|
||||
menu_item *window_pick = (menu_item *) 0;
|
||||
int pick_cnt;
|
||||
char gp = iflags.getpos_coords;
|
||||
|
||||
tmpwin = create_nhwindow(NHW_MENU);
|
||||
start_menu(tmpwin);
|
||||
any = zeroany;
|
||||
any.a_char = GPCOORDS_COMPASS;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_COMPASS,
|
||||
0, ATR_NONE, "compass", MENU_UNSELECTED);
|
||||
0, ATR_NONE, "compass ('east' or '3s' or '2n,4w')",
|
||||
(gp == GPCOORDS_COMPASS) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
any.a_char = GPCOORDS_MAP;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_MAP,
|
||||
0, ATR_NONE, "map", MENU_UNSELECTED);
|
||||
0, ATR_NONE, "map <x,y>",
|
||||
(gp == GPCOORDS_MAP) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
any.a_char = GPCOORDS_SCREEN;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_SCREEN,
|
||||
0, ATR_NONE, "screen [row,column]",
|
||||
(gp == GPCOORDS_SCREEN) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
any.a_char = GPCOORDS_NONE;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, GPCOORDS_NONE,
|
||||
0, ATR_NONE, "none", MENU_UNSELECTED);
|
||||
end_menu(tmpwin, "Select coordinate display when picking a position:");
|
||||
if (select_menu(tmpwin, PICK_ONE, &window_pick) > 0) {
|
||||
iflags.getpos_coords = window_pick->item.a_char;
|
||||
0, ATR_NONE, "none (no coordinates displayed)",
|
||||
(gp == GPCOORDS_NONE) ? MENU_SELECTED : MENU_UNSELECTED);
|
||||
any.a_long = 0L;
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", MENU_UNSELECTED);
|
||||
Sprintf(buf, "map: upper-left: <%d,%d>, lower-right: <%d,%d>%s",
|
||||
1, 0, COLNO - 1, ROWNO - 1,
|
||||
flags.verbose ? "; column 0 unused, off left edge" : "");
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
|
||||
if (strcmp(windowprocs.name, "tty"))
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
|
||||
"screen: row is offset to accommodate tty interface's use of top line",
|
||||
MENU_UNSELECTED);
|
||||
Sprintf(buf, "screen: upper-left: [%02d,%02d], lower-right: [%d,%d]%s",
|
||||
0 + 2, 1, ROWNO - 1 + 2, COLNO - 1,
|
||||
#if COLNO == 80
|
||||
flags.verbose ? "; column 80 is not used" :
|
||||
#endif
|
||||
"");
|
||||
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, MENU_UNSELECTED);
|
||||
end_menu(tmpwin,
|
||||
"Select coordinate display when auto-describing a map position:");
|
||||
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
|
||||
iflags.getpos_coords = window_pick[0].item.a_char;
|
||||
/* PICK_ONE doesn't unselect preselected entry when
|
||||
selecting another one */
|
||||
if (pick_cnt > 1 && iflags.getpos_coords == gp)
|
||||
iflags.getpos_coords = window_pick[1].item.a_char;
|
||||
free((genericptr_t) window_pick);
|
||||
}
|
||||
destroy_nhwindow(tmpwin);
|
||||
@@ -4810,10 +4844,11 @@ char *buf;
|
||||
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
|
||||
} else if (!strcmp(optname, "runmode")) {
|
||||
Sprintf(buf, "%s", runmodes[flags.runmode]);
|
||||
} else if (!strcmp(optname, "getpos_coord")) {
|
||||
} else if (!strcmp(optname, "whatis_coord")) {
|
||||
Sprintf(buf, "%s",
|
||||
(iflags.getpos_coords == GPCOORDS_MAP) ? "map"
|
||||
: (iflags.getpos_coords == GPCOORDS_COMPASS) ? "compass"
|
||||
: (iflags.getpos_coords == GPCOORDS_SCREEN) ? "screen"
|
||||
: "none");
|
||||
} else if (!strcmp(optname, "scores")) {
|
||||
Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around,
|
||||
|
||||
50
src/pager.c
50
src/pager.c
@@ -987,12 +987,7 @@ boolean do_mons; /* True => monsters, False => objects */
|
||||
{
|
||||
winid win;
|
||||
int x, y, lo_x, lo_y, hi_x, hi_y, glyph, count = 0;
|
||||
char buf[BUFSZ], outbuf[BUFSZ], coordbuf[12], fmt[12]; /* "%02d,%02d" */
|
||||
|
||||
/* row,column orientation rather than cartesian x,y */
|
||||
Sprintf(fmt, "%%%sd,%%%sd",
|
||||
(ROWNO <= 100) ? "02" : (ROWNO <= 1000) ? "03" : "",
|
||||
(COLNO <= 100) ? "02" : (COLNO <= 1000) ? "03" : "");
|
||||
char lookbuf[BUFSZ], outbuf[BUFSZ];
|
||||
|
||||
win = create_nhwindow(NHW_TEXT);
|
||||
lo_y = nearby ? max(u.uy - BOLT_LIM, 0) : 0;
|
||||
@@ -1001,7 +996,7 @@ boolean do_mons; /* True => monsters, False => objects */
|
||||
hi_x = nearby ? min(u.ux + BOLT_LIM, COLNO - 1) : COLNO - 1;
|
||||
for (y = lo_y; y <= hi_y; y++) {
|
||||
for (x = lo_x; x <= hi_x; x++) {
|
||||
buf[0] = '\0';
|
||||
lookbuf[0] = '\0';
|
||||
glyph = glyph_at(x, y);
|
||||
if (do_mons) {
|
||||
if (glyph_is_monster(glyph)) {
|
||||
@@ -1010,49 +1005,56 @@ boolean do_mons; /* True => monsters, False => objects */
|
||||
bhitpos.x = x; /* [is this actually necessary?] */
|
||||
bhitpos.y = y;
|
||||
if (x == u.ux && y == u.uy && canspotself()) {
|
||||
(void) self_lookat(buf);
|
||||
(void) self_lookat(lookbuf);
|
||||
++count;
|
||||
} else if ((mtmp = m_at(x, y)) != 0) {
|
||||
look_at_monster(buf, (char *) 0, mtmp, x, y);
|
||||
look_at_monster(lookbuf, (char *) 0, mtmp, x, y);
|
||||
++count;
|
||||
}
|
||||
} else if (glyph_is_invisible(glyph)) {
|
||||
/* remembered, unseen, creature */
|
||||
Strcpy(buf, invisexplain);
|
||||
Strcpy(lookbuf, invisexplain);
|
||||
++count;
|
||||
} else if (glyph_is_warning(glyph)) {
|
||||
int warnindx = glyph_to_warning(glyph);
|
||||
|
||||
Strcpy(buf, def_warnsyms[warnindx].explanation);
|
||||
Strcpy(lookbuf, def_warnsyms[warnindx].explanation);
|
||||
++count;
|
||||
}
|
||||
} else { /* !do_mons */
|
||||
if (glyph_is_object(glyph)) {
|
||||
look_at_object(buf, x, y, glyph);
|
||||
look_at_object(lookbuf, x, y, glyph);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
if (*buf) {
|
||||
if (count == 1) {
|
||||
char which[12];
|
||||
if (*lookbuf) {
|
||||
char coordbuf[20], which[12], cmode;
|
||||
|
||||
cmode = (iflags.getpos_coords != GPCOORDS_NONE)
|
||||
? iflags.getpos_coords : GPCOORDS_MAP;
|
||||
if (count == 1) {
|
||||
Strcpy(which, do_mons ? "monsters" : "objects");
|
||||
if (nearby) {
|
||||
Sprintf(coordbuf, fmt, u.uy, u.ux);
|
||||
if (nearby)
|
||||
Sprintf(outbuf, "%s currently shown near %s:",
|
||||
upstart(which), coordbuf);
|
||||
} else
|
||||
upstart(which),
|
||||
(cmode != GPCOORDS_COMPASS)
|
||||
? coord_desc(u.ux, u.uy, coordbuf, cmode)
|
||||
: !canspotself() ? "your position" : "you");
|
||||
else
|
||||
Sprintf(outbuf, "All %s currently shown on the map:",
|
||||
which);
|
||||
putstr(win, 0, outbuf);
|
||||
putstr(win, 0, "");
|
||||
}
|
||||
Sprintf(coordbuf, fmt, y, x);
|
||||
/* prefix: "C row,column " */
|
||||
Sprintf(outbuf, "%s %s ", encglyph(glyph), coordbuf);
|
||||
/* prefix: "coords C " where 'C' is mon or obj symbol */
|
||||
Sprintf(outbuf, (cmode == GPCOORDS_SCREEN) ? "%s "
|
||||
: (cmode == GPCOORDS_MAP) ? "%8s "
|
||||
: "%12s ",
|
||||
coord_desc(x, y, coordbuf, cmode));
|
||||
Sprintf(eos(outbuf), "%s ", encglyph(glyph));
|
||||
/* guard against potential overflow */
|
||||
buf[sizeof buf - 1 - strlen(outbuf)] = '\0';
|
||||
Strcat(outbuf, buf);
|
||||
lookbuf[sizeof lookbuf - 1 - strlen(outbuf)] = '\0';
|
||||
Strcat(outbuf, lookbuf);
|
||||
putmixed(win, 0, outbuf);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user