TC game digling

xiaoxiao2021-03-05  23

/ * Imitation digs. 2.3 (Concise) TC version, the mouse is changed to the pop-up before responding * // * After generating the EXE file, you can run * // * July 2003 Jia Shenghua xiajia_1981@163.com/#include #include #include #include #include #include #include

Union regs regs; int size = 15; / * Used to indicate the size of each block (square side length) * / int PIX, PIY = 50; / * PIX, PIY is the offset of matrix * / char b [ 2] = "1"; / * Used to display the number of thunder around the square * / int PAN [30] [16]; / * Used to record the disk surface: 0: No, 9: There are thunder, 1 ~ 8: The number of thunder around * / int pan1 [30] [16]; / * PAN1 [] [] record current digging, 0: No operation, 1: Open, 2: Marker * / INT Tt; / * Record Time Parameters * / INT EFLAGS; / * The validity of the mouse button is used to mark the validity of the mouse button, 0: Valid, 1: Invalid, 2: This is any key of the mouse is equal to the restart * /

INT msinit (); Void Draw (int X, int y, int sizex, int sizey); Void Facedraw (int X, int y, int size, int K); Void Dead (int Sizel, Int x, int y); Void setMouse (int Xmax, int ymax, int x, int y); int MSread (int * xp, int * YP, int * BUP, STRUCT TIME T1, INT K); Void Draw1 (int x, int y); int Open (int x, int y); Float Random (); Void Have (int SUM, INT Y); void help (); void coread (); void DDRAW2 (int x, int Y);

