From d80f24c825e4f0102d77cdf092197304949d46ca Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sat, 27 Jun 2009 16:51:02 -0700 Subject: [PATCH] adds bitmaps for shogi promotions, and selects the bitmaps or pixmaps for the more rarely used piece types on a per-variant basis. --- bitmaps/bitmaps.h | 74 +++++++++++++------------- pixmaps/pixmaps.h | 74 +++++++++++++++++++++++++- xboard.c | 151 +++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 221 insertions(+), 78 deletions(-) diff --git a/bitmaps/bitmaps.h b/bitmaps/bitmaps.h index e5948b4..fc861a5 100644 --- a/bitmaps/bitmaps.h +++ b/bitmaps/bitmaps.h @@ -465,64 +465,64 @@ typedef struct { int squareSize; - unsigned char *bits[2][(int)BlackPawn]; + unsigned char *bits[2][(int)BlackPawn+4]; } BuiltInBits; BuiltInBits builtInBits[] = {\ { 129,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 116,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 108,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 95,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 87,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 80,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } },\ { 72,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 64,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 58,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 54,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 49,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 45,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 40,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 37,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 33,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 29,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 25,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 21,\ - { { 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 },\ - { 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 } } },\ + { { 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 },\ + { 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 } } },\ { 0,\ { { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },\ { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } } }\ diff --git a/pixmaps/pixmaps.h b/pixmaps/pixmaps.h index d15a5c1..db0e63e 100644 --- a/pixmaps/pixmaps.h +++ b/pixmaps/pixmaps.h @@ -813,7 +813,7 @@ typedef struct { int size; - char **xpm[(int)BlackPawn][4]; + char **xpm[(int)BlackPawn+4][4]; } XpmPieces; XpmPieces builtInXpms[] = {\ @@ -840,6 +840,10 @@ XpmPieces builtInXpms[] = {\ { kll129, kld129, kdl129, kdd129, },\ { kll129, kld129, kdl129, kdd129, },\ { kll129, kld129, kdl129, kdd129, },\ + { qll129, qld129, qdl129, qdd129, },\ + { qll129, qld129, qdl129, qdd129, },\ + { qll129, qld129, qdl129, qdd129, },\ + { qll129, qld129, qdl129, qdd129, },\ } },\ { 116, {\ { pll116, pld116, pdl116, pdd116, },\ @@ -864,6 +868,10 @@ XpmPieces builtInXpms[] = {\ { kll116, kld116, kdl116, kdd116, },\ { kll116, kld116, kdl116, kdd116, },\ { kll116, kld116, kdl116, kdd116, },\ + { qll116, qld116, qdl116, qdd116, },\ + { qll116, qld116, qdl116, qdd116, },\ + { qll116, qld116, qdl116, qdd116, },\ + { qll116, qld116, qdl116, qdd116, },\ } },\ { 108, {\ { pll108, pld108, pdl108, pdd108, },\ @@ -888,6 +896,10 @@ XpmPieces builtInXpms[] = {\ { kll108, kld108, kdl108, kdd108, },\ { kll108, kld108, kdl108, kdd108, },\ { kll108, kld108, kdl108, kdd108, },\ + { qll108, qld108, qdl108, qdd108, },\ + { qll108, qld108, qdl108, qdd108, },\ + { qll108, qld108, qdl108, qdd108, },\ + { qll108, qld108, qdl108, qdd108, },\ } },\ { 95, {\ { pll95, pld95, pdl95, pdd95, },\ @@ -912,6 +924,10 @@ XpmPieces builtInXpms[] = {\ { kll95, kld95, kdl95, kdd95, },\ { kll95, kld95, kdl95, kdd95, },\ { kll95, kld95, kdl95, kdd95, },\ + { qll95, qld95, qdl95, qdd95, },\ + { qll95, qld95, qdl95, qdd95, },\ + { qll95, qld95, qdl95, qdd95, },\ + { qll95, qld95, qdl95, qdd95, },\ } },\ { 87, {\ { pll87, pld87, pdl87, pdd87, },\ @@ -936,6 +952,10 @@ XpmPieces builtInXpms[] = {\ { kll87, kld87, kdl87, kdd87, },\ { kll87, kld87, kdl87, kdd87, },\ { kll87, kld87, kdl87, kdd87, },\ + { qll87, qld87, qdl87, qdd87, },\ + { qll87, qld87, qdl87, qdd87, },\ + { qll87, qld87, qdl87, qdd87, },\ + { qll87, qld87, qdl87, qdd87, },\ } },\ { 80, {\ { pll80, pld80, pdl80, pdd80, },\ @@ -960,6 +980,10 @@ XpmPieces builtInXpms[] = {\ { kll80, kld80, kdl80, kdd80, },\ { kll80, kld80, kdl80, kdd80, },\ { kll80, kld80, kdl80, kdd80, },\ + { qll80, qld80, qdl80, qdd80, },\ + { qll80, qld80, qdl80, qdd80, },\ + { qll80, qld80, qdl80, qdd80, },\ + { qll80, qld80, qdl80, qdd80, },\ } },\ { 72, {\ { pll72, pld72, pdl72, pdd72, },\ @@ -984,6 +1008,10 @@ XpmPieces builtInXpms[] = {\ { sll72, sld72, sdl72, sdd72, },\ { ull72, uld72, udl72, udd72, },\ { kll72, kld72, kdl72, kdd72, },\ + { wpll72, wpld72, wpdl72, wpdd72, },\ + { wnll72, wnld72, wndl72, wndd72, },\ + { wsll72, wsld72, wsdl72, wsdd72, },\ + { wlll72, wlld72, wldl72, wldd72, },\ } },\ { 64, {\ { pll64, pld64, pdl64, pdd64, },\ @@ -1008,6 +1036,10 @@ XpmPieces builtInXpms[] = {\ { lll64, lld64, ldl64, ldd64, },\ { lll64, lld64, ldl64, ldd64, },\ { kll64, kld64, kdl64, kdd64, },\ + { qll64, qld64, qdl64, qdd64, },\ + { qll64, qld64, qdl64, qdd64, },\ + { qll64, qld64, qdl64, qdd64, },\ + { qll64, qld64, qdl64, qdd64, },\ } },\ { 58, {\ { pll58, pld58, pdl58, pdd58, },\ @@ -1032,6 +1064,10 @@ XpmPieces builtInXpms[] = {\ { lll58, lld58, ldl58, ldd58, },\ { lll58, lld58, ldl58, ldd58, },\ { kll58, kld58, kdl58, kdd58, },\ + { qll58, qld58, qdl58, qdd58, },\ + { qll58, qld58, qdl58, qdd58, },\ + { qll58, qld58, qdl58, qdd58, },\ + { qll58, qld58, qdl58, qdd58, },\ } },\ { 54, {\ { pll54, pld54, pdl54, pdd54, },\ @@ -1056,6 +1092,10 @@ XpmPieces builtInXpms[] = {\ { lll54, lld54, ldl54, ldd54, },\ { lll54, lld54, ldl54, ldd54, },\ { kll54, kld54, kdl54, kdd54, },\ + { qll54, qld54, qdl54, qdd54, },\ + { qll54, qld54, qdl54, qdd54, },\ + { qll54, qld54, qdl54, qdd54, },\ + { qll54, qld54, qdl54, qdd54, },\ } },\ { 49, {\ { pll49, pld49, pdl49, pdd49, },\ @@ -1080,6 +1120,10 @@ XpmPieces builtInXpms[] = {\ { sll49, sld49, sdl49, sdd49, },\ { ull49, uld49, udl49, udd49, },\ { kll49, kld49, kdl49, kdd49, },\ + { wpll49, wpld49, wpdl49, wpdd49, },\ + { wnll49, wnld49, wndl49, wndd49, },\ + { wsll49, wsld49, wsdl49, wsdd49, },\ + { wlll49, wlld49, wldl49, wldd49, },\ } },\ { 45, {\ { pll45, pld45, pdl45, pdd45, },\ @@ -1104,6 +1148,10 @@ XpmPieces builtInXpms[] = {\ { lll45, lld45, ldl45, ldd45, },\ { lll45, lld45, ldl45, ldd45, },\ { kll45, kld45, kdl45, kdd45, },\ + { qll45, qld45, qdl45, qdd45, },\ + { qll45, qld45, qdl45, qdd45, },\ + { qll45, qld45, qdl45, qdd45, },\ + { qll45, qld45, qdl45, qdd45, },\ } },\ { 40, {\ { pll40, pld40, pdl40, pdd40, },\ @@ -1128,6 +1176,10 @@ XpmPieces builtInXpms[] = {\ { lll40, lld40, ldl40, ldd40, },\ { lll40, lld40, ldl40, ldd40, },\ { kll40, kld40, kdl40, kdd40, },\ + { qll40, qld40, qdl40, qdd40, },\ + { qll40, qld40, qdl40, qdd40, },\ + { qll40, qld40, qdl40, qdd40, },\ + { qll40, qld40, qdl40, qdd40, },\ } },\ { 37, {\ { pll37, pld37, pdl37, pdd37, },\ @@ -1152,6 +1204,10 @@ XpmPieces builtInXpms[] = {\ { lll37, lld37, ldl37, ldd37, },\ { lll37, lld37, ldl37, ldd37, },\ { kll37, kld37, kdl37, kdd37, },\ + { qll37, qld37, qdl37, qdd37, },\ + { qll37, qld37, qdl37, qdd37, },\ + { qll37, qld37, qdl37, qdd37, },\ + { qll37, qld37, qdl37, qdd37, },\ } },\ { 33, {\ { pll33, pld33, pdl33, pdd33, },\ @@ -1176,6 +1232,10 @@ XpmPieces builtInXpms[] = {\ { lll33, lld33, ldl33, ldd33, },\ { lll33, lld33, ldl33, ldd33, },\ { kll33, kld33, kdl33, kdd33, },\ + { qll33, qld33, qdl33, qdd33, },\ + { qll33, qld33, qdl33, qdd33, },\ + { qll33, qld33, qdl33, qdd33, },\ + { qll33, qld33, qdl33, qdd33, },\ } },\ { 29, {\ { pll29, pld29, pdl29, pdd29, },\ @@ -1200,6 +1260,10 @@ XpmPieces builtInXpms[] = {\ { kll29, kld29, kdl29, kdd29, },\ { kll29, kld29, kdl29, kdd29, },\ { kll29, kld29, kdl29, kdd29, },\ + { qll29, qld29, qdl29, qdd29, },\ + { qll29, qld29, qdl29, qdd29, },\ + { qll29, qld29, qdl29, qdd29, },\ + { qll29, qld29, qdl29, qdd29, },\ } },\ { 25, {\ { pll25, pld25, pdl25, pdd25, },\ @@ -1224,6 +1288,10 @@ XpmPieces builtInXpms[] = {\ { kll25, kld25, kdl25, kdd25, },\ { kll25, kld25, kdl25, kdd25, },\ { kll25, kld25, kdl25, kdd25, },\ + { qll25, qld25, qdl25, qdd25, },\ + { qll25, qld25, qdl25, qdd25, },\ + { qll25, qld25, qdl25, qdd25, },\ + { qll25, qld25, qdl25, qdd25, },\ } },\ { 21, {\ { pll21, pld21, pdl21, pdd21, },\ @@ -1248,6 +1316,10 @@ XpmPieces builtInXpms[] = {\ { kll21, kld21, kdl21, kdd21, },\ { kll21, kld21, kdl21, kdd21, },\ { kll21, kld21, kdl21, kdd21, },\ + { qll21, qld21, qdl21, qdd21, },\ + { qll21, qld21, qdl21, qdd21, },\ + { qll21, qld21, qdl21, qdd21, },\ + { qll21, qld21, qdl21, qdd21, },\ } },\ { 0, {\ { NULL, NULL, NULL, NULL, },\ diff --git a/xboard.c b/xboard.c index f9ed2d7..7ddd4a8 100644 --- 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]; -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; -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; -#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) @@ -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); + + // [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 @@ -3710,6 +3773,9 @@ void loadXIM(xim, xmask, filename, dest, mask) } } + +char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsukpnsl"; + void CreateXIMPieces() { int piece, kind; @@ -3740,13 +3806,14 @@ void CreateXIMPieces() } 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, "."); - snprintf(buf, sizeof(buf), "%s/%c%s%u.xim", + snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xim", ExpandPathName(appData.pixmapDirectory), - ToLower(PieceToChar((ChessSquare)piece)), + piece <= (int) WhiteKing ? "" : "w", + pieceBitmapNames[piece], 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, - &(xpmPieceBitmap[kind][piece]), - &(ximMaskPm[piece%(int)BlackPawn])); + &(xpmPieceBitmap2[kind][piece]), + &(ximMaskPm2[piece])); + if(piece <= (int)WhiteKing) + xpmPieceBitmap[kind][piece] = xpmPieceBitmap2[kind][piece]; } fprintf(stderr," "); } @@ -3792,8 +3861,6 @@ void CreateXIMPieces() XSynchronize(xDisplay, False); /* Work-around for xlib/xt buffering bug */ } -char pieceBitmapNames[] = "pnbrqfeacwmohijgdvlsuk"; - #if HAVE_LIBXPM void CreateXPMPieces() { @@ -3844,17 +3911,19 @@ void CreateXPMPieces() 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], - &(xpmPieceBitmap[kind][piece]), + &(xpmPieceBitmap2[kind][piece]), 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; @@ -3865,23 +3934,26 @@ void CreateXPMPieces() 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++) { - snprintf(buf, sizeof(buf), "%s/%c%s%u.xpm", + snprintf(buf, sizeof(buf), "%s/%s%c%s%u.xpm", 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, - &(xpmPieceBitmap[kind][piece]), + &(xpmPieceBitmap2[kind][piece]), 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 */ @@ -3933,10 +4005,13 @@ void CreatePieces() 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'); - 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++) { - 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'); - ReadBitmap(&pieceBitmap[kind][piece], buf, + ReadBitmap(&pieceBitmap2[kind][piece], buf, 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; - 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; @@ -8358,7 +8425,7 @@ int OpenTelnet(host, port, pr) 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); } @@ -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. */ +static int xpmDone = 0; + static void CreateAnimMasks (pieceDepth) int pieceDepth; @@ -8672,6 +8741,7 @@ CreateAnimMasks (pieceDepth) 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); @@ -8755,11 +8825,11 @@ InitAnimState (anim, info) static void CreateAnimVars () { - static int done = 0; + static VariantClass old = (VariantClass) -1; // [HGM] pieces: redo every time variant changes 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); @@ -8768,6 +8838,7 @@ CreateAnimVars () /* For XPM pieces, we need bitmaps to use as masks. */ if (useImages) CreateAnimMasks(info.depth); + xpmDone = 1; } #ifndef HAVE_USLEEP @@ -8993,7 +9064,7 @@ SelectGCMask(piece, clip, outline, mask) #if HAVE_LIBXPM *mask = xpmMask[piece]; #else - *mask = ximMaskPm[piece%(int)BlackPawn]; + *mask = ximMaskPm[piece]; #endif } else { *mask = *pieceToSolid(piece); @@ -9042,7 +9113,7 @@ OverlayPiece(piece, clip, outline, dest) 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); -- 1.7.0.4