From: H.G. Muller Date: Mon, 14 Oct 2013 18:07:13 +0000 (+0200) Subject: Adapt WinBoard front-end to Mighty Lion X-Git-Url: http://winboard.nl/cgi-bin?p=xboard.git;a=commitdiff_plain;h=bd85ed7a2aac57e6afa8fdab7f3a13ce22910b18 Adapt WinBoard front-end to Mighty Lion A Lion piece is added, and the roar sound and driver is added. Put Mighty Lion in New Variant menu (WB) Debug WB Mighty Lion Fix dragging on second leg WB Two-leg move animation WB Add Lion .bmp files (WB) --- diff --git a/backend.c b/backend.c index 6675344..4c9968f 100644 --- a/backend.c +++ b/backend.c @@ -5284,7 +5284,8 @@ ProcessICSInitScript (FILE *f) } -static int lastX, lastY, lastLeftX, lastLeftY, selectFlag, dragging; +static int lastX, lastY, lastLeftX, lastLeftY, selectFlag; +int dragging; static ClickType lastClickType; void @@ -7193,7 +7194,6 @@ HoverEvent (int xPix, int yPix, int x, int y) { static int oldX = -1, oldY = -1, oldFromX = -1, oldFromY = -1; int r, f; - if(dragging == 2) DragPieceMove(xPix, yPix); // [HGM] lion: drag without button for second leg if(!first.highlight) return; if(fromX != oldFromX || fromY != oldFromY) oldX = oldY = -1; // kludge to fake entry on from-click if(x == oldX && y == oldY) return; // only do something if we enter new square @@ -7464,7 +7464,6 @@ LeftClick (ClickType clickType, int xPix, int yPix) return; } if(dragging == 2) { // [HGM] lion: just turn buttonless drag into normal drag, and let release to the job - dragging = 1; return; } if(x == killX && y == killY) { // second click on this square, which was selected as first-leg target diff --git a/backend.h b/backend.h index 69197ce..741a9e9 100644 --- a/backend.h +++ b/backend.h @@ -115,6 +115,7 @@ extern char lastMsg[MSG_SIZ]; extern Boolean bookUp; extern int tinyLayout, smallLayout; extern Boolean mcMode; +extern int dragging; void MarkMenuItem P((char *menuRef, int state)); char *CmailMsg P((void)); diff --git a/common.h b/common.h index 2bd7653..ec067ad 100644 --- a/common.h +++ b/common.h @@ -304,7 +304,7 @@ typedef enum { } ColorClass; typedef enum { - SoundMove, SoundBell, SoundAlarm, SoundIcsWin, SoundIcsLoss, + SoundMove, SoundBell, SoundRoar, SoundAlarm, SoundIcsWin, SoundIcsLoss, SoundIcsDraw, SoundIcsUnfinished, NSoundClasses } SoundClass; diff --git a/dialogs.c b/dialogs.c index 5bcbc0b..1a918ed 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2178,7 +2178,7 @@ Exp (int n, int x, int y) if(n == 0) { // motion if(SeekGraphClick(Press, x, y, 1)) return NULL; - if(but1 && !PromoScroll(x, y)) DragPieceMove(x, y); + if((but1 || dragging == 2) && !PromoScroll(x, y)) DragPieceMove(x, y); if(but3) MovePV(x, y, lineGap + BOARD_HEIGHT * (squareSize + lineGap)); if(appData.highlightDragging) { f = EventToSquare(x, BOARD_WIDTH); if ( flipView && f >= 0) f = BOARD_WIDTH - 1 - f; diff --git a/winboard/bitmaps/ln33o.bmp b/winboard/bitmaps/ln33o.bmp new file mode 100644 index 0000000..1e369b2 Binary files /dev/null and b/winboard/bitmaps/ln33o.bmp differ diff --git a/winboard/bitmaps/ln33s.bmp b/winboard/bitmaps/ln33s.bmp new file mode 100644 index 0000000..4f4b4fe Binary files /dev/null and b/winboard/bitmaps/ln33s.bmp differ diff --git a/winboard/bitmaps/ln33w.bmp b/winboard/bitmaps/ln33w.bmp new file mode 100644 index 0000000..8498503 Binary files /dev/null and b/winboard/bitmaps/ln33w.bmp differ diff --git a/winboard/bitmaps/ln49o.bmp b/winboard/bitmaps/ln49o.bmp new file mode 100644 index 0000000..70f760e Binary files /dev/null and b/winboard/bitmaps/ln49o.bmp differ diff --git a/winboard/bitmaps/ln49s.bmp b/winboard/bitmaps/ln49s.bmp new file mode 100644 index 0000000..b9ecc7b Binary files /dev/null and b/winboard/bitmaps/ln49s.bmp differ diff --git a/winboard/bitmaps/ln49w.bmp b/winboard/bitmaps/ln49w.bmp new file mode 100644 index 0000000..16f45eb Binary files /dev/null and b/winboard/bitmaps/ln49w.bmp differ diff --git a/winboard/bitmaps/ln72o.bmp b/winboard/bitmaps/ln72o.bmp new file mode 100644 index 0000000..cb23356 Binary files /dev/null and b/winboard/bitmaps/ln72o.bmp differ diff --git a/winboard/bitmaps/ln72s.bmp b/winboard/bitmaps/ln72s.bmp new file mode 100644 index 0000000..f0a88ce Binary files /dev/null and b/winboard/bitmaps/ln72s.bmp differ diff --git a/winboard/bitmaps/ln72w.bmp b/winboard/bitmaps/ln72w.bmp new file mode 100644 index 0000000..e55a5e8 Binary files /dev/null and b/winboard/bitmaps/ln72w.bmp differ diff --git a/winboard/defaults.h b/winboard/defaults.h index d2fd9cf..fcab2db 100644 --- a/winboard/defaults.h +++ b/winboard/defaults.h @@ -205,14 +205,14 @@ #define BUILT_IN_SOUND_NAMES {\ "Beepbeep", "Ching", "Click", "Cymbal", "Ding", "Drip", \ "Gong", "Laser", "Move", "Penalty", "Phone", "Pop", "Pop2", \ - "Slap", "Squeak", "Swish", "Thud", "Whipcrack", \ + "Roar", "Slap", "Squeak", "Swish", "Thud", "Whipcrack", \ "Alarm", "Challenge", "Channel", "Channel1", "Draw", "Kibitz", \ "Lose", "Request", "Seek", "Shout", "SShout", "Tell", "Unfinished", \ "Win", NULL \ } #define SETTINGS_FILE "winboard.ini" -#define DEBUG_FILE "winboard.debug" +#define DEBUG_FILE "winboard.debug" #define ICS_LOGON "ics.ini" diff --git a/winboard/resource.h b/winboard/resource.h index 0cebfcf..efa3068 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -508,6 +508,7 @@ #define OPT_VariantSpartan 1531 #define OPT_VariantASEAN 1532 #define OPT_VariantGrand 1534 +#define OPT_VariantLion 1535 #define OPT_EngineVariant 1560 #define IDC_Files 1550 #define IDC_Ranks 1551 diff --git a/winboard/winboard.c b/winboard/winboard.c index e5df6db..1539f42 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -109,7 +109,6 @@ VOID NewVariantPopup(HWND hwnd); int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY, /*char*/int promoChar)); void DisplayMove P((int moveNumber)); -Boolean ParseFEN P((Board board, int *blackPlaysFirst, char *fen)); void ChatPopUp P((char *s)); typedef struct { ChessSquare piece; @@ -2273,7 +2272,7 @@ InitDrawingSizes(BoardSize boardSize, int flags) && (boardSize < SizePetite || boardSize > SizeBulky) // Archbishop and Chancellor available in entire middle range || (v == VariantShogi && boardSize != SizeModerate) // Japanese-style Shogi || v == VariantKnightmate || v == VariantSChess || v == VariantXiangqi || v == VariantSpartan - || v == VariantShatranj || v == VariantMakruk || v == VariantGreat || v == VariantFairy ) { + || v == VariantShatranj || v == VariantMakruk || v == VariantGreat || v == VariantFairy || v == VariantLion ) { if(boardSize < SizeMediocre) boardSize = SizePetite; else if(boardSize > SizeModerate) boardSize = SizeBulky; else boardSize = SizeMiddling; @@ -2629,6 +2628,9 @@ InitDrawingSizes(BoardSize boardSize, int flags) pieceBitmap[0][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "s"); pieceBitmap[1][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "o"); pieceBitmap[2][WhiteUnicorn] = DoLoadBitmap(hInst, "u", squareSize, "w"); + pieceBitmap[0][WhiteLion] = DoLoadBitmap(hInst, "ln", squareSize, "s"); + pieceBitmap[1][WhiteLion] = DoLoadBitmap(hInst, "ln", squareSize, "o"); + pieceBitmap[2][WhiteLion] = DoLoadBitmap(hInst, "ln", squareSize, "w"); if(gameInfo.variant == VariantShogi) { /* promoted Gold represemtations */ pieceBitmap[0][WhiteCannon] = DoLoadBitmap(hInst, "wp", squareSize, "s"); @@ -3251,6 +3253,8 @@ BOOL HasHighlightInfo() return result; + + } BOOL IsDrawArrowEnabled() @@ -4274,8 +4278,10 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } else if (PtInRect((LPRECT) &blackRect, pt)) { ClockClick(!flipClock); break; } + if(dragging) { // [HGM] lion: don't destroy dragging info if we are already dragging dragInfo.start.x = dragInfo.start.y = -1; dragInfo.from = dragInfo.start; + } if(fromX == -1 && frozen) { // not sure where this is for fromX = fromY = -1; DrawPosition(forceFullRepaint || FALSE, NULL); /* [AS] */ @@ -4295,7 +4301,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if(PromoScroll(pt.x - boardRect.left, pt.y - boardRect.top)) break; MovePV(pt.x - boardRect.left, pt.y - boardRect.top, boardRect.bottom - boardRect.top); if ((appData.animateDragging || appData.highlightDragging) - && (wParam & MK_LBUTTON) + && (wParam & MK_LBUTTON || dragging == 2) && dragInfo.from.x >= 0) { BOOL full_repaint = FALSE; @@ -5105,6 +5111,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) break; case IDM_Rematch: + RematchEvent(); break; @@ -6262,6 +6269,7 @@ StartupDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) SwapEngines(singleList); // temporarily swap first and second, to load a second 'first', ... ParseArgs(StringGet, &p); SwapEngines(singleList); // ... and then make it 'second' + appData.noChessProgram = FALSE; appData.icsActive = FALSE; } else if (IsDlgButtonChecked(hDlg, OPT_ChessServer)) { @@ -6851,6 +6859,7 @@ SaveInHistory(char *cmd) histIn = (histIn + 1) % HISTORY_SIZE; if (history[histIn] != NULL) { free(history[histIn]); + history[histIn] = NULL; } histP = histIn; @@ -8717,6 +8726,13 @@ EditCommentPopUp(int index, char *title, char *str) } +int +Roar() +{ + MyPlaySound(&sounds[(int)SoundRoar]); + return 1; +} + VOID RingBell() { @@ -8874,6 +8890,7 @@ DisplayBlackClock(long timeRemaining, int highlight) HDC hdc; char *flag = blackFlag && gameMode == TwoMachinesPlay ? "(!)" : ""; + if(appData.noGUI) return; hdc = GetDC(hwndMain); if (!IsIconic(hwndMain)) { @@ -9892,16 +9909,23 @@ AnimateMove(board, fromX, fromY, toX, toY) int toY; { ChessSquare piece; + int x = toX, y = toY; POINT start, finish, mid; POINT frames[kFactor * 2 + 1]; int nFrames, n; + if(killX >= 0 && IS_LION(board[fromY][fromX])) Roar(); + if (!appData.animate) return; if (doingSizing) return; if (fromY < 0 || fromX < 0) return; piece = board[fromY][fromX]; if (piece >= EmptySquare) return; + if(killX >= 0) toX = killX, toY = killY; // [HGM] lion: first to kill square + +again: + ScreenSquare(fromX, fromY, &start); ScreenSquare(toX, toY, &finish); @@ -9940,6 +9964,9 @@ AnimateMove(board, fromX, fromY, toX, toY) } animInfo.pos = finish; DrawPosition(FALSE, NULL); + + if(toX != x || toY != y) { fromX = toX; fromY = toY; toX = x; toY = y; goto again; } // second leg + animInfo.piece = EmptySquare; Explode(board, fromX, fromY, toX, toY); } diff --git a/winboard/winboard.rc b/winboard/winboard.rc index 86428cb..69ed9da 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -713,6 +713,8 @@ BEGIN 70,10 CONTROL "&atomic",OPT_VariantAtomic,"Button",BS_AUTORADIOBUTTON, 9,104,70,10 + CONTROL "&Mighty Lion",OPT_VariantLion,"Button",BS_AUTORADIOBUTTON, + 9,114,70,10 CONTROL "cra&zyhouse",OPT_VariantCrazyhouse,"Button",BS_AUTORADIOBUTTON,80,14, 70,10 CONTROL "&bughouse",OPT_VariantBughouse,"Button",BS_AUTORADIOBUTTON,80,24,70, @@ -1916,6 +1918,7 @@ V72O BITMAP MOVEABLE PURE "bitmaps/v72o.bmp" S72O BITMAP MOVEABLE PURE "bitmaps/s72o.bmp" L72O BITMAP MOVEABLE PURE "bitmaps/l72o.bmp" DK72O BITMAP MOVEABLE PURE "bitmaps/dk72o.bmp" +LN72O BITMAP MOVEABLE PURE "bitmaps/ln72o.bmp" WP72O BITMAP MOVEABLE PURE "bitmaps/wp72o.bmp" WN72O BITMAP MOVEABLE PURE "bitmaps/wn72o.bmp" WL72O BITMAP MOVEABLE PURE "bitmaps/wl72o.bmp" @@ -1936,6 +1939,7 @@ V72S BITMAP MOVEABLE PURE "bitmaps/v72s.bmp" S72S BITMAP MOVEABLE PURE "bitmaps/s72s.bmp" L72S BITMAP MOVEABLE PURE "bitmaps/l72s.bmp" DK72S BITMAP MOVEABLE PURE "bitmaps/dk72s.bmp" +LN72S BITMAP MOVEABLE PURE "bitmaps/ln72s.bmp" WP72S BITMAP MOVEABLE PURE "bitmaps/wp72s.bmp" WN72S BITMAP MOVEABLE PURE "bitmaps/wn72s.bmp" WL72S BITMAP MOVEABLE PURE "bitmaps/wl72s.bmp" @@ -1956,6 +1960,7 @@ V72W BITMAP MOVEABLE PURE "bitmaps/v72w.bmp" S72W BITMAP MOVEABLE PURE "bitmaps/s72w.bmp" L72W BITMAP MOVEABLE PURE "bitmaps/l72w.bmp" DK72W BITMAP MOVEABLE PURE "bitmaps/dk72w.bmp" +LN72W BITMAP MOVEABLE PURE "bitmaps/ln72w.bmp" E49O BITMAP MOVEABLE PURE "bitmaps/e49o.bmp" A49O BITMAP MOVEABLE PURE "bitmaps/a49o.bmp" AA49O BITMAP MOVEABLE PURE "bitmaps/as49o.bmp" @@ -1972,6 +1977,7 @@ V49O BITMAP MOVEABLE PURE "bitmaps/v49o.bmp" S49O BITMAP MOVEABLE PURE "bitmaps/s49o.bmp" L49O BITMAP MOVEABLE PURE "bitmaps/l49o.bmp" DK49O BITMAP MOVEABLE PURE "bitmaps/dk49o.bmp" +LN49O BITMAP MOVEABLE PURE "bitmaps/ln49o.bmp" WP49O BITMAP MOVEABLE PURE "bitmaps/wp49o.bmp" WN49O BITMAP MOVEABLE PURE "bitmaps/wn49o.bmp" WL49O BITMAP MOVEABLE PURE "bitmaps/wl49o.bmp" @@ -1992,6 +1998,7 @@ V49S BITMAP MOVEABLE PURE "bitmaps/v49s.bmp" S49S BITMAP MOVEABLE PURE "bitmaps/s49s.bmp" L49S BITMAP MOVEABLE PURE "bitmaps/l49s.bmp" DK49S BITMAP MOVEABLE PURE "bitmaps/dk49s.bmp" +LN49S BITMAP MOVEABLE PURE "bitmaps/ln49s.bmp" WP49S BITMAP MOVEABLE PURE "bitmaps/wp49s.bmp" WN49S BITMAP MOVEABLE PURE "bitmaps/wn49s.bmp" WL49S BITMAP MOVEABLE PURE "bitmaps/wl49s.bmp" @@ -2012,6 +2019,7 @@ V49W BITMAP MOVEABLE PURE "bitmaps/v49w.bmp" S49W BITMAP MOVEABLE PURE "bitmaps/s49w.bmp" L49W BITMAP MOVEABLE PURE "bitmaps/l49w.bmp" DK49W BITMAP MOVEABLE PURE "bitmaps/dk49w.bmp" +LN49W BITMAP MOVEABLE PURE "bitmaps/ln49w.bmp" A33O BITMAP MOVEABLE PURE "bitmaps/a33o.bmp" AA33O BITMAP MOVEABLE PURE "bitmaps/as33o.bmp" C33O BITMAP MOVEABLE PURE "bitmaps/c33o.bmp" @@ -2026,6 +2034,7 @@ W33O BITMAP MOVEABLE PURE "bitmaps/w33o.bmp" M33O BITMAP MOVEABLE PURE "bitmaps/m33o.bmp" O33O BITMAP MOVEABLE PURE "bitmaps/o33o.bmp" DK33O BITMAP MOVEABLE PURE "bitmaps/dk33o.bmp" +LN33O BITMAP MOVEABLE PURE "bitmaps/ln33o.bmp" WP33O BITMAP MOVEABLE PURE "bitmaps/wp33o.bmp" WN33O BITMAP MOVEABLE PURE "bitmaps/wn33o.bmp" WL33O BITMAP MOVEABLE PURE "bitmaps/wl33o.bmp" @@ -2044,6 +2053,7 @@ W33W BITMAP MOVEABLE PURE "bitmaps/w33w.bmp" M33W BITMAP MOVEABLE PURE "bitmaps/m33w.bmp" O33W BITMAP MOVEABLE PURE "bitmaps/o33w.bmp" DK33W BITMAP MOVEABLE PURE "bitmaps/dk33w.bmp" +LN33W BITMAP MOVEABLE PURE "bitmaps/ln33w.bmp" A33S BITMAP MOVEABLE PURE "bitmaps/a33s.bmp" AA33S BITMAP MOVEABLE PURE "bitmaps/as33s.bmp" C33S BITMAP MOVEABLE PURE "bitmaps/c33s.bmp" @@ -2058,6 +2068,7 @@ W33S BITMAP MOVEABLE PURE "bitmaps/w33s.bmp" M33S BITMAP MOVEABLE PURE "bitmaps/m33s.bmp" O33S BITMAP MOVEABLE PURE "bitmaps/o33s.bmp" DK33S BITMAP MOVEABLE PURE "bitmaps/dk33s.bmp" +LN33S BITMAP MOVEABLE PURE "bitmaps/ln33s.bmp" WP33S BITMAP MOVEABLE PURE "bitmaps/wp33s.bmp" WN33S BITMAP MOVEABLE PURE "bitmaps/wn33s.bmp" WL33S BITMAP MOVEABLE PURE "bitmaps/wl33s.bmp" @@ -2224,6 +2235,7 @@ SSHOUT WAVE DISCARDABLE "sounds/sshout.wav" TELL WAVE DISCARDABLE "sounds/tell.wav" UNFINISHED WAVE DISCARDABLE "sounds/unfinished.wav" WIN WAVE DISCARDABLE "sounds/win.wav" +ROAR WAVE DISCARDABLE "sounds/roar.wav" ///////////////////////////////////////////////////////////////////////////// // diff --git a/winboard/woptions.c b/winboard/woptions.c index a736306..d3dba20 100644 --- a/winboard/woptions.c +++ b/winboard/woptions.c @@ -843,6 +843,7 @@ int radioButton[] = { -1, -1, OPT_VariantShogi, + -1, // Chu OPT_VariantXiangqi, OPT_VariantCourier, OPT_VariantGothic, @@ -862,6 +863,7 @@ int radioButton[] = { OPT_VariantSChess, OPT_VariantGrand, OPT_VariantSpartan, // Spartan + OPT_VariantLion, -2 // sentinel }; @@ -1418,6 +1420,8 @@ IcsOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) break; + + case OPT_ChooseNormalColor: ColorizeTextPopup(hDlg, ColorNormal); UpdateSampleText(hDlg, OPT_SampleNormal, &mca[ColorNormal]); @@ -1796,6 +1800,7 @@ FontsOptionsPopup(HWND hwnd) SoundComboData soundComboData[] = { {N_("Move"), NULL}, {N_("Bell"), NULL}, + {N_("Roar"), NULL}, {N_("ICS Alarm"), NULL}, {N_("ICS Win"), NULL}, {N_("ICS Loss"), NULL},