diff --git a/control.cpp b/control.cpp index 97d09dc1..345444dd 100644 --- a/control.cpp +++ b/control.cpp @@ -437,10 +437,9 @@ bool handleTune(int sym, int uni) { EX purehookset hooks_fixticks; -array - keys_vi = {'l', 'n', 'j', 'b', 'h', 'y', 'k', 'u'}, - keys_wasd = {'d', 'c', 'x', 'z', 'a', 'q', 'w', 'e'}, - keys_numpad = {SDLK_KP6, SDLK_KP3, SDLK_KP2, SDLK_KP1, SDLK_KP4, SDLK_KP7, SDLK_KP8, SDLK_KP9}; +EX array keys_vi = {'l', 'n', 'j', 'b', 'h', 'y', 'k', 'u'}; +EX array keys_wasd = {'d', 'c', 'x', 'z', 'a', 'q', 'w', 'e'}; +EX array keys_numpad = {SDLK_KP6, SDLK_KP3, SDLK_KP2, SDLK_KP1, SDLK_KP4, SDLK_KP7, SDLK_KP8, SDLK_KP9}; EX void handleKeyNormal(int sym, int uni) { diff --git a/graph.cpp b/graph.cpp index 313e8785..4a022874 100644 --- a/graph.cpp +++ b/graph.cpp @@ -3115,6 +3115,11 @@ EX transmatrix applyDowndir(cell *c, const cellfunction& cf) { void draw_movement_arrows(cell *c, const transmatrix& V, int df) { if(viewdists) return; + + string keylist = ""; + const ld keysize = .6; + + color_t col = getcs().uicolor; for(int d=0; d<8; d++) { @@ -3125,19 +3130,33 @@ void draw_movement_arrows(cell *c, const transmatrix& V, int df) { if(xc.at == c) { transmatrix fixrot = sphereflip * rgpushxto0(sphereflip * tC0(V)); // make it more transparent - color_t col = getcs().uicolor; col -= (col & 0xFF) >> 1; poly_outline = OUTLINE_DEFAULT; - queuepoly(fixrot * spin(-d * M_PI/4), cgi.shArrow, col); + + char key = 0; + if(vid.axes >= 5) + key = (vid.axes == 5 ? keys_wasd : keys_vi)[d]; + + if(vid.axes >= 5) keylist += key; + else + queuepoly(fixrot * spin(-d * M_PI/4), cgi.shArrow, col); if((c->type & 1) && (isStunnable(c->monst) || isPushable(c->wall))) { transmatrix Centered = rgpushxto0(tC0(cwtV)); int sd = md.subdir; - queuepoly(inverse(Centered) * rgpushxto0(Centered * tC0(V)) * rspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2), cgi.shArrow, col); + + transmatrix T = inverse(Centered) * rgpushxto0(Centered * tC0(V)) * rspintox(Centered*tC0(V)) * spin(-sd * M_PI/S7) * xpush(0.2); + + if(vid.axes >= 5) + queuestr(T, keysize, s0 + key, col >> 8, 1); + + else + queuepoly(T, cgi.shArrow, col); } else if(!confusingGeometry()) break; } } + if(keylist != "") queuestr(V, keysize, keylist, col >> 8, 1); } EX int celldistAltPlus(cell *c) { return 1000000 + celldistAlt(c); } @@ -4168,12 +4187,12 @@ EX void drawMarkers() { // process mouse #if CAP_SHAPES - if((vid.axes == 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) { + if((vid.axes >= 4 || (vid.axes == 1 && !mousing)) && !shmup::on && GDIM == 2) { if(multi::players == 1) { forCellIdAll(c2, d, cwt.at) if(gmatrix.count(cwt.at)) draw_movement_arrows(c2, gmatrix[cwt.at] * currentmap->adj(cwt.at, d), d); } else if(multi::players > 1) for(int p=0; p= 4 || !drawstaratvec(multi::mdx[p], multi::mdy[p]))) forCellIdAll(c2, d, multi::player[p].at) if(gmatrix.count(cwt.at)) { multi::cpid = p; dynamicval ttm(cwtV, multi::whereis[p]); @@ -4715,7 +4734,7 @@ EX void drawmovestar(double dx, double dy) { int rax = vid.axes; if(rax == 1) rax = drawstaratvec(dx, dy) ? 2 : 0; - if(rax == 0 || vid.axes == 4) return; + if(rax == 0 || vid.axes >= 4) return; int starcol = getcs().uicolor; ignore(starcol); diff --git a/multi.cpp b/multi.cpp index 7cdbdc41..f26c1366 100644 --- a/multi.cpp +++ b/multi.cpp @@ -407,9 +407,9 @@ struct shmup_configurer { dialog::addItem(XLAT("configure player 5"), '5'); else if(!shmup::on && !multi::alwaysuse) { if(GDIM == 2) { - const char *axmodes[5] = {"OFF", "auto", "light", "heavy", "arrows"}; + const char *axmodes[7] = {"OFF", "auto", "light", "heavy", "arrows", "WASD keys", "VI keys"}; dialog::addSelItem(XLAT("help for keyboard users"), XLAT(axmodes[vid.axes]), 'h'); - dialog::add_action([] {vid.axes += 60 + (shiftmul > 0 ? 1 : -1); vid.axes %= 5; } ); + dialog::add_action([] {vid.axes += 70 + (shiftmul > 0 ? 1 : -1); vid.axes %= 7; } ); } else dialog::addBreak(100); }