mirror of
https://github.com/abakh/nbsdgames.git
synced 2025-02-02 15:07:27 -05:00
More common controls
This commit is contained in:
parent
aaf092d106
commit
2199c6efd3
@ -267,7 +267,7 @@ void set_the_board(bool side){
|
|||||||
++px;
|
++px;
|
||||||
if( input=='\n'||input==KEY_ENTER )
|
if( input=='\n'||input==KEY_ENTER )
|
||||||
break;
|
break;
|
||||||
if( input=='q' )
|
if( (input=='q'||input==27) )
|
||||||
sigint_handler(EXIT_SUCCESS);
|
sigint_handler(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ int main(int argc,char** argv){
|
|||||||
input=getch();
|
input=getch();
|
||||||
if(input == KEY_F(1) || input=='?' )
|
if(input == KEY_F(1) || input=='?' )
|
||||||
help(turn);
|
help(turn);
|
||||||
if(input == KEY_F(2) )
|
if((input==KEY_F(2)||input=='!') )
|
||||||
gameplay(turn);
|
gameplay(turn);
|
||||||
if(input == KEY_MOUSE)
|
if(input == KEY_MOUSE)
|
||||||
mouseinput(1);
|
mouseinput(1);
|
||||||
@ -615,7 +615,7 @@ int main(int argc,char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<19)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<19)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(EXIT_SUCCESS);
|
sigint_handler(EXIT_SUCCESS);
|
||||||
if( input=='\n' || input==KEY_ENTER){
|
if( input=='\n' || input==KEY_ENTER){
|
||||||
byte r=shoot(turn,py,px-10);
|
byte r=shoot(turn,py,px-10);
|
||||||
|
@ -661,7 +661,7 @@ int main(int argc,char** argv){
|
|||||||
input=getch();
|
input=getch();
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input == KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input == KEY_MOUSE )
|
if( input == KEY_MOUSE )
|
||||||
mouseinput();
|
mouseinput();
|
||||||
@ -673,7 +673,7 @@ int main(int argc,char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<7)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<7)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q'){
|
if( (input=='q'||input==27)){
|
||||||
result=2;
|
result=2;
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ int main(int argc, char** argv){
|
|||||||
input = getch();
|
input = getch();
|
||||||
if( input==KEY_F(1) || input=='?' )
|
if( input==KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input==KEY_MOUSE )
|
if( input==KEY_MOUSE )
|
||||||
mouseinput();
|
mouseinput();
|
||||||
@ -258,7 +258,7 @@ int main(int argc, char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<size-1)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<size-1)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if(input=='\n'||input==KEY_ENTER){
|
if(input=='\n'||input==KEY_ENTER){
|
||||||
slide_multi(board,py,px);
|
slide_multi(board,py,px);
|
||||||
|
2
fisher.c
2
fisher.c
@ -353,7 +353,7 @@ int main(int argc,char** argv){
|
|||||||
}
|
}
|
||||||
if(input=='?' || input==KEY_F(1))
|
if(input=='?' || input==KEY_F(1))
|
||||||
help();
|
help();
|
||||||
if(input=='q')
|
if((input=='q'||input==27))
|
||||||
break;
|
break;
|
||||||
if(!hooknum)
|
if(!hooknum)
|
||||||
break;
|
break;
|
||||||
|
2
jewels.c
2
jewels.c
@ -319,7 +319,7 @@ int main(int argc,char** argv){
|
|||||||
getch();
|
getch();
|
||||||
halfdelay(DELAY);
|
halfdelay(DELAY);
|
||||||
}
|
}
|
||||||
else if(input=='q')
|
else if((input=='q'||input==27))
|
||||||
goto Lose;
|
goto Lose;
|
||||||
else if(input==' ')
|
else if(input==' ')
|
||||||
while( (falls=fall()) )
|
while( (falls=fall()) )
|
||||||
|
@ -220,7 +220,7 @@ int main(int argc,char** argv){
|
|||||||
input = getch();
|
input = getch();
|
||||||
if( input==KEY_F(1) || input=='?' )
|
if( input==KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input==KEY_MOUSE )
|
if( input==KEY_MOUSE )
|
||||||
mouseinput();
|
mouseinput();
|
||||||
@ -232,7 +232,7 @@ int main(int argc,char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<size2-1)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<size2-1)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if(input=='\n' || input==KEY_ENTER){
|
if(input=='\n' || input==KEY_ENTER){
|
||||||
if(fy!=-1 && board[py][px]==board[fy][fx] && !(fy==py && fx==px) )
|
if(fy!=-1 && board[py][px]==board[fy][fx] && !(fy==py && fx==px) )
|
||||||
|
@ -439,7 +439,7 @@ int main(int argc,char** argv){
|
|||||||
}
|
}
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input == KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
halfspeed=!halfspeed;
|
halfspeed=!halfspeed;
|
||||||
if( (input=='k' || (input==KEY_UP||input=='w')) ){
|
if( (input=='k' || (input==KEY_UP||input=='w')) ){
|
||||||
@ -454,7 +454,7 @@ int main(int argc,char** argv){
|
|||||||
direction=LEFT;
|
direction=LEFT;
|
||||||
else if( (input=='l' || (input==KEY_RIGHT||input=='d')) )
|
else if( (input=='l' || (input==KEY_RIGHT||input=='d')) )
|
||||||
direction=RIGHT;
|
direction=RIGHT;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if(input=='e'){
|
if(input=='e'){
|
||||||
for(int b=0;b<6;++b){
|
for(int b=0;b<6;++b){
|
||||||
|
4
mines.c
4
mines.c
@ -360,7 +360,7 @@ int main(int argc, char** argv){
|
|||||||
}
|
}
|
||||||
if( input==KEY_F(1) || input=='?' )
|
if( input==KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input==KEY_MOUSE )
|
if( input==KEY_MOUSE )
|
||||||
mouseinput(sy,sx);
|
mouseinput(sy,sx);
|
||||||
@ -372,7 +372,7 @@ int main(int argc, char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if(input=='x' && getch()=='y' && getch()=='z' && getch()=='z' && getch()=='y' ){
|
if(input=='x' && getch()=='y' && getch()=='z' && getch()=='z' && getch()=='y' ){
|
||||||
if(first_click){
|
if(first_click){
|
||||||
|
@ -353,7 +353,7 @@ int main(int argc, char** argv){
|
|||||||
input = getch();
|
input = getch();
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( (input=='k' || (input==KEY_UP||input=='w')) && py>0 ){
|
if( (input=='k' || (input==KEY_UP||input=='w')) && py>0 ){
|
||||||
direction=UP;
|
direction=UP;
|
||||||
@ -369,7 +369,7 @@ int main(int argc, char** argv){
|
|||||||
direction=RIGHT;
|
direction=RIGHT;
|
||||||
if( input=='e')
|
if( input=='e')
|
||||||
epilepsy=1;
|
epilepsy=1;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if( input=='p'){
|
if( input=='p'){
|
||||||
nocbreak();
|
nocbreak();
|
||||||
|
@ -282,7 +282,7 @@ int menu(char* entries,char* title){
|
|||||||
if(input=='\n'){
|
if(input=='\n'){
|
||||||
return chosen;
|
return chosen;
|
||||||
}
|
}
|
||||||
if(input=='q'){
|
if((input=='q'||input==27)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
goto Refresh;
|
goto Refresh;
|
||||||
|
6
pipes.c
6
pipes.c
@ -387,7 +387,7 @@ int main(int argc, char** argv){
|
|||||||
if(!flow)
|
if(!flow)
|
||||||
tstart += time(NULL)-now;
|
tstart += time(NULL)-now;
|
||||||
}
|
}
|
||||||
if( input == KEY_F(2) ){
|
if( (input==KEY_F(2)||input=='!') ){
|
||||||
gameplay();
|
gameplay();
|
||||||
if(!flow)
|
if(!flow)
|
||||||
tstart += time(NULL)-now;
|
tstart += time(NULL)-now;
|
||||||
@ -436,13 +436,13 @@ int main(int argc, char** argv){
|
|||||||
flow=1;
|
flow=1;
|
||||||
if( score < -1000)
|
if( score < -1000)
|
||||||
goto End;
|
goto End;
|
||||||
if( input=='q'){
|
if( (input=='q'||input==27)){
|
||||||
nocbreak();
|
nocbreak();
|
||||||
cbreak();
|
cbreak();
|
||||||
curs_set(1);
|
curs_set(1);
|
||||||
mvprintw(len+2,0,"Do you want to see the high scores?(y/n)");
|
mvprintw(len+2,0,"Do you want to see the high scores?(y/n)");
|
||||||
input=getch();
|
input=getch();
|
||||||
if(input == 'N' || input=='n' || input =='q')
|
if(input == 'N' || input=='n' || (input=='q'||input==27))
|
||||||
sigint_handler(EXIT_SUCCESS);
|
sigint_handler(EXIT_SUCCESS);
|
||||||
|
|
||||||
show_scores(save_score());
|
show_scores(save_score());
|
||||||
|
@ -272,7 +272,7 @@ int main(int argc,char** argv){
|
|||||||
if(sx< -(wid*2+1))
|
if(sx< -(wid*2+1))
|
||||||
sx=-(wid*2+1);
|
sx=-(wid*2+1);
|
||||||
}
|
}
|
||||||
if( input == KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
@ -284,7 +284,7 @@ int main(int argc,char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1 && (board[py][px]&RIGHT) )
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1 && (board[py][px]&RIGHT) )
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if( board[py][px] & CARROT ){
|
if( board[py][px] & CARROT ){
|
||||||
++carrots_found;
|
++carrots_found;
|
||||||
|
@ -579,7 +579,7 @@ int main(int argc,char** argv){
|
|||||||
|
|
||||||
if( input==KEY_F(1) || input=='?' )
|
if( input==KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
prey=py;
|
prey=py;
|
||||||
prex=px;
|
prex=px;
|
||||||
@ -610,7 +610,7 @@ int main(int argc,char** argv){
|
|||||||
mk_square(board);
|
mk_square(board);
|
||||||
}
|
}
|
||||||
DidntMove:
|
DidntMove:
|
||||||
if( input=='q'){
|
if( (input=='q'||input==27)){
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
}
|
}
|
||||||
if( input=='p'){
|
if( input=='p'){
|
||||||
@ -630,7 +630,7 @@ int main(int argc,char** argv){
|
|||||||
if( input=='?' || input==KEY_F(1)){
|
if( input=='?' || input==KEY_F(1)){
|
||||||
help();
|
help();
|
||||||
}
|
}
|
||||||
if( input=='!' || input==KEY_F(2)){
|
if( input=='!' || (input==KEY_F(2)||input=='!')){
|
||||||
gameplay();
|
gameplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ int main(int argc , char** argv){
|
|||||||
input=getch();
|
input=getch();
|
||||||
if( input==KEY_F(1) || input=='?' )
|
if( input==KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input==KEY_MOUSE )
|
if( input==KEY_MOUSE )
|
||||||
mouseinput();
|
mouseinput();
|
||||||
@ -407,7 +407,7 @@ int main(int argc , char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<7)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<7)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q'){
|
if( (input=='q'||input==27)){
|
||||||
resign=1;
|
resign=1;
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
@ -706,7 +706,7 @@ int main(int argc, char** argv){
|
|||||||
input = getch();
|
input = getch();
|
||||||
if( input == KEY_F(1) || input=='?' )
|
if( input == KEY_F(1) || input=='?' )
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( (input=='k' || (input==KEY_UP||input=='w')) && p.y>0 && p.direction != DOWN ){
|
if( (input=='k' || (input==KEY_UP||input=='w')) && p.y>0 && p.direction != DOWN ){
|
||||||
p.direction=UP;
|
p.direction=UP;
|
||||||
@ -720,7 +720,7 @@ int main(int argc, char** argv){
|
|||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && p.x<wid-1 && p.direction != LEFT){
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && p.x<wid-1 && p.direction != LEFT){
|
||||||
p.direction=RIGHT;
|
p.direction=RIGHT;
|
||||||
}
|
}
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if( input=='p'){
|
if( input=='p'){
|
||||||
nocbreak();
|
nocbreak();
|
||||||
|
4
sos.c
4
sos.c
@ -399,7 +399,7 @@ int main(int argc, char** argv){
|
|||||||
}
|
}
|
||||||
if( input==KEY_F(1) || input=='?')
|
if( input==KEY_F(1) || input=='?')
|
||||||
help();
|
help();
|
||||||
if( input==KEY_F(2) )
|
if( (input==KEY_F(2)||input=='!') )
|
||||||
gameplay();
|
gameplay();
|
||||||
if( input==KEY_MOUSE )
|
if( input==KEY_MOUSE )
|
||||||
mouseinput(sy,sx);
|
mouseinput(sy,sx);
|
||||||
@ -411,7 +411,7 @@ int main(int argc, char** argv){
|
|||||||
--px;
|
--px;
|
||||||
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1)
|
if( (input=='l' || (input==KEY_RIGHT||input=='d')) && px<wid-1)
|
||||||
++px;
|
++px;
|
||||||
if( input=='q')
|
if( (input=='q'||input==27))
|
||||||
sigint_handler(0);
|
sigint_handler(0);
|
||||||
if(!board[py][px] && (input=='s'||input=='S'||input=='o'||input=='O') ){
|
if(!board[py][px] && (input=='s'||input=='S'||input=='o'||input=='O') ){
|
||||||
if(input=='s'||input=='S')
|
if(input=='s'||input=='S')
|
||||||
|
4
sudoku.c
4
sudoku.c
@ -490,7 +490,7 @@ int main(int argc,char** argv){
|
|||||||
}
|
}
|
||||||
if(input == KEY_F(1))
|
if(input == KEY_F(1))
|
||||||
help();
|
help();
|
||||||
if(input == KEY_F(2))
|
if((input==KEY_F(2)||input=='!'))
|
||||||
gameplay();
|
gameplay();
|
||||||
if(input == KEY_MOUSE)
|
if(input == KEY_MOUSE)
|
||||||
mouseinput(sy,sx);
|
mouseinput(sy,sx);
|
||||||
@ -508,7 +508,7 @@ int main(int argc,char** argv){
|
|||||||
else if(input<=CHAR_MAX && sgn2int(input) && sgn2int(input)<=s )
|
else if(input<=CHAR_MAX && sgn2int(input) && sgn2int(input)<=s )
|
||||||
game[py][px]=input;
|
game[py][px]=input;
|
||||||
}
|
}
|
||||||
if( (input=='q' && size<= 5) || input=='Q')
|
if( ((input=='q'||input==27) && size<= 5) || input=='Q')
|
||||||
sigint_handler(EXIT_SUCCESS);
|
sigint_handler(EXIT_SUCCESS);
|
||||||
if(input=='n'&& size <= 4)
|
if(input=='n'&& size <= 4)
|
||||||
goto Start;
|
goto Start;
|
||||||
|
Loading…
Reference in New Issue
Block a user