mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Add an option to omit the mipmap from extracted textures.
This is at the request of Spirit (quaddicted). Great idea.
This commit is contained in:
parent
940476dce1
commit
6b62b850a7
2 changed files with 28 additions and 17 deletions
|
@ -74,6 +74,7 @@ static const struct option long_options[] = {
|
|||
{"pad", no_argument, 0, 'p'},
|
||||
{"quiet", no_argument, 0, 'q'},
|
||||
{"verbose", no_argument, 0, 'v'},
|
||||
{"nomip", no_argument, 0, 256},
|
||||
{NULL, 0, NULL, 0},
|
||||
};
|
||||
|
||||
|
@ -94,6 +95,7 @@ usage (int status)
|
|||
printf ("Options:\n"
|
||||
" -f, --file ARCHIVE Use ARCHIVE for archive filename\n"
|
||||
" -p, --pad Pad file space to a 32-bit boundary\n"
|
||||
" --nomip Do not output mipmaps with textures\n"
|
||||
" -q, --quiet Inhibit usual output\n"
|
||||
" -v, --verbose Display more output than usual\n");
|
||||
exit (status);
|
||||
|
@ -148,6 +150,9 @@ decode_args (int argc, char **argv)
|
|||
case 'v': // increase verbosity
|
||||
options.verbosity++;
|
||||
break;
|
||||
case 256:
|
||||
options.nomip = 1;
|
||||
break;
|
||||
default:
|
||||
usage (1);
|
||||
}
|
||||
|
@ -328,6 +333,7 @@ wad_extract (wad_t *wad, lumpinfo_t *pf)
|
|||
image = calloc (1, miptex->width * miptex->height * 3 / 2);
|
||||
memcpy (image, buffer + miptex->offsets[0],
|
||||
miptex->width * miptex->height);
|
||||
if (!options.nomip) {
|
||||
for (u = 0; u < miptex->height * 1 / 2; u++) {
|
||||
i = miptex->height + u;
|
||||
memcpy (image + i * miptex->width,
|
||||
|
@ -344,8 +350,12 @@ wad_extract (wad_t *wad, lumpinfo_t *pf)
|
|||
buffer + miptex->offsets[2] + u * miptex->width / 8,
|
||||
miptex->width / 8);
|
||||
}
|
||||
pcx = EncodePCX (image, miptex->width, miptex->height * 3 /2,
|
||||
pcx = EncodePCX (image, miptex->width, miptex->height * 3 / 2,
|
||||
miptex->width, default_palette, false, &len);
|
||||
} else {
|
||||
pcx = EncodePCX (image, miptex->width, miptex->height,
|
||||
miptex->width, default_palette, false, &len);
|
||||
}
|
||||
free (image);
|
||||
free (buffer);
|
||||
if (Qwrite (file, pcx, len) != len) {
|
||||
|
|
|
@ -49,6 +49,7 @@ typedef struct {
|
|||
int verbosity; // 0=silent
|
||||
qboolean compress; // for the future
|
||||
qboolean pad; // pad area of files to 4-byte boundary
|
||||
qboolean nomip; // exclude mipmaps from output textures.
|
||||
char *wadfile; // wad file to read/write/test
|
||||
} options_t;
|
||||
|
||||
|
|
Loading…
Reference in a new issue