runmode option

Provide user control over screen updating for multi-step movement
(run via shift, control, &c and also travel).  [See cvs history for
fixes34.1 for more details.]
This commit is contained in:
nethack.rankin
2002-07-28 10:45:46 +00:00
parent c5540f4687
commit aedd6947d4
7 changed files with 131 additions and 11 deletions

View File

@@ -107,6 +107,13 @@ pickup_burden when you pick up an item that exceeds this encumberance
or overLoaded), you will be asked if you want to continue. [S]
pickup_types a list of default symbols for kinds of objects to autopickup
when that option is on [all]
runmode controls how often the map window is updated when performing
multi-step movement (various running modes or travel command):
teleport -- don't update map until movement stops;
run -- periodically update map (interval is seven steps);
walk -- update map after every step;
crawl -- like walk, but delay after making each step.
(This only affects screen display, not actual movement.) [run]
scores the parts of the score list you wish to see when the game ends
You choose a combination of top scores, scores around the top
scores, and all of your own scores. [!own/3 top/2 around]

View File

@@ -5,7 +5,7 @@
.ds vr "NetHack 3.4
.ds f0 "\*(vr
.ds f1
.ds f2 "July 23, 2002
.ds f2 "July 27, 2002
.mt
A Guide to the Mazes of Menace
(Guidebook for NetHack)
@@ -1980,6 +1980,23 @@ synonym for ``character''. See ``name'' for an alternate method
of specifying your role. Normally only the first letter of the
value is examined; `r' is an exception with ``Rogue'', ``Ranger'',
and ``random'' values.
.lp runmode
Controls the amount of screen updating for the map window when engaged
in multi-turn movement (running via shift+direction or control+direction
and so forth, or via the travel command or mouse click).
The possible values are:
.sd
.si
teleport - update the map after movement has finished;
run - update the map after every seven or so steps;
walk - update the map after each step;
crawl - like walk, but pause briefly after each step.
.ei
.ed
This option only affects the game's screen display, not the actual
results of moving. The default is `run'; versions prior to 3.4.1
used `teleport' only. Whether or not the effect is noticeable will
depend upon the window port used or on the type of terminal.
.lp safe_pet
Prevent you from (knowingly) attacking your pets (default on).
.lp scores
@@ -2041,7 +2058,9 @@ magic portal, web, statue trap, magic trap, anti-magic field, polymorph trap.
Cannot be set with the `O' command.
.lp travel
Allow the travel command (default on).
Allow the travel command (default on). Turning this option off will
prevent the game from attempting unintended moves if you make inadvertent
mouse clicks on the map window.
.lp verbose
Provide more commentary during the game (default on).
.lp windowtype

View File

@@ -27,7 +27,7 @@
\begin{document}
%
% input file: guidebook.mn
% $Revision: 1.44 $ $Date: 2002/06/30 01:10:54 $
% $Revision: 1.45 $ $Date: 2002/07/23 05:10:28 $
%
%.ds h0 "
%.ds h1 %.ds h2 \%
@@ -40,7 +40,7 @@
%.au
\author{Eric S. Raymond\\
(Extensively edited and expanded for 3.4)}
\date{July 23, 2002}
\date{July 27, 2002}
\maketitle
@@ -2430,6 +2430,27 @@ of specifying your role. Normally only the first letter of the
value is examined; `r' is an exception with ``{\tt Rogue}'', {\tt Ranger}'',
and ``{\tt random}'' values.
%.lp
\item[\ib{runmode}]
Controls the amount of screen updating for the map window when engaged
in multi-turn movement (running via {\tt shift}+direction
or {\tt control}+direction
and so forth, or via the travel command or mouse click).
The possible values are:
%.sd
%.si
{\tt teleport} --- update the map after movement has finished;\\
{\tt run} --- update the map after every seven or so steps;\\
{\tt walk} --- update the map after each step;\\
{\tt crawl} --- like {\it walk\/}, but pause briefly after each step.
%.ei
%.ed
This option only affects the game's screen display, not the actual
results of moving. The default is {\it run\/}; versions prior to 3.4.1
used {\it teleport\/} only. Whether or not the effect is noticeable will
depend upon the window port used or on the type of terminal.
%.lp
\item[\ib{safe\_pet}]
Prevent you from (knowingly) attacking your pets (default on).
%.lp
@@ -2502,7 +2523,9 @@ magic portal, web, statue trap, magic trap, anti-magic field, polymorph trap.
Cannot be set with the `{\tt O}' command.
%.lp
\item[\ib{travel}]
Allow the travel command (default on).
Allow the travel command (default on). Turning this option off will
prevent the game from attempting unintended moves if you make inadvertent
mouse clicks on the map window.
%.lp
\item[\ib{verbose}]
Provide more commentary during the game (default on).

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)flag.h 3.4 2000/01/19 */
/* SCCS Id: @(#)flag.h 3.4 2002/07/27 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -258,6 +258,7 @@ struct instance_flags {
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 */
};
/*
@@ -282,4 +283,10 @@ struct instance_flags {
extern NEARDATA struct flag flags;
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 */
#endif /* FLAG_H */

View File

