\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
int\r
MySearchPath(char *installDir, char *name, char *fullname)\r
{\r
- char *dummy;\r
+ char *dummy, buf[MSG_SIZ];\r
+ if(name[0] == '%' && strchr(name+1, '%')) { // [HGM] recognize %*% as environment variable\r
+ strcpy(buf, name+1);\r
+ *strchr(buf, '%') = 0;\r
+ installDir = getenv(buf);\r
+ sprintf(fullname, "%s\\%s", installDir, strchr(name+1, '%')+1);\r
+ return strlen(fullname);\r
+ }\r
return (int) SearchPath(installDir, name, NULL, MSG_SIZ, fullname, &dummy);\r
}\r
\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
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
if (gameMode == EditPosition) {\r
SetWhiteToPlayEvent();\r
+ } else if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) {\r
+ AdjustClock(flipClock, -1);\r
} else if (gameMode == IcsPlayingBlack ||\r
gameMode == MachinePlaysWhite) {\r
CallFlagEvent();\r
- } else if (gameMode == EditGame) {\r
- AdjustClock(flipClock, -1);\r
}\r
} else if (PtInRect((LPRECT) &blackRect, pt)) {\r
if (gameMode == EditPosition) {\r
SetBlackToPlayEvent();\r
+ } else if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) {\r
+ AdjustClock(!flipClock, -1);\r
} else if (gameMode == IcsPlayingWhite ||\r
gameMode == MachinePlaysBlack) {\r
CallFlagEvent();\r
- } else if (gameMode == EditGame) {\r
- AdjustClock(!flipClock, -1);\r
}\r
}\r
dragInfo.start.x = dragInfo.start.y = -1;\r
/* Mouse Wheel is being rolled forward\r
* Play moves forward\r
*/\r
- if((short)HIWORD(wParam) > 0 && currentMove < forwardMostMove) \r
+ if((short)HIWORD(wParam) < 0 && currentMove < forwardMostMove) \r
{ if(lastDir == 1) ForwardEvent(); else lastDir = 1; } // [HGM] suppress first event in direction\r
/* Mouse Wheel is being rolled backward\r
* Play moves backward\r
*/\r
- if((short)HIWORD(wParam) < 0 && currentMove > backwardMostMove) \r
+ if((short)HIWORD(wParam) > 0 && currentMove > backwardMostMove) \r
{ if(lastDir == -1) BackwardEvent(); else lastDir = -1; }\r
}\r
break;\r
if(y == -2) {\r
/* [HGM] right mouse button in clock area edit-game mode ups clock */\r
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
- if (gameMode == EditGame) AdjustClock(flipClock, 1);\r
+ if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) AdjustClock(flipClock, 1);\r
} else if (PtInRect((LPRECT) &blackRect, pt)) {\r
- if (gameMode == EditGame) AdjustClock(!flipClock, 1);\r
+ if (gameMode == EditGame || GetKeyState(VK_SHIFT) < 0) AdjustClock(!flipClock, 1);\r
}\r
+ break;\r
}\r
DrawPosition(TRUE, NULL);\r
\r
TagsPopUp(tags, CmailMsg());\r
free(tags);\r
}\r
- SAY("programs start playing each other");\r
+ SAY("computer starts playing both sides");\r
break;\r
\r
case IDM_AnalysisMode:\r
\r
case IDM_EditPosition:\r
EditPositionEvent();\r
- SAY("to set up a position type a FEN");\r
+ SAY("enter a FEN string or setup a position on the board using the control R pop up menu");\r
break;\r
\r
case IDM_Training:\r
GetDlgItemText(hDlg, OPT_Name, move, sizeof(move));\r
appData.userName = strdup(move);\r
SetUserLogo();\r
+ SetGameInfo();\r
+ if(gameMode == MachinePlaysWhite || gameMode == MachinePlaysBlack) {\r
+ sprintf(move, "%s vs. %s", gameInfo.white, gameInfo.black);\r
+ DisplayTitle(move);\r
+ }\r
+\r
\r
EndDialog(hDlg, TRUE);\r
return TRUE;\r
ReleaseCapture();\r
DrawPosition(TRUE, NULL);\r
}\r
+ TagsPopDown();\r
}\r
\r
\r