From 2199c6efd36e84b90086600ff5c10b7ba9f58fee Mon Sep 17 00:00:00 2001 From: me Date: Wed, 2 Feb 2022 16:09:13 +0330 Subject: [PATCH] More common controls --- battleship.c | 6 +++--- checkers.c | 4 ++-- fifteen.c | 4 ++-- fisher.c | 2 +- jewels.c | 2 +- memoblocks.c | 4 ++-- miketron.c | 4 ++-- mines.c | 4 ++-- muncher.c | 4 ++-- nbsdgames.c | 2 +- pipes.c | 6 +++--- rabbithole.c | 4 ++-- redsquare.c | 6 +++--- reversi.c | 4 ++-- snakeduel.c | 4 ++-- sos.c | 4 ++-- sudoku.c | 4 ++-- 17 files changed, 34 insertions(+), 34 deletions(-) diff --git a/battleship.c b/battleship.c index 67e66f2..e900b19 100644 --- a/battleship.c +++ b/battleship.c @@ -267,7 +267,7 @@ void set_the_board(bool side){ ++px; if( input=='\n'||input==KEY_ENTER ) break; - if( input=='q' ) + if( (input=='q'||input==27) ) sigint_handler(EXIT_SUCCESS); } @@ -603,7 +603,7 @@ int main(int argc,char** argv){ input=getch(); if(input == KEY_F(1) || input=='?' ) help(turn); - if(input == KEY_F(2) ) + if((input==KEY_F(2)||input=='!') ) gameplay(turn); if(input == KEY_MOUSE) mouseinput(1); @@ -615,7 +615,7 @@ int main(int argc,char** argv){ --px; if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<19) ++px; - if( input=='q') + if( (input=='q'||input==27)) sigint_handler(EXIT_SUCCESS); if( input=='\n' || input==KEY_ENTER){ byte r=shoot(turn,py,px-10); diff --git a/checkers.c b/checkers.c index a90e7d3..f6d283e 100644 --- a/checkers.c +++ b/checkers.c @@ -661,7 +661,7 @@ int main(int argc,char** argv){ input=getch(); if( input == KEY_F(1) || input=='?' ) help(); - if( input == KEY_F(2) ) + if( (input==KEY_F(2)||input=='!') ) gameplay(); if( input == KEY_MOUSE ) mouseinput(); @@ -673,7 +673,7 @@ int main(int argc,char** argv){ --px; if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<7) ++px; - if( input=='q'){ + if( (input=='q'||input==27)){ result=2; goto End; } diff --git a/fifteen.c b/fifteen.c index 6d21e3e..8572210 100644 --- a/fifteen.c +++ b/fifteen.c @@ -246,7 +246,7 @@ int main(int argc, char** argv){ input = getch(); if( input==KEY_F(1) || input=='?' ) help(); - if( input==KEY_F(2) ) + if( (input==KEY_F(2)||input=='!') ) gameplay(); if( input==KEY_MOUSE ) mouseinput(); @@ -258,7 +258,7 @@ int main(int argc, char** argv){ --px; if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px0 ){ direction=UP; @@ -369,7 +369,7 @@ int main(int argc, char** argv){ direction=RIGHT; if( input=='e') epilepsy=1; - if( input=='q') + if( (input=='q'||input==27)) sigint_handler(0); if( input=='p'){ nocbreak(); diff --git a/nbsdgames.c b/nbsdgames.c index d212fb1..1877e71 100644 --- a/nbsdgames.c +++ b/nbsdgames.c @@ -282,7 +282,7 @@ int menu(char* entries,char* title){ if(input=='\n'){ return chosen; } - if(input=='q'){ + if((input=='q'||input==27)){ return -1; } goto Refresh; diff --git a/pipes.c b/pipes.c index d6ec4e6..1021016 100644 --- a/pipes.c +++ b/pipes.c @@ -387,7 +387,7 @@ int main(int argc, char** argv){ if(!flow) tstart += time(NULL)-now; } - if( input == KEY_F(2) ){ + if( (input==KEY_F(2)||input=='!') ){ gameplay(); if(!flow) tstart += time(NULL)-now; @@ -436,13 +436,13 @@ int main(int argc, char** argv){ flow=1; if( score < -1000) goto End; - if( input=='q'){ + if( (input=='q'||input==27)){ nocbreak(); cbreak(); curs_set(1); mvprintw(len+2,0,"Do you want to see the high scores?(y/n)"); input=getch(); - if(input == 'N' || input=='n' || input =='q') + if(input == 'N' || input=='n' || (input=='q'||input==27)) sigint_handler(EXIT_SUCCESS); show_scores(save_score()); diff --git a/rabbithole.c b/rabbithole.c index df6c7c3..018fb77 100644 --- a/rabbithole.c +++ b/rabbithole.c @@ -272,7 +272,7 @@ int main(int argc,char** argv){ if(sx< -(wid*2+1)) sx=-(wid*2+1); } - if( input == KEY_F(2) ) + if( (input==KEY_F(2)||input=='!') ) gameplay(); if( input == KEY_F(1) || input=='?' ) help(); @@ -284,7 +284,7 @@ int main(int argc,char** argv){ --px; if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px0 && p.direction != DOWN ){ p.direction=UP; @@ -720,7 +720,7 @@ int main(int argc, char** argv){ if( (input=='l' || (input==KEY_RIGHT||input=='d')) && p.x