History of Mipindex
Copyright (c) 1996
by Ed Kiser

Version 1.0
Sat Sept 22 1996 :
 * created. This has made a lot of people very angry and been widely regarded
   as a bad move.

Sun Sept 23 1996 :
 * Improved the method of choosing singular / plural in English output.
   Now uses a format specifier printf users will find vaguely familiar...
 * Put the index into a class, and made the file parsers into member functions
   of that class.
 * Added a hook where the WAD2-writer can hang.
 * Spent two hours chasing a bug in miptex_index::write_text; the STL-using
   code had run fine before. What happened? I moved the code into a "const"
   function and didn't switch from "iterator" to "const_iterator". If you want
   to see the LONG error messages this produced -- change it back yourself!
 * Made "filelist" a class and made the index keep its filelist as a data
   member. The index can now parse a file from only its name.
 * Made the get_full_name function actually work -- without having to do its
   own string parsing! (Took another two hours figuring this out.)

Mon Sept 24 1996:
 * Added support for indexing WAD2 files.
 * Added an is_valid() function to the miptex class so functions can throw out
   garbage in a uniform way.
 * Got rid of the silly "miptex / miptices" terminology and replaced it with
   "miptexture / miptextures".
 * Added support for writing WAD2 files. It works! Yes!
 * Fixed bugs in get_full_name. It used to change the current directory of
   other drives, and miss the last directory in a file's path. Now those bugs
   are fixed, but the function is completely incomprehensible.
 * Wrote documentation.

Tue Sep 25 1996:
 * Defined the behavior when -makewad2: is specified more than once. Also
   fixed the bug where an empty WAD2 file would be written if no textures were
   found. Now no WAD2 will be written.
 * Updated documentation, uploaded to ftp.cdrom.com. End of version 1.0.

Version 1.1
 * The miptex_index now reads and writes itself in streams.

Wed Sep 26 1996:
 * Created an application object and implemented an entirely new syntax.
 * Hraah! I accidently typed mipindex -idx d:*.pak and it overwrote pak0.pak
   with the index of pak1.pak! Fixed this bug. Had to re-install Quake into a
   tempdir to get back my pak0.pak. -- Glad I got this bug before YOU did!

Thu Sep 27 1996:
 * Took a break from writing 200 lines of code per day.

Tue Sep 30 1996:
 * Split the program up into several separate files in the hope that this
   would speed compilation.
 * Took an even longer break from writing even less code.

Sun Oct 6 1996:
 * Received mail from Remy Horton requesting an option to add a palette to
   a WAD2. I promised one in the next (this) version.
 * Wrote a new member function of the miptex_index to zap unused files. (An
   unused file is a file which was indexed but from which no miptextures were
   added.)
 * Moved a little info about Quake structures to a new file, qstructs.h.
 * write_text and write_idx, member functions of miptex_index, are no longer
   const. This is so they can zap unused files before writing.

Mon Oct 7 1996:
 * Added is_valid functions to some of the structs in qstructs.h and made
   mipindex call those functions instead of looking at the members itself.

Wed Oct 9 1996:
 * Spent HOURS (and much of yesterday as well) trying to make the directories
   of data structures, such as WAD2 and PAK directories, and the list of
   miptexture offsets in BSP, as close to stand-alone classes as possible.
   Made some progress but not much. Simplified memory management but
   complicated streaming.
 * Output for the past three days has NOT been 200 lines! Sad...

Thu Oct 10 1996:
 * Made miptex operators == and < consider size as well as name.
 * Separated miptex_id from miptex to create smaller indexes. Changed index
   header value from MIDX to mIDX. Small m, smaller index.
 * Made operators == and < for location. The type also has a constructor now.
 * The wad2_direntry struct now controls its own typeinfo, but the interface
   is not exactly clear.
 * The wad2_header struct now has constructors that handle the magic numbers.
 * Wrote a write_dir_image function, even though I'm afraid to write the
   corresponding read_dir_image function because it will make a lot of copies
   of a large STL vector.
 * Found out that Quake has two "metal5_8" textures with different sizes.
   Uh-oh. QBSP will only find the first one. (Although DST's will respect the
   difference. Yay!)
 * Found out why miptex_id can't have virtual member functions: a vtable
   pointer breaks the miptex structure.
 * Put the bad ideas in a separate section. I'm keeping them so I don't
   come up with the same bad ideas again. :-)
 * Added code to clean up garbage after strings in IDX's and WAD2's. Borland's
   strncpy fills out the destination with nulls once it hits a source null.
   (It expects you to use memcpy if you don't want that.) DJGPP's strncpy
   doesn't do that. So I wrote some clean() functions to give that effect.
 * Index for PAK's is now about 9,000 bytes smaller. Yay!
 * Still didn't output 200 lines, but it feels like I altered about that many
   lines. :-)