/ * Below is the main function * / main () {int mode = VGAHI, DEVICES = VGA; / * Graphic mode initialized variable * / char AMS; / * Mouse operation marker variable * / int XMS, YMS, BMS; / * Status variables of the mouse * / INT I, J, K, K1 = 0; / * i, j, k is the cyclic variable * / int x = 9, y = 9, Flags = 0; / * x, y matrix Size * / int sum = 10; / * SUM disk's total number of thunders, is a function of x, y * / int x1 = 0, y1 = 0; / * Used to record the cursor current location * / int X11 = 0, Y11 = 0; / * Temporarily save the value of the mouse location * / int size = 10; / * The size of the face * / int cflags = 1; / * This is the menu operation flag variable, no pop-up 1, pop-up 0 * / Struct Time T1 = {0,0,0,0}; / * Time structure, header file has defined * / int co [3]; / * Temporary record history * / void far * map; / * Used to save Mouse image * / char name [3] [20]; / * Name string, used to record name * / file * p; / * file pointer for file operation * / int State [8] = {0}; / * Whether the suspension of the menu is valid * / msinit (); / * Mouse initialization * / registerbgidriver; / * If compiled, this line is wrong, shield this line * / initgraph (& Devices, & devices, " // tc // bgi "); / * Graphic mode initialization * / / * assigns memory * / if ((Map = Farmalloc (imageSize) / *) == null) / * The size of the picture is 20 * 20 * / {Printf ("Memory Ererr! / N"); Printf ("Press Any Key To Out! / N); EXIT (1);} / * Used to verify if the file is complete * / While (p = FOPEN ("OUT.XIA", "R"))) == null) / * If you cannot create a new * / {if ((p = fopen ("out.xia", "w") == null) / * If you cannot make new prompts and launched * / {printf ("THE FILE Cannot Open! / N"); Printf ("Presss any key to exit! / N"); getCH (); exit (1);} / * Write initial content * / fprintf (p, "% D% D,% S / N% S / N% S / N", 999, 999, 999, "xiajia", "xiajia", "xiajia"); fclose (p);} / * temporarily read history records.

And use CO [3] record * / fscanf (p, "% D% D,", & co [0], & co [1], & co [2]); for (i = 0; i <3; i ) Fscanf (p, "% s / n", name [i]); fclose (p); setmouse (1, 1, 1, 615, 460); / * Set the range of activity range * / PIX = 250-x * size / 2; / * Calculate the left side of the mine button matrix * / bss: b [0] = '1'; / * Game start and heavy cut points * / flags = 0; / * This variable does not seem to work, but for logic's integrity Sexual temporary retention * / k = 0; eflags = 0; tt = 0; cleardevice (); / * clear screen * / for (i = 0; i <30; i ) / * disk initialization * / {for (j = 0; j <16; j ) {PAN [i] [j] = 0; PAN1 [i] [j] = 0;}} for (;;) / * Used to generate lights on disk surface * / {i = (int) (x * random ()); j = (int)); if (PAN [i] [j] == 0) {PAN [i] [j] = 9; k = K 1;} if (k == sum) Break;} for (i = 0; i = 0 && J-1> = 0 && PAN [i-1] [J-1] == 9) PAN [I] [J] ; IF (J-1> = 0 && PAN [I] [J-1] == 9) PAN [I] [J] ; If (i 1 = 0 && PAN [i 1] [j-1] == 9) PAN [i] [j] ; if (i-1> = 0 && PAN [I-1] [J] == 9) PAN [I] [J] ; IF (i 1 = 0 && J 1

SetColor (4); Outtextxy (178, 5, "g");} / * Small * / else {if (SUM == 40) {DRAW (115, 1, 272, 307); setColor (1); Outtextxy (125, 5, "Game (g)"); setColor (4); Outtextxy (125, 5, "g");} / * * / else {if (sum == 99) {DRAW (40, 1, 470, 307); setColor (1 ); OutTextxy (45, 5, "Game (g)"); setColor (4); OutTextxy (45, 5, "g");} / * big * /}} setColor (1); / * Show prompt information * / OutTextxy (100, 350, ": Help."); SetColor (4); Outtextxy (100, 350, "H"); setColor (1); Outtextxy (200, 350, "/: exit."); SetColor (4); OutTextxy (200, 350, "Q"); Outtextxy (220, 350, "ESC"); setColor (1); OutTextxy (330, 350, ": Cores."); SetColor (4); Outtextxy (330, 350, "R"); FacedRaw (250 , 30, Sizel, 2); / * Display control button, face type * / for (i = 0; i = PIX-5 && xms <= PIX 49 &&) YMS> = 3 && yms <= 13) || AMS == 'g' || AMS == 'g') &&st [0] == 0) {State [0] = 1; SetFillStyle (1, 1) Bar (PIX-5, 3, PIX 49, 13); SetColor (7); Outtextxy (PIX-5, 5, "Game (g)");

SetColor (2); OUTTEXTXY (PIX-5, 5, "G");} else {ix ((xms PIX 49 || YMS <3 || YMS> 13) && cflags = = 1 && State [0] == 1) {State [0] = 0; SetFillStyle (1, 7); BAR (PIX-5, 3, PIX 49, 13); setColor (1); OutTextxy (PIX- 5, 5, "Game (g)"); setColor (4); OutTextxy (PIX-5, 5, "G");}}} f (((xms> = PIX-6 && xms <= PIX 85 && YMS> = 17 && YMS <28) || (AMS == 'R' || AMS == 'R')) && cflags == 0 && State [1] == 0) {State [1] = 1; SetFillStyle (1, 1); BAR (PIX-6, 17, PIX 85, 28); setColor (7); / * Show menu items * / OutTextxy (PIX-4, 19, "RESTAR (R)") SetColor (2); OUTTEXTXY (PIX-4, 19, "R");} else {IF ((xms PIX 85 || YMS <17 || yms> = 28) ) && cflags == 0 && stat [1] == 1) {State [1] = 0; setfillstyle (1, 7); bar (PIX-6, 17, PIX 85, 28); setColor (1); / * Show menu items * / Outtextxy (PIX-4, 19, "RESTAR (R)"); setColor (4); OutTextxy (PIX-4, 19, "R");}}} f (((xms> = PIX-6 && xms <= PIX 85 && YMS> = 28 && Yms <39) || (AMS == 'E' || AMS == 'e') && cflag s == 0 && State [2] == 0) {State [2] = 1; SetFillStyle (1, 1); BAR (PIX-6, 28, PIX 85, 39); setColor (7); / * The menu item * / OUTTEXTXY (PIX-4, 30, "Easy (E)"); setColor (2); OUTTEXTXY (PIX-4, 30, "E");} else {ix (((xms PIX 85 || YMS <28 || YMS> = 39) &&

CFLAGS == 0 && State [2] == 1) {State [2] = 0; SetFillStyle (1, 7); BAR (PIX-6, 28, PIX 85, 39); setColor (1); / * The menu item * / OutTextxy (PIX-4, 30, "Easy (E)") is shown below; setColor (4); OutTextxy (PIX-4, 30, "E");}} f (((xms> = PIX) -6 && xms <= PIX 85 && YMS> = 39 && YMS <50) || (AMS == 'N' || AMS == 'N')) && cflags == 0 && State [3] == 0) {State [3] = 1; SetFillStyle (1, 1); bar (PIX-6, 39, PIX 85, 50); setColor (7); / * Show menu items * / OutTextxy (PIX-4 , 41, "NOMALL (N)"); setColor (2); Outtextxy (PIX-4, 41, "N");} else {ix (((xms PIX 85 || YMS <39 || YMS> = 50) && cflags == 0 && State [3] == 1) {State [3] = 0; SetFillStyle (1, 7); BAR (PIX-6, 39, PIX 85, 50); SetColor (1); / * Show menu items * / OutTextxy (PIX-4, 41, "Nomall (N)"); setColor (4); Outtextxy (PIX-4, 41, "N" );}} = ((Xms> = pix-6 && xms <= pix 85 && yms> = 50 && yms <61) || (AMS == 'h' || AMS == 'h')) && cflags == 0 && State [4] == 0) {State [4] = 1; setfillstyle (1, 1); bar (PIX-6, 50, PIX 85, 61); SetColor (7); / * Show menu items * / Outtextxy (PIX-4, 52, "Hard (H)"); setColor (2); OutTextxy (PIX-4, 52, "H");} else { IF ((xms PIX 85 || YMS <50 || YMS> = 61) && cflags == 0 &&st [4] == 1) {State [4] = 0 SetFillStyle (1, 7); BAR (PIX-6, 50, PIX 85, 61);

SetColor (1); / * Show menu items * / OutTextxy (PIX-4, 52, "Hard (H)"); setColor (4); OutTextxy (PIX-4, 52, "H");}}}} ((xms> = PIX-6 && xms <= pix 85 && yms> = 61 && yms <72) || (AMS == 'c' || AMS == 'c')) && cflags == 0 && State [5] == 0) {State [5] = 1; SetFillStyle (1, 1); bar (PIX-6, 61, PIX 85, 72); setColor (7); / * Show the menu item below * / OutTextxy (PIX-4, 63, "Corse (c)"); setColor (2); Outtextxy (PIX-4, 63, "C");} else {ix (((xms PIX 85 || YMS <61 || YMS> = 72) && cflags == 0 && State [5] == 1) {State [5] = 0; SetFillStyle (1, 7); BAR (PIX -6, 61, PIX 85, 72); setColor (1); / * Show menu items * / OutTextxy (PIX-4, 63, "Corse (c)"); setColor (4); OutTextxy (PIX- 4, 63, "c");}}} = ((xms> = PIX-6 && xms <= pix 85 && yms> = 72 && yms <83) || (AMS == 'L' || AMS == 'L')) && cflags == 0 &&st [6] == 0) {State [6] = 1; setFillStyle (1, 1); bar (PIX-6, 72, PIX 85, 83) SetColor (7); / * Show menu items * / OutTextxy (PIX-4, 74, "Help (L)"); setColor (2); Outtextxy (PIX-4, 74, " L ");} else {ix ((xms PIX 85 || YMS <72 || YMS> = 83) && cflags == 0 && state [6] == 1) {State [6] = 0; setfillstyle (1, 7); bar (PIX-6, 72, PIX 85, 83); setColor (1); / * Show menu items below * / OutTextxy (PIX-4,74 "Help (L)"); setColor (4); OutTextxy (PIX-4, 74, "L");

}}} F ((xms> = PIX-6 && xms <= PIX 85 && yms> = 83 && yms <94) || AMS == 'q' || AMS == 'q' || AMS == 27) && cflags == 0 && State [7] == 0) {State [7] = 1; SetFillStyle (1, 1); bar (PIX-6, 83, PIX 85, 94); setColor (7) ; / * Show menu items * / Outtextxy (PIX-4, 85, "Quit (Q)"); setColor (2); Outtextxy (PIX-4, 85, "Q");} else {ix XMS PIX 85 || YMS <83 || YMS> = 94) && cflags == 0 && State [7] == 1) {State [7] = 0; SetFillStyle (1 , 7); BAR (PIX-6, 83, PIX 85, 94); SetColor (1); / * Show menu items * / OutTextxy (PIX-4, 85, "Quit (Q)"); setColor 4); OUTTEXTXY (PIX-4, 85, "Q");}} / * Here you insert menu operation * / if ((xms> = PIX-5 && xms <= PIX 49 && yms> = 3 && yms < = 13 && BMS == 1) || AMS == 'g' || AMS == 'g') / * Decision of the menu * / {DRAW (PIX-10, 14, 100, 88); / * Painting menu * / Cflags = 0; setColor (1); / * Display menu item * / Outtextxy (PIX-4, 19, "RESTAR (R)"); setColor (4); Outtextxy (PIX-4, 19, "R "); SetColor (1); / * Show menu items * / OUTTEXTXY (PIX-4, 30," Easy (E) "); setColor (4); Outtextxy (PIX-4, 30, "e"); setColor (1); / * Show menu items * / Outtextxy (PIX-4, 41, "Nomall (N)"); setColor (4); Outtextxy (PIX-4, 41, " N "); setColor (1); / * Show menu items * / Outtextxy (PIX-4, 52," Hard (H) "); setColor (4); OutTextxy (PIX-4, 52," H ") SetColor (1); / * Show menu items * / OutTextxy (PIX-4, 63, "Corse (C)"); setColor (4);

Outtextxy (PIX-4, 63, "C"); setColor (1); / * Show menu items * / Outtextxy (PIX-4, 74, "Help (L)"); setColor (4); Outtextxy (PIX -4, 74, "L"); setColor (1); / * Show menu items * / Outtextxy (PIX-4, 85, "Quit (Q)"); setColor (4); Outtextxy (PIX-4, 85, "q"); bms = 0;} / * Drawing * / / * Here is the content of the mouse control to join * / if (EFLAGS == 2 && (BMS! = 0 | AMS ! = - 1)) {GOTO BSS;} / * The function of the menu is implemented, each responding to a menu item * / if (cflags == 0) {IF ((xms> = PIX-6 && xms <= PIX 85 && Yms> = 17 && YMS <28 && BMS == 1) || (AMS == 'R' || AMS == 'R')) / * The following response menu in the next * / {cflags = 1; GOTO BSS;} else {IF ((xms> = PIX-6 && xms <= PIX 85 && Yms> = 28 && yms <39 && bms == 1) || AMS == 'e' || AMS == 'E') {cflags = 1; x = 9; y = 9; sum = 10; PIX = 250-x * size / 2; goto bss;} else {= ((xms> = PIX-6 && xms <= PIX 85 && YMS> = 39 && YMS <50 && BMS == 1) || AMS == 'N' || AMS == 'N') {cflags = 1; x = 16; y = 16; SUM = 40; PIX = 250-x * size / 2; goto bss; } Else {IF ((xms> = PIX-6 && xms <= PIX 85 && Yms> = 50 && yms <61 && bms == 1) || AMS == 'h' || AMS == 'h' ) {Cflags = 1; x = 30; y = 16; SUM = 99; PIX =

250-x * size / 2 25; goto bss;} else {ix ((xms> = PIX-6 && xms <= pix 85 && yms> = 61 && yms <72 && bms == 1) || AMS == 'c' || AMS == 'c') {cflags = 1; coread ();} else {IF ((xms> = PIX-6 && xms <= PIX 85 && yms> = 72 && yms < 83 && BMS == 1) || AMS == 'L' || AMS == 'L') {cflags = 1; Help ();} else {ix ((xms> = PIX-6 && xms <= PIX 85 && yms> = 83 && yms <94 && bms == 1) || AMS == 'q' || AMS == 'q' || AMS == 27) {cflags = 1; fclose (P); Closegraph (); farfree (map); exit (1);} else {if (bms! = 0) {cflags = 1; goto bss;}}}}}}}}}}}}}}} / * End menu function * / / * Re-start * / if (cflags! = 0 && xms> = 250-sizel-2 && xms> = 30-sizel 2 && xms <= 250 sizel 2 && yms <= 30 Sizel 2 && BMS == 1) {Goto BSS;} if (EFLAGS == 0 && CFLAGS! = 0 && xms-Pix> = 0 && xms-piy> = 0 && xms

0) / * K This judgment is the first press .0: No time, 1: Start timing * / {getTime (& t1); k = 1;} if (PAN [x1] [Y1]! = 9) {DRAW1 (X1, Y1); Open (x, y);} else {dead (sizel, x, y); k = 0;}} IF (AMS == - 1 && BMS == 2 && PAN1 [x1] [Y1] == 0) / * Click the right mouse button * / {Delay (100); setColor (0); circle (x1 * size pix 7, y1 * size piy 7, 4); PAN1 [x1 ] [Y1] = 2; Have (SUM, PIX 20, 30, X, Y); Else {IF (AMS == - 1 && BMS == 2 && PAN1 [x1] [Y1] == 2) / * Click Right-click * / {Delay (100); DRAW (x1 * size pix, y1 * size piy, size, size); PAN1 [X1] [Y1] = 0; Have (SUM, PIX 20, 30, x, y);} / * equivalent to the mouse right - click * /} if (AMS == - 1 && BMS == 3 && PAN1 [x1] [Y1] == 1) {/ * equivalent to double-click, Validity judgment * / i = 0; if (x1-1> = 0 && y1-1> = 0 && PAN1 [x1-1] [Y1-1] == 2) i ; if (Y1-1> = 0 && PAN1 [x1] [Y1-1] == 2) i ; if (x1 1 = 0 && PAN1 [x1 1] [Y1-1] == 2) i ; IF ( X1-1> = 0 && PAN1 [x1-1] [Y1] == 2) i ; if (x1 1 = 0 && y1 1 = 0 && Y1-1> = 0 && PAN1 [x1-1] [Y1-1]! =

2) {IF (PAN [X1-1] [Y1-1]! = 9) DRAW1 (X1-1, Y1-1); Else {DEAD (Sizel, X, Y); K = 0;}} IF Y1-1> = 0 && PAN1 [x1] [Y1-1]! = 2) {IF (PAN [X1] [Y1-1]! = 9) DRAW1 (X1, Y1-1); Else {dead (Sizel , x, y); k = 0;}} f (x1 1 = 0 && PAN1 [x1 1] [Y1-1]! = 2) {IF (PAN [x1 1 ] [Y1-1]! = 9) DRAW1 (x1 1, y1-1); else {dead (sizel, x, y); k = 0;}} IF (x1-1> = 0 && pan1 [x1 -1] [Y1]! = 2) {IF (PAN [X1-1] [Y1]! = 9) DRAW1 (X1-1, Y1); Else {DEAD (Sizel, X, Y); k = 0; }}} F (x1 1] [Y1]! = 2) {IF (PAN [x1 1] [Y1]! = 9) DRAW1 (x1 1, y1); else { DEAD (Sizel, X, Y); K = 0;}} IF (x1-1> = 0 && Y1 1

I

} / * Exit the unique outlet * / if (AMS == 'c' || AMS == 'c') goto bss; / * back * / if (AMS == 'h' || AMS == 'H') {HELP (); k = 0;} / * Help document * / if (AMS == 'R' || AMS == 'r') {coread (); k = 0;} / * Grade * / GetImage (XMS, YMS, XMS 20, YMS 20, MAP); DDRAW2 (XMS, YMS); DELAY (10);} / * End the dead cycle of the mouse loop * /} / * Main Function End * // * This function is used to implement the initialization of the mouse * / int msinit () {int record; regs.x.ax = 0; int86 (0x33 , & regs, & regs); Recored = regs.x.ax; if (record == 0) {Printf ("Mouse Not Found or Mouse Driver Not Installed./N"); Return 0;} else return reclaim;}