@@ -408,8 +408,12 @@ moveloop()
flags.botl = 1;
if (vision_full_recalc) vision_recalc(0); /* vision! */
if (multi && multi%7 == 0)
/* when running in non-tport mode, this gets done through domove() */
if ((!flags.run || iflags.runmode == RUN_TPORT) &&
(multi && (!flags.travel ? !(multi % 7) : !(moves % 7L)))) {
if (flags.time && flags.run) flags.botl = 1;
display_nhwindow(WIN_MAP, FALSE);
}
}
}

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)hack.c 3.4 2002/04/06 */
/* SCCS Id: @(#)hack.c 3.4 2002/07/27 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1367,6 +1367,21 @@ domove()
nomul(-2);
nomovemsg = "";
}
if (flags.run && iflags.runmode != RUN_TPORT) {
/* display every step or every 7th step depending upon mode */
if (iflags.runmode != RUN_LEAP || !(moves % 7L)) {
if (flags.time) flags.botl = 1;
curs_on_u();
delay_output();
if (iflags.runmode == RUN_CRAWL) {
delay_output();
delay_output();
delay_output();
delay_output();
}
}
}
}
void

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)options.c 3.4 2002/02/07 */
/* SCCS Id: @(#)options.c 3.4 2002/07/27 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -283,6 +283,8 @@ static struct Comp_Opt
PL_CSIZ, DISP_IN_GAME },
{ "role", "your starting role (e.g., Barbarian, Valkyrie)",
PL_CSIZ, DISP_IN_GAME },
{ "runmode", "display updating frequency when `running' or `travelling'",
sizeof "teleport", SET_IN_GAME },
{ "scores", "the parts of the score list you wish to see",
32, SET_IN_GAME },
{ "scroll_margin", "scroll map when this far from the edge", 20, DISP_IN_GAME }, /*WC*/
@@ -475,6 +477,7 @@ initoptions()
flags.end_own = FALSE;
flags.end_top = 3;
flags.end_around = 2;
iflags.runmode = RUN_LEAP;
iflags.msg_history = 20;
#ifdef TTY_GRAPHICS
iflags.prevmsg_window = 's';
@@ -1050,6 +1053,25 @@ boolean tinitial, tfrom_file;
return;
}
fullname = "runmode";
if (match_optname(opts, fullname, 4, TRUE)) {
if (negated) {
iflags.runmode = RUN_TPORT;
} else if ((op = string_for_opt(opts, FALSE)) != 0) {
if (!strncmpi(op, "teleport", strlen(op)))
iflags.runmode = RUN_TPORT;
else if (!strncmpi(op, "run", strlen(op)))
iflags.runmode = RUN_LEAP;
else if (!strncmpi(op, "walk", strlen(op)))
iflags.runmode = RUN_STEP;
else if (!strncmpi(op, "crawl", strlen(op)))
iflags.runmode = RUN_CRAWL;
else
badoption(opts);
}
return;
}
fullname = "msghistory";
if (match_optname(opts, fullname, 3, TRUE)) {
op = string_for_env_opt(fullname, opts, negated);
@@ -2114,6 +2136,9 @@ static NEARDATA const char *burdentype[] = {
"strained", "overtaxed", "overloaded"
};
static NEARDATA const char *runmodes[] = {
"teleport", "run", "walk", "crawl"
};
/*
* Convert the given string of object classes to a string of default object
@@ -2368,8 +2393,8 @@ boolean setinitial,setfromfile;
char buf[BUFSZ];
boolean retval = FALSE;
/* Special handling of menustyle, pickup_burden, and pickup_types, disclose
and msg_window options. */
/* Special handling of menustyle, pickup_burden, and pickup_types,
disclose, runmode, and msg_window options. */
if (!strcmp("menustyle", optname)) {
const char *style_name;
menu_item *style_pick = (menu_item *)0;
@@ -2476,6 +2501,24 @@ boolean setinitial,setfromfile;
}
}
retval = TRUE;
} if (!strcmp("runmode", optname)) {
const char *mode_name;
menu_item *mode_pick = (menu_item *)0;
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin);
for (i = 0; i < SIZE(runmodes); i++) {
mode_name = runmodes[i];
any.a_int = i + 1;
add_menu(tmpwin, NO_GLYPH, &any, *mode_name, 0,
ATR_NONE, mode_name, MENU_UNSELECTED);
}
end_menu(tmpwin, "Select run/travel display mode:");
if (select_menu(tmpwin, PICK_ONE, &mode_pick) > 0) {
iflags.runmode = mode_pick->item.a_int - 1;
free((genericptr_t)mode_pick);
}
destroy_nhwindow(tmpwin);
retval = TRUE;
}
#ifdef TTY_GRAPHICS
else if (!strcmp("msg_window", optname)) {
@@ -2672,6 +2715,8 @@ char *buf;
Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
else if (!strcmp(optname, "role"))
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
else if (!strcmp(optname, "runmode"))
Sprintf(buf, "%s", runmodes[iflags.runmode]);
else if (!strcmp(optname, "scores")) {
Sprintf(buf, "%d top/%d around%s", flags.end_top,
flags.end_around, flags.end_own ? "/own" : "");