*** fresh/winboard/winboard.c Sat Feb 2 00:59:38 2002 --- winboard/winboard.c Tue Mar 5 02:47:28 2002 *************** *** 156,161 **** --- 156,162 ---- HWND hCommPort = NULL; /* currently open comm port */ static HWND hwndPause; /* pause button */ static HBITMAP pieceBitmap[3][(int) WhiteKing + 1]; + static HGLOBAL pieceBitmapH[5][(int) WhiteKing + 1]; static HBRUSH lightSquareBrush, darkSquareBrush, whitePieceBrush, blackPieceBrush, iconBkgndBrush, outlineBrush; static POINT gridEndpoints[(BOARD_SIZE + 1) * 4]; *************** *** 211,216 **** --- 212,218 ---- { "giant", 108, 3, 0, 0, 0, 0 }, { "colossal", 116, 4, 0, 0, 0, 0 }, { "titanic", 129, 4, 0, 0, 0, 0 }, + { "hastings", 54, 2, 0, 0, 0, 0 }, { NULL, 0, 0, 0, 0, 0, 0 } }; *************** *** 271,276 **** --- 273,281 ---- { MF(CLOCK_FONT_TITANIC), MF(MESSAGE_FONT_TITANIC), MF(COORD_FONT_TITANIC), MF(CONSOLE_FONT_TITANIC), MF(COMMENT_FONT_TITANIC), MF(EDITTAGS_FONT_TITANIC) }, + { MF(CLOCK_FONT_AVERAGE), MF(MESSAGE_FONT_AVERAGE), + MF(COORD_FONT_AVERAGE), MF(CONSOLE_FONT_AVERAGE), + MF(COMMENT_FONT_AVERAGE), MF(EDITTAGS_FONT_AVERAGE) }, }; MyFont *font[NUM_SIZES][NUM_FONTS]; *************** *** 1974,1979 **** --- 1979,1994 ---- return LoadBitmap(hinst, name); } + HGLOBAL + DoLoadBitmapH(char *piece, int squareSize) + { + char name[128]; + + sprintf(name, "%s%d", piece, squareSize); + + return LoadResource(NULL, FindResource(NULL, name, RT_BITMAP)); + + } /* Insert a color into the program's logical palette structure. This code assumes the given color is *************** *** 2280,2286 **** --- 2295,2335 ---- pieceBitmap[2][WhiteQueen] = DoLoadBitmap(hInst, "q", squareSize, "w"); pieceBitmap[2][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "w"); + LoadHastings54(); + } + + int LoadHastings54() { + + pieceBitmapH[0][WhitePawn] = DoLoadBitmapH("pld", 54); + pieceBitmapH[0][WhiteKnight] = DoLoadBitmapH("nld", 54); + pieceBitmapH[0][WhiteBishop] = DoLoadBitmapH("bld", 54); + pieceBitmapH[0][WhiteRook] = DoLoadBitmapH("rld", 54); + pieceBitmapH[0][WhiteQueen] = DoLoadBitmapH("qld", 54); + pieceBitmapH[0][WhiteKing] = DoLoadBitmapH("kld", 54); + pieceBitmapH[1][WhitePawn] = DoLoadBitmapH("pll", 54); + pieceBitmapH[1][WhiteKnight] = DoLoadBitmapH("nll", 54); + pieceBitmapH[1][WhiteBishop] = DoLoadBitmapH("bll", 54); + pieceBitmapH[1][WhiteRook] = DoLoadBitmapH("rll", 54); + pieceBitmapH[1][WhiteQueen] = DoLoadBitmapH("qll", 54); + pieceBitmapH[1][WhiteKing] = DoLoadBitmapH("kll", 54); + pieceBitmapH[2][WhitePawn] = DoLoadBitmapH("pdd", 54); + pieceBitmapH[2][WhiteKnight] = DoLoadBitmapH("ndd", 54); + pieceBitmapH[2][WhiteBishop] = DoLoadBitmapH("bdd", 54); + pieceBitmapH[2][WhiteRook] = DoLoadBitmapH("rdd", 54); + pieceBitmapH[2][WhiteQueen] = DoLoadBitmapH("qdd", 54); + pieceBitmapH[2][WhiteKing] = DoLoadBitmapH("kdd", 54); + pieceBitmapH[3][WhitePawn] = DoLoadBitmapH("pdl", 54); + pieceBitmapH[3][WhiteKnight] = DoLoadBitmapH("ndl", 54); + pieceBitmapH[3][WhiteBishop] = DoLoadBitmapH("bdl", 54); + pieceBitmapH[3][WhiteRook] = DoLoadBitmapH("rdl", 54); + pieceBitmapH[3][WhiteQueen] = DoLoadBitmapH("qdl", 54); + pieceBitmapH[3][WhiteKing] = DoLoadBitmapH("kdl", 54); + pieceBitmapH[4][0] = DoLoadBitmapH("dsq", 54); + pieceBitmapH[4][1] = DoLoadBitmapH("lsq", 54); + + return 0; + } HBITMAP PieceBitmap(ChessSquare p, int kind) *************** *** 2291,2296 **** --- 2340,2357 ---- return pieceBitmap[kind][(int) p]; } + HGLOBAL + PieceBitmapH(ChessSquare p, int kind) + { + if ((int) p >= (int) BlackPawn) { + kind += 2; + p = (ChessSquare) ((int) p - (int) BlackPawn + (int) WhitePawn); + } + + return pieceBitmapH[kind][(int) p]; + } + + /***************************************************************/ #define MIN(a,b) (((a) < (b)) ? (a) : (b)) *************** *** 2418,2423 **** --- 2479,2499 ---- } } + + VOID DrawStraightHbmpPieceOnDC(HDC hdc, HGLOBAL piece, int x, int y) { + + LPBITMAPINFO lpDIB; + + if (appData.blindfold) return; + + lpDIB = (LPBITMAPINFO) LockResource( (HGLOBAL) piece ); + + StretchDIBits(hdc, x, y, squareSize, squareSize, 0, 0, + squareSize, squareSize, (void*) piece + 4*27, lpDIB, DIB_RGB_COLORS, SRCCOPY); + + } + + /* Note: sqcolor is used only in monoMode */ /* Note that this code is largely duplicated in woptions.c, function DrawSampleSquare, so that needs to be updated too */ *************** *** 2501,2512 **** --- 2577,2599 ---- DrawPieceOnDC(hdc, piece, piece_color, square_color, x, y, tmphdc); } } else { + + if (boardSize == PiecesHastings54 && squareSize == 54) { + + DrawStraightHbmpPieceOnDC(hdc, piece == EmptySquare ? + pieceBitmapH[4][square_color] : PieceBitmapH(piece,square_color) + , x, y); + + } + else { + oldBrush = SelectObject(hdc, square_color ? lightSquareBrush : darkSquareBrush); BitBlt(hdc, x, y, squareSize, squareSize, 0, 0, 0, PATCOPY); SelectObject(hdc, oldBrush); if (piece != EmptySquare) DrawPieceOnDC(hdc, piece, piece_color, -1, x, y, tmphdc); + } } } } *** winboard/winboard.rc Sat Feb 2 02:09:34 2002 --- ../winboard/winboard.rc Sat Mar 2 12:33:40 2002 *************** *** 551,556 **** --- 551,558 ---- 140,55,50,10 CONTROL "Tita&nic",OPT_SizeTitanic,"Button",BS_AUTORADIOBUTTON, 140,65,50,10 + CONTROL "Hastings",OPT_PiecesHastings54,"Button",BS_AUTORADIOBUTTON, + 205,65,50,10 PUSHBUTTON "Choose...",OPT_ChooseLightSquareColor,144,100,40,15 PUSHBUTTON "Choose...",OPT_ChooseDarkSquareColor,144,120,40,15 PUSHBUTTON "Choose...",OPT_ChooseWhitePieceColor,144,140,40,15 *************** *** 1285,1290 **** --- 1287,1320 ---- K129W BITMAP MOVEABLE PURE "bitmaps\\K129w.bmp" GALACTIC BITMAP MOVEABLE PURE "bitmaps\\galactic.bmp" TIM BITMAP MOVEABLE PURE "bitmaps\\tim.bmp" + + DSQ54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\dsq54.bmp" + LSQ54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\lsq54.bmp" + BDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\bdd54.bmp" + BDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\bdl54.bmp" + BLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\bld54.bmp" + BLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\bll54.bmp" + KDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\kdd54.bmp" + KDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\kdl54.bmp" + KLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\kld54.bmp" + KLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\kll54.bmp" + NDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\ndd54.bmp" + NDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\ndl54.bmp" + NLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\nld54.bmp" + NLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\nll54.bmp" + PDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\pdd54.bmp" + PDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\pdl54.bmp" + PLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\pld54.bmp" + PLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\pll54.bmp" + QDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\qdd54.bmp" + QDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\qdl54.bmp" + QLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\qld54.bmp" + QLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\qll54.bmp" + RDD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\rdd54.bmp" + RDL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\rdl54.bmp" + RLD54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\rld54.bmp" + RLL54 BITMAP MOVEABLE PURE "bitmaps\\hastings\\rll54.bmp" + #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// *** winboard/woptions.c Thu Dec 13 04:59:50 2001 --- ../winboard/woptions.c Sat Mar 2 14:17:38 2002 *************** *** 478,484 **** (IsDlgButtonChecked(hDlg, OPT_SizeHuge) ? SizeHuge : (IsDlgButtonChecked(hDlg, OPT_SizeGiant) ? SizeGiant : (IsDlgButtonChecked(hDlg, OPT_SizeColossal) ? SizeColossal : ! SizeTitanic ))))))))))))))))); } LRESULT CALLBACK --- 478,485 ---- (IsDlgButtonChecked(hDlg, OPT_SizeHuge) ? SizeHuge : (IsDlgButtonChecked(hDlg, OPT_SizeGiant) ? SizeGiant : (IsDlgButtonChecked(hDlg, OPT_SizeColossal) ? SizeColossal : ! (IsDlgButtonChecked(hDlg, OPT_PiecesHastings54) ? PiecesHastings54 : ! SizeTitanic )))))))))))))))))); } LRESULT CALLBACK *************** *** 548,553 **** --- 549,557 ---- break; case SizeTitanic: CheckDlgButton(hDlg, OPT_SizeTitanic, TRUE); + break; + case PiecesHastings54: + CheckDlgButton(hDlg, OPT_PiecesHastings54, TRUE); } if (appData.monoMode) *** ../winboard/winboard.h Sun Dec 9 14:22:18 2001 --- winboard.h Sat Mar 2 06:15:42 2002 *************** *** 65,71 **** SizeTiny, SizeTeeny, SizeDinky, SizePetite, SizeSlim, SizeSmall, SizeMediocre, SizeMiddling, SizeAverage, SizeModerate, SizeMedium, SizeBulky, SizeLarge, SizeBig, SizeHuge, SizeGiant, SizeColossal, ! SizeTitanic, NUM_SIZES } BoardSize; typedef struct { --- 65,71 ---- SizeTiny, SizeTeeny, SizeDinky, SizePetite, SizeSlim, SizeSmall, SizeMediocre, SizeMiddling, SizeAverage, SizeModerate, SizeMedium, SizeBulky, SizeLarge, SizeBig, SizeHuge, SizeGiant, SizeColossal, ! SizeTitanic, PiecesHastings54, NUM_SIZES } BoardSize; typedef struct { *** ../winboard/resource.h Mon Dec 3 02:09:42 2001 --- resource.h Sat Mar 2 06:08:02 2002 *************** *** 340,345 **** --- 340,346 ---- #define OPT_DefaultFonts 1419 #define OPT_AutoRaiseBoard 1421 #define OPT_ShowButtonBar 1422 + #define OPT_PiecesHastings54 1423 #define IDC_STATIC -1 // Next default values for new objects