/ * Below this subroutine is to complete a button * / void draw (int x, int y, int sizex, int sizey) / * x, y is the upper left corner coordinate SIZEX, SIZEY is long and width * / {Int Siz = SIZEX-1; int SIZY = SizeY-1; setColor (15); / * Best use of white * / line (x, y, x sizx-1, y); line (x, y 1, x SIZX-2, Y 1); LINE (X, Y, X, Y Sizy-1); line (x 1, y, x 1, y sizy-2); setColor (8); / * It is best to use deep gray * / line (x 1, y sizy, x sizx, y sizy); line (x 2, y sizy-1, x sizx, y sizy-1); LINE (x siz-1, y 1, x sizx-1, y sizy); line (x sizx, y 2, x sizx, y sizy); setColor (7); / * Here It is best to use gray * / putpixel (x, y sizy, 3); PUTPIEL (X 1, Y SIZY-1, 3); PUTPIEL (X SizX, Y, 3); PUTPIXEL (X SIZX-1 , y 1, 3); setfillstyle (1, 7); / * It is best to use gray, set fill mode * / bar (x 2, y 2, x sizx-2, y sizy-2) }

/ * Below is some painting programs * // * Guan X, Y smile center coordinates, Sizel face size (radius), K is the face to describe, 1: cry, 2: usual, 3: laugh * / void FaceDraw (int X, int y, int size, int K) {DRAW (X-Sizel-3, Y-Sizel-3, 2 * (Sizel 4), 2 * (Sizel 4)); / * Painting one Button * / setColor (14); setfillstyle (1, 14); piemelice (x, y, 0, 360, size); / * Draw a yellow round surface * / setFillStyle (1, 0); setColor (0); IF (k == 1) / * failed * / {line (X-Sizel * 7/20, Y-Sizel * 7/20, X-Sizel * 3/20, Y-Sizel * 3/20); / * Draw two differences expressing eyes * / line (X-Sizel * 7/20, Y-Sizel * 3/20, X-Sizel * 7/20, Y-Sizel * 7/20); line (x sizel * 3 / 20, Y-Sizel * 7/20, X Sizel * 7/20, Y-Sizel * 3/20); LINE (X Sizel * 3/20, Y-Sizel * 3/20, x Sizel * 7/20, Y-Sizel * 7/20); ARC (X, Y Sizel, 20, 160, Sizel / 2);} IF (k == 2) / * Zimei * / {BAR (X-Sizel * 7 / 20, Y-Sizel * 7/20, X-Sizel * 3/20, Y-Sizel * 3/20); BAR (x Sizel * 3/20, Y-Sizel * 7/20, X Sizel * 7 / 20, Y-Sizel * 3/20); Arc (x, y, 200, 340, sizel * 3/4);} if (k == 3) / * success * / {bar (x-sizel / 2, y -Sizel / 2, X-Sizel * 3/20, Y-Sizel * 3/20); BAR (x Sizel * 3/20, Y-Sizel / 2, X Sizel / 2, Y-Sizel * 3 / 20); line (X-Sizel * 3/20, Y-Sizel / 2, X Sizel * 3/20, Y-Sizel / 2); line (X-Sizel / 2, Y-Sizel * 5/20, X-Sizel, Y); LINE (X Sizel / 2, Y-Sizel * 5/20, X Sizel, y); Arc (x, y, 200, 340, sizel * 3/4); / * mouth * /}} / * Death processing program * // * x, y to judge the coordinate of the point, Sizel is Face size * / void dead (int size, int x, int y) {INT I, J; / * cycle variable * / setColor (4); for (i = 0; i

