Fix multi-leg promotions
[xboard.git] / board.h
1 /*
2  * board.h -- header for XBoard: variables shared by xboard.c and board.c
3  *
4  * Copyright 1991 by Digital Equipment Corporation, Maynard,
5  * Massachusetts.
6  *
7  * Enhancements Copyright 1992-2001, 2002, 2003, 2004, 2005, 2006,
8  * 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free
9  * Software Foundation, Inc.
10  *
11  * The following terms apply to Digital Equipment Corporation's copyright
12  * interest in XBoard:
13  * ------------------------------------------------------------------------
14  * All Rights Reserved
15  *
16  * Permission to use, copy, modify, and distribute this software and its
17  * documentation for any purpose and without fee is hereby granted,
18  * provided that the above copyright notice appear in all copies and that
19  * both that copyright notice and this permission notice appear in
20  * supporting documentation, and that the name of Digital not be
21  * used in advertising or publicity pertaining to distribution of the
22  * software without specific, written prior permission.
23  *
24  * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
25  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
26  * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
27  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
28  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
29  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
30  * SOFTWARE.
31  * ------------------------------------------------------------------------
32  *
33  * The following terms apply to the enhanced version of XBoard
34  * distributed by the Free Software Foundation:
35  * ------------------------------------------------------------------------
36  *
37  * GNU XBoard is free software: you can redistribute it and/or modify
38  * it under the terms of the GNU General Public License as published by
39  * the Free Software Foundation, either version 3 of the License, or (at
40  * your option) any later version.
41  *
42  * GNU XBoard is distributed in the hope that it will be useful, but
43  * WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45  * General Public License for more details.
46  *
47  * You should have received a copy of the GNU General Public License
48  * along with this program. If not, see http://www.gnu.org/licenses/.  *
49  *
50  *------------------------------------------------------------------------
51  ** See the file ChangeLog for a revision history.  */
52
53
54 /* This magic number is the number of intermediate frames used
55    in each half of the animation. For short moves it's reduced
56    by 1. The total number of frames will be factor * 2 + 1.  */
57 #define kFactor    4
58
59 /* Variables for doing smooth animation. This whole thing
60    would be much easier if the board was double-buffered,
61    but that would require a fairly major rewrite.       */
62
63 #define DISP 4
64
65 typedef enum { Game=0, Player, NrOfAnims } AnimNr;
66
67 typedef struct {
68         short int x, y;
69     } Pnt;
70
71 typedef struct {
72         Pnt     startSquare, prevFrame, mouseDelta;
73         int     startColor;
74         int     dragPiece;
75         Boolean dragActive;
76         int     startBoardX, startBoardY;
77     } AnimState;
78
79 extern AnimState anims[];
80
81 void DrawPolygon P((Pnt arrow[], int nr));
82 void DrawOneSquare P((int x, int y, ChessSquare piece, int square_color, int marker, char *tString, char *bString, int align));
83 void DrawDot P((int marker, int x, int y, int r));
84 void DrawGrid P((void));
85 int SquareColor P((int row, int column));
86 void ScreenSquare P((int column, int row, Pnt *pt, int *color));
87 void BoardSquare P((int x, int y, int *column, int *row));
88 void FrameDelay P((int time));
89 void InsertPiece P((AnimNr anr, ChessSquare piece));
90 void DrawBlank P((AnimNr anr, int x, int y, int startColor));
91 void CopyRectangle P((AnimNr anr, int srcBuf, int destBuf, int srcX, int srcY, int width, int height, int destX, int destY));
92 void SetDragPiece P((AnimNr anr, ChessSquare piece));
93 void DragPieceMove P((int x, int y));
94 void DrawBorder P((int x, int y, int type, int odd));
95 void FlashDelay P((int flash_delay));
96 void SwitchWindow P((int main));
97
98 extern int damage[2][BOARD_RANKS][BOARD_FILES];
99 extern Option *currBoard;