From dae6b9e3d377b36e421536801d59d2702a9e2bbe Mon Sep 17 00:00:00 2001 From: Arthur O'Dwyer Date: Sun, 29 Oct 2017 12:04:27 -0700 Subject: [PATCH] Consistently use "space" for the "pop this menu" option in all submenus. The "pop this menu" option's *text* is still highly variable among all the different menus, which could make it hard to navigate, but at least if you're using the keyboard it's now easy to "go back". Plus, the rogueviz menu incorrectly reported "(v) exit menu" when actually `v` was already in use by an earlier option. This is now fixed. --- config.cpp | 22 ++++++++++++---------- conformal.cpp | 2 +- dialogs.cpp | 2 +- hyper.h | 2 ++ mapeditor.cpp | 2 +- menus.cpp | 7 +++---- netgen.cpp | 2 +- rogueviz.cpp | 2 +- rug.cpp | 2 +- scores.cpp | 2 +- shmup.cpp | 2 +- tour.cpp | 2 +- 12 files changed, 26 insertions(+), 23 deletions(-) diff --git a/config.cpp b/config.cpp index 73b76894..11f521da 100644 --- a/config.cpp +++ b/config.cpp @@ -527,7 +527,7 @@ void loadConfig() { void showAllConfig() { dialog::addBreak(50); - dialog::addItem(XLAT("exit configuration"), 'v'); + dialog::addItem(XLAT("exit configuration"), ' '); #if CAP_CONFIG dialog::addItem(XLAT("save the current config"), 's'); if(getcstat == 's') @@ -538,7 +538,7 @@ void showAllConfig() { void handleAllConfig(int sym, int uni) { if(sym == SDLK_F1 || uni == 'h') gotoHelp(help); - else if(uni == 'v') popScreen(); + else if(uni == ' ') popScreen(); else if(sym == SDLK_ESCAPE) popScreen(); #if CAP_CONFIG else if(uni == 's') saveConfig(); @@ -624,6 +624,8 @@ void showGraphConfig() { char xuni = uni | 96; + if(uni >= 32 && uni < 64) xuni = uni; + if(xuni == 'u') vid.particles = !vid.particles; if(xuni == 'd') vid.graphglyph = (1+vid.graphglyph)%3; @@ -849,12 +851,12 @@ void showJoyConfig() { dialog::addSelItem(XLAT("second joystick: pan threshold"), its(vid.joypanthreshold), 'c'); dialog::addSelItem(XLAT("second joystick: panning speed"), fts(vid.joypanspeed * 1000), 'd'); - dialog::addItem(XLAT("back"), 'v'); + dialog::addItem(XLAT("back"), ' '); dialog::display(); keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); - char xuni = uni | 96; + char xuni = uni | 32; if(xuni == 'p') autojoy = !autojoy; else if(xuni == 'a') dialog::editNumber(vid.joyvalue, 0, 32768, 100, 4800, XLAT("first joystick: movement threshold"), ""); @@ -1003,7 +1005,7 @@ void show3D() { else dialog::addInfo(XLAT("parameters set correctly")); dialog::addBreak(50); - dialog::addItem(XLAT("exit 3D configuration"), 'v'); + dialog::addItem(XLAT("exit 3D configuration"), ' '); dialog::display(); keyhandler = [] (int sym, int uni) { @@ -1104,7 +1106,7 @@ void showCustomizeChar() { if(numplayers() > 1) dialog::addSelItem(XLAT("player"), its(shmup::cpid+1), 'a'); dialog::addBreak(50); - dialog::addItem(XLAT("return to the game"), 'v'); + dialog::addItem(XLAT("return to the game"), ' '); dialog::display(); int firsty = dialog::items[0].position / 2; @@ -1119,7 +1121,7 @@ void showCustomizeChar() { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); - char xuni = uni | 96; + char xuni = uni | 32; if(shmup::on || multi::players) shmup::cpid = shmup::cpid_edit % shmup::players; charstyle& cs = getcs(); @@ -1137,7 +1139,7 @@ void showCustomizeChar() { if(xuni == 'd') switchcolor(cs.dresscolor, cat ? haircolors : dresscolors); if(xuni == 'f') switchcolor(cs.dresscolor2, dresscolors2); if(xuni == 'u') switchcolor(cs.uicolor, eyecolors); - if(xuni == 'v' || sym == SDLK_ESCAPE) popScreen(); + if(uni == ' ' || sym == SDLK_ESCAPE) popScreen(); }; } @@ -1189,7 +1191,7 @@ void selectLanguageScreen() { dialog::addBreak(50); vid.language = -1; dialog::addBoolItem(XLAT("default") + ": " + XLAT("EN"), v == -1, '0'); - dialog::addItem(XLAT("exit configuration"), '1'); + dialog::addItem(XLAT("exit configuration"), ' '); dialog::addBreak(50); @@ -1216,7 +1218,7 @@ void selectLanguageScreen() { keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); - char xuni = uni | 96; + char xuni = uni | 32; if(uni == '0') { vid.language = -1; ANDROID_SETTINGS; diff --git a/conformal.cpp b/conformal.cpp index 9ef71b2a..9682ce1d 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -591,7 +591,7 @@ namespace conformal { } #endif - dialog::addItem(XLAT("exit this menu"), 'q'); + dialog::addItem(XLAT("exit this menu"), ' '); dialog::display(); mouseovers = XLAT("see http://www.roguetemple.com/z/hyper/conformal.php"); keyhandler = handleKeyC; diff --git a/dialogs.cpp b/dialogs.cpp index 2b5e6e1f..7694fe2f 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -769,7 +769,7 @@ namespace dialog { getcstat = '2'; if(pages) if(displayfrZ(xr*40, i0, 1, vid.fsize, IFM("3 - ") + XLAT("all"), nlpage == 1 ? 0xD8D8C0 : 0xC0C0C0, 8)) getcstat = '3'; - if(i&1) if(displayfrZ(xr*56, i0, 1, vid.fsize, IFM("0 - ") + XLAT("return"), 0xC0C0C0, 8)) + if(i&1) if(displayfrZ(xr*56, i0, 1, vid.fsize, IFM(keyname(' ') + " - ") + XLAT("return"), 0xC0C0C0, 8)) getcstat = '0'; if(i&2) if(displayfrZ(xr*72, i0, 1, vid.fsize, IFM("F1 - ") + XLAT("help"), 0xC0C0C0, 8)) getcstat = SDLK_F1; diff --git a/hyper.h b/hyper.h index c500371e..d66ccc20 100644 --- a/hyper.h +++ b/hyper.h @@ -820,6 +820,8 @@ namespace dialog { item& lastItem(); extern unsigned int *palette; + + string keyname(int k); void addSelItem(string body, string value, int key); void addBoolItem(string body, bool value, int key); diff --git a/mapeditor.cpp b/mapeditor.cpp index 9d8ebf28..92a6df8f 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -2247,7 +2247,7 @@ lessalphaif(col, behindsphere(V), behindsphere(gmatrix[c2])) dialog::addColorItem(XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat); dialog::addBreak(50); - dialog::addItem(XLAT("exit menu"), 'v'); + dialog::addItem(XLAT("exit menu"), ' '); dialog::addBreak(50); dialog::addInfo("change the alpha parameter to show the lines"); diff --git a/menus.cpp b/menus.cpp index f99f202c..12897c20 100644 --- a/menus.cpp +++ b/menus.cpp @@ -448,14 +448,14 @@ void showChangeMode() { dialog::addBreak(50); - dialog::addItem(XLAT("return to the game"), 'v'); + dialog::addItem(XLAT("return to the game"), ' '); dialog::display(); keyhandler = [] (int sym, int uni) { dialog::handleNavigation(sym, uni); char xuni = uni; - - if(xuni == 'v' || sym == SDLK_ESCAPE) popScreen(); + + if(xuni == ' ' || sym == SDLK_ESCAPE) popScreen(); else if(uni == 'c') { if(tactic::on && gold()) { @@ -773,4 +773,3 @@ void setAppropriateOverview() { pushScreen(showOverview); } } - diff --git a/netgen.cpp b/netgen.cpp index f82f5fdf..72afd32e 100644 --- a/netgen.cpp +++ b/netgen.cpp @@ -656,7 +656,7 @@ namespace netgen { dialog::addItem(XLAT("synchronize net and map"), 's'); dialog::addItem(XLAT("display the scope"), 't'); dialog::addItem(XLAT("create the model"), 'c'); - dialog::addItem(XLAT("back to HyperRogue"), 'q'); + dialog::addItem(XLAT("back to HyperRogue"), ' '); dialog::addItem(XLAT("design the net"), 'd'); dialog::display(); diff --git a/rogueviz.cpp b/rogueviz.cpp index c85fc8a7..528a5171 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1739,7 +1739,7 @@ void showMenu() { kohonen::showMenu(); dialog::addBreak(50); - dialog::addItem(XLAT("exit menu"), 'v'); + dialog::addItem(XLAT("exit menu"), ' '); dialog::display(); diff --git a/rug.cpp b/rug.cpp index 52e9fb6a..91d7f3e2 100644 --- a/rug.cpp +++ b/rug.cpp @@ -661,7 +661,7 @@ void show() { dialog::init(XLAT("hypersian rug mode"), iinf[itPalace].color, 150, 100); dialog::addItem(XLAT("what's this?"), 'h'); - dialog::addItem(XLAT("take me back"), 'q'); + dialog::addItem(XLAT("take me back"), ' '); dialog::addItem(XLAT("enable the Hypersian Rug mode"), 'u'); dialog::addBoolItem(XLAT("render the texture only once"), (renderonce), 'o'); dialog::addBoolItem(XLAT("render texture without OpenGL"), (rendernogl), 'g'); diff --git a/scores.cpp b/scores.cpp index 6842adcb..4d65caa0 100644 --- a/scores.cpp +++ b/scores.cpp @@ -238,7 +238,7 @@ void show() { displayButton(xr*10, i0, IFM("s - ") + XLAT("sort"), 's', 8); displayButton(xr*30, i0, IFM("t - ") + XLAT("choose"), 't', 8); - displayButton(xr*50, i0, IFM("0 - ") + XLAT("play"), '0', 8); + displayButton(xr*50, i0, IFM(dialog::keyname(' ') + " - ") + XLAT("play"), '0', 8); keyhandler = [] (int sym, int uni) { if(sym == SDLK_LEFT || sym == SDLK_KP4 || sym == 'h' || sym == 'a') { diff --git a/shmup.cpp b/shmup.cpp index 96d0d6f4..09969b12 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -300,7 +300,7 @@ void showShmupConfig() { dialog::addItem(XLAT("help"), 'h'); - dialog::addItem(XLAT("exit configuration"), 'v'); + dialog::addItem(XLAT("exit configuration"), ' '); dialog::display(); } diff --git a/tour.cpp b/tour.cpp index 6268c439..b4ff9cbd 100644 --- a/tour.cpp +++ b/tour.cpp @@ -249,7 +249,7 @@ namespace ss { } dialog::addBreak(50); if(size(slideshows) > 1) dialog::addItem(XLAT("change slideshow"), '1'); - dialog::addItem(XLAT("exit menu"), '0'); + dialog::addItem(XLAT("exit menu"), ' '); dialog::display(); keyhandler = [] (int sym, int uni) { if(uni >= 'a' && uni < 'a' + sssize) {