X11: Make statue tiles look like grayscale monsters
This commit is contained in:
@@ -31,9 +31,11 @@ all: $(VARDAT) spec_levs quest_levs dungeon
|
||||
(cd ../util ; $(MAKE) tile2bmp)
|
||||
|
||||
x11tiles: ../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
|
||||
../win/share/other.txt
|
||||
../win/share/other.txt \
|
||||
../win/share/monsters.txt
|
||||
../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
|
||||
../win/share/other.txt
|
||||
../win/share/other.txt \
|
||||
-grayscale ../win/share/monsters.txt
|
||||
|
||||
beostiles: ../util/tile2beos ../win/share/monsters.txt \
|
||||
../win/share/objects.txt \
|
||||
|
||||
@@ -177,7 +177,7 @@ char **argv;
|
||||
header.per_row = TILES_PER_ROW;
|
||||
|
||||
if (argc == 1) {
|
||||
Fprintf(stderr, "usage: %s txt_file1 [txt_file2 ...]\n", argv[0]);
|
||||
Fprintf(stderr, "usage: %s txt_file1 [txt_file2 ...] [-grayscale txt_fileN]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -190,8 +190,15 @@ char **argv;
|
||||
/* don't leave garbage at end of partial row */
|
||||
(void) memset((genericptr_t) tile_bytes, 0, sizeof(tile_bytes));
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strncmp(argv[i], "-grayscale", 10)) {
|
||||
set_grayscale(TRUE);
|
||||
if (i < (argc - 1)) i++;
|
||||
} else {
|
||||
set_grayscale(FALSE);
|
||||
}
|
||||
process_file(argv[i]);
|
||||
}
|
||||
Fprintf(stderr, "Total tiles: %ld\n", header.ntiles);
|
||||
|
||||
/* round size up to the end of the row */
|
||||
|
||||
@@ -57,8 +57,10 @@ boolean read_text_tile(pixel[TILE_Y][TILE_X]);
|
||||
boolean write_text_tile(pixel[TILE_Y][TILE_X]);
|
||||
writes tile
|
||||
|
||||
There are two additional shared routines provided for writers:
|
||||
There are some additional shared routines provided for writers:
|
||||
|
||||
void set_grayscale(boolean g);
|
||||
do grayscale color substitutions when reading the tile text file
|
||||
void init_colormap();
|
||||
initialize the output colormap from the input one
|
||||
must be called before opening output file as colormap is part of header
|
||||
|
||||
@@ -35,6 +35,7 @@ extern boolean FDECL(read_text_tile, (pixel(*) [TILE_X]));
|
||||
extern boolean FDECL(write_text_tile, (pixel(*) [TILE_X]));
|
||||
extern int NDECL(fclose_text_file);
|
||||
|
||||
extern void FDECL(set_grayscale, (boolean));
|
||||
extern void NDECL(init_colormap);
|
||||
extern void NDECL(merge_colormap);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ extern void FDECL(exit, (int));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(WIN32)
|
||||
#if defined(MSDOS) || defined(WIN32) || defined(X11_GRAPHICS)
|
||||
#define STATUES_LOOK_LIKE_MONSTERS
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user