]> git.draconx.ca Git - liblbx.git/blobdiff - src/lbximg.c
Add man pages for lbxtool and lbximg
[liblbx.git] / src / lbximg.c
index 6c6de5759e32e9e24ab83ca56c60f7bfc0e3558d..61516196174999a7aab25ca0f9428699184845ff 100644 (file)
@@ -1,3 +1,21 @@
+/* 2ooM: The Master of Orion II Reverse Engineering Project
+ * Simple command-line tool to convert an LBX image to a set of PNGs.
+ * Copyright (C) 2006-2008 Nick Bowler
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
@@ -206,7 +224,7 @@ static int loadoverride(FILE *f, struct lbx_colour palette[static 256])
        }
        lbximg_getinfo(overimg, &info);
 
-       if (!info.haspalette) {
+       if (!info.palettesz) {
                errmsg("override image has no palette.\n", 0);
                lbximg_close(overimg);
                return -1;
@@ -238,7 +256,7 @@ static int loadpalette(LBX_IMG *img, struct lbx_imginfo *info,
        }
 
        /* For sanity. */
-       if (!palf && !info->haspalette && !override) {
+       if (!palf && !info->palettesz && !override) {
                errmsg("no palette available.\n", 0);
                return -1;
        }
@@ -255,7 +273,7 @@ static int loadpalette(LBX_IMG *img, struct lbx_imginfo *info,
        }
 
        /* Read the embedded palette, if any. */
-       if (info->haspalette && lbximg_getpalette(img, palette) == -1) {
+       if (info->palettesz && lbximg_getpalette(img, palette) == -1) {
                errmsg("error reading embedded palette: %s\n", lbx_strerror());
                return -1;
        }
@@ -340,7 +358,7 @@ int main(int argc, char **argv)
 
        static const char *sopts = "idvf:p:O:";
        static const struct option lopts[] = {
-               { "info",     0, NULL, 'i' },
+               { "ident",    0, NULL, 'i' },
                { "decode",   0, NULL, 'd' },
                { "verbose",  0, NULL, 'v' },
                { "file",     1, NULL, 'f' },
@@ -415,8 +433,8 @@ int main(int argc, char **argv)
 
                printf("%s is %ux%u LBX image, %u frame(s)%s%s\n",
                       name, info.width, info.height, info.nframes,
-                      info.haspalette ? ", embedded palette" : "",
-                      info.looping    ? ", loops" : "");
+                      info.palettesz ? ", embedded palette" : "",
+                      info.looping   ? ", loops" : "");
        }
 
        switch (mode) {