X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=6e189dbb910927abdb44ebc599bfd836c0c2f34f;hb=3dbaa3c440b654ec995f9e0d5a0fa4ef8f38b4ec;hp=7d8c272ba6cbb60d8c48ee2c37f89ac2526ac93b;hpb=433ea9c5827629a7d19708ff06949a4abe03e548;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index 7d8c272..6e189db 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"; @@ -1244,6 +1244,8 @@ ArgDescriptor argDescriptors[] = { { "autoLogo", ArgBoolean, (LPVOID) &appData.autoLogo, TRUE }, { "firstOptions", ArgString, (LPVOID) &appData.firstOptions, FALSE }, { "secondOptions", ArgString, (LPVOID) &appData.secondOptions, FALSE }, + { "firstNeedsNoncompliantFEN", ArgString, (LPVOID) &appData.fenOverride1, FALSE }, + { "secondNeedsNoncompliantFEN", ArgString, (LPVOID) &appData.fenOverride2, FALSE }, #ifdef ZIPPY { "zippyTalk", ArgBoolean, (LPVOID) &appData.zippyTalk, FALSE }, @@ -1284,6 +1286,7 @@ ArgDescriptor argDescriptors[] = { { "zippyVariants", ArgString, (LPVOID) &appData.zippyVariants, FALSE }, { "zippyMaxGames", ArgInt, (LPVOID)&appData.zippyMaxGames, FALSE }, { "zippyReplayTimeout", ArgInt, (LPVOID)&appData.zippyReplayTimeout, FALSE }, + { "zippyShortGame", ArgInt, (LPVOID)&appData.zippyShortGame, FALSE }, /* Kludge to allow winboard.ini files from buggy 4.0.4 to be read: */ { "zippyReplyTimeout", ArgInt, (LPVOID)&junk, FALSE }, #endif @@ -4481,7 +4484,14 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) x2 = boardRect.left + animInfo.pos.x; y2 = boardRect.top + animInfo.pos.y; clips[num_clips++] = CreateRectRgn(MIN(x,x2), MIN(y,y2), MAX(x,x2)+squareSize, MAX(y,y2)+squareSize); - /* [HGM] old location of "slight kludge" below */ + /* Slight kludge. The real problem is that after AnimateMove is + done, the position on the screen does not match lastDrawn. + This currently causes trouble only on e.p. captures in + atomic, where the piece moves to an empty square and then + explodes. The old and new positions both had an empty square + at the destination, but animation has drawn a piece there and + we have to remember to erase it. [HGM] moved until after setting lastDrawn */ + lastDrawn[animInfo.to.y][animInfo.to.x] = animInfo.piece; } } @@ -4502,7 +4512,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) { @@ -4558,14 +4569,6 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board) DrawPieceOnDC(hdcmem, animInfo.piece, ((int) animInfo.piece < (int) BlackPawn), (animInfo.from.y + animInfo.from.x) % 2, x, y, tmphdc); - /* Slight kludge. The real problem is that after AnimateMove is - done, the position on the screen does not match lastDrawn. - This currently causes trouble only on e.p. captures in - atomic, where the piece moves to an empty square and then - explodes. The old and new positions both had an empty square - at the destination, but animation has drawn a piece there and - we have to remember to erase it. [HGM] moved until after setting lastDrawn */ - lastDrawn[animInfo.to.y][animInfo.to.x] = animInfo.piece; } /* Release the bufferBitmap by selecting in the old bitmap @@ -5054,7 +5057,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); } } @@ -6276,6 +6282,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* [AS] Also move "attached" child windows */ case WM_WINDOWPOSCHANGING: + if( hwnd == hwndMain && appData.useStickyWindows ) { LPWINDOWPOS lpwp = (LPWINDOWPOS) lParam; @@ -6283,11 +6290,17 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) /* Window is moving */ RECT rcMain; - GetWindowRect( hwnd, &rcMain ); +// GetWindowRect( hwnd, &rcMain ); //[HGM] sticky: in XP this returned new position, not old + rcMain.left = boardX; // replace by these 4 lines to reconstruct old rect + rcMain.right = boardX + winWidth; + rcMain.top = boardY; + rcMain.bottom = boardY + winHeight; ReattachAfterMove( &rcMain, lpwp->x, lpwp->y, moveHistoryDialog, &wpMoveHistory ); ReattachAfterMove( &rcMain, lpwp->x, lpwp->y, evalGraphDialog, &wpEvalGraph ); ReattachAfterMove( &rcMain, lpwp->x, lpwp->y, engineOutputDialog, &wpEngineOutput ); + boardX = lpwp->x; + boardY = lpwp->y; } } break; @@ -10587,13 +10600,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