mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-15 03:35:47 +00:00
factored out some functions from the normal view
This commit is contained in:
parent
6cff0839fd
commit
1b61d7dc22
32
control.cpp
32
control.cpp
@ -553,6 +553,23 @@ EX array<int, 8> keys_vi = {{'l', 'n', 'j', 'b', 'h', 'y', 'k', 'u'}};
|
||||
EX array<int, 8> keys_wasd = {{'d', 'c', 'x', 'z', 'a', 'q', 'w', 'e'}};
|
||||
EX array<int, 8> keys_numpad = {{SDLK_KP6, SDLK_KP3, SDLK_KP2, SDLK_KP1, SDLK_KP4, SDLK_KP7, SDLK_KP8, SDLK_KP9}};
|
||||
|
||||
EX void handle_movement(int sym, int uni) {
|
||||
if(!(uni >= 'A' && uni <= 'Z') && DEFAULTCONTROL && !game_keys_scroll) {
|
||||
for(int i=0; i<8; i++)
|
||||
if(among(sym, keys_vi[i], keys_wasd[i], (uni >= '0' && uni <= '9' && !ISMAC) ? -1 : keys_numpad[i]))
|
||||
movepckeydir(i);
|
||||
}
|
||||
|
||||
#if ISPANDORA
|
||||
if(DEFAULTCONTROL) {
|
||||
if(sym == SDLK_RIGHT) movepckeydir(0);
|
||||
if(sym == SDLK_LEFT) movepckeydir(4);
|
||||
if(sym == SDLK_DOWN) movepckeydir(2 + (pandora_leftclick?1:0) - (pandora_rightclick?1:0));
|
||||
if(sym == SDLK_UP) movepckeydir(6 - (pandora_leftclick?1:0) + (pandora_rightclick?1:0));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EX void handleKeyNormal(int sym, int uni) {
|
||||
|
||||
if(cheater && sym < 256 && sym > 0 && !dialog::key_actions.count(uni)) {
|
||||
@ -570,20 +587,7 @@ EX void handleKeyNormal(int sym, int uni) {
|
||||
if(handleTune(sym, uni)) return;
|
||||
#endif
|
||||
|
||||
if(!(uni >= 'A' && uni <= 'Z') && DEFAULTCONTROL && !game_keys_scroll) {
|
||||
for(int i=0; i<8; i++)
|
||||
if(among(sym, keys_vi[i], keys_wasd[i], (uni >= '0' && uni <= '9' && !ISMAC) ? -1 : keys_numpad[i]))
|
||||
movepckeydir(i);
|
||||
}
|
||||
|
||||
#if ISPANDORA
|
||||
if(DEFAULTCONTROL) {
|
||||
if(sym == SDLK_RIGHT) movepckeydir(0);
|
||||
if(sym == SDLK_LEFT) movepckeydir(4);
|
||||
if(sym == SDLK_DOWN) movepckeydir(2 + (pandora_leftclick?1:0) - (pandora_rightclick?1:0));
|
||||
if(sym == SDLK_UP) movepckeydir(6 - (pandora_leftclick?1:0) + (pandora_rightclick?1:0));
|
||||
}
|
||||
#endif
|
||||
handle_movement(sym, uni);
|
||||
|
||||
#if CAP_COMPLEX2
|
||||
if(DEFAULTNOR(sym)) {
|
||||
|
25
graph.cpp
25
graph.cpp
@ -5854,6 +5854,19 @@ EX void emptyscreen() {
|
||||
EX int nohelp;
|
||||
EX bool no_find_player;
|
||||
|
||||
EX void show_menu_button() {
|
||||
if(menu_format != "")
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, eval_programmable_string(menu_format), 'v', 16);
|
||||
else if(nomenukey || ISMOBILE)
|
||||
;
|
||||
#if CAP_TOUR
|
||||
else if(tour::on)
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(ESC) tour menu"), SDLK_ESCAPE, 16);
|
||||
#endif
|
||||
else
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(v) menu"), 'v', 16);
|
||||
}
|
||||
|
||||
EX void normalscreen() {
|
||||
help = "@";
|
||||
|
||||
@ -5867,16 +5880,8 @@ EX void normalscreen() {
|
||||
cmode = sm::NORMAL | sm::DOTOUR | sm::CENTER;
|
||||
if(viewdists && show_distance_lists) cmode |= sm::SIDE | sm::MAYDARK;
|
||||
gamescreen(); drawStats();
|
||||
if(menu_format != "")
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, eval_programmable_string(menu_format), 'v', 16);
|
||||
else if(nomenukey || ISMOBILE)
|
||||
;
|
||||
#if CAP_TOUR
|
||||
else if(tour::on)
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(ESC) tour menu"), SDLK_ESCAPE, 16);
|
||||
#endif
|
||||
else
|
||||
displayButton(vid.xres-8, vid.yres-vid.fsize, XLAT("(v) menu"), 'v', 16);
|
||||
|
||||
show_menu_button();
|
||||
keyhandler = handleKeyNormal;
|
||||
|
||||
if(!playerfound && !anims::any_on() && !sphere && !no_find_player && mapeditor::drawplayer)
|
||||
|
Loading…
Reference in New Issue
Block a user