|
|
@ -4,6 +4,8 @@
|
|
|
|
#include <input/input.h>
|
|
|
|
#include <input/input.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <notification/notification_messages.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include "assets.h"
|
|
|
|
#include "assets.h"
|
|
|
|
|
|
|
|
|
|
|
|
#define PLAYFIELD_WIDTH 16
|
|
|
|
#define PLAYFIELD_WIDTH 16
|
|
|
@ -209,6 +211,13 @@ static void place_flag(Minesweeper* minesweeper_state) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void game_lost() {
|
|
|
|
|
|
|
|
NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
|
|
|
|
|
|
|
|
notification_message(notifications, &sequence_set_vibro_on);
|
|
|
|
|
|
|
|
furi_delay_ms(200);
|
|
|
|
|
|
|
|
notification_message(notifications, &sequence_reset_vibro);
|
|
|
|
|
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y) {
|
|
|
|
static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y) {
|
|
|
|
if (minesweeper_state->playfield[cursor_x][cursor_y] != TileTypeUncleared) {
|
|
|
|
if (minesweeper_state->playfield[cursor_x][cursor_y] != TileTypeUncleared) {
|
|
|
@ -217,6 +226,8 @@ static void play_move(Minesweeper* minesweeper_state, int cursor_x, int cursor_y
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (minesweeper_state->minefield[cursor_x][cursor_y] == FieldMine) {
|
|
|
|
if (minesweeper_state->minefield[cursor_x][cursor_y] == FieldMine) {
|
|
|
|
// TODO: player loses!
|
|
|
|
// TODO: player loses!
|
|
|
|
|
|
|
|
minesweeper_state->playfield[cursor_x][cursor_y] = TileTypeMine;
|
|
|
|
|
|
|
|
game_lost();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// get number of surrounding mines.
|
|
|
|
// get number of surrounding mines.
|
|
|
|