{
int x, y;
Boolean saveAnimate;
- static int second = 0, promotionChoice = 0, clearFlag = 0, sweepSelecting = 0;
+ static int second = 0, promotionChoice = 0, clearFlag = 0, sweepSelecting = 0, flashing = 0, saveFlash;
char promoChoice = NULLCHAR;
ChessSquare piece;
static TimeMark lastClickTime, prevClickTime;
+ if(flashing) return;
+
x = EventToSquare(xPix, BOARD_WIDTH);
y = EventToSquare(yPix, BOARD_HEIGHT);
if (!flipView && y >= 0) {
if(gameInfo.variant != VariantChuChess && PieceToChar(CHUPROMOTED(piece)) == '+') promoSweep = CHUPROMOTED(piece);
selectFlag = 0; lastX = xPix; lastY = yPix;
ReportClick("put", x, y); // extra put to prompt engine for 'choice' command
+ saveFlash = appData.flashCount; appData.flashCount = 0;
Sweep(0); // Pawn that is going to promote: preview promotion piece
sweepSelecting = 1;
DisplayMessage("", _("Pull pawn backwards to under-promote"));
MarkTargetSquares(1);
} else if(sweepSelecting) { // this must be the up-click corresponding to the down-click that started the sweep
sweepSelecting = 0; appData.animate = FALSE; // do not animate, a selected piece already on to-square
- *promoRestrict = 0;
+ *promoRestrict = 0; appData.flashCount = saveFlash;
if (appData.animate || appData.highlightLastMove) {
SetHighlights(fromX, fromY, toX, toY);
} else {
PromotionPopUp(promoChoice);
} else {
int oldMove = currentMove;
+ flashing = 1; // prevent recursive calling (by release of to-click) while flashing piece
UserMoveEvent(fromX, fromY, toX, toY, promoChoice);
if (!appData.highlightLastMove || gotPremove) ClearHighlights();
if (gotPremove) SetPremoveHighlights(fromX, fromY, toX, toY);
Explode(boards[currentMove-1], fromX, fromY, toX, toY))
DrawPosition(TRUE, boards[currentMove]);
fromX = fromY = -1;
+ flashing = 0;
}
appData.animate = saveAnimate;
if (appData.animate || appData.animateDragging) {
for (i=0; i<appData.flashCount; ++i) {
DrawOneSquare(x, y, piece, square_color, 0, tString, bString, 0);
GraphExpose(currBoard, x, y, squareSize, squareSize);
+ DoEvents(); // requires event processing to actually update screen :-(
FlashDelay(flash_delay);
DrawOneSquare(x, y, EmptySquare, square_color, 0, tString, bString, 0);
GraphExpose(currBoard, x, y, squareSize, squareSize);
+ DoEvents();
FlashDelay(flash_delay);
}
}
/* Special check for castling so we don't flash both the king
and the rook (just flash the king). */
if (do_flash) {
- /* Mark rook for drawing with NO flashing. */
- check_castle_draw(board, lastBoard[nr], &rrow, &rcol);
+ if(check_castle_draw(board, lastBoard[nr], &rrow, &rcol)) {
+ /* Mark rook for drawing with NO flashing. */
+ damage[nr][rrow][rcol] |= 1;
+ }
}
/* First pass -- Erase arrow and grid highlights, but keep square content unchanged. Except for new markers. */