| version 1.10, 2003/07/16 19:56:36 |
version 1.11, 2003/07/17 21:44:29 |
|
|
| /* $Platon: games/mines/mines.c,v 1.9 2003/07/16 17:30:26 nepto Exp $ */ |
/* $Platon: games/mines/mines.c,v 1.10 2003/07/16 19:56:36 nepto Exp $ */ |
| |
|
| #define PSQUARE_DYNAMIC_ALLOCATION (0) |
#define PSQUARE_DYNAMIC_ALLOCATION (0) |
| |
|
| Line 784 BYTE DoAll(void) /* {{{ */ |
|
| Line 784 BYTE DoAll(void) /* {{{ */ |
|
| } |
} |
| } |
} |
| } |
} |
| but=getmousepos(&x,&y); |
but = getmousepos(&x, &y); |
| if (!but && !sqclosed && !cmines) { |
if (!but && !sqclosed && !cmines) { |
| curr=clock()-start; |
curr = clock() - start; |
| break; |
break; |
| } /* All mines discovered */ |
} /* All mines discovered */ |
| if (cminesold != cmines) { /* Update Mines */ |
if (cminesold != cmines) { /* Update Mines */ |
| Line 854 BYTE DoAll(void) /* {{{ */ |
|
| Line 854 BYTE DoAll(void) /* {{{ */ |
|
| xold=x; |
xold=x; |
| yold=y; |
yold=y; |
| } |
} |
| if (x<nx&&y<ny&&!underinfo(x,y)){ |
if (x < nx && y < ny && ! underinfo(x, y)) { |
| if (!but){ |
if (!but){ |
| mlstant=mrstant=0; |
mlstant=mrstant=0; |
| (void)releasebutton(0,NULL,NULL); |
(void)releasebutton(0,NULL,NULL); |
| (void)releasebutton(1,NULL,NULL); |
(void)releasebutton(1,NULL,NULL); |
| } |
} |
| if ((but==2)&&!sqopen(x,y)&&mlstant!=but) { |
if (but == 2 && ! sqopen(x, y) && mlstant != but) { |
| /* Right button pressed */ |
/* Right button pressed */ |
| mlstant=but; |
mlstant=but; |
| switch (((sqmark(x,y)+(!sqmark(x,y)&&!cmines?2:1))%3)) { |
switch (((sqmark(x,y)+(!sqmark(x,y)&&!cmines?2:1))%3)) { |
| Line 871 BYTE DoAll(void) /* {{{ */ |
|
| Line 871 BYTE DoAll(void) /* {{{ */ |
|
| hidemouse(); |
hidemouse(); |
| SetSquare(x,y,1); |
SetSquare(x,y,1); |
| showmouse(); |
showmouse(); |
| } else { |
} else if (but == 1 && |
| if (but==1&&!sqopen(x,y)&&!sqpress(x,y)&&sqmark(x,y)!=1) { |
! sqopen(x, y) && ! sqpress(x, y) && sqmark(x, y) != 1) { |
| /* Left button pressed and square not pressed */ |
/* Left button pressed and square not pressed */ |
| sqpress(x,y)=YES; |
sqpress(x,y)=YES; |
| hidemouse(); |
hidemouse(); |
| SetSquare(x,y,0); |
SetSquare(x,y,0); |
| showmouse(); |
showmouse(); |
| } else { |
} else if (but == 0 && |
| if (!but && |
! sqopen(x, y) && sqpress(x, y) && sqmark(x, y) != 1) { |
| !sqopen(x,y) && sqpress(x,y) && sqmark(x,y) != 1) { |
if (first_click) { |
| if (first_click) { |
if (value(x, y) == MINE) |
| if (value(x, y) == MINE) |
SetExcludeMines(x, y); |
| SetExcludeMines(x, y); |
first_click = 0; |
| first_click = 0; |
} |
| } |
/* Left button released; Open the square */ |
| /* Left button released; Open the square */ |
if (value(x,y) == MINE) { |
| if (value(x,y) == MINE) |
sqclosed = 0xffff; |
| break; |
break; |
| hidemouse(); |
|
| OpenSquare(x,y); |
|
| showmouse(); |
|
| if (infosafe == NULL) |
|
| ShowInfo(); |
|
| /* previous info hide was done by Set Square */ |
|
| } else { |
|
| if (but==3&&sqopen(x,y)&&mrstant!=but) { |
|
| /* Open near squares */ |
|
| mrstant=but; |
|
| HideInfo(); |
|
| if (OpenNearSquares(x,y)==YES) |
|
| break; |
|
| ShowInfo(); |
|
| } |
|
| } |
|
| } |
} |
| |
hidemouse(); |
| |
OpenSquare(x,y); |
| |
showmouse(); |
| |
if (infosafe == NULL) |
| |
ShowInfo(); |
| |
/* previous info hide was done by Set Square */ |
| |
} else if (but == 3 && sqopen(x, y) && mrstant != but) { |
| |
/* Open near squares */ |
| |
mrstant=but; |
| |
HideInfo(); |
| |
if (OpenNearSquares(x,y)==YES) |
| |
break; |
| |
ShowInfo(); |
| } |
} |
| } |
} |
| } |
} |
| HideInfo(); |
HideInfo(); |
| (void)releasebutton(0,NULL,NULL); |
(void)releasebutton(0,NULL,NULL); |
| if (but!=ESC) { /* game end (not break) */ |
if (but!=ESC) { /* game end (not break) */ |
| if (sqclosed) {/* GAME LOST */ |
if (sqclosed) { /* GAME LOST */ |
| settextstyle(0,0,1); |
settextstyle(0,0,1); |
| hidemouse(); |
hidemouse(); |
| for (x=0;x<nx;x++) { |
for (x=0;x<nx;x++) { |