#include #include #include "minefield.h" #include "fonctionUtile.h" #include "number.h" #include "game.h" #include "menu.h" bool Is_win (int** tab, eTypeAction** tab_act, int height, int lenght) { int i; int j; for ( i=0 ; i3) pos_cursor.y-=6; if (keydown(37) && (pos_cursor.y+14)/163) pos_cursor.x-=6; if (keydown(48)) { newgame_choosen = Menu(&minef); Bdisp_AllClr_VRAM(); } if (!game_win && !game_over) { if (keydown(78)) { Display_clicked_field(minefield_action, pos_cursor.x/16, pos_cursor.y/16, scrolling); left_mouse_clicked = true; smiley = tension; } else if (!keydown(78) && left_mouse_clicked) //78 isn't clicked anymore { if (!map_generated) { Generate_minefield(minefield, height, lenght, number_mines,pos_cursor.x/16,pos_cursor.y/16); time_start = RTC_GetTicks(); map_generated = true; } Select_rec (minefield,minefield_action,height,lenght,pos_cursor.x/16, pos_cursor.y/16); left_mouse_clicked = false; if (minefield[pos_cursor.y/16][pos_cursor.x/16]==-1) //hit the mine { game_over = true; minefield_action[pos_cursor.y/16][pos_cursor.x/16]=clicked_on_mine; } else smiley = happy; } if (keydown(77) && minefield_action[pos_cursor.y/16][pos_cursor.x/16] == none) { right_mouse_clicked = true; } else if (!keydown(77) && right_mouse_clicked && minefield_action[pos_cursor.y/16][pos_cursor.x/16] == none) { minefield_action[pos_cursor.y/16][pos_cursor.x/16] = flaged; right_mouse_clicked = false; number_flag++; } else if (keydown(77) && minefield_action[pos_cursor.y/16][pos_cursor.x/16] == flaged) { right_mouse_clicked = true; } else if (!keydown(77) && right_mouse_clicked && minefield_action[pos_cursor.y/16][pos_cursor.x/16] == flaged) { minefield_action[pos_cursor.y/16][pos_cursor.x/16] = none; right_mouse_clicked = false; number_flag--; } } if (game_win) smiley = win; if (game_over) smiley = dead; if (game_over || game_win) Sole_minefield(minefield,minefield_action, height, lenght, smiley ); Display_number(scrolling,height,lenght,(map_generated?(time_actual-time_start)/126:0),number_mines-number_flag); Display_smiley(scrolling,height,lenght,smiley); Display_cursor (pos_cursor.x,pos_cursor.y,scrolling); Bdisp_PutDisp_DD(); }while(!keydown(47) && !newgame_choosen); Bdisp_AllClr_VRAM(); Free_tab2dim_eTypeAction(minefield_action, height, lenght); Free_tab2dim_int(minefield, height, lenght); }while(!keydown(47)); return game; }