|
@@ -10,16 +10,16 @@
|
|
|
#include "../helpers/flipchess_voice.h"
|
|
#include "../helpers/flipchess_voice.h"
|
|
|
#include "../helpers/flipchess_haptic.h"
|
|
#include "../helpers/flipchess_haptic.h"
|
|
|
|
|
|
|
|
-#define SCL_960_CASTLING 0 // setting to 1 compiles a 960 version of smolchess
|
|
|
|
|
-#define XBOARD_DEBUG 0 // will create files with xboard communication
|
|
|
|
|
|
|
+#define SCL_960_CASTLING 0 // setting to 1 compiles a 960 version of smolchess
|
|
|
|
|
+#define XBOARD_DEBUG 0 // will create files with xboard communication
|
|
|
#define SCL_EVALUATION_FUNCTION SCL_boardEvaluateStatic
|
|
#define SCL_EVALUATION_FUNCTION SCL_boardEvaluateStatic
|
|
|
-#define SCL_DEBUG_AI 0
|
|
|
|
|
|
|
+#define SCL_DEBUG_AI 0
|
|
|
|
|
|
|
|
#include "../chess/smallchesslib.h"
|
|
#include "../chess/smallchesslib.h"
|
|
|
|
|
|
|
|
-#define ENABLE_960 0 // setting to 1 enables 960 chess
|
|
|
|
|
-#define MAX_TEXT_LEN 15 // 15 = max length of text
|
|
|
|
|
-#define MAX_TEXT_BUF (MAX_TEXT_LEN + 1) // max length of text + null terminator
|
|
|
|
|
|
|
+#define ENABLE_960 0 // setting to 1 enables 960 chess
|
|
|
|
|
+#define MAX_TEXT_LEN 15 // 15 = max length of text
|
|
|
|
|
+#define MAX_TEXT_BUF (MAX_TEXT_LEN + 1) // max length of text + null terminator
|
|
|
#define THREAD_WAIT_TIME 20 // time to wait for draw thread to finish
|
|
#define THREAD_WAIT_TIME 20 // time to wait for draw thread to finish
|
|
|
|
|
|
|
|
struct FlipChessScene1 {
|
|
struct FlipChessScene1 {
|
|
@@ -231,15 +231,14 @@ uint8_t flipchess_turn(FlipChessScene1Model* model) {
|
|
|
// Color check before allowing piece selection
|
|
// Color check before allowing piece selection
|
|
|
char piece = model->game.board[model->squareSelected];
|
|
char piece = model->game.board[model->squareSelected];
|
|
|
if(piece != '.' &&
|
|
if(piece != '.' &&
|
|
|
- SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
|
|
|
|
|
|
|
+ SCL_pieceIsWhite(piece) == SCL_boardWhitesTurn(model->game.board)) {
|
|
|
model->squareFrom = model->squareSelected;
|
|
model->squareFrom = model->squareSelected;
|
|
|
model->turnState = 1;
|
|
model->turnState = 1;
|
|
|
}
|
|
}
|
|
|
} else if(model->turnState == 1 && model->squareSelected != 255) {
|
|
} else if(model->turnState == 1 && model->squareSelected != 255) {
|
|
|
// Validate before executing
|
|
// Validate before executing
|
|
|
- if(SCL_boardMoveIsLegal(model->game.board,
|
|
|
|
|
- model->squareFrom,
|
|
|
|
|
- model->squareSelected)) {
|
|
|
|
|
|
|
+ if(SCL_boardMoveIsLegal(
|
|
|
|
|
+ model->game.board, model->squareFrom, model->squareSelected)) {
|
|
|
model->squareTo = model->squareSelected;
|
|
model->squareTo = model->squareSelected;
|
|
|
model->turnState = 2;
|
|
model->turnState = 2;
|
|
|
model->squareSelectedLast = model->squareSelected;
|
|
model->squareSelectedLast = model->squareSelected;
|
|
@@ -665,8 +664,7 @@ void flipchess_scene_1_exit(void* context) {
|
|
|
furi_assert(context);
|
|
furi_assert(context);
|
|
|
FlipChessScene1* instance = (FlipChessScene1*)context;
|
|
FlipChessScene1* instance = (FlipChessScene1*)context;
|
|
|
|
|
|
|
|
- with_view_model(
|
|
|
|
|
- instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
|
|
|
|
|
|
|
+ with_view_model(instance->view, FlipChessScene1Model * model, { model->paramExit = 0; }, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void flipchess_scene_1_enter(void* context) {
|
|
void flipchess_scene_1_enter(void* context) {
|
|
@@ -727,8 +725,7 @@ FlipChessScene1* flipchess_scene_1_alloc() {
|
|
|
void flipchess_scene_1_free(FlipChessScene1* instance) {
|
|
void flipchess_scene_1_free(FlipChessScene1* instance) {
|
|
|
furi_assert(instance);
|
|
furi_assert(instance);
|
|
|
|
|
|
|
|
- with_view_model(
|
|
|
|
|
- instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);
|
|
|
|
|
|
|
+ with_view_model(instance->view, FlipChessScene1Model * model, { UNUSED(model); }, true);
|
|
|
|
|
|
|
|
view_free(instance->view);
|
|
view_free(instance->view);
|
|
|
free(instance);
|
|
free(instance);
|
|
@@ -737,4 +734,4 @@ void flipchess_scene_1_free(FlipChessScene1* instance) {
|
|
|
View* flipchess_scene_1_get_view(FlipChessScene1* instance) {
|
|
View* flipchess_scene_1_get_view(FlipChessScene1* instance) {
|
|
|
furi_assert(instance);
|
|
furi_assert(instance);
|
|
|
return instance->view;
|
|
return instance->view;
|
|
|
-}
|
|
|
|
|
|
|
+}
|