number_pad (modified from <Someone>'s patch)
The number_pad option can now optionally hold a value
{0,1, 2 } for {off, on, DOS-mode} but plain number_pad and
!number_pad in config files still work as before.
When number_pad:2 is set, iflags.num_pad_mode is set to 1
which triggers the following behaviour:
> '5', M('5') and M('0') are mapped in rhack()
>in cmd.c, only when they are entered as a command. When used as a
>number, like in the 'n' command, no mapping takes place. '0' is
>already mapped to 'i' by the core. The
>only difference [<Someone>] left in (deliberately) is when you press Ctrl-0;
>this used to map to C('i'), which is an invalid command; now
>keep it '0' (which is interpreted as 'i' by the core.)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
.ds vr "NetHack 3.4
|
||||
.ds f0 "\*(vr
|
||||
.ds f1
|
||||
.ds f2 "May 11, 2003
|
||||
.ds f2 "June 5, 2003
|
||||
.mt
|
||||
A Guide to the Mazes of Menace
|
||||
(Guidebook for NetHack)
|
||||
@@ -1943,7 +1943,9 @@ in setting this with the `O' command.
|
||||
.lp "null "
|
||||
Send padding nulls to the terminal (default off).
|
||||
.lp number_pad
|
||||
Use the number keys to move instead of [yuhjklbn] (default off).
|
||||
Use the number keys to move instead of [yuhjklbn] (default 0 or off).
|
||||
(number_pad:2 invokes the old DOS behaviour where `5' means `g', meta-`5'
|
||||
means `G', and meta-`0' means `I'.)
|
||||
.lp objects
|
||||
Set the characters used to display object classes
|
||||
(default ``])[="(%!?+/$*`0_.'').
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\begin{document}
|
||||
%
|
||||
% input file: guidebook.mn
|
||||
% $Revision: 1.64 $ $Date: 2003/04/05 02:14:51 $
|
||||
% $Revision: 1.65 $ $Date: 2003/05/12 03:05:00 $
|
||||
%
|
||||
%.ds h0 "
|
||||
%.ds h1 %.ds h2 \%
|
||||
@@ -40,7 +40,7 @@
|
||||
%.au
|
||||
\author{Eric S. Raymond\\
|
||||
(Extensively edited and expanded for 3.4)}
|
||||
\date{May 11, 2003}
|
||||
\date{June 5, 2003}
|
||||
|
||||
\maketitle
|
||||
|
||||
@@ -2387,7 +2387,9 @@ in setting this with the `{\tt O}' command.
|
||||
Send padding nulls to the terminal (default off).
|
||||
%.lp
|
||||
\item[\ib{number\_pad}]
|
||||
Use the number keys to move instead of {\tt [yuhjklbn]} (default off).
|
||||
Use the number keys to move instead of {\tt [yuhjklbn]} (default 0 or off).
|
||||
(number\_pad:2 invokes the old DOS behaviour where `{\tt 5}' means `{\tt g}',
|
||||
meta-`{\tt 5}' means `{\tt G}', and meta-`{\tt 0}' means `{\tt I}'.)
|
||||
%.lp
|
||||
\item[\ib{objects}]
|
||||
Set the characters used to display object classes (default
|
||||
|
||||
@@ -172,6 +172,7 @@ struct instance_flags {
|
||||
boolean menu_tab_sep; /* Use tabs to separate option menu fields */
|
||||
boolean menu_requested; /* Flag for overloaded use of 'm' prefix
|
||||
* on some non-move commands */
|
||||
uchar num_pad_mode;
|
||||
int purge_monsters; /* # of dead monsters still on fmon list */
|
||||
int *opt_booldup; /* for duplication of boolean opts in config file */
|
||||
int *opt_compdup; /* for duplication of compound opts in config file */
|
||||
|
||||
13
src/cmd.c
13
src/cmd.c
@@ -1792,7 +1792,18 @@ register char *cmd;
|
||||
flags.move = FALSE;
|
||||
return; /* probably we just had an interrupt */
|
||||
}
|
||||
|
||||
if (iflags.num_pad && iflags.num_pad_mode == 1) {
|
||||
/* This handles very old inconsistent DOS/Windows behaviour
|
||||
* in a new way: earlier, the keyboard handler mapped these,
|
||||
* which caused counts to be strange when entered from the
|
||||
* number pad. Now do not map them until here.
|
||||
*/
|
||||
switch (*cmd) {
|
||||
case '5': *cmd = 'g'; break;
|
||||
case M('5'): *cmd = 'G'; break;
|
||||
case M('0'): *cmd = 'I'; break;
|
||||
}
|
||||
}
|
||||
/* handle most movement commands */
|
||||
do_walk = do_rush = prefix_seen = FALSE;
|
||||
flags.travel = 0;
|
||||
|
||||
@@ -137,7 +137,6 @@ static struct Bool_Opt
|
||||
{"news", (boolean *)0, FALSE, SET_IN_FILE},
|
||||
#endif
|
||||
{"null", &flags.null, TRUE, SET_IN_GAME},
|
||||
{"number_pad", &iflags.num_pad, FALSE, SET_IN_GAME},
|
||||
#ifdef MAC
|
||||
{"page_wait", &flags.page_wait, TRUE, SET_IN_GAME},
|
||||
#else
|
||||
@@ -268,6 +267,7 @@ static struct Comp_Opt
|
||||
# endif
|
||||
{ "name", "your character's name (e.g., name:Merlin-W)",
|
||||
PL_NSIZ, DISP_IN_GAME },
|
||||
{ "number_pad", "use the number pad", 1, SET_IN_GAME},
|
||||
{ "objects", "the symbols to use for objects",
|
||||
MAXOCLASSES, SET_IN_FILE },
|
||||
{ "packorder", "the inventory order of the items in your pack",
|
||||
@@ -1067,6 +1067,35 @@ boolean tinitial, tfrom_file;
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "number_pad";
|
||||
if (match_optname(opts, fullname, 10, TRUE)) {
|
||||
boolean compat = (strlen(opts) <= 10);
|
||||
number_pad(iflags.num_pad ? 1 : 0);
|
||||
op = string_for_opt(opts, (compat || !initial));
|
||||
if (!op) {
|
||||
if (compat || negated || initial) {
|
||||
/* for backwards compatibility, "number_pad" without a
|
||||
value is a synonym for number_pad:1 */
|
||||
iflags.num_pad = !negated;
|
||||
if (iflags.num_pad) iflags.num_pad_mode = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (negated) {
|
||||
bad_negation("number_pad", TRUE);
|
||||
return;
|
||||
}
|
||||
if (*op == '1' || *op == '2') {
|
||||
iflags.num_pad = 1;
|
||||
if (*op == '2') iflags.num_pad_mode = 1;
|
||||
else iflags.num_pad_mode = 0;
|
||||
} else if (*op == '0') {
|
||||
iflags.num_pad = 0;
|
||||
iflags.num_pad_mode = 0;
|
||||
} else badoption(opts);
|
||||
return;
|
||||
}
|
||||
|
||||
fullname = "runmode";
|
||||
if (match_optname(opts, fullname, 4, TRUE)) {
|
||||
if (negated) {
|
||||
@@ -2131,9 +2160,6 @@ goodfruit:
|
||||
else lan_mail_finish();
|
||||
}
|
||||
#endif
|
||||
else if ((boolopt[i].addr) == &iflags.num_pad)
|
||||
number_pad(iflags.num_pad ? 1 : 0);
|
||||
|
||||
else if ((boolopt[i].addr) == &flags.lit_corridor) {
|
||||
/*
|
||||
* All corridor squares seen via night vision or
|
||||
|
||||
@@ -178,13 +178,13 @@ static const struct pad {
|
||||
{'9', M('9'), '9'}, /* 9 */
|
||||
{'m', C('p'), C('p')}, /* - */
|
||||
{'4', M('4'), '4'}, /* 4 */
|
||||
{'g', 'G', 'g'}, /* 5 */
|
||||
{'5', M('5'), '5'}, /* 5 */
|
||||
{'6', M('6'), '6'}, /* 6 */
|
||||
{'p', 'P', C('p')}, /* + */
|
||||
{'1', M('1'), '1'}, /* 1 */
|
||||
{'2', M('2'), '2'}, /* 2 */
|
||||
{'3', M('3'), '3'}, /* 3 */
|
||||
{'i', 'I', C('i')}, /* Ins */
|
||||
{'0', M('0'), '0'}, /* Ins */
|
||||
{'.', ':', ':'} /* Del */
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -81,13 +81,13 @@ static const struct pad {
|
||||
{'9', M('9'), '9'}, /* 9 */
|
||||
{'m', C('p'), C('p')}, /* - */
|
||||
{'4', M('4'), '4'}, /* 4 */
|
||||
{'g', 'G', 'g'}, /* 5 */
|
||||
{'5', M('5'), '5'}, /* 5 */
|
||||
{'6', M('6'), '6'}, /* 6 */
|
||||
{'+', 'P', C('p')}, /* + */
|
||||
{'1', M('1'), '1'}, /* 1 */
|
||||
{'2', M('2'), '2'}, /* 2 */
|
||||
{'3', M('3'), '3'}, /* 3 */
|
||||
{'i', 'I', C('i')}, /* Ins */
|
||||
{'0', M('0'), '0'}, /* Ins */
|
||||
{'.', ':', ':'} /* Del */
|
||||
};
|
||||
|
||||
|
||||
@@ -138,13 +138,13 @@ numpad[KEY_LAST][3] = {
|
||||
{'9', M('9'), '9'}, /* 9 */
|
||||
{'m', C('p'), C('p')}, /* - */
|
||||
{'4', M('4'), '4'}, /* 4 */
|
||||
{'g', 'G', 'g'}, /* 5 */
|
||||
{'5', M('5'), '5'}, /* 5 */
|
||||
{'6', M('6'), '6'}, /* 6 */
|
||||
{'+', 'P', C('p')}, /* + */
|
||||
{'1', M('1'), '1'}, /* 1 */
|
||||
{'2', M('2'), '2'}, /* 2 */
|
||||
{'3', M('3'), '3'}, /* 3 */
|
||||
{'i', 'I', C('i')}, /* Ins */
|
||||
{'0', M('0'), '0'}, /* Ins */
|
||||
{'.', ':', ':'} /* Del */
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user