Updated: December 16, 1997
=====================================================================
Title                   : Q2toWad
Filenames               : q2towad.exe, q2pal.lmp
Version                 : 1.2

Author                  : Tim Wright
Net Nick                : Argh!
Email Address           : argh@ntplx.net
WWW                     : still workin on it... ;)

Description             : Utility to extract all the Quake2 textures 
                          into a specfied number of wad2 files.
                          * Includes the ability to convert to a new 
                            palette, like for Quake or Hexen2!
                          * Can include Quake2 dir names in textures
                            so that most any editor can compile the
                            level for Quake2!

Requirements            : A Win32 operating system, about 30Mb free
                          diskspace for the extraction process 
                          (final wad(s) total about 15Mb).

Additional Credits to   : id Software for Quake and Quake2, Mattias 
                          "Preacher" Konradsson and David "Kevlar"
                          Kelvin for help with testing, the 
                          Unofficial Quake Specs at:
          http://www.gamers.org/dEngine/quake/spec/quake-spec32.html,
                          and everyone who sent me constructive
                          feedback.
 
Other Works by Author   : ArghLite - enhanced bsp lighting utility

=====================================================================
* Usage *

Put q2towad.exe and q2pal.lmp in the same dir as the Quake2 pak0.pak 
and run the executable with whatever options you wish.

Remember, any textures extracted and/or converted from Quake2 remain 
the property of id software.


Command-line options
--------------------
-?                - Lists command line options.

-pak filename     - Use specified pak file.  Can be used to run 
                     q2towad from any location by specifing a full
                     pathname to pak0.pak.  Default is "pak0.pak".

-palette filename - Convert textures to specified palette (must be 
                     in palette.lmp format).  Default is no new 
                     palette.

-wad filename     - Uses this filename for the output wad.  Default 
                     is "quake2.wad".

-brights #        - Specifies number of fullbrights at the end of the
                     new palette, these colors will be ignored in 
                     palette conversions.  Default is 32.

-split #          - Splits the output into specified number of wads.
                     Simply splits into similar-sized parts, no
                     attempt is made to organize the textures in any 
                     way.  Successive letters, starting with "a", are
                     appended to the filename.

-dirname          - Adds Quake2 texture dir names to the texture's 
                     names.  Allows most editors to use this wad to 
                     compile levels for Quake2.  Default is no dir
                     names.

-nogray           - Turns OFF special processing for pure gray 
                     values (only use if the destination palette 
                     does not contain many pure grays).  Default is 
                     ON.


* Examples *

>Q2TOWAD.EXE

   Extracts all textures into quake2.wad, keeping the Quake2 
   palette.

>Q2TOWAD.EXE -palette palette.lmp

   If Quake's "palette.lmp" is in the same dir, extracts all 
   textures into quake2.wad, converting them to the Quake palette.

>Q2TOWAD.EXE -split 5 -wad Q2.wad

   Extracts textures into 5 wads: Q2a.wad, Q2b.wad, Q2c,wad, 
   Q2d.wad, and Q2e.wad, keeping the Quake2 palette.

>Q2TOWAD.EXE -dirname

   Extracts textures into quake2.wad, putting the Quake2 texture 
   dir names on the textures, and keeping the Quake2 palette.


* Technical *

For the curious...  

Pak file operations are done in-place, relatively little is loaded 
into memory at a time.  Considering the size of the Quake2 pak, this 
is a very good thing. ;)

To convert to other palettes, I used a basic nearest-color-matching 
algorithm.  Distance ties are broken by examining the difference in 
green values, then if still tied examining the difference in red 
values, then if still tied examining the difference in blue values, 
then if still tied it picks the brighter color.  Also, by default, 
pure grays are only remapped to other pure grays (this can be turned 
off with command-line option: -nogray).

To eliminate duplicates, I first check for duplicate names (without
the Quake2 directory), then I do a CRC32 check on that.  I do this 
because Quake2 has some textures with the same name, but the textures 
themselves are different.  If it's a different texture, and -dirname
isn't used, then I append a "_" to the texture name so editors wont
get confused.

=====================================================================
* History *

Version 1.2 (Dec 16, 1997):
   * added -split command line option

Version 1.1:
   * added -dirname command line option
   * added CRC checking to duplicate texture removing formula

Version 1.0 (Dec 9, 1997):
   * first official release

=====================================================================
* Construction *

Compiler used           : Microsoft VC++ 4.0
Construction time       : Couple hours a day for a couple days?
Known Issues            : ?

=====================================================================
* Copyright / Permissions *

Any textures extracted and/or converted from Quake2 remain the 
property of id software.

You MAY distribute this EXE, provided you include this file, with no
modifications.  You may distribute this file in any electronic format
(BBS, Diskette, CD, etc.) as long as you include this file intact.

* Disclaimer *

Usage of Q2toWad is at your own risk.  I accept NO responsibility
for any form of damage incurred through the usage of this program.

=====================================================================
* Where to get this Utility *

ftp.cdrom.com (and all mirrors)