/ * The following function is used to implement the mobile range of the mouse * // * Xmax, Ymax is the size X, Y matrix of the upper left corner * / void setmouse (int Xmax, int ymax, int x, int y) {int x, int y) {int x LEFT, RIGHT, TOP, Buttom; / * These four variables are used to determine the left upper corner and lower right corner * / left = xmax; Right = x; TOP = YMAX; button = Y; regs.x.ax = 7; Regs.x.cx = left; regs.x.dx = right; int86 (0x33, & regs, & regs); regs.x.ax = 8; regs.x.cx = top; regs.x.dx = budtom; int86 (0x33, & regs, & regs);} / * The following function is used to implement the read of the mouse * // * XP, YP, BUP is the position and button case of the mouse, respectively, T1, K is the time real parameters, T1 begins Time, k is the start mark * / int msread (int * xp, int * yp, int *) {INT X0 = * XP, Y0 = * YP, BU0 = 0, bu1 = 0; INT XNEW, YNEW, CH; INT TT1 = 0; / * Used to recording time difference * / struct time T2; char TTT [4] = "000"; * BUP = 0; do {IF (kbhit ()) return getCH ); Regs.x.ax = 3; INT86 (0x33, & regs, & regs); xnew = regs.x.cx; ynew = regs.x.dx; bu 0 = regs.x.bx; if (bu 0! = 0) BU1 = BU0; / * The following is used for display time * / if (k == 1) / * If the time difference is calculated * / {GetTime (& T2); TT1 = (t2.ti_Hour-t1.ti_Hour) * 3600 (t2.ti_min- t1.ti_min) * 60 t2.ti_sec - t1.ti_sec; / * to improve * / if (tt1 <= 999 && tt! = tt1) / * When there is a change in time, it is displayed * / {TT = TT1; TTT [0] = (TT-TT% 100) / 100 48; TTT [1] = (TT% 100-TT% 10) / 10 48; TTT [2] = TT% 10 48; SetFillStyle (1, 0); BAR (460-PIX, 25, 490-PIX, 40); SetColor (4); Outtextxy (465-PIX, 30, TTT);}}} (BU0 == 0 && Bu1! = 0) * BUP = BU1; if (bu1 == 3) * BUP = 3;} while (xnew == x0 && ynew == y0 && * bup == 0); * xp = xnew; * yp = ynew; return -1; / * Keyboard is not input when it returns -1, followed by the keyboard value * /}

