{ "keepAlive", ArgInt, (void *) &appData.keepAlive, FALSE, INVALID },
{ "icstype", ArgInt, (void *) &ics_type, FALSE, INVALID },
{ "forceIllegalMoves", ArgTrue, (void *) &appData.forceIllegal, FALSE, INVALID },
+ { "showTargetSquares", ArgBoolean, (void *) &appData.markers, TRUE, FALSE },
#ifdef ZIPPY
{ "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
char chatPartner[MAX_CHAT][MSG_SIZ]; /* [HGM] chat: list of chatting partners */
extern int chatCount;
int chattingPartner;
+char marker[BOARD_RANKS][BOARD_FILES]; /* [HGM] marks for target squares */
/* States for ics_getting_history */
#define H_FALSE 0
FinishMove(moveType, fromX, fromY, toX, toY, promoChar);
}
+void
+Mark(board, flags, kind, rf, ff, rt, ft, closure)
+ Board board;
+ int flags;
+ ChessMove kind;
+ int rf, ff, rt, ft;
+ VOIDSTAR closure;
+{
+ typedef char Markers[BOARD_RANKS][BOARD_FILES];
+ Markers *m = (Markers *) closure;
+ if(rf == fromY && ff == fromX)
+ (*m)[rt][ft] = 1 + (board[rt][ft] != EmptySquare
+ || kind == WhiteCapturesEnPassant
+ || kind == BlackCapturesEnPassant);
+ else if(flags & F_MANDATORY_CAPTURE && board[rt][ft] != EmptySquare) (*m)[rt][ft] = 3;
+}
+
+void
+MarkTargetSquares(int clear)
+{
+ int x, y;
+ if(!appData.markers || !appData.highlightDragging ||
+ !appData.testLegality || gameMode == EditPosition) return;
+ if(clear) {
+ for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) marker[y][x] = 0;
+ } else {
+ int capt = 0;
+ GenLegal(boards[currentMove], PosFlags(currentMove), Mark, (void*) marker);
+ if(PosFlags(0) & F_MANDATORY_CAPTURE) {
+ for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) if(marker[y][x]>1) capt++;
+ if(capt)
+ for(x=0; x<BOARD_WIDTH; x++) for(y=0; y<BOARD_HEIGHT; y++) if(marker[y][x] == 1) marker[y][x] = 0;
+ }
+ }
+ DrawPosition(TRUE, NULL);
+}
+
void LeftClick(ClickType clickType, int xPix, int yPix)
{
int x, y;
char promoChoice = NULLCHAR;
if (clickType == Press) ErrorPopDown();
+ MarkTargetSquares(1);
x = EventToSquare(xPix, BOARD_WIDTH);
y = EventToSquare(yPix, BOARD_HEIGHT);
fromX = x;
fromY = y;
second = 0;
+ MarkTargetSquares(0);
DragPieceBegin(xPix, yPix);
if (appData.highlightDragging) {
SetHighlights(x, y, -1, -1);
if (OKToStartUserMove(x, y)) {
fromX = x;
fromY = y;
+ MarkTargetSquares(0);
DragPieceBegin(xPix, yPix);
}
return;
extern char* programVersion;
extern ProcRef firstProgramPR, secondProgramPR;
extern Board boards[];
+extern char marker[BOARD_RANKS][BOARD_FILES];
char *CmailMsg P((void));
/* Tord: Added the useFEN960 parameter in PositionToFEN() below */
Boolean useInternalWrap; /* use internal wrapping -- noJoin usurps this if set */
Boolean pasteSelection; /* paste X selection instead of clipboard */
int nrVariations; /* [HGM] multivar */
- Boolean dropMenu;
+ Boolean dropMenu; /* [HGM] pv */
+ Boolean markers; /* [HGM] markers */
} AppData, *AppDataPtr;
/* [AS] PGN tags (for showing in the game list) */
static HBRUSH lightSquareBrush, darkSquareBrush,\r
blackSquareBrush, /* [HGM] for band between board and holdings */\r
explodeBrush, /* [HGM] atomic */\r
+ markerBrush, /* [HGM] markers */\r
whitePieceBrush, blackPieceBrush, iconBkgndBrush /*, outlineBrush*/;\r
static POINT gridEndpoints[(BOARD_RANKS + BOARD_FILES + 2) * 2];\r
static DWORD gridVertexCounts[BOARD_RANKS + BOARD_FILES + 2];\r
blackPieceBrush = CreateSolidBrush(blackPieceColor);\r
iconBkgndBrush = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND));\r
explodeBrush = CreateSolidBrush(highlightSquareColor); // [HGM] atomic\r
+ markerBrush = CreateSolidBrush(premoveHighlightColor); // [HGM] markers\r
/* [AS] Force rendering of the font-based pieces */\r
if( fontBitmapSquareSize > 0 ) {\r
fontBitmapSquareSize = 0;\r
DrawHighlightsOnDC(hdcmem);\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
}\r
+ for (row = 0; row < BOARD_HEIGHT; row++) {\r
+ for (column = 0; column < BOARD_WIDTH; column++) {\r
+ if (marker[row][column]) { // marker changes only occur with full repaint!\r
+ HBRUSH oldBrush = SelectObject(hdcmem, \r
+ marker[row][column] == 2 ? markerBrush : explodeBrush);\r
+ SquareToPos(row, column, &x, &y);\r
+ Ellipse(hdcmem, x + squareSize/4, y + squareSize/4,\r
+ x + 3*squareSize/4, y + 3*squareSize/4);\r
+ SelectObject(hdcmem, oldBrush);\r
+ }\r
+ }\r
+ }\r
if(logoHeight) {\r
HBITMAP whiteLogo = (HBITMAP) first.programLogo, blackLogo = (HBITMAP) second.programLogo;\r
if(appData.autoLogo) {\r
*------------------------------------------------------------------------
** See the file ChangeLog for a revision history. */
+#define HIGHDRAG 1
+
#include "config.h"
#include <stdio.h>
x + 2, y + font_ascent + 1, string, 1);
}
}
+ if(marker[row][column]) {
+ XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? prelineGC : highlineGC,
+ x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+ }
}
corner.x = x - player.mouseDelta.x;
corner.y = y - player.mouseDelta.y;
AnimationFrame(&player, &corner, player.dragPiece);
-#if HIGHDRAG
+#if HIGHDRAG*0
if (appData.highlightDragging) {
int boardX, boardY;
BoardSquare(x, y, &boardX, &boardY);