OSDN Git Service

upgrade to 3.6.1
[jnethack/source.git] / win / X11 / tile2x11.c
index c9e410f..750f12a 100644 (file)
@@ -1,4 +1,6 @@
-/* $NHDT-Date: 1432512808 2015/05/25 00:13:28 $  $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */
+/* $NHDT-Date: 1524689304 2018/04/25 20:48:24 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.11 $ */
+/*      Copyright (c) 2017 by Pasi Kallinen                       */
+/* NetHack may be freely redistributed.  See license for details. */
 
 /*
  * Convert the given input files into an output file that is expected
@@ -91,7 +93,7 @@ merge_text_colormap()
 
         if (j == header.ncolors) { /* couldn't find it */
 #ifdef PRINT_COLORMAP
-            printf("color %2d: %3d %3d %3d\n", header.ncolors,
+            Fprintf(stdout, "color %2d: %3d %3d %3d\n", header.ncolors,
                    ColorMap[CM_RED][i], ColorMap[CM_GREEN][i],
                    ColorMap[CM_BLUE][i]);
 #endif
@@ -117,7 +119,7 @@ char *fname;
     }
     merge_text_colormap();
     count = convert_tiles(&curr_tb, header.ntiles);
-    Fprintf(stderr, "%s: %lu tiles\n", fname, count);
+    Fprintf(stdout, "%s: %lu tiles\n", fname, count);
     header.ntiles += count;
     fclose_text_file();
 }
@@ -177,7 +179,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,9 +192,16 @@ 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);
+    }
+    Fprintf(stdout, "Total tiles: %ld\n", header.ntiles);
 
     /* round size up to the end of the row */
     if ((header.ntiles % header.per_row) != 0) {