{
int n = 0;
if(!*escapes) return strlen(s);
- while(*s) n += (*s != '-' && *s != '^' && *s != '*' && !strchr(escapes, *s)), s++;
+ while(*s) n += (*s != '/' && *s != '-' && *s != '^' && *s != '*' && !strchr(escapes, *s)), s++;
return n;
}
-static int pieceOrder[] = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // P N B R Q F E A C W M
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, // O H I J G D V L S U Lion
- 45, 23, 24, 25, 26, 27, 28, 29, 46, 31, 32, // Sword Zebra Camel Tower Wolf Dragon Duck Axe Leopard Gnu Cub
- 44, 51, 56, 57, 58, 59, 60, 61, 62, 63, 34, // Whale Pegasus Wizard Copper Iron Viking Flag Amazon Wheel Shield Claw
- 33, 55, 53, 42, 37, 48, 39, 40, 41, 22, 30, // +P +N =B =R +L +S +E +Ph +Kn Butterfly Hat
- 38, 43, 35, 36, 49, 47, 52, 50, 54, 64, 65 // +V +M =H =D Princess HSword +GB HCrown Wheer Shierd King
-};
-
int
SetCharTableEsc (unsigned char *table, const char * map, char * escapes)
/* [HGM] moved here from winboard.c because of its general usefulness */
if( map != NULL && (NrPieces=ptclen(map, escapes)) <= (int) EmptySquare
&& NrPieces >= 12 && !(NrPieces&1)) {
- int i, ii, j = 0; /* [HGM] Accept even length from 12 to 88 */
+ int i, ii, offs, j = 0; /* [HGM] Accept even length from 12 to 88 */
for( i=0; i<(int) EmptySquare; i++ ) table[i] = '.';
- for( ii=0; ii<NrPieces/2-1; ii++ ) {
+ for( i=offs=0; i<NrPieces/2-1; i++ ) {
char *p, c=0;
- i = pieceOrder[ii];
+ if(map[j] == '/') offs = WhitePBishop - i, j++;
if(*escapes && (map[j] == '*' || map[j] == '-' || map[j] == '^')) c = map[j++];
- table[i] = map[j++];
- if(p = strchr(escapes, map[j])) j++, table[i] += 64*(p - escapes + 1);
- if(c) partner[i] = table[i], table[i] = c;
+ table[i+offs] = map[j++];
+ if(p = strchr(escapes, map[j])) j++, table[i+offs] += 64*(p - escapes + 1);
+ if(c) partner[i+offs] = table[i+offs], table[i+offs] = c;
}
table[(int) WhiteKing] = map[j++];
- for( ii=0; ii<NrPieces/2-1; ii++ ) {
+ for( ii=offs=0; ii<NrPieces/2-1; ii++ ) {
char *p, c=0;
- i = WHITE_TO_BLACK pieceOrder[ii];
+ if(map[j] == '/') offs = WhitePBishop - ii, j++;
+ i = WHITE_TO_BLACK ii;
if(*escapes && (map[j] == '*' || map[j] == '-' || map[j] == '^')) c = map[j++];
- table[i] = map[j++];
- if(p = strchr(escapes, map[j])) j++, table[i] += 64*(p - escapes + 1);
- if(c) partner[i] = table[i], table[i] = c;
+ table[i+offs] = map[j++];
+ if(p = strchr(escapes, map[j])) j++, table[i+offs] += 64*(p - escapes + 1);
+ if(c) partner[i+offs] = table[i+offs], table[i+offs] = c;
}
table[(int) BlackKing] = map[j++];
gameInfo.boardWidth = 12;
gameInfo.boardHeight = 12;
nrCastlingRights = 0;
- SetCharTableEsc(pieceToChar, "P.BRQSEXOGCATHD.VMLIFN^T.......^H..^A^L.........^P.^F^G..^E^X^O..^S^C^B^R^V^D^I^MK"
- "p.brqsexogcathd.vmlifn^t.......^h..^a^l.........^p.^f^g..^e^x^o..^s^c^b^r^v^d^i^mk", SUFFIXES);
+ SetCharTableEsc(pieceToChar, "P.BRQSEXOGCATHD.VMLIFN.........^T..^L......^A^H/^F^G^M.^E^X^O^I.^P.^B^R..^D^S^C^VK"
+ "p.brqsexogcathd.vmlifn.........^t..^l......^a^h/^f^g^m.^e^x^o^i.^p.^b^r..^d^s^c^vk", SUFFIXES);
break;
case VariantCourier:
pieces = CourierArray;
if(p != EmptySquare){
int j = (int)p, promoted = 0;
j -= (j >= (int)BlackPawn) ? (int)BlackPawn :(int)WhitePawn;
- if(j >= WhiteTokin && j != WhiteKing) promoted++, j -= WhiteTokin;
+ if(j >= WhitePBishop && j != WhiteKing) promoted++, j -= WhiteTokin;
if(j > (int)WhiteQueen) j++; // make space for King
if(j > (int) WhiteKing) j = (int)WhiteQueen + 1;
p_enc = 2*j + ((int)p < (int)BlackPawn);
WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan,
WhiteCannon, WhiteNightrider, WhiteCardinal, WhiteDragon, WhiteGrasshopper,
WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteLion,
- WhiteButterfly, WhiteZebra, WhiteCamel, WhiteTower, WhiteWolf,
- WhiteFlying, WhiteDuck, WhiteAxe, WhiteHat, WhiteGnu, WhiteCub,
- WhiteTokin, WhiteClaw, WhitePCardinal, WhitePDragon, WhiteCat,
- WhitePSword, WhiteMonarch, WhiteMother, WhiteNothing, WhitePRook, WhitePDagger,
- WhiteDolphin, WhiteStag, WhiteHorned, WhiteEagle, WhiteSword,
- WhiteCrown, WhiteHCrown, WhiteHorse, WhiteDrunk, WhitePBishop,
- WhiteWheel, WhitePKnight, WhiteWizard, WhiteCopper, WhiteIron, WhiteViking,
- WhiteFlag, WhiteAmazon, WhiteWheer, WhiteShield, WhiteShierd,
- WhiteKing,
+ WhiteSword, WhiteZebra, WhiteCamel, WhiteTower, WhiteWolf,
+ WhiteHat, WhiteDuck, WhiteAmazon, WhiteFlying, WhiteGnu, WhiteCub,
+ WhiteShield, WhiteHorse, WhiteWizard, WhiteCopper, WhiteIron,
+ WhiteViking, WhiteFlag, WhiteAxe, WhiteDolphin, WhiteCat, WhiteClaw,
+ WhiteWheel, WhiteButterfly, WhitePBishop, WhitePRook, WhiteHCrown,
+ WhiteShierd, WhiteMonarch, WhiteMother, WhiteNothing, WhiteDrunk, WhiteWheer,
+ WhiteTokin, WhitePKnight, WhitePCardinal, WhitePDragon, WhitePLance,
+ WhitePSilver, WhiteDagger, WhitePSword, WhitePDagger, WhiteCrown, WhiteKing,
BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen,
BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan,
BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper,
BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackLion,
- BlackButterfly, BlackZebra, BlackCamel, BlackTower, BlackWolf,
- BlackFlying, BlackDuck, BlackAxe, BlackHat, BlackGnu, BlackCub,
- BlackTokin, BlackClaw, BlackPCardinal, BlackPDragon, BlackCat,
- BlackPSword, BlackMonarch, BlackMother, BlackNothing, BlackPRook, BlackPDagger,
- BlackDolphin, BlackStag, BlackHorned, BlackEagle, BlackSword,
- BlackCrown, BlackHCrown, BlackHorse, BlackDrunk, BlackPBishop,
- BlackWheel, BlackPKnight, BlackWizard, BlackCopper, BlackIron, BlackViking,
- BlackFlag, BlackAmazon, BlackWheer, BlackShield, BlackShierd,
- BlackKing,
+ BlackSword, BlackZebra, BlackCamel, BlackTower, BlackWolf,
+ BlackHat, BlackDuck, BlackAmazon, BlackFlying, BlackGnu, BlackCub,
+ BlackShield, BlackHorse, BlackWizard, BlackCopper, BlackIron,
+ BlackViking, BlackFlag, BlackAxe, BlackDolphin, BlackCat, BlackClaw,
+ BlackWheel, BlackButterfly, BlackPBishop, BlackPRook, BlackHCrown,
+ BlackShierd, BlackMonarch, BlackMother, BlackNothing, BlackDrunk, BlackWheer,
+ BlackTokin, BlackPKnight, BlackPCardinal, BlackPDragon, BlackPLance,
+ BlackPSilver, BlackDagger, BlackPSword, BlackPDagger, BlackCrown, BlackKing,
EmptySquare, DarkSquare,
NoRights, // [HGM] gamestate: for castling rights hidden in board[CASTLING]
ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/
Boolean cairoAnimate;
Option *currBoard;
cairo_surface_t *csBoardWindow;
-static cairo_surface_t *pngPieceImages[2][(int)BlackPawn+4]; // png 256 x 256 images
-static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used
-static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn+4]; // scaled pieces in store
+static cairo_surface_t *pngPieceImages[2][(int)BlackPawn]; // png 256 x 256 images
+static cairo_surface_t *pngPieceBitmaps[2][(int)BlackPawn]; // scaled pieces as used
+static cairo_surface_t *pngPieceBitmaps2[2][(int)BlackPawn]; // scaled pieces in store
static RsvgHandle *svgPieces[2][(int)BlackPawn+4]; // vector pieces in store
static cairo_surface_t *pngBoardBitmap[2], *pngOriginalBoardBitmap[2];
int useTexture, textureW[2], textureH[2];
pngPieceBitmaps[i][p] = pngPieceBitmaps2[i][p]; // defaults
if(v == VariantShogi && BOARD_HEIGHT != 7) { // no exceptions in Tori Shogi
pngPieceBitmaps[i][(int)WhiteCannon] = pngPieceBitmaps2[i][(int)WhiteTokin];
- pngPieceBitmaps[i][(int)WhiteNightrider] = pngPieceBitmaps2[i][(int)WhiteKing+2];
- pngPieceBitmaps[i][(int)WhiteGrasshopper] = pngPieceBitmaps2[i][(int)WhiteKing+3];
- pngPieceBitmaps[i][(int)WhiteSilver] = pngPieceBitmaps2[i][(int)WhiteKing+4];
+ pngPieceBitmaps[i][(int)WhiteNightrider] = pngPieceBitmaps2[i][(int)WhitePKnight];
+ pngPieceBitmaps[i][(int)WhiteGrasshopper] = pngPieceBitmaps2[i][(int)WhitePLance];
+ pngPieceBitmaps[i][(int)WhiteSilver] = pngPieceBitmaps2[i][(int)WhitePSilver];
pngPieceBitmaps[i][(int)WhiteQueen] = pngPieceBitmaps2[i][(int)WhiteLance];
pngPieceBitmaps[i][(int)WhiteFalcon] = pngPieceBitmaps2[i][(int)WhiteMonarch]; // for Sho Shogi
}
if(v == VariantChu) {
pngPieceBitmaps[i][(int)WhiteNightrider] = pngPieceBitmaps2[i][(int)WhiteClaw];
pngPieceBitmaps[i][(int)WhiteClaw] = pngPieceBitmaps2[i][(int)WhiteNightrider];
- pngPieceBitmaps[i][(int)WhiteUnicorn] = pngPieceBitmaps2[i][(int)WhiteHorned];
- pngPieceBitmaps[i][(int)WhiteSilver] = pngPieceBitmaps2[i][(int)WhiteStag];
- pngPieceBitmaps[i][(int)WhiteFalcon] = pngPieceBitmaps2[i][(int)WhiteEagle];
- pngPieceBitmaps[i][(int)WhiteHorned] = pngPieceBitmaps2[i][(int)WhiteUnicorn];
- pngPieceBitmaps[i][(int)WhiteStag] = pngPieceBitmaps2[i][(int)WhiteSilver];
- pngPieceBitmaps[i][(int)WhiteEagle] = pngPieceBitmaps2[i][(int)WhiteFalcon];
+ pngPieceBitmaps[i][(int)WhiteUnicorn] = pngPieceBitmaps2[i][(int)WhiteCat];
+ pngPieceBitmaps[i][(int)WhiteSilver] = pngPieceBitmaps2[i][(int)WhiteSword];
+ pngPieceBitmaps[i][(int)WhiteFalcon] = pngPieceBitmaps2[i][(int)WhiteDagger];
+ pngPieceBitmaps[i][(int)WhiteCat] = pngPieceBitmaps2[i][(int)WhiteUnicorn];
+ pngPieceBitmaps[i][(int)WhiteSword] = pngPieceBitmaps2[i][(int)WhiteSilver];
+ pngPieceBitmaps[i][(int)WhiteDagger] = pngPieceBitmaps2[i][(int)WhiteFalcon];
pngPieceBitmaps[i][(int)WhiteMan] = pngPieceBitmaps2[i][(int)WhiteCopper];
pngPieceBitmaps[i][(int)WhiteCopper] = pngPieceBitmaps2[i][(int)WhiteMan];
pngPieceBitmaps[i][(int)WhiteAxe] = pngPieceBitmaps2[i][(int)WhiteCannon];
char *pngPieceNames[] = // must be in same order as internal piece encoding
{ "Pawn", "Knight", "Bishop", "Rook", "Queen", "Advisor", "Elephant", "Archbishop", "Marshall", "Gold", "Commoner",
"Canon", "Nightrider", "CrownedBishop", "CrownedRook", "Crown", "Chancellor", "Hawk", "Lance", "Cobra", "Unicorn", "Lion",
- "Butterfly", "Zebra", "Camel", "Tower", "Wolf", "Dragon", "Duck", "Axe", "Hat", "Gnu", "Cub",
- "GoldPawn", "Claw", "PromoHorse", "PromoDragon", "GoldLance", "PromoSword", "Prince", "Phoenix", "Kylin", "PromoRook", "PromoHSword",
- "Dolphin", "Sword", "Leopard", "HSword", "GoldSilver", "Princess", "HCrown", "Pegasus", "Elephant", "PromoBishop",
- "Left", "GoldKnight", "Wizard", "Copper", "Iron", "Viking", "Flag", "Lance", "Right", "LShield", "RShield", "King",
- "Claw", "GoldKnight", "GoldLance", "GoldSilver", NULL
+ "Sword", "Zebra", "Camel", "Tower", "Wolf", "Hat", "Duck", "Lance", "Dragon", "Gnu", "Cub",
+ "LShield", "Pegasus", "Wizard", "Copper", "Iron", "Viking", "Flag", "Axe", "Dolphin", "Leopard", "Claw",
+ "Left", "Butterfly", "PromoBishop", "PromoRook", "HCrown", "RShield", "Prince", "Phoenix", "Kylin", "Drunk", "Right",
+ "GoldPawn", "GoldKnight", "PromoHorse", "PromoDragon", "GoldLance", "GoldSilver", "HSword", "PromoSword", "PromoHSword", "Princess", "King",
+ NULL
};
-char *backupPiece[] = { "Princess", NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL, "King", "Queen", "Lion" }; // pieces that map on other when not kanji
+char *backupPiece[] = { // pieces that map on other in default theme ("Crown" - "Drunk")
+ "Princess", NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Chancellor", NULL,
+ NULL, "Knight", NULL, "Commoner", NULL, NULL, NULL, "Canon", NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, "King", "Queen", "Lion", "Elephant"
+};
RsvgHandle *
LoadSVG (char *dir, int color, int piece, int retry)
return svg;
}
- if(!retry && piece >= WhiteGrasshopper && piece <= WhiteNothing) // pieces that are only different in kanji sets
+ if(!retry && piece >= WhiteGrasshopper && piece <= WhiteDrunk) // pieces that are only different in kanji sets
return LoadSVG(dir, color, piece, 1);
if(svgerror)
g_error_free(svgerror);
break;
- case SHOGI WhiteStag:
- case SHOGI BlackStag:
+ case SHOGI WhiteGnu:
+ case SHOGI BlackGnu:
if(gameInfo.variant == VariantShogi) goto BlackGold;
SlideVertical(board, flags, rf, ff, callback, closure);
Ferz(board, flags, rf, ff, callback, closure);
SlideVertical(board, flags, rf, ff, callback, closure);
break;
- case SHOGI WhiteHorned:
+ case SHOGI WhiteCat:
Sting(board, flags, rf, ff, 1, 0, callback, closure);
callback(board, flags, NormalMove, rf, ff, rf, ff, closure);
if(killX >= 0) break;
SlideBackward(board, flags, rf, ff, callback, closure);
break;
- case SHOGI BlackHorned:
+ case SHOGI BlackCat:
Sting(board, flags, rf, ff, -1, 0, callback, closure);
callback(board, flags, NormalMove, rf, ff, rf, ff, closure);
if(killX >= 0) break;
SlideForward(board, flags, rf, ff, callback, closure);
break;
- case SHOGI WhiteEagle:
+ case SHOGI WhiteDagger:
Sting(board, flags, rf, ff, 1, 1, callback, closure);
Sting(board, flags, rf, ff, 1, -1, callback, closure);
callback(board, flags, NormalMove, rf, ff, rf, ff, closure);
SlideDiagBackward(board, flags, rf, ff, callback, closure);
break;
- case SHOGI BlackEagle:
+ case SHOGI BlackDagger:
Sting(board, flags, rf, ff, -1, 1, callback, closure);
Sting(board, flags, rf, ff, -1, -1, callback, closure);
callback(board, flags, NormalMove, rf, ff, rf, ff, closure);