1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

more cleanup with uniformizing the keys for 'back' and 'help'

This commit is contained in:
Zeno Rogue 2018-06-13 00:00:01 +02:00
parent 44affc3e9d
commit 3881a7dd97
18 changed files with 69 additions and 58 deletions

View File

@ -554,7 +554,7 @@ void loadConfig() {
void showAllConfig() { void showAllConfig() {
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
#if CAP_CONFIG #if CAP_CONFIG
dialog::addItem(XLAT("save the current config"), 's'); dialog::addItem(XLAT("save the current config"), 's');
if(getcstat == 's') if(getcstat == 's')
@ -565,8 +565,7 @@ void showAllConfig() {
void handleAllConfig(int sym, int uni) { void handleAllConfig(int sym, int uni) {
if(sym == SDLK_F1 || uni == 'h') gotoHelp(help); if(sym == SDLK_F1 || uni == 'h') gotoHelp(help);
else if(uni == ' ') popScreen(); else if(uni == ' ' || sym == SDLK_ESCAPE) popScreen();
else if(sym == SDLK_ESCAPE) popScreen();
#if CAP_CONFIG #if CAP_CONFIG
else if(uni == 's') saveConfig(); else if(uni == 's') saveConfig();
#endif #endif
@ -908,20 +907,19 @@ void showJoyConfig() {
dialog::addSelItem(XLAT("second joystick: panning speed"), fts(vid.joypanspeed * 1000), 'd'); dialog::addSelItem(XLAT("second joystick: panning speed"), fts(vid.joypanspeed * 1000), 'd');
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);
char xuni = uni | 32; if(uni == 'p') autojoy = !autojoy;
if(xuni == 'p') autojoy = !autojoy; else if(uni == 'a')
else if(xuni == 'a')
dialog::editNumber(vid.joyvalue, 0, 32768, 100, 4800, XLAT("first joystick: movement threshold"), ""); dialog::editNumber(vid.joyvalue, 0, 32768, 100, 4800, XLAT("first joystick: movement threshold"), "");
else if(xuni == 'b') else if(uni == 'b')
dialog::editNumber(vid.joyvalue2, 0, 32768, 100, 5600, XLAT("first joystick: execute movement threshold"), ""); dialog::editNumber(vid.joyvalue2, 0, 32768, 100, 5600, XLAT("first joystick: execute movement threshold"), "");
else if(xuni == 'c') else if(uni == 'c')
dialog::editNumber(vid.joypanthreshold, 0, 32768, 100, 2500, XLAT("second joystick: pan threshold"), ""); dialog::editNumber(vid.joypanthreshold, 0, 32768, 100, 2500, XLAT("second joystick: pan threshold"), "");
else if(xuni == 'd') else if(uni == 'd')
dialog::editNumber(vid.joypanspeed, 0, 1e-2, 1e-5, 1e-4, XLAT("second joystick: panning speed"), ""); dialog::editNumber(vid.joypanspeed, 0, 1e-2, 1e-5, 1e-4, XLAT("second joystick: panning speed"), "");
else if(doexiton(sym, uni)) popScreen(); else if(doexiton(sym, uni)) popScreen();
@ -1047,7 +1045,7 @@ void showStereo() {
dialog::addSelItem(XLAT("field of view"), fts(stereo::fov) + "°", 'f'); dialog::addSelItem(XLAT("field of view"), fts(stereo::fov) + "°", 'f');
dialog::addItem(XLAT("back"), 'v'); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
@ -1146,7 +1144,7 @@ void show3D() {
dialog::addInfo(XLAT("parameters set correctly")); dialog::addInfo(XLAT("parameters set correctly"));
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("stereo vision config"), 'e'); dialog::addItem(XLAT("stereo vision config"), 'e');
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
@ -1235,7 +1233,7 @@ void showCustomizeChar() {
if(numplayers() > 1) dialog::addSelItem(XLAT("player"), its(shmup::cpid+1), 'a'); if(numplayers() > 1) dialog::addSelItem(XLAT("player"), its(shmup::cpid+1), 'a');
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
int firsty = dialog::items[0].position / 2; int firsty = dialog::items[0].position / 2;
@ -1250,25 +1248,24 @@ void showCustomizeChar() {
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);
char xuni = uni | 32;
if(shmup::on || multi::players) shmup::cpid = shmup::cpid_edit % shmup::players; if(shmup::on || multi::players) shmup::cpid = shmup::cpid_edit % shmup::players;
charstyle& cs = getcs(); charstyle& cs = getcs();
if(xuni == 'a') { shmup::cpid_edit++; shmup::cpid_edit %= 60; } bool cat = cs.charid >= 4;
if(xuni == 'g') { if(uni == 'a') { shmup::cpid_edit++; shmup::cpid_edit %= 60; }
else if(uni == 'g') {
cs.charid++; cs.charid++;
if(cs.charid == 2 && !princess::everSaved && !autocheat) cs.charid = 4; if(cs.charid == 2 && !princess::everSaved && !autocheat) cs.charid = 4;
cs.charid %= 10; cs.charid %= 10;
} }
if(xuni == 'p') vid.samegender = !vid.samegender; else if(uni == 'p') vid.samegender = !vid.samegender;
bool cat = cs.charid >= 4; else if(uni == 's') switchcolor(cs.skincolor, cat ? haircolors : skincolors);
if(xuni == 's') switchcolor(cs.skincolor, cat ? haircolors : skincolors); else if(uni == 'h') switchcolor(cs.haircolor, haircolors);
if(xuni == 'h') switchcolor(cs.haircolor, haircolors); else if(uni == 'w') switchcolor(cs.swordcolor, cat ? eyecolors : swordcolors);
if(xuni == 'w') switchcolor(cs.swordcolor, cat ? eyecolors : swordcolors); else if(uni == 'd') switchcolor(cs.dresscolor, cat ? haircolors : dresscolors);
if(xuni == 'd') switchcolor(cs.dresscolor, cat ? haircolors : dresscolors); else if(uni == 'f') switchcolor(cs.dresscolor2, dresscolors2);
if(xuni == 'f') switchcolor(cs.dresscolor2, dresscolors2); else if(uni == 'u') switchcolor(cs.uicolor, eyecolors);
if(xuni == 'u') switchcolor(cs.uicolor, eyecolors); else if(doexiton(sym, uni)) popScreen();
if(uni == ' ' || sym == SDLK_ESCAPE) popScreen();
}; };
} }
@ -1320,7 +1317,7 @@ void selectLanguageScreen() {
dialog::addBreak(50); dialog::addBreak(50);
vid.language = -1; vid.language = -1;
dialog::addBoolItem(XLAT("default") + ": " + XLAT("EN"), v == -1, '0'); dialog::addBoolItem(XLAT("default") + ": " + XLAT("EN"), v == -1, '0');
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::addBreak(50); dialog::addBreak(50);
@ -1347,14 +1344,13 @@ void selectLanguageScreen() {
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);
char xuni = uni | 32;
if(uni == '0') { if(uni == '0') {
vid.language = -1; vid.language = -1;
ANDROID_SETTINGS; ANDROID_SETTINGS;
} }
else if(xuni >= 'a' && xuni < 'a'+NUMLAN) { else if(uni >= 'a' && uni < 'a'+NUMLAN) {
vid.language = xuni - 'a'; vid.language = uni - 'a';
ANDROID_SETTINGS; ANDROID_SETTINGS;
} }

View File

@ -770,7 +770,7 @@ namespace conformal {
} }
#endif #endif
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
mouseovers = XLAT("see http://www.roguetemple.com/z/hyper/models.php"); mouseovers = XLAT("see http://www.roguetemple.com/z/hyper/models.php");
keyhandler = handleKeyC; keyhandler = handleKeyC;

View File

@ -379,7 +379,7 @@ void showCheatMenu() {
dialog::addItem(XLAT("switch web display"), 'W'-64); dialog::addItem(XLAT("switch web display"), 'W'-64);
dialog::addItem(XLAT("peaceful mode"), 'P'-64); dialog::addItem(XLAT("peaceful mode"), 'P'-64);
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni); dialog::handleNavigation(sym, uni);

View File

@ -20,6 +20,14 @@ const char* COLORBAR = "###";
namespace dialog { namespace dialog {
void addBack() {
addItem(XLAT("go back"), SDLK_ESCAPE);
}
void addHelp() {
addItem(XLAT("help"), SDLK_F1);
}
namespace zoom { namespace zoom {
int zoomf = 1, shiftx, shifty; int zoomf = 1, shiftx, shifty;
bool zoomoff = false; bool zoomoff = false;
@ -673,7 +681,7 @@ namespace dialog {
addBreak(100); addBreak(100);
#endif #endif
addItem("go back", ' '); dialog::addBack();
addSelItem(XLAT("default value"), disp(ne.dft), SDLK_HOME); addSelItem(XLAT("default value"), disp(ne.dft), SDLK_HOME);
addBreak(100); addBreak(100);
@ -826,7 +834,7 @@ namespace dialog {
getcstat = '2'; getcstat = '2';
if(pages) if(displayfrZ(xr*40, i0, 1, vid.fsize, IFM("3 - ") + XLAT("all"), nlpage == 1 ? 0xD8D8C0 : 0xC0C0C0, 8)) if(pages) if(displayfrZ(xr*40, i0, 1, vid.fsize, IFM("3 - ") + XLAT("all"), nlpage == 1 ? 0xD8D8C0 : 0xC0C0C0, 8))
getcstat = '3'; getcstat = '3';
if(i&1) if(displayfrZ(xr*56, i0, 1, vid.fsize, IFM(keyname(' ') + " - ") + XLAT("go back"), 0xC0C0C0, 8)) if(i&1) if(displayfrZ(xr*56, i0, 1, vid.fsize, IFM(keyname(SDLK_ESCAPE) + " - ") + XLAT("go back"), 0xC0C0C0, 8))
getcstat = '0'; getcstat = '0';
if(i&2) if(displayfrZ(xr*72, i0, 1, vid.fsize, IFM("F1 - ") + XLAT("help"), 0xC0C0C0, 8)) if(i&2) if(displayfrZ(xr*72, i0, 1, vid.fsize, IFM("F1 - ") + XLAT("help"), 0xC0C0C0, 8))
getcstat = SDLK_F1; getcstat = SDLK_F1;

View File

@ -327,8 +327,8 @@ void showEuclideanMenu() {
dialog::addBoolItem(XLAT("Poincaré/Klein"), vid.alpha>.5, '1'); dialog::addBoolItem(XLAT("Poincaré/Klein"), vid.alpha>.5, '1');
if(torus || quotient == 2) if(torus || quotient == 2)
dialog::addItem(XLAT("advanced parameters"), '4'); dialog::addItem(XLAT("advanced parameters"), '4');
dialog::addItem(XLAT("help"), SDLK_F1); dialog::addHelp();
dialog::addItem(XLAT("back"), '0'); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
@ -409,8 +409,8 @@ void showEuclideanMenu() {
dialog::addItem(XLAT("Chaos mode"), '1'); dialog::addItem(XLAT("Chaos mode"), '1');
dialog::addItem(XLAT("next page"), '-'); dialog::addItem(XLAT("next page"), '-');
dialog::addItem(XLAT("help"), SDLK_F1); dialog::addHelp();
dialog::addItem(XLAT("back"), '0'); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {

View File

@ -606,8 +606,8 @@ namespace hr { namespace gp {
dialog::addBoolItem(XLAT("select"), param == internal_representation(config), 'f'); dialog::addBoolItem(XLAT("select"), param == internal_representation(config), 'f');
dialog::addBreak(100); dialog::addBreak(100);
dialog::addItem(XLAT("help"), SDLK_F1); dialog::addHelp();
dialog::addItem(XLAT("back"), '0'); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [show_nonthree, texture_remap] (int sym, int uni) { keyhandler = [show_nonthree, texture_remap] (int sym, int uni) {

View File

@ -1488,6 +1488,9 @@ namespace dialog {
void vpush(int i, const char *name); void vpush(int i, const char *name);
extern vector<pair<string, int> > v; extern vector<pair<string, int> > v;
void addHelp();
void addBack();
} }
void checkStunKill(cell *dest); void checkStunKill(cell *dest);

View File

@ -71,7 +71,7 @@ void showDemo() {
dialog::addItem(XLAT("play"), 'f'); dialog::addItem(XLAT("play"), 'f');
dialog::addItem(XLAT("tutorial"), 'T'); dialog::addItem(XLAT("tutorial"), 'T');
dialog::addItem(XLAT("help"), 'h'); dialog::lastItem().keycaption += " / F1"; dialog::addHelp(); dialog::lastItem().keycaption += " / F1";
// dialog::addItem(XLAT("toggle high detail"), 'a'); // dialog::addItem(XLAT("toggle high detail"), 'a');
dialog::addBreak(100); dialog::addBreak(100);

View File

@ -198,7 +198,7 @@ void showMainMenu() {
#if CAP_SAVE #if CAP_SAVE
dialog::addItem(XLAT("local highscores"), 't'); dialog::addItem(XLAT("local highscores"), 't');
#endif #endif
dialog::addItem(XLAT("help"), 'h'); dialog::lastItem().keycaption += " / F1"; dialog::addHelp();
if(cheater) if(cheater)
dialog::addItem(XLAT("cheats"), 'c'); dialog::addItem(XLAT("cheats"), 'c');
else dialog::addBreak(100); else dialog::addBreak(100);
@ -473,7 +473,7 @@ void showChangeMode() {
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
@ -893,9 +893,9 @@ void showMessageLog() {
string timeformats[5] = {"turns", "real time", "game time", "precise", "no time"}; string timeformats[5] = {"turns", "real time", "game time", "precise", "no time"};
displayButton(xr*70, i0, IFM("0 - ") + XLAT("back"), '0', 8); displayButton(xr*70, i0, IFM(dialog::keyname(SDLK_ESCAPE) + " - ") + XLAT("go back"), SDLK_ESCAPE, 8);
displayButton(xr*10, i0, IFM("c - ") + XLAT("clear"), '0', 8); displayButton(xr*10, i0, IFM("c - ") + XLAT("clear"), 'c', 8);
displayButton(xr*40, i0, IFM("t - ") + XLAT(timeformats[timeformat]), '0', 8); displayButton(xr*40, i0, IFM("t - ") + XLAT(timeformats[timeformat]), 't', 8);
keyhandler = [lines] (int sym, int uni) { keyhandler = [lines] (int sym, int uni) {
if(uni == PSEUDOKEY_WHEELDOWN) messagelogpos++; if(uni == PSEUDOKEY_WHEELDOWN) messagelogpos++;

View File

@ -658,7 +658,7 @@ namespace hr { namespace netgen {
dialog::addItem(XLAT("create the model"), 'c'); dialog::addItem(XLAT("create the model"), 'c');
dialog::addItem(XLAT("design the net"), 'd'); dialog::addItem(XLAT("design the net"), 'd');
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
} }

View File

@ -1988,7 +1988,7 @@ namespace linepatterns {
dialog::addColorItem(among(patterns[numpat].id, patVine, patPower) && gp::on ? XLAT("Goldberg") + (patterns[numpat].id == patVine ? " " : ""): XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat); dialog::addColorItem(among(patterns[numpat].id, patVine, patPower) && gp::on ? XLAT("Goldberg") + (patterns[numpat].id == patVine ? " " : ""): XLAT(patterns[numpat].lpname), patterns[numpat].color, 'a'+numpat);
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::addBreak(50); dialog::addBreak(50);
dialog::addInfo("change the alpha parameter to show the lines"); dialog::addInfo("change the alpha parameter to show the lines");

View File

@ -1557,7 +1557,7 @@ void showMenu() {
kohonen::showMenu(); kohonen::showMenu();
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();

View File

@ -1703,7 +1703,7 @@ void show() {
dialog::init(XLAT("hypersian rug mode"), iinf[itPalace].color, 150, 100); dialog::init(XLAT("hypersian rug mode"), iinf[itPalace].color, 150, 100);
dialog::addItem(XLAT("what's this?"), 'h'); dialog::addItem(XLAT("what's this?"), 'h');
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::addBoolItem(XLAT("enable the Hypersian Rug mode"), rug::rugged, 'u'); dialog::addBoolItem(XLAT("enable the Hypersian Rug mode"), rug::rugged, 'u');

View File

@ -222,7 +222,7 @@ void show() {
displayButton(xr*10, i0, IFM("s - ") + XLAT("sort"), 's', 8); displayButton(xr*10, i0, IFM("s - ") + XLAT("sort"), 's', 8);
displayButton(xr*30, i0, IFM("t - ") + XLAT("choose"), 't', 8); displayButton(xr*30, i0, IFM("t - ") + XLAT("choose"), 't', 8);
displayButton(xr*50, i0, IFM(dialog::keyname(' ') + " - ") + XLAT("go back"), '0', 8); displayButton(xr*50, i0, IFM(dialog::keyname(SDLK_ESCAPE) + " - ") + XLAT("go back"), '0', 8);
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
if(sym == SDLK_LEFT || sym == SDLK_KP4 || sym == 'h' || sym == 'a') { if(sym == SDLK_LEFT || sym == SDLK_KP4 || sym == 'h' || sym == 'a') {

View File

@ -303,9 +303,9 @@ void showShmupConfig() {
dialog::addItem(XLAT("save the configuration"), 'c'); dialog::addItem(XLAT("save the configuration"), 'c');
#endif #endif
dialog::addItem(XLAT("help"), 'h'); dialog::addHelp();
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
} }

View File

@ -950,7 +950,7 @@ void showMagicMenu() {
dialog::addSelItem(XLAT("delete markers"), its(size(amp)), 'D'); dialog::addSelItem(XLAT("delete markers"), its(size(amp)), 'D');
dialog::addItem(XLAT("perform auto-adjustment"), 'R'); dialog::addItem(XLAT("perform auto-adjustment"), 'R');
dialog::addItem(XLAT("back"), '0'); dialog::addBack();
getcstat = '-'; getcstat = '-';
@ -1095,8 +1095,8 @@ void showMenu() {
dialog::addItem(XLAT("save texture config"), 's'); dialog::addItem(XLAT("save texture config"), 's');
} }
dialog::addItem(XLAT("help"), SDLK_F1); dialog::addHelp();
dialog::addItem(XLAT("back"), '0'); dialog::addBack();
getcstat = '-'; getcstat = '-';

View File

@ -277,7 +277,7 @@ namespace ss {
} }
dialog::addBreak(50); dialog::addBreak(50);
if(size(slideshows) > 1) dialog::addItem(XLAT("change slideshow"), '1'); if(size(slideshows) > 1) dialog::addItem(XLAT("change slideshow"), '1');
dialog::addItem(XLAT("go back"), ' '); dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
if(uni >= 'a' && uni < 'a' + sssize) { if(uni >= 'a' && uni < 'a' + sssize) {

View File

@ -482,6 +482,8 @@ namespace yendor {
easy ? "Challenges do not get harder" : "Each challenge gets harder after each victory"), easy ? "Challenges do not get harder" : "Each challenge gets harder after each victory"),
" " + XLAT(easy ? "easy" : "challenge"), '1'); " " + XLAT(easy ? "easy" : "challenge"), '1');
dialog::addBack();
dialog::addHelp();
dialog::display(); dialog::display();
int yc = char_to_yendor(getcstat); int yc = char_to_yendor(getcstat);
@ -1078,9 +1080,11 @@ namespace peace {
dialog::addBreak(100); dialog::addBreak(100);
dialog::addItem(XLAT(otherpuzzles ? "memory game" : "puzzles and exploration"), '1'); dialog::addItem(XLAT(otherpuzzles ? "memory game" : "puzzles and exploration"), '1');
dialog::addBoolItem(XLAT("display hints"), hint, '2'); dialog::addBoolItem(XLAT("display hints"), hint, '2');
dialog::addItem(XLAT("help"), SDLK_F1);
dialog::addItem(XLAT("Return to the normal game"), '0'); dialog::addItem(XLAT("Return to the normal game"), '0');
dialog::addBreak(50);
dialog::addHelp();
dialog::addBack();
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {