mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
improved key handling: numpad works as directions with numlock off and numbers with numlock on; shift+5 works now; better key assignments in crystal rug
This commit is contained in:
parent
9b21b9c5a0
commit
b256ac70af
@ -209,15 +209,16 @@ namespace spiral {
|
||||
goto breakloop;
|
||||
|
||||
case SDL_KEYDOWN: {
|
||||
int key = event.key.keysym.sym;
|
||||
// int uni = event.key.keysym.unicode;
|
||||
if(key == SDLK_RIGHT) velx++;
|
||||
if(key == SDLK_LEFT) velx--;
|
||||
if(key == SDLK_UP) vely++;
|
||||
if(key == SDLK_DOWN) vely--;
|
||||
if(key == SDLK_ESCAPE) goto breakloop;
|
||||
if(key == 'h') displayhelp = !displayhelp;
|
||||
if(key == 's') dosave = true;
|
||||
int sym = event.key.keysym.sym;
|
||||
int uni = event.key.keysym.unicode;
|
||||
numlock_on = event.key.keysym.mod & KMOD_NUM;
|
||||
if(DKEY == SDLK_RIGHT) velx++;
|
||||
if(DKEY == SDLK_LEFT) velx--;
|
||||
if(DKEY == SDLK_UP) vely++;
|
||||
if(DKEY == SDLK_DOWN) vely--;
|
||||
if(sym == SDLK_ESCAPE) goto breakloop;
|
||||
if(uni == 'h') displayhelp = !displayhelp;
|
||||
if(uni == 's') dosave = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -886,7 +887,7 @@ namespace conformal {
|
||||
}
|
||||
else if(uni == 'a')
|
||||
pushScreen(history_menu);
|
||||
else if(sym == 'r') {
|
||||
else if(uni == 'r') {
|
||||
if(rotation < 0) rotation = 0;
|
||||
dialog::editNumber(rotation, 0, 360, 90, 0, XLAT("rotation"),
|
||||
"This controls the automatic rotation of the world. "
|
||||
@ -967,23 +968,23 @@ namespace conformal {
|
||||
autoband = !autoband;
|
||||
else if(uni == 'm')
|
||||
pushScreen(model_menu);
|
||||
else if(sym == 'a')
|
||||
else if(uni == 'a')
|
||||
dialog::editNumber(lvspeed, -5, 5, .1, 1, XLAT("animation speed"), "");
|
||||
else if(sym == 'd') {
|
||||
else if(uni == 'd') {
|
||||
dialog::editNumber(bandhalf, 5, 1000, 5, 200, XLAT("band width"), "");
|
||||
dialog::bound_low(5);
|
||||
}
|
||||
else if(sym == 's') {
|
||||
else if(uni == 's') {
|
||||
dialog::editNumber(bandsegment, 500, 32000, 500, 16000, XLAT("band segment"), "");
|
||||
dialog::bound_low(500);
|
||||
}
|
||||
else if(sym == 'p')
|
||||
else if(uni == 'p')
|
||||
dialog::editNumber(extra_line_steps, 0, 5, 1, 1, XLAT("extend the ends"),
|
||||
"0 = start at the game start, endat the end position; "
|
||||
"larger numbers give extra space at the ends."
|
||||
);
|
||||
else if(sym == 'g') { dospiral = !dospiral; }
|
||||
else if(sym == 'i') {
|
||||
else if(uni == 'g') { dospiral = !dospiral; }
|
||||
else if(uni == 'i') {
|
||||
if(canmove && !cheater) {
|
||||
addMessage("Enable cheat mode or GAME OVER to use this");
|
||||
return;
|
||||
@ -994,7 +995,7 @@ namespace conformal {
|
||||
#if CAP_SDL
|
||||
else if(uni == 'f' && band_renderable_now()) createImage(dospiral);
|
||||
#endif
|
||||
else if(sym == 'j') {
|
||||
else if(uni == 'j') {
|
||||
autobandhistory = !autobandhistory;
|
||||
}
|
||||
else if(doexiton(sym, uni)) popScreen();
|
||||
|
36
control.cpp
36
control.cpp
@ -10,7 +10,7 @@ int mousex, mousey;
|
||||
hyperpoint mouseh, mouseoh;
|
||||
|
||||
bool leftclick, rightclick, targetclick, hiliteclick, anyshiftclick, wheelclick,
|
||||
forcetarget, lshiftclick, lctrlclick;
|
||||
forcetarget, lshiftclick, lctrlclick, numlock_on;
|
||||
bool gtouched;
|
||||
|
||||
bool holdmouse;
|
||||
@ -642,6 +642,7 @@ void handle_event(SDL_Event& ev) {
|
||||
uni = ev.key.keysym.unicode;
|
||||
if(ev.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) shiftmul = -1;
|
||||
if(ev.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) shiftmul /= 10;
|
||||
numlock_on = ev.key.keysym.mod & KMOD_NUM;
|
||||
if(sym == SDLK_RETURN && (ev.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||
sym = 0; uni = 0;
|
||||
switchFullscreen();
|
||||
@ -827,21 +828,36 @@ void displayabutton(int px, int py, string s, int col) {
|
||||
}
|
||||
#endif
|
||||
|
||||
bool numberkey(int sym, int uni, char number) {
|
||||
return uni == number && !(sym >= SDLK_KP0 && sym <= SDLK_KP9);
|
||||
bool interpret_as_direction(int sym, int uni) {
|
||||
return (sym >= SDLK_KP0 && sym <= SDLK_KP9 && !numlock_on);
|
||||
}
|
||||
|
||||
int get_direction_key(int sym, int uni) {
|
||||
if(interpret_as_direction(sym, uni)) {
|
||||
if(sym == SDLK_KP1) return SDLK_END;
|
||||
if(sym == SDLK_KP2) return SDLK_DOWN;
|
||||
if(sym == SDLK_KP3) return SDLK_PAGEDOWN;
|
||||
if(sym == SDLK_KP4) return SDLK_LEFT;
|
||||
if(sym == SDLK_KP6) return SDLK_RIGHT;
|
||||
if(sym == SDLK_KP7) return SDLK_HOME;
|
||||
if(sym == SDLK_KP8) return SDLK_UP;
|
||||
if(sym == SDLK_KP8) return SDLK_PAGEUP;
|
||||
return 0;
|
||||
}
|
||||
return sym;
|
||||
}
|
||||
|
||||
void gmodekeys(int sym, int uni) {
|
||||
#if CAP_RUG
|
||||
if(rug::rugged) rug::handlekeys(sym, uni);
|
||||
#endif
|
||||
if(numberkey(sym, uni, '1') && !rug::rugged) { vid.alpha = 999; vid.scale = 998; vid.xposition = vid.yposition = 0; }
|
||||
if(numberkey(sym, uni, '2') && !rug::rugged) { vid.alpha = 1; vid.scale = 0.4; vid.xposition = vid.yposition = 0; }
|
||||
if(numberkey(sym, uni, '3') && !rug::rugged) { vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
||||
if(numberkey(sym, uni, '4') && !rug::rugged) { vid.alpha = 0; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
||||
if(numberkey(sym, uni, '5')) { vid.wallmode += 60 + (shiftmul > 0 ? 1 : -1); vid.wallmode %= 6; }
|
||||
if(numberkey(sym, uni, '6')) vid.grid = !vid.grid;
|
||||
if(numberkey(sym, uni, '7')) { vid.darkhepta = !vid.darkhepta; }
|
||||
if(NUMBERKEY == '1' && !rug::rugged) { vid.alpha = 999; vid.scale = 998; vid.xposition = vid.yposition = 0; }
|
||||
if(NUMBERKEY == '2' && !rug::rugged) { vid.alpha = 1; vid.scale = 0.4; vid.xposition = vid.yposition = 0; }
|
||||
if(NUMBERKEY == '3' && !rug::rugged) { vid.alpha = 1; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
||||
if(NUMBERKEY == '4' && !rug::rugged) { vid.alpha = 0; vid.scale = 1; vid.xposition = vid.yposition = 0; }
|
||||
if(NUMBERKEY == '5') { vid.wallmode += 60 + (shiftmul > 0 ? 1 : -1); vid.wallmode %= 6; }
|
||||
if(NUMBERKEY == '6') vid.grid = !vid.grid;
|
||||
if(NUMBERKEY == '7') { vid.darkhepta = !vid.darkhepta; }
|
||||
if(uni == '%') {
|
||||
if(vid.wallmode == 0) vid.wallmode = 6;
|
||||
vid.wallmode--;
|
||||
|
26
dialogs.cpp
26
dialogs.cpp
@ -400,26 +400,26 @@ namespace dialog {
|
||||
}
|
||||
|
||||
void handleNavigation(int &sym, int &uni) {
|
||||
if(uni == '\n' || uni == '\r' || sym == SDLK_KP5)
|
||||
if(uni == '\n' || uni == '\r' || DIRECTIONKEY == SDLK_KP5)
|
||||
for(int i=0; i<isize(items); i++)
|
||||
if(isitem(items[i]))
|
||||
if(items[i].body == highlight_text) {
|
||||
uni = sym = items[i].key;
|
||||
return;
|
||||
}
|
||||
if(sym == SDLK_PAGEDOWN || sym == SDLK_KP3) {
|
||||
if(DKEY == SDLK_PAGEDOWN) {
|
||||
for(int i=0; i<isize(items); i++)
|
||||
if(isitem(items[i]))
|
||||
highlight_text = items[i].body;
|
||||
}
|
||||
if(sym == SDLK_PAGEUP || sym == SDLK_KP9) {
|
||||
if(DKEY == SDLK_PAGEUP) {
|
||||
for(int i=0; i<isize(items); i++)
|
||||
if(isitem(items[i])) {
|
||||
highlight_text = items[i].body;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(sym == SDLK_UP || sym == SDLK_KP8) {
|
||||
if(DKEY == SDLK_UP) {
|
||||
string last = "";
|
||||
for(int i=0; i<isize(items); i++)
|
||||
if(isitem(items[i]))
|
||||
@ -434,7 +434,7 @@ namespace dialog {
|
||||
}
|
||||
highlight_text = last;
|
||||
}
|
||||
if(sym == SDLK_DOWN || sym == SDLK_KP2) {
|
||||
if(DKEY == SDLK_DOWN) {
|
||||
int state = 0;
|
||||
for(int i=0; i<isize(items); i++)
|
||||
if(isitem(items[i])) {
|
||||
@ -494,17 +494,17 @@ namespace dialog {
|
||||
else if(palette && uni >= 'a' && uni < 'a'+(int) palette[0]) {
|
||||
color = palette[1 + uni - 'a'] >> shift;
|
||||
}
|
||||
else if(sym == SDLK_DOWN || sym == SDLK_KP2) {
|
||||
else if(DKEY == SDLK_DOWN) {
|
||||
colorp = (colorp-1) & 3;
|
||||
}
|
||||
else if(sym == SDLK_UP || sym == SDLK_KP8) {
|
||||
else if(DKEY == SDLK_UP) {
|
||||
colorp = (colorp+1) & 3;
|
||||
}
|
||||
else if(sym == SDLK_LEFT || sym == SDLK_KP4) {
|
||||
else if(DKEY == SDLK_LEFT) {
|
||||
unsigned char* pts = (unsigned char*) &color;
|
||||
pts[colorp] -= abs(shiftmul) < .6 ? 1 : 17;
|
||||
}
|
||||
else if(sym == SDLK_RIGHT || sym == SDLK_KP6) {
|
||||
else if(DKEY == SDLK_RIGHT) {
|
||||
unsigned char* pts = (unsigned char*) &color;
|
||||
pts[colorp] += abs(shiftmul) < .6 ? 1 : 17;
|
||||
}
|
||||
@ -689,14 +689,14 @@ namespace dialog {
|
||||
apply_edit();
|
||||
}
|
||||
#if !ISMOBILE
|
||||
else if(sym == SDLK_RIGHT || sym == SDLK_KP6) {
|
||||
else if(DKEY == SDLK_RIGHT) {
|
||||
if(ne.intval && abs(shiftmul) < .6)
|
||||
(*ne.editwhat)++;
|
||||
else
|
||||
*ne.editwhat = ne.sc.inverse(ne.sc.direct(*ne.editwhat) + shiftmul * ne.step);
|
||||
apply_slider();
|
||||
}
|
||||
else if(sym == SDLK_LEFT || sym == SDLK_KP4) {
|
||||
else if(DKEY == SDLK_LEFT) {
|
||||
if(ne.intval && abs(shiftmul) < .6)
|
||||
(*ne.editwhat)--;
|
||||
else
|
||||
@ -998,8 +998,8 @@ namespace dialog {
|
||||
bool handle_edit_string(int sym, int uni, function<string(int, int)> checker) {
|
||||
auto& es = *edited_string;
|
||||
string u2;
|
||||
if(sym == SDLK_LEFT) editpos--;
|
||||
else if(sym == SDLK_RIGHT) editpos++;
|
||||
if(DKEY == SDLK_LEFT) editpos--;
|
||||
else if(DKEY == SDLK_RIGHT) editpos++;
|
||||
else if(uni == 8) {
|
||||
if(editpos == 0) return true;
|
||||
es.replace(editpos-1, 1, "");
|
||||
|
9
hyper.h
9
hyper.h
@ -976,7 +976,7 @@ extern hyperpoint mouseh;
|
||||
extern hyperpoint ccenter;
|
||||
extern ld crad;
|
||||
|
||||
extern bool mousepressed, anyshiftclick;
|
||||
extern bool mousepressed, anyshiftclick, numlock_on;
|
||||
extern string help;
|
||||
|
||||
typedef function<void()> reaction_t;
|
||||
@ -2488,7 +2488,12 @@ extern function <bool(SDL_Event &ev)> joyhandler;
|
||||
void gmodekeys(int sym, int uni);
|
||||
|
||||
// check for a plain number key
|
||||
bool numberkey(int sym, int uni, char number);
|
||||
#define NUMBERKEY (interpret_as_direction(sym, uni) ? 0 : uni)
|
||||
#define DKEY (get_direction_key(sym, uni))
|
||||
#define DIRECTIONKEY (interpret_as_direction(sym, uni) ? uni : 0)
|
||||
|
||||
bool interpret_as_direction(int sym, int uni);
|
||||
int get_direction_key(int sym, int uni);
|
||||
|
||||
void switchGL();
|
||||
void switchFullscreen();
|
||||
|
14
hyperweb.cpp
14
hyperweb.cpp
@ -95,30 +95,30 @@ void showDemo() {
|
||||
|
||||
keyhandler = [] (int sym, int uni) {
|
||||
dialog::handleNavigation(sym, uni);
|
||||
if(sym == SDLK_F1 || sym == 'h') gotoHelp(help);
|
||||
else if(sym == 'a') {
|
||||
if(sym == SDLK_F1 || uni == 'h') gotoHelp(help);
|
||||
else if(uni == 'a') {
|
||||
toggleanim(!demoanim);
|
||||
popScreen();
|
||||
}
|
||||
else if(sym == 'f') {
|
||||
else if(uni == 'f') {
|
||||
firstland = laIce;
|
||||
restart_game(tactic::on ? rg::tactic : rg::nothing);
|
||||
}
|
||||
#if CAP_TOUR
|
||||
else if(sym == 'T') {
|
||||
else if(uni == 'T') {
|
||||
firstland = laIce;
|
||||
if(!tour::on) tour::start();
|
||||
}
|
||||
#endif
|
||||
else if(sym == 't') {
|
||||
else if(uni == 't') {
|
||||
firstland = laTemple;
|
||||
restart_game(tactic::on ? rg::tactic : rg::nothing);
|
||||
}
|
||||
else if(sym == 'l') {
|
||||
else if(uni == 'l') {
|
||||
firstland = laStorms;
|
||||
restart_game(tactic::on ? rg::tactic : rg::nothing);
|
||||
}
|
||||
else if(sym == 'b') {
|
||||
else if(uni == 'b') {
|
||||
firstland = laBurial;
|
||||
restart_game(tactic::on ? rg::tactic : rg::nothing);
|
||||
items[itOrbSword] = 60;
|
||||
|
34
menus.cpp
34
menus.cpp
@ -248,21 +248,21 @@ void showMainMenu() {
|
||||
|
||||
keyhandler = [] (int sym, int uni) {
|
||||
dialog::handleNavigation(sym, uni);
|
||||
if(sym == SDLK_F1 || sym == 'h') gotoHelp("@");
|
||||
else if(sym == 'c' && cheater) pushScreen(showCheatMenu);
|
||||
else if(sym == 'b') pushScreen(showBasicConfig);
|
||||
else if(sym == 'g') pushScreen(showGraphConfig);
|
||||
else if(sym == 'd') pushScreen(showDisplayMode);
|
||||
else if(sym == 'm') pushScreen(showChangeMode);
|
||||
if(sym == SDLK_F1 || uni == 'h') gotoHelp("@");
|
||||
else if(uni == 'c' && cheater) pushScreen(showCheatMenu);
|
||||
else if(uni == 'b') pushScreen(showBasicConfig);
|
||||
else if(uni == 'g') pushScreen(showGraphConfig);
|
||||
else if(uni == 'd') pushScreen(showDisplayMode);
|
||||
else if(uni == 'm') pushScreen(showChangeMode);
|
||||
else if(uni == 'R')
|
||||
popScreenAll(), pushScreen(showStartMenu);
|
||||
#if CAP_SAVE
|
||||
else if(sym == 't') scores::load();
|
||||
else if(uni == 't') scores::load();
|
||||
#endif
|
||||
else if(uni == 'r' || sym == SDLK_F5) {
|
||||
restart_game();
|
||||
}
|
||||
else if(sym == 'q' || sym == SDLK_F10) {
|
||||
else if(uni == 'q' || sym == SDLK_F10) {
|
||||
#if ISMOBILE
|
||||
extern void openURL();
|
||||
openURL();
|
||||
@ -270,12 +270,12 @@ void showMainMenu() {
|
||||
quitmainloop = true;
|
||||
#endif
|
||||
}
|
||||
else if(sym == 'o') {
|
||||
else if(uni == 'o') {
|
||||
clearMessages();
|
||||
get_o_key().second();
|
||||
}
|
||||
#if CAP_INV
|
||||
else if(sym == 'i') {
|
||||
else if(uni == 'i') {
|
||||
clearMessages();
|
||||
pushScreen(inv::show);
|
||||
}
|
||||
@ -284,7 +284,7 @@ void showMainMenu() {
|
||||
showMissionScreen();
|
||||
#if ISMOBILE==1
|
||||
#ifdef HAVE_ACHIEVEMENTS
|
||||
else if(sym == '3') {
|
||||
else if(NUMBERKEY == '3') {
|
||||
achievement_final(false);
|
||||
pushScreen(leader::showMenu);
|
||||
}
|
||||
@ -791,7 +791,7 @@ void showStartMenu() {
|
||||
pushScreen(daily::showMenu);
|
||||
}
|
||||
#endif
|
||||
else if(sym == 'm') {
|
||||
else if(uni == 'm') {
|
||||
popScreen();
|
||||
pushScreen(showMainMenu);
|
||||
}
|
||||
@ -799,7 +799,7 @@ void showStartMenu() {
|
||||
quitmainloop = true;
|
||||
else if(sym == SDLK_F1)
|
||||
gotoHelp("@");
|
||||
else if(sym == SDLK_ESCAPE || sym == ' ') {
|
||||
else if(sym == SDLK_ESCAPE || uni == ' ') {
|
||||
popScreen();
|
||||
timerstart = time(NULL);
|
||||
stampbase = ticks;
|
||||
@ -905,10 +905,10 @@ void showMessageLog() {
|
||||
keyhandler = [lines] (int sym, int uni) {
|
||||
if(uni == PSEUDOKEY_WHEELDOWN) messagelogpos++;
|
||||
else if(uni == PSEUDOKEY_WHEELUP) messagelogpos--;
|
||||
else if(uni == SDLK_DOWN || uni == SDLK_KP2) messagelogpos++;
|
||||
else if(uni == SDLK_UP || uni == SDLK_KP8) messagelogpos--;
|
||||
else if(uni == SDLK_PAGEUP || uni == SDLK_KP9) messagelogpos -= lines;
|
||||
else if(uni == SDLK_PAGEDOWN || uni == SDLK_KP3) messagelogpos -= lines;
|
||||
else if(DKEY == SDLK_DOWN) messagelogpos++;
|
||||
else if(DKEY == SDLK_UP) messagelogpos--;
|
||||
else if(DKEY == SDLK_PAGEUP) messagelogpos -= lines;
|
||||
else if(DKEY == SDLK_PAGEDOWN) messagelogpos -= lines;
|
||||
else if(uni == 'c') gamelog.clear();
|
||||
else if(uni == 't') { timeformat++; timeformat %= 5; }
|
||||
else if(doexiton(sym, uni)) popScreen();
|
||||
|
6
rug.cpp
6
rug.cpp
@ -1485,7 +1485,7 @@ void move_forward(ld distance) {
|
||||
#define CAP_HOLDKEYS CAP_SDL // && !ISWEB)
|
||||
|
||||
bool handlekeys(int sym, int uni) {
|
||||
if(numberkey(sym, uni, '1')) {
|
||||
if(NUMBERKEY == '1') {
|
||||
ld bdist = 1e12;
|
||||
if(finger_center)
|
||||
finger_center = NULL;
|
||||
@ -1499,14 +1499,14 @@ bool handlekeys(int sym, int uni) {
|
||||
if(renderonce) renderlate+=10;
|
||||
return true;
|
||||
}
|
||||
else if(numberkey(sym, uni, '2')) {
|
||||
else if(NUMBERKEY == '2') {
|
||||
if(in_crystal())
|
||||
crystal::switch_z_coordinate();
|
||||
else
|
||||
apply_rotation(rotmatrix(M_PI, 0, 2));
|
||||
return true;
|
||||
}
|
||||
else if(numberkey(sym, uni, '3')) {
|
||||
else if(NUMBERKEY == '3') {
|
||||
if(in_crystal())
|
||||
crystal::flip_z();
|
||||
else
|
||||
|
12
scores.cpp
12
scores.cpp
@ -230,11 +230,11 @@ void show() {
|
||||
displayButton(xr*50, i0, IFM(dialog::keyname(SDLK_ESCAPE) + " - ") + XLAT("go back"), '0', 8);
|
||||
|
||||
keyhandler = [] (int sym, int uni) {
|
||||
if(sym == SDLK_LEFT || sym == SDLK_KP4 || sym == 'h' || sym == 'a') {
|
||||
if(DKEY == SDLK_LEFT || uni == 'h' || uni == 'a') {
|
||||
scorerev = false;
|
||||
if(curcol > 0) curcol--;
|
||||
}
|
||||
else if(sym == SDLK_RIGHT || sym == SDLK_KP6 || sym == 'l' || sym == 'd') {
|
||||
else if(DKEY == SDLK_RIGHT || uni == 'l' || uni == 'd') {
|
||||
scorerev = false;
|
||||
if(curcol < POSSCORE) curcol++;
|
||||
}
|
||||
@ -242,16 +242,16 @@ void show() {
|
||||
scorerev = false;
|
||||
curcol = sym - 1000;
|
||||
}
|
||||
else if(sym == 't') { dialog::infix = ""; pushScreen(showPickScores); }
|
||||
else if(sym == SDLK_UP || sym == 'k' || sym == 'w')
|
||||
else if(uni == 't') { dialog::infix = ""; pushScreen(showPickScores); }
|
||||
else if(DKEY == SDLK_UP || uni == 'k' || uni == 'w')
|
||||
scorefrom -= 5;
|
||||
else if(sym == SDLK_DOWN || sym == 'j' || sym == 'x')
|
||||
else if(DKEY == SDLK_DOWN || uni == 'j' || uni == 'x')
|
||||
scorefrom += 5;
|
||||
else if(sym == PSEUDOKEY_WHEELUP)
|
||||
scorefrom--;
|
||||
else if(sym == PSEUDOKEY_WHEELDOWN)
|
||||
scorefrom++;
|
||||
else if(sym == 's') {
|
||||
else if(uni == 's') {
|
||||
if(scorerev) reverse(scores.begin(), scores.end());
|
||||
else {
|
||||
scorerev = true;
|
||||
|
36
tour.cpp
36
tour.cpp
@ -114,27 +114,27 @@ bool handleKeyTour(int sym, int uni) {
|
||||
if(inhelp) slidehelp();
|
||||
return true;
|
||||
}
|
||||
if(sym == '1' || sym == '2') { // || sym == '3')
|
||||
if(NUMBERKEY == '1' || NUMBERKEY == '2') {
|
||||
int legal = slides[currentslide].flags & 7;
|
||||
|
||||
if(legal == LEGAL_NONE || legal == LEGAL_HYPERBOLIC) {
|
||||
addMessage(XLAT("You cannot change geometry in this slide."));
|
||||
return true;
|
||||
}
|
||||
if(legal == LEGAL_UNLIMITED && sym == '1') {
|
||||
if(legal == LEGAL_UNLIMITED && NUMBERKEY == '1') {
|
||||
addMessage(XLAT("This does not work in bounded geometries."));
|
||||
return true;
|
||||
}
|
||||
if(legal == LEGAL_NONEUC && sym == '2') {
|
||||
if(legal == LEGAL_NONEUC && NUMBERKEY == '2') {
|
||||
addMessage(XLAT("This does not work in Euclidean geometry."));
|
||||
return true;
|
||||
}
|
||||
if(legal == LEGAL_HYPERBOLIC && sym != '3') {
|
||||
if(legal == LEGAL_HYPERBOLIC && NUMBERKEY != '3') {
|
||||
addMessage(XLAT("This works only in hyperbolic geometry."));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(sym == '2') {
|
||||
if(NUMBERKEY == '2') {
|
||||
dynamicval<eGeometry> g(geometry, gEuclid);
|
||||
if(cwt.at->land != laCanvas && !land_validity(cwt.at->land).quality_level) {
|
||||
addMessage(XLAT("This land has no Euclidean version."));
|
||||
@ -142,7 +142,7 @@ bool handleKeyTour(int sym, int uni) {
|
||||
}
|
||||
}
|
||||
|
||||
if(sym == '1') {
|
||||
if(NUMBERKEY == '1') {
|
||||
dynamicval<eGeometry> g(geometry, gSphere);
|
||||
if(cwt.at->land != laCanvas && !land_validity(cwt.at->land).quality_level) {
|
||||
addMessage(XLAT("This land has no spherical version."));
|
||||
@ -159,7 +159,7 @@ bool handleKeyTour(int sym, int uni) {
|
||||
|
||||
firstland = specialland = cwt.at->land;
|
||||
push_game();
|
||||
switch(sym) {
|
||||
switch(NUMBERKEY) {
|
||||
case '3':
|
||||
set_variation(eVariation::pure);
|
||||
break;
|
||||
@ -176,12 +176,12 @@ bool handleKeyTour(int sym, int uni) {
|
||||
presentation(pmGeometryStart);
|
||||
string x;
|
||||
if(slides[currentslide].flags & USE_SLIDE_NAME) {
|
||||
if(sym == '1') x = XLAT("Spherical version of %the1. ", s0 + "'" + slides[currentslide].name + "'");
|
||||
if(sym == '2') x = XLAT("Euclidean version of %the1. ", s0 + "'" + slides[currentslide].name + "'");
|
||||
if(NUMBERKEY == '1') x = XLAT("Spherical version of %the1. ", s0 + "'" + slides[currentslide].name + "'");
|
||||
if(NUMBERKEY == '2') x = XLAT("Euclidean version of %the1. ", s0 + "'" + slides[currentslide].name + "'");
|
||||
}
|
||||
else {
|
||||
if(sym == '1') x = XLAT("Spherical version of %the1. ", cwt.at->land);
|
||||
if(sym == '2') x = XLAT("Euclidean version of %the1. ", cwt.at->land);
|
||||
if(NUMBERKEY == '1') x = XLAT("Spherical version of %the1. ", cwt.at->land);
|
||||
if(NUMBERKEY == '2') x = XLAT("Euclidean version of %the1. ", cwt.at->land);
|
||||
}
|
||||
if(mousing)
|
||||
addMessage(x + XLAT("Click again to go back to your game."));
|
||||
@ -189,12 +189,12 @@ bool handleKeyTour(int sym, int uni) {
|
||||
addMessage(x + XLAT("Press %1 again to go back to your game.", dialog::keyname(sym)));
|
||||
return true;
|
||||
}
|
||||
if(sym == '3' && sphere) {
|
||||
if(NUMBERKEY == '3' && sphere) {
|
||||
if(vid.alpha < 2) vid.scale = 400, vid.alpha = 400; else vid.scale = .5, vid.alpha = 1;
|
||||
addMessage(XLAT("Changed the projection."));
|
||||
return true;
|
||||
}
|
||||
if(sym == '4') {
|
||||
if(NUMBERKEY == '4') {
|
||||
popScreenAll();
|
||||
if(items[itOrbTeleport]) goto give_aether;
|
||||
items[itOrbTeleport] = 1;
|
||||
@ -217,11 +217,11 @@ bool handleKeyTour(int sym, int uni) {
|
||||
));
|
||||
return true;
|
||||
}
|
||||
if(sym == '5') {
|
||||
if(NUMBERKEY == '5') {
|
||||
presentation(pmKey);
|
||||
return true;
|
||||
}
|
||||
if(sym == '6') {
|
||||
if(NUMBERKEY == '6') {
|
||||
sickmode = !sickmode;
|
||||
static ld spd;
|
||||
if(sickmode == true) {
|
||||
@ -234,17 +234,17 @@ bool handleKeyTour(int sym, int uni) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if(sym == '7') {
|
||||
if(NUMBERKEY == '7') {
|
||||
texts = !texts;
|
||||
if(texts) slidehelp();
|
||||
else addMessage("Help texts disabled.");
|
||||
return true;
|
||||
}
|
||||
if(sym == '8') {
|
||||
if(NUMBERKEY == '8') {
|
||||
conformal::includeHistory = !conformal::includeHistory;
|
||||
return true;
|
||||
}
|
||||
if(sym == '9') {
|
||||
if(NUMBERKEY == '9') {
|
||||
pushScreen(ss::showMenu);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user