1 /* SCCS Id: @(#)thintile.c 3.4 1995/11/26 */
2 /* Copyright (c) NetHack Development Team 1995 */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* Create a set of overview tiles by eliminating even pixels in original */
14 static char pixels[TILE_Y][TILE_X];
16 static char *tilefiles[] = { "../win/share/monsters.txt",
17 "../win/share/objects.txt",
18 "../win/share/other.txt"};
20 static char *thinfiles[] = { "../win/share/monthin.txt",
21 "../win/share/objthin.txt",
22 "../win/share/oththin.txt"};
23 static FILE *infile, *outfile;
25 static int tilecount_per_file;
27 static char comment[BUFSZ];
35 while (fscanf(infile, "%[A-Za-z0-9] = (%d, %d, %d) ", c, &r, &g, &b)
37 Fprintf(outfile, "%c = (%d, %d, %d)\n", c[0], r, g, b);
51 if (fscanf(infile, "# %s %d (%[^)])", buf2, &i, buf) <= 0)
54 Sprintf(comment,"# tile %d (%s)", i, buf);
56 /* look for non-whitespace at each stage */
57 if (fscanf(infile, "%1s", c) < 0) {
58 Fprintf(stderr, "unexpected EOF\n");
62 Fprintf(stderr, "didn't find expected '{'\n");
65 for (j = 0; j < TILE_Y; j++) {
66 for (i = 0; i < TILE_X; i++) {
67 if (fscanf(infile, "%1s", c) < 0) {
68 Fprintf(stderr, "unexpected EOF\n");
74 if (fscanf(infile, "%1s ", c) < 0) {
75 Fprintf(stderr, "unexpected EOF\n");
79 Fprintf(stderr, "didn't find expected '}'\n");
91 Fprintf(outfile, "%s\n", comment);
92 Fprintf(outfile, "{\n");
93 for (j = 0; j < TILE_Y; j++) {
94 Fprintf(outfile, " ");
95 for (i = 0; i < TILE_X; i += 2) {
96 (void) fputc(pixels[j][i], outfile);
98 Fprintf(outfile, "\n");
100 Fprintf(outfile, "}\n");
107 while (filenum < 3) {
108 tilecount_per_file = 0;
109 infile = fopen(tilefiles[filenum], RDTMODE);
110 outfile = fopen(thinfiles[filenum], WRTMODE);
112 while (read_txttile()) {
114 tilecount_per_file++;
119 printf("%d tiles processed from %s\n",
120 tilecount_per_file, tilefiles[filenum]);
123 printf("Grand total of %d tiles processed.\n", tilecount);