Use the graymapping stuff in the tile lib
authorPasi Kallinen <paxed@alt.org>
Thu, 23 Jun 2016 07:15:55 +0000 (10:15 +0300)
committerPasi Kallinen <paxed@alt.org>
Thu, 23 Jun 2016 07:15:55 +0000 (10:15 +0300)
win/share/tile2bmp.c

index 7a6c736a4ff355829b1609b7d7cdd2a721bb31d5..d0fb36333a476fe087d9e3225f386d0e24064c7e 100644 (file)
@@ -237,6 +237,7 @@ char *argv[];
             }
             initflag = 1;
         }
+        set_grayscale(pass == 3);
         /*             printf("Colormap initialized\n"); */
         while (read_text_tile(tilepixels)) {
             build_bmptile(tilepixels);
@@ -327,11 +328,6 @@ BITMAPINFOHEADER *pbmih;
     pbmih->biClrImportant = (DWORD) 0;
 }
 
-static 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
-};
-
 static void
 build_bmptile(pixels)
 pixel (*pixels)[TILE_X];
@@ -351,14 +347,6 @@ pixel (*pixels)[TILE_X];
                 Fprintf(stderr, "color not in colormap!\n");
             y = (MAX_Y - 1) - (cur_y + yoffset);
             apply_color = cur_color;
-            if (pass == 3) {
-                /* map to shades of gray */
-                if (cur_color > (SIZE(graymappings) - 1))
-                    Fprintf(stderr, "Gray mapping issue %d %d.\n", cur_color,
-                            SIZE(graymappings) - 1);
-                else
-                    apply_color = graymappings[cur_color];
-            }
 #if BITCOUNT == 4
             x = (cur_x / 2) + xoffset;
             bmp.packtile[y][x] = cur_x % 2