From f46d551f1373e9f3d4ddddff66691b2b8d237c40 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 11 Oct 2024 13:14:09 +0200 Subject: [PATCH] made keybd_subdir optional --- config.cpp | 2 ++ control.cpp | 8 ++++++-- graph.cpp | 6 +++--- help.cpp | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config.cpp b/config.cpp index c0cef09de..8da0e9a7c 100644 --- a/config.cpp +++ b/config.cpp @@ -1176,6 +1176,8 @@ EX void initConfig() { param_i(vid.faraway_highlight_color, "faraway_highlight_color", 50) -> editable(0, 100, 10, "faraway highlight color", "0 = monster color, 100 = red-light oscillation", 'c'); + param_b(keybd_subdir_enabled, "keybd_subdir_enabled", 0)->editable("control the pushing direction with TAB", 'P')->help("If set, you control the off-hepetagon pushing direction with TAB. Otherwise, you control it by rotating the screen."); + param_enum(glyphsortorder, parameter_names("glyph_sort", "glyph sort order"), glyphsortorder) ->editable({ {"first on top", ""}, diff --git a/control.cpp b/control.cpp index 8e7303d4f..5bf246d7b 100644 --- a/control.cpp +++ b/control.cpp @@ -142,6 +142,9 @@ EX hyperpoint move_destination_vec(int d) { else return cspin(0, 2, d * 45._deg) * smalltangent(); } +EX int keybd_subdir = 1; +EX bool keybd_subdir_enabled = 0; + EX void movepckeydir(int d) { DEBB(DF_GRAPH, ("movepckeydir\n")); // EUCLIDEAN @@ -149,7 +152,7 @@ EX void movepckeydir(int d) { if(protect_memory()) return; movedir md = vectodir(move_destination_vec(d)); - md.subdir = keybd_subdir ? 1 : -1; + if(keybd_subdir_enabled) md.subdir = keybd_subdir; if(!canmove) movepcto(md), remission(); else movepcto(md); } @@ -620,7 +623,8 @@ EX void handleKeyNormal(int sym, int uni) { } if(sym == SDLK_TAB) { - keybd_subdir = !keybd_subdir; + keybd_subdir_enabled = !anyshiftclick; + keybd_subdir *= -1; } if(sym == SDLK_ESCAPE) { diff --git a/graph.cpp b/graph.cpp index e8364b5d4..cc00cedd7 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3597,9 +3597,8 @@ EX transmatrix applyDowndir(cell *c, const cellfunction& cf) { return ddspin180(c, patterns::downdir(c, cf)); } -EX bool keybd_subdir; - void draw_movement_arrows(cell *c, const transmatrix& V, int df) { + if(viewdists) return; string keylist = ""; @@ -3629,7 +3628,8 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) { if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) { transmatrix Centered = rgpushxto0(unshift(tC0(cwtV))); - int sd = keybd_subdir ? 1 : -1; + int sd = md.subdir; + if(keybd_subdir_enabled) sd = keybd_subdir; transmatrix T = iso_inverse(Centered) * rgpushxto0(Centered * tC0(V)) * lrspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2); diff --git a/help.cpp b/help.cpp index 0a5f0f95d..1e36aa35e 100644 --- a/help.cpp +++ b/help.cpp @@ -259,7 +259,7 @@ string pushtext(stringpar p) { "\n\nNote: when pushing %the1 off a heptagonal cell, you can control the pushing direction " "by clicking left or right half of the heptagon.", p); #if !ISMOBILE - s += XLAT(" With the keyboard, you can press Tab to invert the way the pushing direction leans."); + s += XLAT(" With the keyboard, you can press Tab to invert the way the pushing direction leans, or Shift+Tab to decide based on how the view is rotated."); #endif return s; }