From c3137496fb3ecf4899b82bd6a294023b5cb4a9ac Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 15 Jun 2009 23:56:40 -0700 Subject: [PATCH] fixed some bugs in the animation of atomic captures --- winboard/winboard.c | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-) diff --git a/winboard/winboard.c b/winboard/winboard.c index fb317b7..fe03139 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -103,7 +103,7 @@ void DisplayHoldingsCount(HDC hdc, int x, int y, int align, int copyNumber); VOID NewVariantPopup(HWND hwnd); int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY, /*char*/int promoChar)); -void AnimateAtomicCapture(int toX, int toY, int nFrames); +void AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames); typedef struct { ChessSquare piece; @@ -132,10 +132,10 @@ static HighlightInfo highlightInfo = { {{-1, -1}, {-1, -1}} }; static HighlightInfo premoveHighlightInfo = { {{-1, -1}, {-1, -1}} }; typedef struct { // [HGM] atomic - int x, y, radius; + int fromX, fromY, toX, toY, radius; } ExplodeInfo; -static ExplodeInfo explodeInfo = {0, 0, 0}; +static ExplodeInfo explodeInfo; /* Window class names */ char szAppName[] = "WinBoard"; @@ -4511,7 +4511,8 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) if(explodeInfo.radius) { // [HGM] atomic HBRUSH oldBrush; int x, y, r=(explodeInfo.radius * squareSize)/100; - SquareToPos(explodeInfo.y, explodeInfo.x, &x, &y); + board[explodeInfo.fromY][explodeInfo.fromX] = EmptySquare; // suppress display of capturer + SquareToPos(explodeInfo.toY, explodeInfo.toX, &x, &y); x += squareSize/2; y += squareSize/2; if(!fullrepaint) { @@ -5055,7 +5056,10 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) PromotionPopup(hwnd); /* [HGM] Popup now calls FinishMove */ } else { if(saveAnimate /* ^$!%@#$!$ */ && gameInfo.variant == VariantAtomic - && boards[currentMove][toY][toX] != EmptySquare) AnimateAtomicCapture(toX, toY, 20); + && (boards[currentMove][toY][toX] != EmptySquare || + moveType == WhiteCapturesEnPassant || + moveType == BlackCapturesEnPassant ) ) + AnimateAtomicCapture(fromX, fromY, toX, toY, 20); FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR); } } @@ -10595,13 +10599,15 @@ static void Tween( POINT * start, POINT * mid, POINT * finish, int factor, void -AnimateAtomicCapture(int toX, int toY, int nFrames) +AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames) { // [HGM] atomic: animate blast wave int i; if(appData.debugMode) fprintf(debugFP, "exploding (%d,%d)\n", toX, toY); - explodeInfo.x = toX; - explodeInfo.y = toY; - for(i=0; i