adds bitmaps for shogi promotions, and selects the bitmaps or pixmaps for the more...
authorH.G. Muller <h.g.muller@hccnet.nl>
Sat, 27 Jun 2009 23:51:02 +0000 (16:51 -0700)
committerArun Persaud <arun@nubati.net>
Sat, 27 Jun 2009 23:51:02 +0000 (16:51 -0700)
bitmaps/bitmaps.h
pixmaps/pixmaps.h
xboard.c

index e5948b4..fc861a5 100644 (file)
 \r
 typedef struct {\r
     int squareSize;\r
 \r
 typedef struct {\r
     int squareSize;\r
-    unsigned char *bits[2][(int)BlackPawn];\r
+    unsigned char *bits[2][(int)BlackPawn+4];\r
 } BuiltInBits;\r
 \r
 BuiltInBits builtInBits[] = {\\r
 { 129,\\r
 } BuiltInBits;\r
 \r
 BuiltInBits builtInBits[] = {\\r
 { 129,\\r
-  { { p129s_bits, n129s_bits, b129s_bits, r129s_bits, q129s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k129s_bits },\\r
-    { p129o_bits, n129o_bits, b129o_bits, r129o_bits, q129o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k129o_bits } } },\\r
+  { { p129s_bits, n129s_bits, b129s_bits, r129s_bits, q129s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k129s_bits, NULL, NULL, NULL, NULL },\\r
+    { p129o_bits, n129o_bits, b129o_bits, r129o_bits, q129o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k129o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 116,\\r
 { 116,\\r
-  { { p116s_bits, n116s_bits, b116s_bits, r116s_bits, q116s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k116s_bits },\\r
-    { p116o_bits, n116o_bits, b116o_bits, r116o_bits, q116o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k116o_bits } } },\\r
+  { { p116s_bits, n116s_bits, b116s_bits, r116s_bits, q116s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k116s_bits, NULL, NULL, NULL, NULL },\\r
+    { p116o_bits, n116o_bits, b116o_bits, r116o_bits, q116o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k116o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 108,\\r
 { 108,\\r
-  { { p108s_bits, n108s_bits, b108s_bits, r108s_bits, q108s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k108s_bits },\\r
-    { p108o_bits, n108o_bits, b108o_bits, r108o_bits, q108o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k108o_bits } } },\\r
+  { { p108s_bits, n108s_bits, b108s_bits, r108s_bits, q108s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k108s_bits, NULL, NULL, NULL, NULL },\\r
+    { p108o_bits, n108o_bits, b108o_bits, r108o_bits, q108o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k108o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 95,\\r
 { 95,\\r
-  { { p95s_bits, n95s_bits, b95s_bits, r95s_bits, q95s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k95s_bits },\\r
-    { p95o_bits, n95o_bits, b95o_bits, r95o_bits, q95o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k95o_bits } } },\\r
+  { { p95s_bits, n95s_bits, b95s_bits, r95s_bits, q95s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k95s_bits, NULL, NULL, NULL, NULL },\\r
+    { p95o_bits, n95o_bits, b95o_bits, r95o_bits, q95o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k95o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 87,\\r
 { 87,\\r
-  { { p87s_bits, n87s_bits, b87s_bits, r87s_bits, q87s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k87s_bits },\\r
-    { p87o_bits, n87o_bits, b87o_bits, r87o_bits, q87o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k87o_bits } } },\\r
+  { { p87s_bits, n87s_bits, b87s_bits, r87s_bits, q87s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k87s_bits, NULL, NULL, NULL, NULL },\\r
+    { p87o_bits, n87o_bits, b87o_bits, r87o_bits, q87o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k87o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 80,\\r
 { 80,\\r
-  { { p80s_bits, n80s_bits, b80s_bits, r80s_bits, q80s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k80s_bits },\\r
-    { p80o_bits, n80o_bits, b80o_bits, r80o_bits, q80o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k80o_bits } } },\\r
+  { { p80s_bits, n80s_bits, b80s_bits, r80s_bits, q80s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k80s_bits, NULL, NULL, NULL, NULL },\\r
+    { p80o_bits, n80o_bits, b80o_bits, r80o_bits, q80o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k80o_bits }, NULL, NULL, NULL, NULL } },\\r
 { 72,\\r
 { 72,\\r
-  { { p72s_bits, n72s_bits, b72s_bits, r72s_bits, q72s_bits, f72s_bits, e72s_bits, a72s_bits, c72s_bits, w72s_bits, m72s_bits, o72s_bits, h72s_bits, i72s_bits, j72s_bits, g72s_bits, d72s_bits, v72s_bits, l72s_bits, s72s_bits, u72s_bits, k72s_bits },\\r
-    { p72o_bits, n72o_bits, b72o_bits, r72o_bits, q72o_bits, f72o_bits, e72o_bits, a72o_bits, c72o_bits, w72o_bits, m72o_bits, o72o_bits, h72o_bits, i72o_bits, j72o_bits, g72o_bits, d72o_bits, v72o_bits, l72o_bits, s72o_bits, u72o_bits, k72o_bits } } },\\r
+  { { p72s_bits, n72s_bits, b72s_bits, r72s_bits, q72s_bits, f72s_bits, e72s_bits, a72s_bits, c72s_bits, w72s_bits, m72s_bits, o72s_bits, h72s_bits, i72s_bits, j72s_bits, g72s_bits, d72s_bits, v72s_bits, l72s_bits, s72s_bits, u72s_bits, k72s_bits, wp_72s_bits, wn_72s_bits, ws_72s_bits, wl_72s_bits },\\r
+    { p72o_bits, n72o_bits, b72o_bits, r72o_bits, q72o_bits, f72o_bits, e72o_bits, a72o_bits, c72o_bits, w72o_bits, m72o_bits, o72o_bits, h72o_bits, i72o_bits, j72o_bits, g72o_bits, d72o_bits, v72o_bits, l72o_bits, s72o_bits, u72o_bits, k72o_bits, wp_72o_bits, wn_72o_bits, ws_72o_bits, wl_72o_bits } } },\\r
 { 64,\\r
 { 64,\\r
-  { { p64s_bits, n64s_bits, b64s_bits, r64s_bits, q64s_bits, l64s_bits, l64s_bits, a64s_bits, c64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, d64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, k64s_bits },\\r
-    { p64o_bits, n64o_bits, b64o_bits, r64o_bits, q64o_bits, l64o_bits, l64o_bits, a64o_bits, c64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, d64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, k64o_bits } } },\\r
+  { { p64s_bits, n64s_bits, b64s_bits, r64s_bits, q64s_bits, l64s_bits, l64s_bits, a64s_bits, c64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, d64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits, k64s_bits, l64s_bits, l64s_bits, l64s_bits, l64s_bits },\\r
+    { p64o_bits, n64o_bits, b64o_bits, r64o_bits, q64o_bits, l64o_bits, l64o_bits, a64o_bits, c64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, d64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits, k64o_bits, l64o_bits, l64o_bits, l64o_bits, l64o_bits } } },\\r
 { 58,\\r
 { 58,\\r
-  { { p58s_bits, n58s_bits, b58s_bits, r58s_bits, q58s_bits, l58s_bits, l58s_bits, a58s_bits, c58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, d58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, k58s_bits },\\r
-    { p58o_bits, n58o_bits, b58o_bits, r58o_bits, q58o_bits, l58o_bits, l58o_bits, a58o_bits, c58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, d58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, k58o_bits } } },\\r
+  { { p58s_bits, n58s_bits, b58s_bits, r58s_bits, q58s_bits, l58s_bits, l58s_bits, a58s_bits, c58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, d58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits, k58s_bits, l58s_bits, l58s_bits, l58s_bits, l58s_bits },\\r
+    { p58o_bits, n58o_bits, b58o_bits, r58o_bits, q58o_bits, l58o_bits, l58o_bits, a58o_bits, c58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, d58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits, k58o_bits, l58o_bits, l58o_bits, l58o_bits, l58o_bits } } },\\r
 { 54,\\r
 { 54,\\r
-  { { p54s_bits, n54s_bits, b54s_bits, r54s_bits, q54s_bits, l54s_bits, l54s_bits, a54s_bits, c54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, d54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, k54s_bits },\\r
-    { p54o_bits, n54o_bits, b54o_bits, r54o_bits, q54o_bits, l54o_bits, l54o_bits, a54o_bits, c54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, d54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, k54o_bits } } },\\r
+  { { p54s_bits, n54s_bits, b54s_bits, r54s_bits, q54s_bits, l54s_bits, l54s_bits, a54s_bits, c54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, d54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits, k54s_bits, l54s_bits, l54s_bits, l54s_bits, l54s_bits },\\r
+    { p54o_bits, n54o_bits, b54o_bits, r54o_bits, q54o_bits, l54o_bits, l54o_bits, a54o_bits, c54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, d54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits, k54o_bits, l54o_bits, l54o_bits, l54o_bits, l54o_bits } } },\\r
 { 49,\\r
 { 49,\\r
-  { { p49s_bits, n49s_bits, b49s_bits, r49s_bits, q49s_bits, f49s_bits, e49s_bits, a49s_bits, c49s_bits, w49s_bits, m49s_bits, o49s_bits, h49s_bits, i49s_bits, j49s_bits, g49s_bits, d49s_bits, v49s_bits, l49s_bits, s49s_bits, u49s_bits, k49s_bits },\\r
-    { p49o_bits, n49o_bits, b49o_bits, r49o_bits, q49o_bits, f49o_bits, e49o_bits, a49o_bits, c49o_bits, w49o_bits, m49o_bits, o49o_bits, h49o_bits, i49s_bits, j49o_bits, g49o_bits, d49o_bits, v49o_bits, l49o_bits, s49o_bits, u49o_bits, k49o_bits } } },\\r
+  { { p49s_bits, n49s_bits, b49s_bits, r49s_bits, q49s_bits, f49s_bits, e49s_bits, a49s_bits, c49s_bits, w49s_bits, m49s_bits, o49s_bits, h49s_bits, i49s_bits, j49s_bits, g49s_bits, d49s_bits, v49s_bits, l49s_bits, s49s_bits, u49s_bits, k49s_bits, wp49s_bits, wn49s_bits, ws49s_bits, wl49s_bits },\\r
+    { p49o_bits, n49o_bits, b49o_bits, r49o_bits, q49o_bits, f49o_bits, e49o_bits, a49o_bits, c49o_bits, w49o_bits, m49o_bits, o49o_bits, h49o_bits, i49s_bits, j49o_bits, g49o_bits, d49o_bits, v49o_bits, l49o_bits, s49o_bits, u49o_bits, k49o_bits, wp49o_bits, wn49o_bits, ws49o_bits, wl49o_bits } } },\\r
 { 45,\\r
 { 45,\\r
-  { { p45s_bits, n45s_bits, b45s_bits, r45s_bits, q45s_bits, l45s_bits, l45s_bits, a45s_bits, c45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, d45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, k45s_bits },\\r
-    { p45o_bits, n45o_bits, b45o_bits, r45o_bits, q45o_bits, l45o_bits, l45o_bits, a45o_bits, c45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, d45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, k45o_bits } } },\\r
+  { { p45s_bits, n45s_bits, b45s_bits, r45s_bits, q45s_bits, l45s_bits, l45s_bits, a45s_bits, c45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, d45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits, k45s_bits, l45s_bits, l45s_bits, l45s_bits, l45s_bits },\\r
+    { p45o_bits, n45o_bits, b45o_bits, r45o_bits, q45o_bits, l45o_bits, l45o_bits, a45o_bits, c45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, d45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits, k45o_bits, l45o_bits, l45o_bits, l45o_bits, l45o_bits } } },\\r
 { 40,\\r
 { 40,\\r
-  { { p40s_bits, n40s_bits, b40s_bits, r40s_bits, q40s_bits, l40s_bits, l40s_bits, a40s_bits, c40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, d40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, k40s_bits },\\r
-    { p40o_bits, n40o_bits, b40o_bits, r40o_bits, q40o_bits, l40o_bits, l40o_bits, a40o_bits, c40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, d40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, k40o_bits } } },\\r
+  { { p40s_bits, n40s_bits, b40s_bits, r40s_bits, q40s_bits, l40s_bits, l40s_bits, a40s_bits, c40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, d40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits, k40s_bits, l40s_bits, l40s_bits, l40s_bits, l40s_bits },\\r
+    { p40o_bits, n40o_bits, b40o_bits, r40o_bits, q40o_bits, l40o_bits, l40o_bits, a40o_bits, c40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, d40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits, k40o_bits, l40o_bits, l40o_bits, l40o_bits, l40o_bits } } },\\r
 { 37,\\r
 { 37,\\r
-  { { p37s_bits, n37s_bits, b37s_bits, r37s_bits, q37s_bits, l37s_bits, l37s_bits, a37s_bits, c37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, d37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, k37s_bits },\\r
-    { p37o_bits, n37o_bits, b37o_bits, r37o_bits, q37o_bits, l37o_bits, l37o_bits, a37o_bits, c37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, d37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, k37o_bits } } },\\r
+  { { p37s_bits, n37s_bits, b37s_bits, r37s_bits, q37s_bits, l37s_bits, l37s_bits, a37s_bits, c37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, d37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits, k37s_bits, l37s_bits, l37s_bits, l37s_bits, l37s_bits },\\r
+    { p37o_bits, n37o_bits, b37o_bits, r37o_bits, q37o_bits, l37o_bits, l37o_bits, a37o_bits, c37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, d37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits, k37o_bits, l37o_bits, l37o_bits, l37o_bits, l37o_bits } } },\\r
 { 33,\\r
 { 33,\\r
-  { { p33s_bits, n33s_bits, b33s_bits, r33s_bits, q33s_bits, f33s_bits, e33s_bits, a33s_bits, c33s_bits, w33s_bits, m33s_bits, o33s_bits, h33s_bits, a33s_bits, j33s_bits, g33s_bits, d33s_bits, l33s_bits, d33s_bits, l33s_bits, l33s_bits, k33s_bits },\\r
-    { p33o_bits, n33o_bits, b33o_bits, r33o_bits, q33o_bits, f33o_bits, e33o_bits, a33o_bits, c33o_bits, w33o_bits, m33o_bits, o33o_bits, h33o_bits, a33o_bits, j33o_bits, g33o_bits, d33o_bits, l33o_bits, d33o_bits, l33o_bits, l33o_bits, k33o_bits } } },\\r
+  { { p33s_bits, n33s_bits, b33s_bits, r33s_bits, q33s_bits, f33s_bits, e33s_bits, a33s_bits, c33s_bits, w33s_bits, m33s_bits, o33s_bits, h33s_bits, a33s_bits, j33s_bits, g33s_bits, d33s_bits, l33s_bits, d33s_bits, l33s_bits, l33s_bits, k33s_bits, l33s_bits, l33s_bits, l33s_bits, l33s_bits },\\r
+    { p33o_bits, n33o_bits, b33o_bits, r33o_bits, q33o_bits, f33o_bits, e33o_bits, a33o_bits, c33o_bits, w33o_bits, m33o_bits, o33o_bits, h33o_bits, a33o_bits, j33o_bits, g33o_bits, d33o_bits, l33o_bits, d33o_bits, l33o_bits, l33o_bits, k33o_bits, l33o_bits, l33o_bits, l33o_bits, l33o_bits } } },\\r
 { 29,\\r
 { 29,\\r
-  { { p29s_bits, n29s_bits, b29s_bits, r29s_bits, q29s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k29s_bits },\\r
-    { p29o_bits, n29o_bits, b29o_bits, r29o_bits, q29o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k29o_bits } } },\\r
+  { { p29s_bits, n29s_bits, b29s_bits, r29s_bits, q29s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k29s_bits, NULL, NULL, NULL, NULL },\\r
+    { p29o_bits, n29o_bits, b29o_bits, r29o_bits, q29o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k29o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 25,\\r
 { 25,\\r
-  { { p25s_bits, n25s_bits, b25s_bits, r25s_bits, q25s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k25s_bits },\\r
-    { p25o_bits, n25o_bits, b25o_bits, r25o_bits, q25o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k25o_bits } } },\\r
+  { { p25s_bits, n25s_bits, b25s_bits, r25s_bits, q25s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k25s_bits, NULL, NULL, NULL, NULL },\\r
+    { p25o_bits, n25o_bits, b25o_bits, r25o_bits, q25o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k25o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 21,\\r
 { 21,\\r
-  { { p21s_bits, n21s_bits, b21s_bits, r21s_bits, q21s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k21s_bits },\\r
-    { p21o_bits, n21o_bits, b21o_bits, r21o_bits, q21o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k21o_bits } } },\\r
+  { { p21s_bits, n21s_bits, b21s_bits, r21s_bits, q21s_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k21s_bits, NULL, NULL, NULL, NULL },\\r
+    { p21o_bits, n21o_bits, b21o_bits, r21o_bits, q21o_bits, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, k21o_bits, NULL, NULL, NULL, NULL } } },\\r
 { 0,\\r
   { { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },\\r
     { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } } }\\r
 { 0,\\r
   { { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },\\r
     { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } } }\\r
index d15a5c1..db0e63e 100644 (file)
 \r
 typedef struct {\r
   int size;\r
 \r
 typedef struct {\r
   int size;\r
-  char **xpm[(int)BlackPawn][4];\r
+  char **xpm[(int)BlackPawn+4][4];\r
 } XpmPieces;\r
 \r
 XpmPieces builtInXpms[] = {\\r
 } XpmPieces;\r
 \r
 XpmPieces builtInXpms[] = {\\r
@@ -840,6 +840,10 @@ XpmPieces builtInXpms[] = {\
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
+    { qll129, qld129, qdl129, qdd129, },\\r
+    { qll129, qld129, qdl129, qdd129, },\\r
+    { qll129, qld129, qdl129, qdd129, },\\r
+    { qll129, qld129, qdl129, qdd129, },\\r
   } },\\r
   { 116, {\\r
     { pll116, pld116, pdl116, pdd116, },\\r
   } },\\r
   { 116, {\\r
     { pll116, pld116, pdl116, pdd116, },\\r
@@ -864,6 +868,10 @@ XpmPieces builtInXpms[] = {\
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
+    { qll116, qld116, qdl116, qdd116, },\\r
+    { qll116, qld116, qdl116, qdd116, },\\r
+    { qll116, qld116, qdl116, qdd116, },\\r
+    { qll116, qld116, qdl116, qdd116, },\\r
   } },\\r
   { 108, {\\r
     { pll108, pld108, pdl108, pdd108, },\\r
   } },\\r
   { 108, {\\r
     { pll108, pld108, pdl108, pdd108, },\\r
@@ -888,6 +896,10 @@ XpmPieces builtInXpms[] = {\
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
+    { qll108, qld108, qdl108, qdd108, },\\r
+    { qll108, qld108, qdl108, qdd108, },\\r
+    { qll108, qld108, qdl108, qdd108, },\\r
+    { qll108, qld108, qdl108, qdd108, },\\r
   } },\\r
   { 95, {\\r
     { pll95, pld95, pdl95, pdd95, },\\r
   } },\\r
   { 95, {\\r
     { pll95, pld95, pdl95, pdd95, },\\r
@@ -912,6 +924,10 @@ XpmPieces builtInXpms[] = {\
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
+    { qll95, qld95, qdl95, qdd95, },\\r
+    { qll95, qld95, qdl95, qdd95, },\\r
+    { qll95, qld95, qdl95, qdd95, },\\r
+    { qll95, qld95, qdl95, qdd95, },\\r
   } },\\r
   { 87, {\\r
     { pll87, pld87, pdl87, pdd87, },\\r
   } },\\r
   { 87, {\\r
     { pll87, pld87, pdl87, pdd87, },\\r
@@ -936,6 +952,10 @@ XpmPieces builtInXpms[] = {\
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
+    { qll87, qld87, qdl87, qdd87, },\\r
+    { qll87, qld87, qdl87, qdd87, },\\r
+    { qll87, qld87, qdl87, qdd87, },\\r
+    { qll87, qld87, qdl87, qdd87, },\\r
   } },\\r
   { 80, {\\r
     { pll80, pld80, pdl80, pdd80, },\\r
   } },\\r
   { 80, {\\r
     { pll80, pld80, pdl80, pdd80, },\\r
@@ -960,6 +980,10 @@ XpmPieces builtInXpms[] = {\
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
+    { qll80, qld80, qdl80, qdd80, },\\r
+    { qll80, qld80, qdl80, qdd80, },\\r
+    { qll80, qld80, qdl80, qdd80, },\\r
+    { qll80, qld80, qdl80, qdd80, },\\r
   } },\\r
   { 72, {\\r
     { pll72, pld72, pdl72, pdd72, },\\r
   } },\\r
   { 72, {\\r
     { pll72, pld72, pdl72, pdd72, },\\r
@@ -984,6 +1008,10 @@ XpmPieces builtInXpms[] = {\
     { sll72, sld72, sdl72, sdd72, },\\r
     { ull72, uld72, udl72, udd72, },\\r
     { kll72, kld72, kdl72, kdd72, },\\r
     { sll72, sld72, sdl72, sdd72, },\\r
     { ull72, uld72, udl72, udd72, },\\r
     { kll72, kld72, kdl72, kdd72, },\\r
+    { wpll72, wpld72, wpdl72, wpdd72, },\\r
+    { wnll72, wnld72, wndl72, wndd72, },\\r
+    { wsll72, wsld72, wsdl72, wsdd72, },\\r
+    { wlll72, wlld72, wldl72, wldd72, },\\r
   } },\\r
   { 64, {\\r
     { pll64, pld64, pdl64, pdd64, },\\r
   } },\\r
   { 64, {\\r
     { pll64, pld64, pdl64, pdd64, },\\r
@@ -1008,6 +1036,10 @@ XpmPieces builtInXpms[] = {\
     { lll64, lld64, ldl64, ldd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
     { kll64, kld64, kdl64, kdd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
     { kll64, kld64, kdl64, kdd64, },\\r
+    { qll64, qld64, qdl64, qdd64, },\\r
+    { qll64, qld64, qdl64, qdd64, },\\r
+    { qll64, qld64, qdl64, qdd64, },\\r
+    { qll64, qld64, qdl64, qdd64, },\\r
   } },\\r
   { 58, {\\r
     { pll58, pld58, pdl58, pdd58, },\\r
   } },\\r
   { 58, {\\r
     { pll58, pld58, pdl58, pdd58, },\\r
@@ -1032,6 +1064,10 @@ XpmPieces builtInXpms[] = {\
     { lll58, lld58, ldl58, ldd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
     { kll58, kld58, kdl58, kdd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
     { kll58, kld58, kdl58, kdd58, },\\r
+    { qll58, qld58, qdl58, qdd58, },\\r
+    { qll58, qld58, qdl58, qdd58, },\\r
+    { qll58, qld58, qdl58, qdd58, },\\r
+    { qll58, qld58, qdl58, qdd58, },\\r
   } },\\r
   { 54, {\\r
     { pll54, pld54, pdl54, pdd54, },\\r
   } },\\r
   { 54, {\\r
     { pll54, pld54, pdl54, pdd54, },\\r
@@ -1056,6 +1092,10 @@ XpmPieces builtInXpms[] = {\
     { lll54, lld54, ldl54, ldd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
     { kll54, kld54, kdl54, kdd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
     { kll54, kld54, kdl54, kdd54, },\\r
+    { qll54, qld54, qdl54, qdd54, },\\r
+    { qll54, qld54, qdl54, qdd54, },\\r
+    { qll54, qld54, qdl54, qdd54, },\\r
+    { qll54, qld54, qdl54, qdd54, },\\r
   } },\\r
   { 49, {\\r
     { pll49, pld49, pdl49, pdd49, },\\r
   } },\\r
   { 49, {\\r
     { pll49, pld49, pdl49, pdd49, },\\r
@@ -1080,6 +1120,10 @@ XpmPieces builtInXpms[] = {\
     { sll49, sld49, sdl49, sdd49, },\\r
     { ull49, uld49, udl49, udd49, },\\r
     { kll49, kld49, kdl49, kdd49, },\\r
     { sll49, sld49, sdl49, sdd49, },\\r
     { ull49, uld49, udl49, udd49, },\\r
     { kll49, kld49, kdl49, kdd49, },\\r
+    { wpll49, wpld49, wpdl49, wpdd49, },\\r
+    { wnll49, wnld49, wndl49, wndd49, },\\r
+    { wsll49, wsld49, wsdl49, wsdd49, },\\r
+    { wlll49, wlld49, wldl49, wldd49, },\\r
   } },\\r
   { 45, {\\r
     { pll45, pld45, pdl45, pdd45, },\\r
   } },\\r
   { 45, {\\r
     { pll45, pld45, pdl45, pdd45, },\\r
@@ -1104,6 +1148,10 @@ XpmPieces builtInXpms[] = {\
     { lll45, lld45, ldl45, ldd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
     { kll45, kld45, kdl45, kdd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
     { kll45, kld45, kdl45, kdd45, },\\r
+    { qll45, qld45, qdl45, qdd45, },\\r
+    { qll45, qld45, qdl45, qdd45, },\\r
+    { qll45, qld45, qdl45, qdd45, },\\r
+    { qll45, qld45, qdl45, qdd45, },\\r
   } },\\r
   { 40, {\\r
     { pll40, pld40, pdl40, pdd40, },\\r
   } },\\r
   { 40, {\\r
     { pll40, pld40, pdl40, pdd40, },\\r
@@ -1128,6 +1176,10 @@ XpmPieces builtInXpms[] = {\
     { lll40, lld40, ldl40, ldd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
     { kll40, kld40, kdl40, kdd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
     { kll40, kld40, kdl40, kdd40, },\\r
+    { qll40, qld40, qdl40, qdd40, },\\r
+    { qll40, qld40, qdl40, qdd40, },\\r
+    { qll40, qld40, qdl40, qdd40, },\\r
+    { qll40, qld40, qdl40, qdd40, },\\r
   } },\\r
   { 37, {\\r
     { pll37, pld37, pdl37, pdd37, },\\r
   } },\\r
   { 37, {\\r
     { pll37, pld37, pdl37, pdd37, },\\r
@@ -1152,6 +1204,10 @@ XpmPieces builtInXpms[] = {\
     { lll37, lld37, ldl37, ldd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
     { kll37, kld37, kdl37, kdd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
     { kll37, kld37, kdl37, kdd37, },\\r
+    { qll37, qld37, qdl37, qdd37, },\\r
+    { qll37, qld37, qdl37, qdd37, },\\r
+    { qll37, qld37, qdl37, qdd37, },\\r
+    { qll37, qld37, qdl37, qdd37, },\\r
   } },\\r
   { 33, {\\r
     { pll33, pld33, pdl33, pdd33, },\\r
   } },\\r
   { 33, {\\r
     { pll33, pld33, pdl33, pdd33, },\\r
@@ -1176,6 +1232,10 @@ XpmPieces builtInXpms[] = {\
     { lll33, lld33, ldl33, ldd33, },\\r
     { lll33, lld33, ldl33, ldd33, },\\r
     { kll33, kld33, kdl33, kdd33, },\\r
     { lll33, lld33, ldl33, ldd33, },\\r
     { lll33, lld33, ldl33, ldd33, },\\r
     { kll33, kld33, kdl33, kdd33, },\\r
+    { qll33, qld33, qdl33, qdd33, },\\r
+    { qll33, qld33, qdl33, qdd33, },\\r
+    { qll33, qld33, qdl33, qdd33, },\\r
+    { qll33, qld33, qdl33, qdd33, },\\r
   } },\\r
   { 29, {\\r
     { pll29, pld29, pdl29, pdd29, },\\r
   } },\\r
   { 29, {\\r
     { pll29, pld29, pdl29, pdd29, },\\r
@@ -1200,6 +1260,10 @@ XpmPieces builtInXpms[] = {\
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
+    { qll29, qld29, qdl29, qdd29, },\\r
+    { qll29, qld29, qdl29, qdd29, },\\r
+    { qll29, qld29, qdl29, qdd29, },\\r
+    { qll29, qld29, qdl29, qdd29, },\\r
   } },\\r
   { 25, {\\r
     { pll25, pld25, pdl25, pdd25, },\\r
   } },\\r
   { 25, {\\r
     { pll25, pld25, pdl25, pdd25, },\\r
@@ -1224,6 +1288,10 @@ XpmPieces builtInXpms[] = {\
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
+    { qll25, qld25, qdl25, qdd25, },\\r
+    { qll25, qld25, qdl25, qdd25, },\\r
+    { qll25, qld25, qdl25, qdd25, },\\r
+    { qll25, qld25, qdl25, qdd25, },\\r
   } },\\r
   { 21, {\\r
     { pll21, pld21, pdl21, pdd21, },\\r
   } },\\r
   { 21, {\\r
     { pll21, pld21, pdl21, pdd21, },\\r
@@ -1248,6 +1316,10 @@ XpmPieces builtInXpms[] = {\
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
+    { qll21, qld21, qdl21, qdd21, },\\r
+    { qll21, qld21, qdl21, qdd21, },\\r
+    { qll21, qld21, qdl21, qdd21, },\\r
+    { qll21, qld21, qdl21, qdd21, },\\r
   } },\\r
   { 0, {\\r
     { NULL, NULL, NULL, NULL, },\\r
   } },\\r
   { 0, {\\r
     { NULL, NULL, NULL, NULL, },\\r
index f9ed2d7..7ddd4a8 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -495,16 +495,19 @@ char *chessDir, *programName, *programVersion,
 #define SOLID 0
 #define OUTLINE 1
 Pixmap pieceBitmap[2][(int)BlackPawn];
 #define SOLID 0
 #define OUTLINE 1
 Pixmap pieceBitmap[2][(int)BlackPawn];
-Pixmap xpmPieceBitmap[4][(int)BlackPawn];      /* LL, LD, DL, DD */
+Pixmap pieceBitmap2[2][(int)BlackPawn+4];       /* [HGM] pieces */
+Pixmap xpmPieceBitmap[4][(int)BlackPawn];      /* LL, LD, DL, DD actually used*/
+Pixmap xpmPieceBitmap2[4][(int)BlackPawn+4];   /* LL, LD, DL, DD set to select from */
 Pixmap xpmLightSquare, xpmDarkSquare, xpmJailSquare;
 int useImages, useImageSqs;
 Pixmap xpmLightSquare, xpmDarkSquare, xpmJailSquare;
 int useImages, useImageSqs;
-XImage *ximPieceBitmap[4][(int)BlackPawn];     /* LL, LD, DL, DD */
-Pixmap ximMaskPm[(int)BlackPawn];            /* clipmasks, used for XIM pieces */
+XImage *ximPieceBitmap[4][(int)BlackPawn+4];   /* LL, LD, DL, DD */
+Pixmap ximMaskPm[(int)BlackPawn];               /* clipmasks, used for XIM pieces */
+Pixmap ximMaskPm2[(int)BlackPawn+4];            /* clipmasks, used for XIM pieces */
 XImage *ximLightSquare, *ximDarkSquare;
 XImage *xim_Cross;
 
 XImage *ximLightSquare, *ximDarkSquare;
 XImage *xim_Cross;
 
-#define pieceToSolid(piece) &pieceBitmap[SOLID][((int)(piece)) % (int)BlackPawn]
-#define pieceToOutline(piece) &pieceBitmap[OUTLINE][((int)(piece)) % (int)BlackPawn]
+#define pieceToSolid(piece) &pieceBitmap[SOLID][(piece) % (int)BlackPawn]
+#define pieceToOutline(piece) &pieceBitmap[OUTLINE][(piece) % (int)BlackPawn]
 
 #define White(piece) ((int)(piece) < (int)BlackPawn)
 
 
 #define White(piece) ((int)(piece) < (int)BlackPawn)
 
@@ -2250,6 +2253,66 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     shellArgs[4].value = shellArgs[2].value = w;
     shellArgs[5].value = shellArgs[3].value = h;
     XtSetValues(shellWidget, &shellArgs[0], 6);
     shellArgs[4].value = shellArgs[2].value = w;
     shellArgs[5].value = shellArgs[3].value = h;
     XtSetValues(shellWidget, &shellArgs[0], 6);
+
+    // [HGM] pieces: tailor piece bitmaps to needs of specific variant
+    // (only for xpm)
+    if(useImages) {
+      for(i=0; i<4; i++) {
+       int p;
+       for(p=0; p<=(int)WhiteKing; p++)
+          xpmPieceBitmap[i][p] = xpmPieceBitmap2[i][p]; // defaults
+       if(gameInfo.variant == VariantShogi) {
+          xpmPieceBitmap[i][(int)WhiteCannon] = xpmPieceBitmap2[i][(int)WhiteKing+1];
+          xpmPieceBitmap[i][(int)WhiteNightrider] = xpmPieceBitmap2[i][(int)WhiteKing+2];
+          xpmPieceBitmap[i][(int)WhiteSilver] = xpmPieceBitmap2[i][(int)WhiteKing+3];
+          xpmPieceBitmap[i][(int)WhiteGrasshopper] = xpmPieceBitmap2[i][(int)WhiteKing+4];
+          xpmPieceBitmap[i][(int)WhiteQueen] = xpmPieceBitmap2[i][(int)WhiteLance];
+       }
+#ifdef GOTHIC
+       if(gameInfo.variant == VariantGothic) {
+          xpmPieceBitmap[i][(int)WhiteMarshall] = xpmPieceBitmap2[i][(int)WhiteSilver];
+       }
+#endif
+#if !HAVE_LIBXPM
+       // [HGM] why are thee ximMasks used at all? the ximPieceBitmaps seem to be never used!
+       for(p=0; p<=(int)WhiteKing; p++)
+          ximMaskPm[p] = ximMaskPm2[p]; // defaults
+       if(gameInfo.variant == VariantShogi) {
+          ximMaskPm[(int)WhiteCannon] = ximMaskPm2[(int)WhiteKing+1];
+          ximMaskPm[(int)WhiteNightrider] = ximMaskPm2[(int)WhiteKing+2];
+          ximMaskPm[(int)WhiteSilver] = ximMaskPm2[(int)WhiteKing+3];
+          ximMaskPm[(int)WhiteGrasshopper] = ximMaskPm2[(int)WhiteKing+4];
+          ximMaskPm[(int)WhiteQueen] = ximMaskPm2[(int)WhiteLance];
+       }
+#ifdef GOTHIC
+       if(gameInfo.variant == VariantGothic) {
+           ximMaskPm[(int)WhiteMarshall] = ximMaskPm2[i][(int)WhiteSilver];
+       }
+#endif
+#endif
+      }
+    } else {
+      for(i=0; i<2; i++) {
+       int p;
+       for(p=0; p<=(int)WhiteKing; p++)
+          pieceBitmap[i][p] = pieceBitmap2[i][p]; // defaults
+       if(gameInfo.variant == VariantShogi) {
+          pieceBitmap[i][(int)WhiteCannon] = pieceBitmap2[i][(int)WhiteKing+1];
+          pieceBitmap[i][(int)WhiteNightrider] = pieceBitmap2[i][(int)WhiteKing+2];
+          pieceBitmap[i][(int)WhiteSilver] = pieceBitmap2[i][(int)WhiteKing+3];
+          pieceBitmap[i][(int)WhiteGrasshopper] = pieceBitmap2[i][(int)WhiteKing+4];
+          pieceBitmap[i][(int)WhiteQueen] = pieceBitmap2[i][(int)WhiteLance];
+       }
+#ifdef GOTHIC
+       if(gameInfo.variant == VariantGothic) {
+          pieceBitmap[i][(int)WhiteMarshall] = pieceBitmap2[i][(int)WhiteSilver];
+       }
+#endif
+      }
+    }
+#if HAVE_LIBXPM
+    CreateAnimVars();
+#endif
 }
 #endif
 
 }
 #endif
 
@@ -3710,6 +3773,9 @@ void loadXIM(xim, xmask, filename, dest, mask)
     }
 }
 
     }
 }
 
+
+char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsukpnsl";
+
 void CreateXIMPieces()
 {
     int piece, kind;
 void CreateXIMPieces()
 {
     int piece, kind;
@@ -3740,13 +3806,14 @@ void CreateXIMPieces()
        }
        fprintf(stderr, _("\nLoading XIMs...\n"));
        /* Load pieces */
        }
        fprintf(stderr, _("\nLoading XIMs...\n"));
        /* Load pieces */
-       for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
+       for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
            fprintf(stderr, "%d", piece+1);
            for (kind=0; kind<4; kind++) {
                fprintf(stderr, ".");
            fprintf(stderr, "%d", piece+1);
            for (kind=0; kind<4; kind++) {
                fprintf(stderr, ".");
-               snprintf(buf, sizeof(buf), "%s/%c%s%u.xim",
+               snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xim",
                        ExpandPathName(appData.pixmapDirectory),
                        ExpandPathName(appData.pixmapDirectory),
-                       ToLower(PieceToChar((ChessSquare)piece)),
+                       piece <= (int) WhiteKing ? "" : "w",
+                       pieceBitmapNames[piece],
                        ximkind[kind], ss);
                ximPieceBitmap[kind][piece] =
                  XGetImage(xDisplay, DefaultRootWindow(xDisplay),
                        ximkind[kind], ss);
                ximPieceBitmap[kind][piece] =
                  XGetImage(xDisplay, DefaultRootWindow(xDisplay),
@@ -3755,8 +3822,10 @@ void CreateXIMPieces()
                  fprintf(stderr, _("(File:%s:) "), buf);
                loadXIM(ximPieceBitmap[kind][piece],
                        ximtemp, buf,
                  fprintf(stderr, _("(File:%s:) "), buf);
                loadXIM(ximPieceBitmap[kind][piece],
                        ximtemp, buf,
-                       &(xpmPieceBitmap[kind][piece]),
-                       &(ximMaskPm[piece%(int)BlackPawn]));
+                       &(xpmPieceBitmap2[kind][piece]),
+                       &(ximMaskPm2[piece]));
+               if(piece <= (int)WhiteKing)
+                   xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
            }
            fprintf(stderr," ");
        }
            }
            fprintf(stderr," ");
        }
@@ -3792,8 +3861,6 @@ void CreateXIMPieces()
     XSynchronize(xDisplay, False); /* Work-around for xlib/xt buffering bug */
 }
 
     XSynchronize(xDisplay, False); /* Work-around for xlib/xt buffering bug */
 }
 
-char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsuk";
-
 #if HAVE_LIBXPM
 void CreateXPMPieces()
 {
 #if HAVE_LIBXPM
 void CreateXPMPieces()
 {
@@ -3844,17 +3911,19 @@ void CreateXPMPieces()
          fprintf(stderr, _("No builtin XPM pieces of size %d\n"), squareSize);
          exit(1);
        }
          fprintf(stderr, _("No builtin XPM pieces of size %d\n"), squareSize);
          exit(1);
        }
-       for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
+       for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
            for (kind=0; kind<4; kind++) {
 
                if ((r=XpmCreatePixmapFromData(xDisplay, xBoardWindow,
                                               pieces->xpm[piece][kind],
            for (kind=0; kind<4; kind++) {
 
                if ((r=XpmCreatePixmapFromData(xDisplay, xBoardWindow,
                                               pieces->xpm[piece][kind],
-                                              &(xpmPieceBitmap[kind][piece]),
+                                              &(xpmPieceBitmap2[kind][piece]),
                                               NULL, &attr)) != 0) {
                  fprintf(stderr, _("Error %d loading XPM image \"%s\"\n"),
                          r, buf);
                  exit(1);
                }
                                               NULL, &attr)) != 0) {
                  fprintf(stderr, _("Error %d loading XPM image \"%s\"\n"),
                          r, buf);
                  exit(1);
                }
+               if(piece <= (int) WhiteKing)
+                   xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
            }
        }
        useImageSqs = 0;
            }
        }
        useImageSqs = 0;
@@ -3865,23 +3934,26 @@ void CreateXPMPieces()
        fprintf(stderr, _("\nLoading XPMs...\n"));
 
        /* Load pieces */
        fprintf(stderr, _("\nLoading XPMs...\n"));
 
        /* Load pieces */
-       for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
+       for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
            fprintf(stderr, "%d ", piece+1);
            for (kind=0; kind<4; kind++) {
            fprintf(stderr, "%d ", piece+1);
            for (kind=0; kind<4; kind++) {
-             snprintf(buf, sizeof(buf), "%s/%c%s%u.xpm",
+             snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xpm",
                        ExpandPathName(appData.pixmapDirectory),
                        ExpandPathName(appData.pixmapDirectory),
+                       piece > (int) WhiteKing ? "w" : "",
                        pieceBitmapNames[piece],
                        xpmkind[kind], ss);
                if (appData.debugMode) {
                    fprintf(stderr, _("(File:%s:) "), buf);
                }
                if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
                        pieceBitmapNames[piece],
                        xpmkind[kind], ss);
                if (appData.debugMode) {
                    fprintf(stderr, _("(File:%s:) "), buf);
                }
                if ((r=XpmReadFileToPixmap(xDisplay, xBoardWindow, buf,
-                                          &(xpmPieceBitmap[kind][piece]),
+                                          &(xpmPieceBitmap2[kind][piece]),
                                           NULL, &attr)) != 0) {
                    fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),
                            r, buf);
                    exit(1);
                }
                                           NULL, &attr)) != 0) {
                    fprintf(stderr, _("Error %d loading XPM file \"%s\"\n"),
                            r, buf);
                    exit(1);
                }
+               if(piece <= (int) WhiteKing) 
+                   xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece];
            }
        }
        /* Load light and dark squares */
            }
        }
        /* Load light and dark squares */
@@ -3933,10 +4005,13 @@ void CreatePieces()
                                     buffering bug */
 
     for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
                                     buffering bug */
 
     for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
-       for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
-           sprintf(buf, "%c%u%c.bm", pieceBitmapNames[piece],
+       for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
+           sprintf(buf, "%s%c%u%c.bm", piece > (int)WhiteKing ? "w" : "",
+                   pieceBitmapNames[piece],
                    ss, kind == SOLID ? 's' : 'o');
                    ss, kind == SOLID ? 's' : 'o');
-           ReadBitmap(&pieceBitmap[kind][piece], buf, NULL, ss, ss);
+           ReadBitmap(&pieceBitmap2[kind][piece], buf, NULL, ss, ss);
+           if(piece <= (int)WhiteKing)
+               pieceBitmap[kind][piece] = pieceBitmap2[kind][piece];
        }
     }
 
        }
     }
 
@@ -3958,11 +4033,14 @@ void CreatePieces()
     while (bib->squareSize != ss && bib->squareSize != 0) bib++;
 
     for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
     while (bib->squareSize != ss && bib->squareSize != 0) bib++;
 
     for (kind = SOLID; kind <= (appData.monoMode ? OUTLINE : SOLID); kind++) {
-       for (piece = (int) WhitePawn; piece <= (int) WhiteKing; piece++) {
-           sprintf(buf, "%c%u%c.bm", pieceBitmapNames[piece],
+       for (piece = (int) WhitePawn; piece <= (int) WhiteKing + 4; piece++) {
+           sprintf(buf, "%s%c%u%c.bm", piece > (int)WhiteKing ? "w" : "",
+                   pieceBitmapNames[piece],
                    ss, kind == SOLID ? 's' : 'o');
                    ss, kind == SOLID ? 's' : 'o');
-           ReadBitmap(&pieceBitmap[kind][piece], buf,
+           ReadBitmap(&pieceBitmap2[kind][piece], buf,
                       bib->bits[kind][piece], ss, ss);
                       bib->bits[kind][piece], ss, ss);
+           if(piece <= (int)WhiteKing)
+               pieceBitmap[kind][piece] = pieceBitmap2[kind][piece];
        }
     }
 
        }
     }
 
@@ -4678,17 +4756,6 @@ void DrawSquare(row, column, piece, do_flash)
     DrawFunc drawfunc;
     int flash_delay;
 
     DrawFunc drawfunc;
     int flash_delay;
 
-    if(gameInfo.variant == VariantShogi) { // [HGM] shogi: in shogi Q is used for Lance
-       if(piece == WhiteQueen) piece = WhiteLance; else
-       if(piece == BlackQueen) piece = BlackLance;
-    }
-#ifdef GOTHIC
-    else if(gameInfo.variant == VariantGothic) { // [HGM] shogi: in Gothic Chancelor has alternative look
-       if(piece == WhiteMarshall) piece = WhiteSilver; else
-       if(piece == BlackMarshall) piece = BlackSilver;
-    }
-#endif
-
     /* Calculate delay in milliseconds (2-delays per complete flash) */
     flash_delay = 500 / appData.flashRate;
 
     /* Calculate delay in milliseconds (2-delays per complete flash) */
     flash_delay = 500 / appData.flashRate;
 
@@ -8358,7 +8425,7 @@ int OpenTelnet(host, port, pr)
     if (port[0] == NULLCHAR) {
       snprintf(cmdLine, sizeof(cmdLine), "%s %s", appData.telnetProgram, host);
     } else {
     if (port[0] == NULLCHAR) {
       snprintf(cmdLine, sizeof(cmdLine), "%s %s", appData.telnetProgram, host);
     } else {
-      snprintf(cmdLine,sizeof(cmdLine), "%s %s %s", appData.telnetProgram, host, port);
+      snprintf(cmdLine, sizeof(cmdLine), "%s %s %s", appData.telnetProgram, host, port);
     }
     return StartChildProcess(cmdLine, "", pr);
 }
     }
     return StartChildProcess(cmdLine, "", pr);
 }
@@ -8642,6 +8709,8 @@ int OutputToProcessDelayed(pr, message, count, outError, msdelay)
        and dark squares, and all pieces must use the same
        background square colors/images.                */
 
        and dark squares, and all pieces must use the same
        background square colors/images.                */
 
+static int xpmDone = 0;
+
 static void
 CreateAnimMasks (pieceDepth)
      int pieceDepth;
 static void
 CreateAnimMasks (pieceDepth)
      int pieceDepth;
@@ -8672,6 +8741,7 @@ CreateAnimMasks (pieceDepth)
 
   for (piece = WhitePawn; piece <= BlackKing; piece++) {
     /* Begin with empty mask */
 
   for (piece = WhitePawn; piece <= BlackKing; piece++) {
     /* Begin with empty mask */
+    if(!xpmDone) // [HGM] pieces: keep using existing
     xpmMask[piece] = XCreatePixmap(xDisplay, xBoardWindow,
                                 squareSize, squareSize, 1);
     XSetFunction(xDisplay, maskGC, GXclear);
     xpmMask[piece] = XCreatePixmap(xDisplay, xBoardWindow,
                                 squareSize, squareSize, 1);
     XSetFunction(xDisplay, maskGC, GXclear);
@@ -8755,11 +8825,11 @@ InitAnimState (anim, info)
 static void
 CreateAnimVars ()
 {
 static void
 CreateAnimVars ()
 {
-  static int done = 0;
+  static VariantClass old = (VariantClass) -1; // [HGM] pieces: redo every time variant changes
   XWindowAttributes info;
 
   XWindowAttributes info;
 
-  if (done) return;
-  done = 1;
+  if (xpmDone && gameInfo.variant == old) return;
+  if(xpmDone) old = gameInfo.variant; // first time pieces might not be created yet
   XGetWindowAttributes(xDisplay, xBoardWindow, &info);
 
   InitAnimState(&game, &info);
   XGetWindowAttributes(xDisplay, xBoardWindow, &info);
 
   InitAnimState(&game, &info);
@@ -8768,6 +8838,7 @@ CreateAnimVars ()
   /* For XPM pieces, we need bitmaps to use as masks. */
   if (useImages)
     CreateAnimMasks(info.depth);
   /* For XPM pieces, we need bitmaps to use as masks. */
   if (useImages)
     CreateAnimMasks(info.depth);
+   xpmDone = 1;
 }
 
 #ifndef HAVE_USLEEP
 }
 
 #ifndef HAVE_USLEEP
@@ -8993,7 +9064,7 @@ SelectGCMask(piece, clip, outline, mask)
 #if HAVE_LIBXPM
       *mask = xpmMask[piece];
 #else
 #if HAVE_LIBXPM
       *mask = xpmMask[piece];
 #else
-      *mask = ximMaskPm[piece%(int)BlackPawn];
+      *mask = ximMaskPm[piece];
 #endif
   } else {
       *mask = *pieceToSolid(piece);
 #endif
   } else {
       *mask = *pieceToSolid(piece);
@@ -9042,7 +9113,7 @@ OverlayPiece(piece, clip, outline,  dest)
       kind = 0;
     else
       kind = 2;
       kind = 0;
     else
       kind = 2;
-    XCopyArea(xDisplay, xpmPieceBitmap[kind][((int)piece) % (int)BlackPawn],
+    XCopyArea(xDisplay, xpmPieceBitmap[kind][piece],
              dest, clip,
              0, 0, squareSize, squareSize,
              0, 0);
              dest, clip,
              0, 0, squareSize, squareSize,
              0, 0);