From: Pasi Kallinen Date: Sat, 29 Jan 2022 10:57:58 +0000 (+0200) Subject: Swap running and rushing modes back X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f9551bdb3682bdd006aff15bfe36e0362e2b680;p=nethack Swap running and rushing modes back 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 ------------------------------------------------- | 0 | 0 || 0 | 0 shift- | 1 | 1 || 0 | N/A ctrl- | 3 | 3 || 0 | N/A meta- | 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- running. This doesn't fix the issue of three badly differentiated run values. --- diff --git a/src/cmd.c b/src/cmd.c index 74d1180f1..777a5faea 100644 --- 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()) {