static int setboardSpoiledMachineBlack = 0 /*, errorExitFlag = 0*/;
int startedFromPositionFile = FALSE; Board filePosition; /* [HGM] loadPos */
Board partnerBoard; /* [HGM] bughouse: for peeking at partner game */
+int partnerHighlight[2];
Boolean partnerBoardValid = 0;
char partnerStatus[MSG_SIZ];
Boolean partnerUp;
char promoChar;
int ranks=1, files=0; /* [HGM] ICS80: allow variable board size */
char *bookHit = NULL; // [HGM] book
- Boolean weird = FALSE, reqFlag = FALSE, repaint = FALSE;
+ Boolean weird = FALSE, reqFlag = FALSE;
fromX = fromY = toX = toY = -1;
if((gameMode == IcsPlayingWhite || gameMode == IcsPlayingBlack)
&& newGameMode == IcsObserving && appData.bgObserve) {
// [HGM] bughouse: don't act on alien boards while we play. Just parse the board and save it */
+ char *toSqr;
for (k = 0; k < ranks; k++) {
for (j = 0; j < files; j++)
board[k][j+gameInfo.holdingsWidth] = CharToPiece(board_chars[(ranks-1-k)*(files+1) + j]);
}
}
CopyBoard(partnerBoard, board);
- if(appData.dualBoard && !twoBoards) { twoBoards = repaint = 1; InitDrawingSizes(-2,0); }
+ if(toSqr = strchr(str, '/')) { // extract highlights from long move
+ partnerBoard[EP_STATUS-3] = toSqr[1] - AAA; // kludge: hide highlighting info in board
+ partnerBoard[EP_STATUS-4] = toSqr[2] - ONE;
+ } else partnerBoard[EP_STATUS-4] = partnerBoard[EP_STATUS-3] = -1;
+ if(toSqr = strchr(str, '-')) {
+ partnerBoard[EP_STATUS-1] = toSqr[1] - AAA;
+ partnerBoard[EP_STATUS-2] = toSqr[2] - ONE;
+ } else partnerBoard[EP_STATUS-1] = partnerBoard[EP_STATUS-2] = -1;
+ if(appData.dualBoard && !twoBoards) { twoBoards = 1; InitDrawingSizes(-2,0); }
if(twoBoards) { partnerUp = 1; flipView = !flipView; } // [HGM] dual
- if(partnerUp) DrawPosition(repaint, partnerBoard);
+ if(partnerUp) DrawPosition(FALSE, partnerBoard);
if(twoBoards) { partnerUp = 0; flipView = !flipView; } // [HGM] dual
sprintf(partnerStatus, "W: %d:%02d B: %d:%02d (%d-%d) %c", white_time/60000, (white_time%60000)/1000,
(black_time/60000), (black_time%60000)/1000, white_stren, black_stren, to_play);
\r
static HighlightInfo highlightInfo = { {{-1, -1}, {-1, -1}} };\r
static HighlightInfo premoveHighlightInfo = { {{-1, -1}, {-1, -1}} };\r
+static HighlightInfo partnerHighlightInfo = { {{-1, -1}, {-1, -1}} };\r
+static HighlightInfo oldPartnerHighlight = { {{-1, -1}, {-1, -1}} };\r
\r
typedef struct { // [HGM] atomic\r
int fromX, fromY, toX, toY, radius;\r
}\r
\r
VOID\r
-DrawHighlightsOnDC(HDC hdc)\r
+DrawHighlightsOnDC(HDC hdc, HighlightInfo *h, int pen)\r
{\r
int i;\r
for (i=0; i<2; i++) {\r
- if (highlightInfo.sq[i].x >= 0 && highlightInfo.sq[i].y >= 0) \r
+ if (h->sq[i].x >= 0 && h->sq[i].y >= 0) \r
DrawHighlightOnDC(hdc, TRUE,\r
- highlightInfo.sq[i].x, highlightInfo.sq[i].y,\r
- HIGHLIGHT_PEN);\r
- }\r
- for (i=0; i<2; i++) {\r
- if (premoveHighlightInfo.sq[i].x >= 0 && \r
- premoveHighlightInfo.sq[i].y >= 0) {\r
- DrawHighlightOnDC(hdc, TRUE,\r
- premoveHighlightInfo.sq[i].x, \r
- premoveHighlightInfo.sq[i].y,\r
- PREMOVE_PEN);\r
- }\r
+ h->sq[i].x, h->sq[i].y,\r
+ pen);\r
}\r
}\r
\r
}\r
}\r
}\r
+ } else { // nr == 1\r
+ partnerHighlightInfo.sq[0].y = board[EP_STATUS-4];\r
+ partnerHighlightInfo.sq[0].x = board[EP_STATUS-3];\r
+ partnerHighlightInfo.sq[1].y = board[EP_STATUS-2];\r
+ partnerHighlightInfo.sq[1].x = board[EP_STATUS-1];\r
+ for (i=0; i<2; i++) {\r
+ if (partnerHighlightInfo.sq[i].x >= 0 &&\r
+ partnerHighlightInfo.sq[i].y >= 0) {\r
+ SquareToPos(partnerHighlightInfo.sq[i].y,\r
+ partnerHighlightInfo.sq[i].x, &x, &y);\r
+ clips[num_clips++] =\r
+ CreateRectRgn(x - lineGap, y - lineGap, \r
+ x + squareSize + lineGap, y + squareSize + lineGap);\r
+ }\r
+ if (oldPartnerHighlight.sq[i].x >= 0 && \r
+ oldPartnerHighlight.sq[i].y >= 0) {\r
+ SquareToPos(oldPartnerHighlight.sq[i].y, \r
+ oldPartnerHighlight.sq[i].x, &x, &y);\r
+ clips[num_clips++] =\r
+ CreateRectRgn(x - lineGap, y - lineGap, \r
+ x + squareSize + lineGap, y + squareSize + lineGap);\r
+ }\r
+ }\r
}\r
} else {\r
fullrepaint = TRUE;\r
ExtSelectClipRgn(hdcmem, clips[num_clips++], RGN_OR);\r
}\r
DrawGridOnDC(hdcmem);\r
- DrawHighlightsOnDC(hdcmem);\r
+ DrawHighlightsOnDC(hdcmem, &highlightInfo, HIGHLIGHT_PEN);\r
+ DrawHighlightsOnDC(hdcmem, &premoveHighlightInfo, PREMOVE_PEN);\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
oldBrush = SelectObject(hdcmem, explodeBrush);\r
Ellipse(hdcmem, x-r, y-r, x+r, y+r);\r
SelectObject(hdcmem, oldBrush);\r
} else {\r
DrawGridOnDC(hdcmem);\r
- if(nr == 0) DrawHighlightsOnDC(hdcmem); // [HGM] dual: no highlights on right board yet\r
+ if(nr == 0) { // [HGM] dual: decide which highlights to draw\r
+ DrawHighlightsOnDC(hdcmem, &highlightInfo, HIGHLIGHT_PEN);\r
+ DrawHighlightsOnDC(hdcmem, &premoveHighlightInfo, PREMOVE_PEN);\r
+ } else {\r
+ DrawHighlightsOnDC(hdcmem, &partnerHighlightInfo, HIGHLIGHT_PEN);\r
+ oldPartnerHighlight = partnerHighlightInfo;\r
+ }\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
}\r
if(nr == 0) // [HGM] dual: markers only on left board\r