X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=board.c;h=ab3985e8d4a0817cdb333dace1479e9c0f3afed6;hb=da8802ac4d06115296e0f8ba955ecf5570741d08;hp=d4afa00da902300dbc27d405d9c813e38bec1307;hpb=1c03d229073e56dda9e5856db5adaae51576a3bb;p=xboard.git diff --git a/board.c b/board.c index d4afa00..ab3985e 100644 --- a/board.c +++ b/board.c @@ -599,11 +599,13 @@ void AnimateMove (Board board, int fromX, int fromY, int toX, int toY) { ChessSquare piece; - int hop; + int hop, x = toX, y = toY; Pnt start, finish, mid; Pnt frames[kFactor * 2 + 1]; int nFrames, startColor, endColor; + if(killX >= 0 && IS_LION(board[fromY][fromX])) Roar(); + /* Are we animating? */ if (!appData.animate || appData.blindfold) return; @@ -616,6 +618,10 @@ AnimateMove (Board board, int fromX, int fromY, int toX, int toY) piece = board[fromY][fromX]; if (piece >= EmptySquare) return; + if(killX >= 0) toX = killX, toY = killY; // [HGM] lion: first to kill square + +again: + #if DONT_HOP hop = FALSE; #else @@ -653,6 +659,8 @@ AnimateMove (Board board, int fromX, int fromY, int toX, int toY) /* Be sure end square is redrawn */ damage[0][toY][toX] |= True; + + if(toX != x || toY != y) { fromX = toX; fromY = toY; toX = x; toY = y; goto again; } // second leg } void @@ -771,7 +779,7 @@ DrawDragPiece () 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; } @@ -781,7 +789,7 @@ DrawSquare (int row, int column, ChessSquare piece, int do_flash) { int square_color, x, y, align=0; int i; - char string[2]; + char tString[3], bString[2]; int flash_delay; /* Calculate delay in milliseconds (2-delays per complete flash) */ @@ -799,37 +807,38 @@ DrawSquare (int row, int column, ChessSquare piece, int do_flash) square_color = SquareColor(row, column); - string[1] = NULLCHAR; + bString[1] = bString[0] = NULLCHAR; if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0) && column >= BOARD_LEFT && column < BOARD_RGHT) { - string[0] = 'a' + column - BOARD_LEFT; + bString[0] = 'a' + column - BOARD_LEFT; align = 1; // coord in lower-right corner } if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) { - string[0] = ONE + row; + snprintf(tString, 3, "%d", ONE - '0' + row); align = 2; // coord in upper-left corner } if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) { - string[0] = '0' + piece; + snprintf(tString, 3, "%d", piece); align = 3; // holdings count in upper-right corner } if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) { - string[0] = '0' + piece; + snprintf(tString, 3, "%d", piece); align = 4; // holdings count in upper-left corner } + if(piece == DarkSquare) square_color = 2; if(square_color == 2 || appData.blindfold) piece = EmptySquare; if (do_flash && piece != EmptySquare && appData.flashCount > 0) { for (i=0; i= 0 && pm1Y >= 0) { drawHighlight(pm1X, pm1Y, 2); - damage[nr][pm1Y][pm1X] = False; + if(lineGap) damage[nr][pm1Y][pm1X] = False; } if (pm2X >= 0 && pm2Y >= 0) { drawHighlight(pm2X, pm2Y, 2); - damage[nr][pm2Y][pm2X] = False; + if(lineGap) damage[nr][pm2Y][pm2X] = False; } if (hi1X >= 0 && hi1Y >= 0) { drawHighlight(hi1X, hi1Y, 1); - damage[nr][hi1Y][hi1X] = False; + if(lineGap) damage[nr][hi1Y][hi1X] = False; } if (hi2X >= 0 && hi2Y >= 0) { drawHighlight(hi2X, hi2Y, 1); - damage[nr][hi2Y][hi2X] = False; + if(lineGap) damage[nr][hi2Y][hi2X] = False; } DrawArrowHighlight(hi1X, hi1Y, hi2X, hi2Y); } @@ -1029,12 +1038,12 @@ DrawPosition (int repaint, Board board) GraphExpose(currBoard, x - lineGap, y - lineGap, squareSize + 2*lineGap, squareSize + 2*lineGap); else GraphExpose(currBoard, x, y, squareSize, squareSize); - damage[nr][i][j] &= ~2; // remember damage by newly drawn error in '2' bit, to schedule it for erasure next draw + damage[nr][i][j] &= 2; // remember damage by newly drawn error in '2' bit, to schedule it for erasure next draw } } FlashDelay(0); // this flushes drawing queue; - if(nr) SwitchWindow(); + if(nr) SwitchWindow(1); } /* [AS] Arrow highlighting support */