Fri Oct 11 1996:
 * IDX reading now visits the miptextures.
 * When calling ifstream::open, remember to "or" ios::in; it is not added
   automatically, as it is with the constructor. (Took me half an hour to find
   this out the hard way.)

Sat Oct 12 1996:
 * Created a new miptex class that keeps its data.
 * Added "get" and "has" functions to miptex_index.
 * Altered the miptex class, so now a palette is a "special kind of miptex."
   One palette gets added to the WAD2 and IDX now, if one is found.
 * Wrote a hash function, but never used it because it would break a lot of
   code.
 * Got BSP <-> DST conversion to work. Tested it on many BSP's -- convert to
   DST, convert back, and play in Quake. It works! Yes!
 * Never forget ios::binary.

Sun Oct 13 1996:
 * Updated documentation. Fixed a bug that would cause bad textures in a
   source BSP to expand to aliased textures in the re-expanded BSP -- and
   then duplicate textures in the next re-expanded BSP.
 * Final revise on documentation and upload to ftp.cdrom.com. End of version
   1.1.

Version 1.1a
 * Downloaded a bunch of BSP's and conversion didn't always work! Bugfix
   release will be necessary.

Tue Oct 15 1996:
 * Moved this history into its own file.
 * Found out that Quake and QBSP seem to use an offset of -1 to indicate an
   "empty slot" in the miptexture directory. Fixed BSP <-> DST conversion so
   it respects this.
 * Altered the "miptex" class so now miptexture data will ALWAYS be aligned
   with 16-byte multiples. Space between is filled with zeroes.
 * Rewrote the BSP <-> DST conversion routines to consolidate common code and
   get rid of all those levels of indentation. Also to provide a summary
   report of conversions. Put them in their own CPP file to ease compilation
   during debugging, and this made the EXE 100k bigger... arrgh!
 * Made a small.cpp file that includes all the other .cpp files. This is
   100K smaller.

Wed Oct 23 1996:
 * Added the -s option to the compilation of small.exe and took off another
   100K. Now that can be replaced with functionality.

Fri Dec  6 1996:
 * Went over the documentation and source for the conversion to the General
   Public License.
 * Date unknown. Changed -bsp option to -undst; retained -bsp for
   compatibility.

Version 1.2

Additions & changes to consider:

* WAD2 or PAK <-> DST conversion. Imagine how much faster it would be to
  download those BASE, MEDIEVAL, etc. WAD2s!

* Multiple files in one DST. Yes, that makes this a sort of archiver. But
  that's good for people making Total Conversions.

* "Self-referential" option so when a texture is repeated in a PAK file, only
  the first instance of the texture is included, and later instances refer
  back to that first instance. Useful for PAK files.

* Option to output DST to standard out, for further compression.

* "Move" option for if conversion is successful.

* Hash the texture data to make sure textures are identical. Just in case
  they're not. GIGGLER3 had a problem with different textures with same name
  and size.

* Texture viewing using GRX or Allegro.

* Print a directory of a DST so you can see which textures it actually
  contains and which ones it wants to get from the index.

* Use a multimap instead of a map, make it so ONLY the name is part of the
  search key, keep the size of graphical data (and its hash) as "incidental"
  information, and allow the user to choose a substitute if a miptexture is
  not in the index. (Better to play an ugly level than not to play.) Allow
  individual textures to be extracted into files or indexed as individual
  files (for building a WAD2 out of them.)
