From c1d1ad880f230c340839df52e61c822896a739e4 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 20 Apr 2016 14:44:13 +0200 Subject: [PATCH] Add option -jewelled to decide which King is a Zebra XB A new volatile option -jewelled is added, with default value -1. When it is set to 0 the King image will be replaced by the Zebra image, when it is 1 the same thing will happen to the black King. This color testing will be done before the swapping of colors ordered by -flipBlack, so that the color rather than the side of the (possibly flipped) board decides which King is displayed as Zebra. (While the board side determines whether a white or black Zebra will then be used in -flibBlack mode). Shogi themes can use this by providing a Jewelled General as Zebra (a piece that was not used in any Shogi variant). --- args.h | 1 + common.h | 1 + draw.c | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/args.h b/args.h index 8d07b20..c67abf1 100644 --- a/args.h +++ b/args.h @@ -224,6 +224,7 @@ ArgDescriptor argDescriptors[] = { { "pieceImageDirectory", ArgFilename, (void *) &appData.pieceDirectory, TRUE, (ArgIniType) "" }, { "pid", ArgFilename, (void *) &appData.pieceDirectory, FALSE, INVALID }, { "trueColors", ArgBoolean, (void *) &appData.trueColors, TRUE, (ArgIniType) FALSE }, + { "jewelled", ArgInt, (void *) &appData.jewelled, FALSE, (ArgIniType) -1 }, { "soundDirectory", ArgFilename, (void *) &appData.soundDirectory, XBOARD, (ArgIniType) "" }, { "msLoginDelay", ArgInt, (void *) &appData.msLoginDelay, XBOARD, (ArgIniType) MS_LOGIN_DELAY }, { "pasteSelection", ArgBoolean, (void *) &appData.pasteSelection, XBOARD, (ArgIniType) FALSE }, diff --git a/common.h b/common.h index c557257..0136a00 100644 --- a/common.h +++ b/common.h @@ -577,6 +577,7 @@ typedef struct { Boolean localLineEditing; /* WinBoard only */ Boolean zippyTalk; Boolean zippyPlay; + int jewelled; int flashCount; /* Number of times to flash (xboard only) */ int flashRate; /* Flashes per second (xboard only) */ int msLoginDelay; /* Delay per character (in msec) while sending diff --git a/draw.c b/draw.c index bbe4a79..1604a23 100644 --- a/draw.c +++ b/draw.c @@ -793,6 +793,7 @@ pngDrawPiece (cairo_surface_t *dest, ChessSquare piece, int square_color, int x, kind = 1; piece -= BlackPawn; } + if(piece == WhiteKing && kind == appData.jewelled) piece = WhiteZebra; if(appData.upsideDown && flipView) kind = 1 - kind; // swap white and black pieces BlankSquare(dest, x, y, square_color, piece, 1); // erase previous contents with background cr = cairo_create (dest); -- 1.7.0.4