more key bindings
number_pad==1 adds '5' => 'G' M-5 => 'g' '0' => 'i' number_pad==2 swaps 5 and M-5 and adds M-0 '5' => 'g' M-5 => 'G' '0' => 'i' M-0 => 'I' M-5 and M-0 were missing from the bound key handling; they still used hardcoded digits even though the actions for plain 5 and plain 0 can be bound to other keys these days. This implements the M-5 variation as NHKF_RUSH2. Changing numpad from 1 to 2 or vice versa will swap the NHKF_RUN2 and NHKF_RUSH2 actions regardless of what keys they're assigned to. I haven't done anything for unimplemented NHKF_DOINV2 though (and am not planning to in case someone else wants to jump in...). This also fixes the description of the 'I' command. The extended command name for that still misleadingly refers to "type" rather than "class" though.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.381 $ $NHDT-Date: 1607591199 2020/12/10 09:06:39 $
|
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.383 $ $NHDT-Date: 1607641577 2020/12/10 23:06:17 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -322,6 +322,8 @@ brown pudding monster hitting another monster with decay attack corroded armor
|
|||||||
instead of rotting it
|
instead of rotting it
|
||||||
<?> -> <full key bindings> omitted 'n' prefix and M-digit for number_pad mode,
|
<?> -> <full key bindings> omitted 'n' prefix and M-digit for number_pad mode,
|
||||||
and ^A/re-do was suppressed due lack of obsolete '#define REDO'
|
and ^A/re-do was suppressed due lack of obsolete '#define REDO'
|
||||||
|
add missing key binding support for rush.numpad; default is M-5 for numpad==1
|
||||||
|
or plain 5 for numpad==2 where behavior of 5 and M-5 are swapped
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 decl.h $NHDT-Date: 1606919254 2020/12/02 14:27:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.247 $ */
|
/* NetHack 3.7 decl.h $NHDT-Date: 1607641577 2020/12/10 23:06:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2007. */
|
/*-Copyright (c) Michael Allison, 2007. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -416,15 +416,16 @@ enum nh_keyfunc {
|
|||||||
NHKF_REQMENU,
|
NHKF_REQMENU,
|
||||||
|
|
||||||
/* run ... clicklook need to be in a continuous block */
|
/* run ... clicklook need to be in a continuous block */
|
||||||
NHKF_RUN,
|
NHKF_RUN, /* 'G' */
|
||||||
NHKF_RUN2,
|
NHKF_RUN2, /* '5' or M-5 */
|
||||||
NHKF_RUSH,
|
NHKF_RUSH, /* 'g' */
|
||||||
NHKF_FIGHT,
|
NHKF_RUSH2, /* M-5 or '5' */
|
||||||
NHKF_FIGHT2,
|
NHKF_FIGHT, /* 'F' */
|
||||||
NHKF_NOPICKUP,
|
NHKF_FIGHT2, /* '-' */
|
||||||
NHKF_RUN_NOPICKUP,
|
NHKF_NOPICKUP, /* 'm' */
|
||||||
NHKF_DOINV,
|
NHKF_RUN_NOPICKUP, /* 'M' */
|
||||||
NHKF_TRAVEL,
|
NHKF_DOINV, /* '0' */
|
||||||
|
NHKF_TRAVEL, /* via mouse */
|
||||||
NHKF_CLICKLOOK,
|
NHKF_CLICKLOOK,
|
||||||
|
|
||||||
NHKF_REDRAW,
|
NHKF_REDRAW,
|
||||||
|
|||||||
55
src/cmd.c
55
src/cmd.c
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 cmd.c $NHDT-Date: 1607591200 2020/12/10 09:06:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.431 $ */
|
/* NetHack 3.7 cmd.c $NHDT-Date: 1607641581 2020/12/10 23:06:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.432 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -1821,7 +1821,7 @@ struct ext_func_tab extcmdlist[] = {
|
|||||||
{ 'V', "history", "show long version and game history",
|
{ 'V', "history", "show long version and game history",
|
||||||
dohistory, IFBURIED | GENERALCMD },
|
dohistory, IFBURIED | GENERALCMD },
|
||||||
{ 'i', "inventory", "show your inventory", ddoinv, IFBURIED },
|
{ 'i', "inventory", "show your inventory", ddoinv, IFBURIED },
|
||||||
{ 'I', "inventtype", "inventory specific item types",
|
{ 'I', "inventtype", "show inventory of one specific item class",
|
||||||
dotypeinv, IFBURIED },
|
dotypeinv, IFBURIED },
|
||||||
{ M('i'), "invoke", "invoke an object's special powers",
|
{ M('i'), "invoke", "invoke an object's special powers",
|
||||||
doinvoke, IFBURIED | AUTOCOMPLETE },
|
doinvoke, IFBURIED | AUTOCOMPLETE },
|
||||||
@@ -2199,6 +2199,7 @@ dokeylist(VOID_ARGS)
|
|||||||
int i;
|
int i;
|
||||||
static const char
|
static const char
|
||||||
run_desc[] = "Prefix: run until something very interesting is seen",
|
run_desc[] = "Prefix: run until something very interesting is seen",
|
||||||
|
rush_desc[] = "Prefix: rush until something interesting is seen",
|
||||||
forcefight_desc[] =
|
forcefight_desc[] =
|
||||||
"Prefix: force fight even if you don't see a monster";
|
"Prefix: force fight even if you don't see a monster";
|
||||||
static const struct {
|
static const struct {
|
||||||
@@ -2206,9 +2207,9 @@ dokeylist(VOID_ARGS)
|
|||||||
const char *desc;
|
const char *desc;
|
||||||
boolean numpad;
|
boolean numpad;
|
||||||
} misc_keys[] = {
|
} misc_keys[] = {
|
||||||
{ NHKF_ESC, "escape from the current query/action", FALSE },
|
{ NHKF_ESC, "cancel current prompt or pending prefix", FALSE },
|
||||||
{ NHKF_RUSH,
|
{ NHKF_RUSH, rush_desc, FALSE },
|
||||||
"Prefix: rush until something interesting is seen", FALSE },
|
{ NHKF_RUSH2, rush_desc, TRUE },
|
||||||
{ NHKF_RUN, run_desc, FALSE },
|
{ NHKF_RUN, run_desc, FALSE },
|
||||||
{ NHKF_RUN2, run_desc, TRUE },
|
{ NHKF_RUN2, run_desc, TRUE },
|
||||||
{ NHKF_FIGHT, forcefight_desc, FALSE },
|
{ NHKF_FIGHT, forcefight_desc, FALSE },
|
||||||
@@ -2217,7 +2218,9 @@ dokeylist(VOID_ARGS)
|
|||||||
"Prefix: move without picking up objects or fighting", FALSE },
|
"Prefix: move without picking up objects or fighting", FALSE },
|
||||||
{ NHKF_RUN_NOPICKUP,
|
{ NHKF_RUN_NOPICKUP,
|
||||||
"Prefix: run without picking up objects or fighting", FALSE },
|
"Prefix: run without picking up objects or fighting", FALSE },
|
||||||
{ NHKF_DOINV, "view inventory", TRUE },
|
{ NHKF_DOINV, "view full inventory", TRUE },
|
||||||
|
/* NHKF_DOINV2 for num_pad+pcHack_compat isn't implemented */
|
||||||
|
/* { NHKF_DOINV2, "view inventory of one class of objects", TRUE }, */
|
||||||
{ NHKF_REQMENU, "Prefix: request a menu", FALSE },
|
{ NHKF_REQMENU, "Prefix: request a menu", FALSE },
|
||||||
{ NHKF_COUNT,
|
{ NHKF_COUNT,
|
||||||
"Prefix: for digits when prefixing a command with a count", TRUE },
|
"Prefix: for digits when prefixing a command with a count", TRUE },
|
||||||
@@ -2303,8 +2306,9 @@ dokeylist(VOID_ARGS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
keys_used[(uchar) C('c')] = TRUE;
|
key = (uchar) C('c');
|
||||||
Sprintf(buf, "%-7s %s", key2txt(C('c'), buf2),
|
keys_used[key] = TRUE;
|
||||||
|
Sprintf(buf, "%-7s %s", key2txt(key, buf2),
|
||||||
"break out of NetHack (SIGINT)");
|
"break out of NetHack (SIGINT)");
|
||||||
putstr(datawin, 0, buf);
|
putstr(datawin, 0, buf);
|
||||||
#endif
|
#endif
|
||||||
@@ -2320,15 +2324,14 @@ dokeylist(VOID_ARGS)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (keylist_putcmds(datawin, TRUE, 0,
|
if (keylist_putcmds(datawin, TRUE, 0,
|
||||||
GENERALCMD | WIZMODECMD, keys_used)) {
|
GENERALCMD | WIZMODECMD, keys_used)) {
|
||||||
putstr(datawin, 0, "");
|
putstr(datawin, 0, "");
|
||||||
putstr(datawin, 0, "Game commands:");
|
putstr(datawin, 0, "Game commands:");
|
||||||
(void) keylist_putcmds(datawin, FALSE, 0,
|
(void) keylist_putcmds(datawin, FALSE, 0,
|
||||||
GENERALCMD | WIZMODECMD, keys_used);
|
GENERALCMD | WIZMODECMD, keys_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wizard
|
if (wizard && keylist_putcmds(datawin, TRUE, WIZMODECMD, 0, keys_used)) {
|
||||||
&& keylist_putcmds(datawin, TRUE, WIZMODECMD, 0, keys_used)) {
|
|
||||||
putstr(datawin, 0, "");
|
putstr(datawin, 0, "");
|
||||||
putstr(datawin, 0, "Debug mode commands:");
|
putstr(datawin, 0, "Debug mode commands:");
|
||||||
(void) keylist_putcmds(datawin, FALSE, WIZMODECMD, 0, keys_used);
|
(void) keylist_putcmds(datawin, FALSE, WIZMODECMD, 0, keys_used);
|
||||||
@@ -2842,7 +2845,7 @@ wiz_migrate_mons()
|
|||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
int nhkf;
|
int nhkf;
|
||||||
char key;
|
uchar key;
|
||||||
const char *name;
|
const char *name;
|
||||||
} const spkeys_binds[] = {
|
} const spkeys_binds[] = {
|
||||||
{ NHKF_ESC, '\033', (char *) 0 }, /* no binding */
|
{ NHKF_ESC, '\033', (char *) 0 }, /* no binding */
|
||||||
@@ -2851,6 +2854,7 @@ static struct {
|
|||||||
{ NHKF_RUN, 'G', "run" },
|
{ NHKF_RUN, 'G', "run" },
|
||||||
{ NHKF_RUN2, '5', "run.numpad" },
|
{ NHKF_RUN2, '5', "run.numpad" },
|
||||||
{ NHKF_RUSH, 'g', "rush" },
|
{ NHKF_RUSH, 'g', "rush" },
|
||||||
|
{ NHKF_RUSH2, M('5'), "rush.numpad" },
|
||||||
{ NHKF_FIGHT, 'F', "fight" },
|
{ NHKF_FIGHT, 'F', "fight" },
|
||||||
{ NHKF_FIGHT2, '-', "fight.numpad" },
|
{ NHKF_FIGHT2, '-', "fight.numpad" },
|
||||||
{ NHKF_NOPICKUP, 'm', "nopickup" },
|
{ NHKF_NOPICKUP, 'm', "nopickup" },
|
||||||
@@ -3109,13 +3113,14 @@ boolean initial;
|
|||||||
if (flagtemp != g.Cmd.swap_yz) {
|
if (flagtemp != g.Cmd.swap_yz) {
|
||||||
g.Cmd.swap_yz = flagtemp;
|
g.Cmd.swap_yz = flagtemp;
|
||||||
++updated;
|
++updated;
|
||||||
/* g.Cmd.swap_yz has been toggled;
|
/* FIXME? should Cmd.spkeys[] be scanned for y and/or z to swap?
|
||||||
|
Cmd.swap_yz has been toggled;
|
||||||
perform the swap (or reverse previous one) */
|
perform the swap (or reverse previous one) */
|
||||||
for (i = 0; i < SIZE(ylist); i++) {
|
for (i = 0; i < SIZE(ylist); i++) {
|
||||||
c = ylist[i] & 0xff;
|
c = ylist[i] & 0xff;
|
||||||
cmdtmp = g.Cmd.commands[c]; /* tmp = [y] */
|
cmdtmp = g.Cmd.commands[c]; /* tmp = [y] */
|
||||||
g.Cmd.commands[c] = g.Cmd.commands[c + 1]; /* [y] = [z] */
|
g.Cmd.commands[c] = g.Cmd.commands[c + 1]; /* [y] = [z] */
|
||||||
g.Cmd.commands[c + 1] = cmdtmp; /* [z] = tmp */
|
g.Cmd.commands[c + 1] = cmdtmp; /* [z] = tmp */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* MSDOS compatibility mode (only applicable for num_pad) */
|
/* MSDOS compatibility mode (only applicable for num_pad) */
|
||||||
@@ -3124,10 +3129,17 @@ boolean initial;
|
|||||||
g.Cmd.pcHack_compat = flagtemp;
|
g.Cmd.pcHack_compat = flagtemp;
|
||||||
++updated;
|
++updated;
|
||||||
/* pcHack_compat has been toggled */
|
/* pcHack_compat has been toggled */
|
||||||
|
#if 0
|
||||||
c = M('5') & 0xff;
|
c = M('5') & 0xff;
|
||||||
cmdtmp = g.Cmd.commands['5'];
|
cmdtmp = g.Cmd.commands['5'];
|
||||||
g.Cmd.commands['5'] = g.Cmd.commands[c];
|
g.Cmd.commands['5'] = g.Cmd.commands[c];
|
||||||
g.Cmd.commands[c] = cmdtmp;
|
g.Cmd.commands[c] = cmdtmp;
|
||||||
|
#else
|
||||||
|
c = g.Cmd.spkeys[NHKF_RUN2];
|
||||||
|
g.Cmd.spkeys[NHKF_RUN2] = g.Cmd.spkeys[NHKF_RUSH2];
|
||||||
|
g.Cmd.spkeys[NHKF_RUSH2] = c;
|
||||||
|
#endif
|
||||||
|
/* FIXME: NHKF_DOINV2 ought to be implemented instead of this */
|
||||||
c = M('0') & 0xff;
|
c = M('0') & 0xff;
|
||||||
g.Cmd.commands[c] = g.Cmd.pcHack_compat ? g.Cmd.commands['I'] : 0;
|
g.Cmd.commands[c] = g.Cmd.pcHack_compat ? g.Cmd.commands['I'] : 0;
|
||||||
}
|
}
|
||||||
@@ -3338,6 +3350,10 @@ register char *cmd;
|
|||||||
spkey = ch2spkeys(*cmd, NHKF_RUN, NHKF_CLICKLOOK);
|
spkey = ch2spkeys(*cmd, NHKF_RUN, NHKF_CLICKLOOK);
|
||||||
|
|
||||||
switch (spkey) {
|
switch (spkey) {
|
||||||
|
case NHKF_RUSH2:
|
||||||
|
if (!g.Cmd.num_pad)
|
||||||
|
break;
|
||||||
|
/*FALLTHRU*/
|
||||||
case NHKF_RUSH:
|
case NHKF_RUSH:
|
||||||
if (movecmd(cmd[1])) {
|
if (movecmd(cmd[1])) {
|
||||||
g.context.run = 2;
|
g.context.run = 2;
|
||||||
@@ -3597,7 +3613,8 @@ char c;
|
|||||||
|| c == g.Cmd.spkeys[NHKF_RUN_NOPICKUP]
|
|| c == g.Cmd.spkeys[NHKF_RUN_NOPICKUP]
|
||||||
|| c == g.Cmd.spkeys[NHKF_FIGHT]
|
|| c == g.Cmd.spkeys[NHKF_FIGHT]
|
||||||
|| (g.Cmd.num_pad && (c == g.Cmd.spkeys[NHKF_RUN2]
|
|| (g.Cmd.num_pad && (c == g.Cmd.spkeys[NHKF_RUN2]
|
||||||
|| c == g.Cmd.spkeys[NHKF_FIGHT2])));
|
|| c == g.Cmd.spkeys[NHKF_RUSH2]
|
||||||
|
|| c == g.Cmd.spkeys[NHKF_FIGHT2])));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3751,6 +3768,10 @@ const char *msg;
|
|||||||
case NHKF_NOPICKUP:
|
case NHKF_NOPICKUP:
|
||||||
dothat = "move";
|
dothat = "move";
|
||||||
break;
|
break;
|
||||||
|
case NHKF_RUSH2:
|
||||||
|
if (!g.Cmd.num_pad)
|
||||||
|
break;
|
||||||
|
/*FALLTHRU*/
|
||||||
case NHKF_RUSH:
|
case NHKF_RUSH:
|
||||||
dothat = "rush";
|
dothat = "rush";
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user