]> granicus.if.org Git - nethack/commitdiff
Swap running and rushing modes back
authorPasi Kallinen <paxed@alt.org>
Sat, 29 Jan 2022 10:57:58 +0000 (12:57 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 29 Jan 2022 10:58:06 +0000 (12:58 +0200)
I unintentionally swapped the shift and ctrl movement keys
when redoing the movement input - change them back to how
it was earlier.

Also change the number_pad meta-key bindings, and explain
in the comments why: We can't bind shift or ctrl numbers.
Meta (aka alt-key) works with number-pad numbers when
the altmeta-option is on. There was no altmeta in 3.4.3.

Here's a table of the flags.run/g.context.run values,
from 3.4.3 and 3.7 as of this commit:

             | num_pad:0 || num_pad:1
             | 343 | 370 || 343 | 370
-------------------------------------------------
 <dir>       |  0  |  0  ||  0  |  0
 shift-<dir> |  1  |  1  ||  0  | N/A
 ctrl-<dir>  |  3  |  3  ||  0  | N/A
 meta-<dir>  | N/A | N/A || N/A |  1 (with altmeta)
 m-prefix    |  0  |  -  ||  0  |  -
 G-prefix    |  3  |  3  ||  3  |  3
 g-prefix    |  2  |  2  ||  2  |  2
 5-prefix    | N/A | N/A ||  3  |  3
-------------------------------------------------

The m-prefix in 3.7 does not set the run-value, as it can now
be used with any movement key or prefix, which will set the run value.

New input system does not lose functionality when compared to 3.4.3.
Instead, the number_pad users gain the meta-<dir> running.

This doesn't fix the issue of three badly differentiated run values.

src/cmd.c

index 74d1180f125b6420dd6c4bb52789bf38ac149448..777a5faeaaac81bd9460fb2ba9058c11daf7c1a0 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1921,56 +1921,56 @@ do_move_southwest(void)
 int
 do_rush_west(void)
 {
-    set_move_cmd(DIR_W, 1);
+    set_move_cmd(DIR_W, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_northwest(void)
 {
-    set_move_cmd(DIR_NW, 1);
+    set_move_cmd(DIR_NW, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_north(void)
 {
-    set_move_cmd(DIR_N, 1);
+    set_move_cmd(DIR_N, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_northeast(void)
 {
-    set_move_cmd(DIR_NE, 1);
+    set_move_cmd(DIR_NE, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_east(void)
 {
-    set_move_cmd(DIR_E, 1);
+    set_move_cmd(DIR_E, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_southeast(void)
 {
-    set_move_cmd(DIR_SE, 1);
+    set_move_cmd(DIR_SE, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_south(void)
 {
-    set_move_cmd(DIR_S, 1);
+    set_move_cmd(DIR_S, 3);
     return ECMD_TIME;
 }
 
 int
 do_rush_southwest(void)
 {
-    set_move_cmd(DIR_SW, 1);
+    set_move_cmd(DIR_SW, 3);
     return ECMD_TIME;
 }
 
@@ -1978,56 +1978,56 @@ do_rush_southwest(void)
 int
 do_run_west(void)
 {
-    set_move_cmd(DIR_W, 3);
+    set_move_cmd(DIR_W, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_northwest(void)
 {
-    set_move_cmd(DIR_NW, 3);
+    set_move_cmd(DIR_NW, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_north(void)
 {
-    set_move_cmd(DIR_N, 3);
+    set_move_cmd(DIR_N, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_northeast(void)
 {
-    set_move_cmd(DIR_NE, 3);
+    set_move_cmd(DIR_NE, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_east(void)
 {
-    set_move_cmd(DIR_E, 3);
+    set_move_cmd(DIR_E, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_southeast(void)
 {
-    set_move_cmd(DIR_SE, 3);
+    set_move_cmd(DIR_SE, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_south(void)
 {
-    set_move_cmd(DIR_S, 3);
+    set_move_cmd(DIR_S, 1);
     return ECMD_TIME;
 }
 
 int
 do_run_southwest(void)
 {
-    set_move_cmd(DIR_SW, 3);
+    set_move_cmd(DIR_SW, 1);
     return ECMD_TIME;
 }
 
@@ -3622,8 +3622,9 @@ reset_commands(boolean initial)
             (void) bind_key_fn(highc(g.Cmd.dirchars[i]), move_funcs[i][MV_RUN]);
             (void) bind_key_fn(C(g.Cmd.dirchars[i]), move_funcs[i][MV_RUSH]);
         } else {
+            /* M(number) works when altmeta is on */
             (void) bind_key_fn(M(g.Cmd.dirchars[i]), move_funcs[i][MV_RUN]);
-            (void) bind_key_fn(M(g.Cmd.dirchars[i]), move_funcs[i][MV_RUSH]);
+            /* can't bind highc() or C() of numbers. just use the 5 prefix. */
         }
     }
     update_rest_on_space();
@@ -3835,6 +3836,7 @@ got_prefix_input:
                     /* it was a prefix command, mark and get another command */
                     prefix_seen = TRUE;
                     bad_command = FALSE;
+                    cmdq_ec = NULL;
                     goto got_prefix_input;
                 } else if (((g.domove_attempting & (DOMOVE_RUSH | DOMOVE_WALK)) != 0L)
                             && !g.context.travel && !dxdy_moveok()) {