Skip to content

Commit

Permalink
made keybd_subdir optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zenorogue committed Oct 11, 2024
1 parent 74dcd03 commit f46d551
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", ""},
Expand Down
8 changes: 6 additions & 2 deletions control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,17 @@ 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

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);
}
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f46d551

Please sign in to comment.