summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/rltiles/tool/tile_convert.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-12 03:55:34 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-09-12 03:55:34 +0000
commit7c1e0016bfbaf83edc7ced6c18525b02cef706e8 (patch)
tree77d315f9f55aba8bb2372974b17b8f7dbc26a1b6 /crawl-ref/source/rltiles/tool/tile_convert.cc
parentb1c63e6499689b802d76caa64f766a36ec081ec2 (diff)
downloadcrawl-ref-7c1e0016bfbaf83edc7ced6c18525b02cef706e8.tar.gz
crawl-ref-7c1e0016bfbaf83edc7ced6c18525b02cef706e8.zip
Incorporating new tiles from Denzi/Mitsuhiro. Rings and amulets now have labels when identified. Centaurs/yaktaurs now display the weapon they're wielding (and look better too). Variations of weapons and armor (i.e. normal, shiny, randart) are now determined automatically from the tile definitions, rather than being hardcoded. Also, improved axe tiles.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6910 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/rltiles/tool/tile_convert.cc')
-rw-r--r--crawl-ref/source/rltiles/tool/tile_convert.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/crawl-ref/source/rltiles/tool/tile_convert.cc b/crawl-ref/source/rltiles/tool/tile_convert.cc
new file mode 100644
index 0000000000..b65518cfb2
--- /dev/null
+++ b/crawl-ref/source/rltiles/tool/tile_convert.cc
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <string.h>
+
+// This is a standalone utility to convert old-style palettized BMPs
+// to transparent PNGs.
+
+#include "tile.h"
+
+int main(int argc, char **argv)
+{
+ if (argc < 2)
+ {
+ printf("Usage: %s (filename.bmp)\n", argv[0]);
+ return -1;
+ }
+
+ char dest[1024];
+ strcpy(dest, argv[1]);
+
+ size_t len = strlen(dest);
+ if (strcmp(&dest[len-4], ".bmp"))
+ {
+ printf("File '%s' does not end in bmp.\n", argv[1]);
+ return -2;
+ }
+
+ dest[len-3] = 'p';
+ dest[len-2] = 'n';
+ dest[len-1] = 'g';
+
+ tile conv;
+ if (!conv.load(argv[1]))
+ {
+ printf("Failed to load '%s'.\n", argv[1]);
+ return -3;
+ }
+
+ conv.replace_colour(tile_colour::background, tile_colour::transparent);
+
+ if (!write_png(dest, &conv.get_pixel(0,0), conv.width(), conv.height()))
+ {
+ printf("Failed to write dest '%s'.\n", dest);
+ return -4;
+ }
+
+ printf("Converted '%s'.\n", argv[1]);
+
+ return 0;
+}