* Massachusetts.
*
* Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
* Massachusetts.
*
* Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
- * 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
if(arrow) // there currently is an arrow displayed
ArrowDamage(hi1X, hi1Y, hi2X, hi2Y); // mark which squares it damaged
if(arrow) // there currently is an arrow displayed
ArrowDamage(hi1X, hi1Y, hi2X, hi2Y); // mark which squares it damaged
/* Save what we are about to draw into the new buffer */
CopyRectangle(anr, DISP, 0,
/* Save what we are about to draw into the new buffer */
CopyRectangle(anr, DISP, 0,
- frame->x, frame->y, squareSize, squareSize,
+ x = frame->x, y = frame->y, w = squareSize, h = squareSize,
updates[i].y - anim->prevFrame.y,
updates[i].width, updates[i].height,
updates[i].x, updates[i].y);
updates[i].y - anim->prevFrame.y,
updates[i].width, updates[i].height,
updates[i].x, updates[i].y);
+ /* [HGM] correct expose rectangle to encompass both overlapping squares */
+ if(x > anim->prevFrame.x) w += x - anim->prevFrame.x, x = anim->prevFrame.x;
+ else w += anim->prevFrame.x - x;
+ if(y > anim->prevFrame.y) h += y - anim->prevFrame.y, y = anim->prevFrame.y;
+ else h += anim->prevFrame.y - y;
} else {
/* Easy when no overlap */
CopyRectangle(anr, 2, DISP,
0, 0, squareSize, squareSize,
anim->prevFrame.x, anim->prevFrame.y);
} else {
/* Easy when no overlap */
CopyRectangle(anr, 2, DISP,
0, 0, squareSize, squareSize,
anim->prevFrame.x, anim->prevFrame.y);
CopyRectangle(anr, 0, DISP,
0, 0, squareSize, squareSize,
frame->x, frame->y);
CopyRectangle(anr, 0, DISP,
0, 0, squareSize, squareSize,
frame->x, frame->y);
AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
{
ChessSquare piece;
AnimateMove (Board board, int fromX, int fromY, int toX, int toY)
{
ChessSquare piece;
Pnt start, finish, mid;
Pnt frames[kFactor * 2 + 1];
int nFrames, startColor, endColor;
Pnt start, finish, mid;
Pnt frames[kFactor * 2 + 1];
int nFrames, startColor, endColor;
/* Are we animating? */
if (!appData.animate || appData.blindfold)
return;
if(board[toY][toX] == WhiteRook && board[fromY][fromX] == WhiteKing ||
/* Are we animating? */
if (!appData.animate || appData.blindfold)
return;
if(board[toY][toX] == WhiteRook && board[fromY][fromX] == WhiteKing ||
- board[toY][toX] == BlackRook && board[fromY][fromX] == BlackKing)
+ board[toY][toX] == BlackRook && board[fromY][fromX] == BlackKing ||
+ board[toY][toX] == WhiteKing && board[fromY][fromX] == WhiteRook || // [HGM] seirawan
+ board[toY][toX] == BlackKing && board[fromY][fromX] == BlackRook)
return; // [HGM] FRC: no animtion of FRC castlings, as to-square is not true to-square
if (fromY < 0 || fromX < 0 || toX < 0 || toY < 0) return;
piece = board[fromY][fromX];
if (piece >= EmptySquare) return;
return; // [HGM] FRC: no animtion of FRC castlings, as to-square is not true to-square
if (fromY < 0 || fromX < 0 || toX < 0 || toY < 0) return;
piece = board[fromY][fromX];
if (piece >= EmptySquare) return;
{
anims[Player].dragPiece = piece;
SetDragPiece(Player, piece);
{
anims[Player].dragPiece = piece;
SetDragPiece(Player, piece);
it's being dragged around the board. So we erase the square
that the piece is on and draw it at the last known drag point. */
DrawOneSquare(anims[Player].startSquare.x, anims[Player].startSquare.y,
it's being dragged around the board. So we erase the square
that the piece is on and draw it at the last known drag point. */
DrawOneSquare(anims[Player].startSquare.x, anims[Player].startSquare.y,
- EmptySquare, anims[Player].startColor, 0, NULL, 0);
+ EmptySquare, anims[Player].startColor, 0, NULL, NULL, 0);
AnimationFrame(Player, &anims[Player].prevFrame, anims[Player].dragPiece);
damage[0][anims[Player].startBoardY][anims[Player].startBoardX] = TRUE;
}
AnimationFrame(Player, &anims[Player].prevFrame, anims[Player].dragPiece);
damage[0][anims[Player].startBoardY][anims[Player].startBoardX] = TRUE;
}
{
int square_color, x, y, align=0;
int i;
{
int square_color, x, y, align=0;
int i;
if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
&& column >= BOARD_LEFT && column < BOARD_RGHT) {
if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
&& column >= BOARD_LEFT && column < BOARD_RGHT) {
align = 1; // coord in lower-right corner
}
if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) {
align = 1; // coord in lower-right corner
}
if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) {
align = 2; // coord in upper-left corner
}
if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {
align = 2; // coord in upper-left corner
}
if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {
align = 3; // holdings count in upper-right corner
}
if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) {
align = 3; // holdings count in upper-right corner
}
if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) {
if(square_color == 2 || appData.blindfold) piece = EmptySquare;
if (do_flash && piece != EmptySquare && appData.flashCount > 0) {
for (i=0; i<appData.flashCount; ++i) {
if(square_color == 2 || appData.blindfold) piece = EmptySquare;
if (do_flash && piece != EmptySquare && appData.flashCount > 0) {
for (i=0; i<appData.flashCount; ++i) {
- DrawOneSquare(x, y, piece, square_color, 0, string, 0);
+ DrawOneSquare(x, y, piece, square_color, 0, tString, bString, 0);
GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
- DrawOneSquare(x, y, EmptySquare, square_color, 0, string, 0);
+ DrawOneSquare(x, y, EmptySquare, square_color, 0, tString, bString, 0);
GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
}
}
GraphExpose(currBoard, x, y, squareSize, squareSize);
FlashDelay(flash_delay);
}
}
- DrawOneSquare(x, y, piece, square_color, partnerUp ? 0 : marker[row][column], string, align);
+ DrawOneSquare(x, y, piece, square_color, partnerUp ? 0 : marker[row][column], tString, bString, align);
DrawSquare(i, j, board[i][j], 0);
if(damage[nr][i][j] & 2) {
drawHighlight(j, i, 0); // repair arrow damage
DrawSquare(i, j, board[i][j], 0);
if(damage[nr][i][j] & 2) {
drawHighlight(j, i, 0); // repair arrow damage
/* Draw highlights */
if (pm1X >= 0 && pm1Y >= 0) {
drawHighlight(pm1X, pm1Y, 2);
/* Draw highlights */
if (pm1X >= 0 && pm1Y >= 0) {
drawHighlight(pm1X, pm1Y, 2);
}
if (pm2X >= 0 && pm2Y >= 0) {
drawHighlight(pm2X, pm2Y, 2);
}
if (pm2X >= 0 && pm2Y >= 0) {
drawHighlight(pm2X, pm2Y, 2);
}
if (hi1X >= 0 && hi1Y >= 0) {
drawHighlight(hi1X, hi1Y, 1);
}
if (hi1X >= 0 && hi1Y >= 0) {
drawHighlight(hi1X, hi1Y, 1);
}
if (hi2X >= 0 && hi2Y >= 0) {
drawHighlight(hi2X, hi2Y, 1);
}
if (hi2X >= 0 && hi2Y >= 0) {
drawHighlight(hi2X, hi2Y, 1);
}
DrawArrowHighlight(hi1X, hi1Y, hi2X, hi2Y);
}
}
DrawArrowHighlight(hi1X, hi1Y, hi2X, hi2Y);
}
GraphExpose(currBoard, x - lineGap, y - lineGap, squareSize + 2*lineGap, squareSize + 2*lineGap);
else
GraphExpose(currBoard, x, y, squareSize, squareSize);
GraphExpose(currBoard, x - lineGap, y - lineGap, squareSize + 2*lineGap, squareSize + 2*lineGap);
else
GraphExpose(currBoard, x, y, squareSize, squareSize);
if( IsDrawArrowEnabled() && fromX >= 0 && fromY >= 0 && toX >= 0 && toY >= 0)
DrawArrowBetweenSquares(fromX, fromY, toX, toY);
}
if( IsDrawArrowEnabled() && fromX >= 0 && fromY >= 0 && toX >= 0 && toY >= 0)
DrawArrowBetweenSquares(fromX, fromY, toX, toY);
}