X11: Make statue tiles look like grayscale monsters

This commit is contained in:
Pasi Kallinen
2016-06-23 09:44:07 +03:00
parent 7feb3ad948
commit 5f35d49105
6 changed files with 39 additions and 6 deletions

View File

@@ -37,6 +37,20 @@ static void FDECL(write_txttile, (FILE *, pixel (*)[TILE_X]));
"%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.] = " \
"(%d, %d, %d) "
static boolean grayscale = FALSE;
/* grayscale color mapping */
static const int graymappings[] = {
/* . A B C D E F G H I J K L M N O P */
0, 1, 17, 18, 19, 20, 27, 22, 23, 24, 25, 26, 21, 15, 13, 14, 14
};
void
set_grayscale(g)
boolean g;
{
grayscale = g;
}
static void
read_text_colormap(txtfile)
FILE *txtfile;
@@ -135,6 +149,13 @@ pixel (*pixels)[TILE_X];
return FALSE;
}
k = color_index[(int) c[0]];
if (grayscale) {
if (k > (SIZE(graymappings) - 1))
Fprintf(stderr, "Gray mapping issue %d > %d.\n", k,
SIZE(graymappings) - 1);
else
k = graymappings[k];
}
if (k == -1)
Fprintf(stderr, "color %c not in colormap!\n", c[0]);
else {