---------------------------------
MD2 viewer for Quake 2 Models
with source code
v2.1
December 9, 1997
by Trey Harrison (trey@crack.com)
---------------------------------

-------------
Instructions:
-------------

I've added a glideemu.dll for those of you without 3dfx cards.
Rename glideemu.dll to glide.dll, put it somewhere where
Windows can find it (the best place is in the directory from
which you run md2view), and make sure you're running Windows
in 16-bit color. Its doesnt (for some crazy reason) take screenshots
correctly, and runs a bit slow, but people were begging me
to support non-3dfx machines, so this is my answer.

I've added .pak reading capabilities. You can run md2view the old
way (by going into a directory with the proper skins and .md2 files
and running md2view there), OR you can specify a pak file and
a .md2 file on the command line, and md2view will try to load
the model from the pak.

* Note that you must supply the full path for the pak file and the
  internal path for the .md2 file if you wish to use the pak loading
  method. All of the internal path names use '/' for directory
  seperations (as opposed to '\'). To find out whats IN the pak file,
  specify a pak file and no .md2 file. It will write the names of all
  .md2 files found in the .pak file to a file named "md2names.txt"

Examples:

md2view c:\quake2\baseq2\pak0.pak models/monsters/tank/tris.md2

md2view tris.md2 (assumes you're in a directory containing tris.md2)

md2view c:\quake2\baseq2\pak0.pak (will create md2names.txt)

I don't think you can do this:

md2view c:\asdf\tris.md2

because it will try to load skins from the directory which the
program started in (most likely, not c:\asdf in the above case)

You can specify a "override" skin on the command line, and md2view
will also look in your .pak path incase it doesnt find the files
it needs in the actual pak file. The override skin *can* be in
the pak file, as long as you specify the full .pak path.

Examples:

md2view tris.md2 blah.pcx

md2view c:\quake2\baseq2\pak0.pak models/monsters/tank/tris.md2  models/monsters/soldier/skin.pcx

md2view c:\quake2\baseq2\pak0.pak models/monsters/tank/tris.md2 c:\photoshop\new_skin.pcx

You cant do this:

md2view tris.md2 models/monsters/tank/skin.pcx

Because no pak file was specified.

------------------------------
Controls:
(* = changed from version 2.0)
------------------------------

- You can rotate him around with the mouse similar to +mlook.

- You can zoom in and out with the left and right mouse buttons, OR
  the A and Z keys.

- You can adjust the speed of animation with the + and - keys. (It
  might only work with the + and - on the numeric keypad, I havent
  checked)

- You can see what the animation looks like WITHOUT linear interpolation
  by holding down the I key.

- You can move him in xy screen space with the arrow keys. This
  is especially useful for taking screen shots.

- You can freeze the animation by holding down the F key. (Releasing
  it resumes animation)

- You can take a screenshot by hitting the S key. (DONT hold it down)

- You can view different skins of the model by using keys 0-9
  (skin #0 is at key '1', skin #1 at key '2', skin #9 at key '0')
  

Example:

Position the model on screen using the mouse and arrow keys. Use +/-/F
to get the model in the frame of animation you want. While holding
F (to freeze the animation), tap S to take a screenshot.

------------
Screenshots:
------------

When you start md2view, it starts writing screenshot files with
"shot0.tga". It will increment the number on the end of the filename
every time you take another screenshot, but (as I just said) resets
the number every time you restart.

Also, the screenshots seem dark, so you'll probably have to
doctor them up in your favorite image editor.

For some reason it doesnt make screenshots correctly when running
it with the Glide emulator. I'm not sure why, at this time.

---------
The code:
---------

It started out as my old mdldemo code, but lots changed. I commented
some of it but not all. As it says at the top of each file, LEARN,
dont steal. And don't laugh at my method of transforming / projecting /
clipping the tris. It was a 5 minute hack =).

The .mdp and .mak files were built using MSVC 4.0. You'll also
need the GLIDE SDK.

Feel free to add on to this code and release a better viewer
(as long as you give credit where its due, *ahem*).

Allowing the user to browse through the .pak and selectively
view models w/their different skins would be pretty cool (its
also something I dont have time for). A nice GUI "front-end"
that generates proper command line arguments probably wouldnt
be hard for those who have actually taken the time to learn MFC.

------------------
The Glide Emulator
------------------

It has extremely limited functionality, and I can pretty much
guarantee that you wont get it to work with much other than
md2view. I don't plan on releasing the code (sorry).

-----
Plug:
-----

My real job involves me working on an extremely cool game
called Golgotha. It is a combination of Doom and Warcraft
and deserves a much better description than what I've
written here. You can find more information and download
our latest demo via the link listed below.

http://crack.com/games/golgotha

-------
Thanks:
-------

Thanks to John Carmack and Brian Hook for responding to my
questions about the .md2 format, American McGee for sending
me the Q2 demo 10 minutes before the official release <yay!>,
and the rest of the id staff for making such cool games.

Trey Harrison
trey@crack.com
