VOID NewVariantPopup(HWND hwnd);\r
int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY,\r
/*char*/int promoChar));\r
-void AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames);\r
void DisplayMove P((int moveNumber));\r
Boolean ParseFEN P((Board board, int *blackPlaysFirst, char *fen));\r
void ChatPopUp P((char *s));\r
{ // return the translation of the given string\r
// efficiency can be improved a lot...\r
int i=0;\r
-if(appData.debugMode) fprintf(debugFP, "T_(%s)\n", s);\r
+//if(appData.debugMode) fprintf(debugFP, "T_(%s)\n", s);\r
if(!barbaric) return s;\r
if(!s) return ""; // sanity\r
while(english[i]) {\r
if(dialogItems[i][0] != dialogID) return; // unknown dialog, should not happen\r
GetWindowText( hDlg, buf, MSG_SIZ );\r
s = T_(buf);\r
-if(appData.debugMode) fprintf(debugFP, "WindowText '%s' -> '%s'\n", buf, s);\r
+//if(appData.debugMode) fprintf(debugFP, "WindowText '%s' -> '%s'\n", buf, s);\r
if(strcmp(buf, s)) SetWindowText(hDlg, s); // replace by translated string (if different)\r
for(j=1; k=dialogItems[i][j]; j++) { // translate all listed dialog items\r
GetDlgItemText(hDlg, k, buf, MSG_SIZ);\r
pieceBitmap[2][WhiteBishop] = DoLoadBitmap(hInst, "b", squareSize, "w");\r
pieceBitmap[2][WhiteRook] = DoLoadBitmap(hInst, "r", squareSize, "w");\r
pieceBitmap[2][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "w");\r
- if( !strcmp(appData.variant, "shogi") && (squareSize==72 || squareSize==49)) {\r
+ if( gameInfo.variant == VariantShogi && squareSize <= 72 && squareSize >= 33) {\r
// in Shogi, Hijack the unused Queen for Lance\r
pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "s");\r
pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "o");\r
if(explodeInfo.radius) { // [HGM] atomic\r
HBRUSH oldBrush;\r
int x, y, r=(explodeInfo.radius * squareSize)/100;\r
+ ChessSquare piece = board[explodeInfo.fromY][explodeInfo.fromX];\r
board[explodeInfo.fromY][explodeInfo.fromX] = EmptySquare; // suppress display of capturer\r
SquareToPos(explodeInfo.toY, explodeInfo.toX, &x, &y);\r
x += squareSize/2;\r
DrawHighlightsOnDC(hdcmem, &highlightInfo, HIGHLIGHT_PEN);\r
DrawHighlightsOnDC(hdcmem, &premoveHighlightInfo, PREMOVE_PEN);\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
+ board[explodeInfo.fromY][explodeInfo.fromX] = piece;\r
oldBrush = SelectObject(hdcmem, explodeBrush);\r
Ellipse(hdcmem, x-r, y-r, x+r, y+r);\r
SelectObject(hdcmem, oldBrush);\r
x = BOARD_WIDTH - 1 - x;\r
}\r
\r
+ shiftKey = GetKeyState(VK_SHIFT) < 0; // [HGM] remember last shift status\r
+\r
switch (message) {\r
case WM_LBUTTONDOWN:\r
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
\r
if (fileName == NULL) fileName = buf1;\r
if (defName == NULL) {\r
- safeStrCpy(fileName, "*.", sizeof(fileName)/sizeof(fileName[0]) );\r
+ safeStrCpy(fileName, "*.", 3 );\r
strcat(fileName, defExt);\r
} else {\r
- safeStrCpy(fileName, defName, sizeof(fileName)/sizeof(fileName[0]) );\r
+ safeStrCpy(fileName, defName, MSG_SIZ );\r
}\r
- if (fileTitle) safeStrCpy(fileTitle, "", sizeof(fileTitle)/sizeof(fileTitle[0]) );\r
+ if (fileTitle) safeStrCpy(fileTitle, "", MSG_SIZ );\r
if (number) *number = 0;\r
\r
openFileName.lStructSize = sizeof(OPENFILENAME);\r
\r
case WM_COMMAND:\r
switch (LOWORD(wParam)) {\r
- case IDOK:\r
+ case IDOK:
+ shiftKey = GetKeyState(VK_SHIFT) < 0; // [HGM] remember last shift status\r
GetDlgItemText(hDlg, OPT_Move, move, sizeof(move));\r
{ int n; Board board;\r
// [HGM] FENedit\r
POINT frames[], int * nFrames);\r
\r
\r
+#define kFactor 4\r
+\r
void\r
-AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames)\r
+AnimateAtomicCapture(Board board, int fromX, int fromY, int toX, int toY)\r
{ // [HGM] atomic: animate blast wave\r
int i;\r
-if(appData.debugMode) fprintf(debugFP, "exploding (%d,%d)\n", toX, toY);\r
+\r
explodeInfo.fromX = fromX;\r
explodeInfo.fromY = fromY;\r
explodeInfo.toX = toX;\r
explodeInfo.toY = toY;\r
- for(i=1; i<nFrames; i++) {\r
- explodeInfo.radius = (i*180)/(nFrames-1);\r
- DrawPosition(FALSE, NULL);\r
+ for(i=1; i<4*kFactor; i++) {\r
+ explodeInfo.radius = (i*180)/(4*kFactor-1);\r
+ DrawPosition(FALSE, board);\r
Sleep(appData.animSpeed);\r
}\r
explodeInfo.radius = 0;\r
- DrawPosition(TRUE, NULL);\r
+ DrawPosition(TRUE, board);\r
}\r
\r
-#define kFactor 4\r
-\r
void\r
AnimateMove(board, fromX, fromY, toX, toY)\r
Board board;\r
ScreenSquare(fromX, fromY, &start);\r
ScreenSquare(toX, toY, &finish);\r
\r
- /* All pieces except knights move in straight line */\r
- if (piece != WhiteKnight && piece != BlackKnight) {\r
+ /* All moves except knight jumps move in straight line */\r
+ if (!(abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
} else {\r
- /* Knight: make diagonal movement then straight */\r
+ /* Knight: make straight movement then diagonal */\r
if (abs(toY - fromY) < abs(toX - fromX)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
- mid.y = finish.y;\r
+ mid.y = start.y;\r
} else {\r
- mid.x = finish.x;\r
+ mid.x = start.x;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
}\r
}\r
animInfo.pos = finish;\r
DrawPosition(FALSE, NULL);\r
animInfo.piece = EmptySquare;\r
- if(gameInfo.variant == VariantAtomic && \r
- (board[toY][toX] != EmptySquare || fromX != toX && (piece == WhitePawn || piece == BlackPawn) ) )\r
- AnimateAtomicCapture(fromX, fromY, toX, toY, 2*nFrames);\r
+ Explode(board, fromX, fromY, toX, toY);\r
}\r
\r
/* Convert board position to corner of screen rect and color */\r