Void Draw1 (int x, int y) / * This function is used to depict the case after X, Y, * / {setFillStyle (1, 7); bar (x * size pix, y * size piy, X * Size Size PIX-1, Y * Size Size PIY-1); / * Painted on four corners * / / * Putpixel (X * Size PIX, Y * Size PIY, 8); PUTPIEL (X * Size Size PIX-1, Y * Size Size PIY-1, 8); PUTPIXEL (X * Size PIX, Y * Size Size PIY-1, 8); PUTPIXEL (x * size size pix-1, y * size piy, 8); * / setColor (8); setLinesTyle (1, 0, 1); Rectangle (x * size pix, y * size piy, X * Size Size PIX-1, Y * Size Size Piy-1); SetLinesTyle (0, 0, 1); if (PAN [x] [Y]! = 0) / * If there is no thunder, do not do Display * / {b [0] = PAN [x] [y] 48; if (PAN [x] [y]! = 7) / * Prevent color and background color of the word * / setColor (PAN [x] [Y]); Else setColor (9); Outtextxy (x * size pix 3, y * size piy 3, b);} PAN1 [x] [y] = 1; / * in PAN1 [] [ ]] 中 情况 情况 * /}

/ * The purpose of the auto-open function * / int open (int x, int y) / * function is introduced to increase the efficiency of auto-opening, but it is still inadequate * / {INT I, J, K; int PAN2 [30] [16] = {0}; / * pan2 [] [], the auto-record disk is available, 0 is not available, 1: I have already opened (30 is dangerous in danger Question !!!) * / for (;;) {k = 0; / * is a marker variable * / for (i = 0; i = 0 && J -1> = 0 && PAN1 [i-1] [j-1] == 0) DRAW1 (i-1, j-1); / * Left level * / if (j-1> = 0 && PAN1 [i ] [J-1] == 0) DRAW1 (i, j-1); / * Above * / if (i 1 = 0 && PAN1 [i 1] [J-1] == 0) DRAW1 (i 1, j-1); / * upper right * / if (i-1> = 0 && PAN1 [i-1] [j] == 0) DRAW1 (I-1, J ); / * Left * / if (i 1 = 0 && J 1

/ * Below is a function of displaying the remaining mine * / void Have (int SUM, INT X, INT Y, INT XX, INT YY) / * The total number of thunders in the game cannot be more than 99, SUM is the total number of thunder , x, y is displayed * / {INT I, J, K = 0; char A [3] = "1"; for (i = 0; i

Void coreAd () / * This function is used to read records and display * / {int Co [3], i; char name [3] [20]; char CCO [3] [4]; file * p; for i = 0; i <3; i ) CCO [I] [3] = '/ 0'; if ((p = fopen ("out.xia", "RB")) == null) {printf ("the File cannot open! / n "); exit (1);} fscanf (p,"% D% D, ", & co [0], & co [1], & co [2]); for (i = 0 i <3; i ) fscanf (p, "% s / n", name [i]); fclose (p); DRAW (10, 20, 320, 90); setColor (1); OutTextxy (140, 30, " Highcore "); setColor (2); Outtextxy (20, 50," Easy "); Outtextxy (20, 60," Normal "); Outtextxy (20, 70," hard "); for (i = 0; i < 3; i ) {CCO [I] [0] = (CO [i] -CO [I]% 100) / 100 48; CCO [I] [1] = (CO [i]% 100-CO [i ]% 10) / 10 48; CCO [I] [2] = CO [i]% 10 48;} setColor (3); Outtextxy (100, 50, cco [0]); OutTextxy (100, 60, CCO [1]); OUTTEXTXY (100, 70, CCO [2]); setColor (5); Outtextxy (150, 50, Name [0]); OutTextxy (150, 60, Name [1]); OutTextxy (150 , 70, Name [2]); setColor (9); Outtextxy (30, 85, "Press any key to play again."); Eflags = 2;} / * This function is used to paint the mouse cursor, X, Y, For the upper left corner coordinate, the size is 20 * 20 * / void DDRAW2 (int x, int y) {/ * This place temporarily uses the simple cursor, and the program is mature after using complex * / setcolor (1); line (x, y, X, Y 18); line (x 1, y, x 1, y 18); Lin e (x, y, x 12, y 12); line (x 1, y, x 13, y 12); line (x, y 18, x 4, y 14); line (x, y 17, x 4, y 13); line (x 4, y 14, x 6, y 20); line (x 4, y 13, x 6, y 19); LINE (x 6, y 20, x 10, y 18); line (x 6, y 19, x 10, y 17); line (x 10, y 18, x 8, y 12); line (x 10, y 17, x 8, y 11); line (x 8, y 12, x 12, y 12); line (x 8, y 11, x 12, y 11);

转载请注明原文地址:https://www.9cbs.com/read-35880.html

New Post(0)