1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-18 06:30:41 +00:00

made keybd_subdir optional

This commit is contained in:
Zeno Rogue 2024-10-11 13:14:09 +02:00
parent 74dcd03ac6
commit f46d551f13
4 changed files with 12 additions and 6 deletions

View File

@ -1176,6 +1176,8 @@ EX void initConfig() {
param_i(vid.faraway_highlight_color, "faraway_highlight_color", 50) 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'); -> 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) param_enum(glyphsortorder, parameter_names("glyph_sort", "glyph sort order"), glyphsortorder)
->editable({ ->editable({
{"first on top", ""}, {"first on top", ""},

View File

@ -142,6 +142,9 @@ EX hyperpoint move_destination_vec(int d) {
else return cspin(0, 2, d * 45._deg) * smalltangent(); 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) { EX void movepckeydir(int d) {
DEBB(DF_GRAPH, ("movepckeydir\n")); DEBB(DF_GRAPH, ("movepckeydir\n"));
// EUCLIDEAN // EUCLIDEAN
@ -149,7 +152,7 @@ EX void movepckeydir(int d) {
if(protect_memory()) return; if(protect_memory()) return;
movedir md = vectodir(move_destination_vec(d)); 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); if(!canmove) movepcto(md), remission(); else movepcto(md);
} }
@ -620,7 +623,8 @@ EX void handleKeyNormal(int sym, int uni) {
} }
if(sym == SDLK_TAB) { if(sym == SDLK_TAB) {
keybd_subdir = !keybd_subdir; keybd_subdir_enabled = !anyshiftclick;
keybd_subdir *= -1;
} }
if(sym == SDLK_ESCAPE) { if(sym == SDLK_ESCAPE) {

View File

@ -3597,9 +3597,8 @@ EX transmatrix applyDowndir(cell *c, const cellfunction& cf) {
return ddspin180(c, patterns::downdir(c, cf)); return ddspin180(c, patterns::downdir(c, cf));
} }
EX bool keybd_subdir;
void draw_movement_arrows(cell *c, const transmatrix& V, int df) { void draw_movement_arrows(cell *c, const transmatrix& V, int df) {
if(viewdists) return; if(viewdists) return;
string keylist = ""; 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))) { if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) {
transmatrix Centered = rgpushxto0(unshift(tC0(cwtV))); 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); transmatrix T = iso_inverse(Centered) * rgpushxto0(Centered * tC0(V)) * lrspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2);

View File

@ -259,7 +259,7 @@ string pushtext(stringpar p) {
"\n\nNote: when pushing %the1 off a heptagonal cell, you can control the pushing direction " "\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); "by clicking left or right half of the heptagon.", p);
#if !ISMOBILE #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 #endif
return s; return s;
} }