---------------------------------

MD2 viewer for Quake 2 Models

with source code

v2.3

December 11, 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.



Md2view is a command-line based program, and there are a lot

of parameters. Dont worry, no list of -options to memorize, the md2view

command-line interface is about as easy as it gets. You specify

the model file (.md2), the .pak file (if you want to search

the .pak for models and skins), the .pcx file (if you want to use

a skin other than the one used by the .md2 file), or a .lst file

(a regular text file like this one with 1 .pcx filename per line --

a list of skins to view on the specified .md2 file).



* When you specify a .pak file, filenaming on the .md2 and .pcx files

  becomes important. You must specify the path for those files as

  it appears in the .pak file (dont foget the forward slashes '/').



* To find out what .md2's are 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"



* If you specify a .pak file, and the specified .md2 or .pcx can't

  be found in it, md2view will search through your external .pak

  directories (the same way Quake does) for those files.



Examples (these are probably more useful than the above mess of instructions):



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



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

                  and that directory also contains the skins that tris.md2

                  needs)



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 (not c:\asdf, most likely)



md2view tris.md2 skin.pcx



md2view tris.md2 skins.lst



This probably wont work:



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



Because no pak file was specified.



------------------------------

Controls:

(* = changed from version 2.1)

------------------------------



- 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')



* You can also use the TAB key to flip through the different skins.

  (Shift+TAB flips backwards through the skin list)

  

* You can toggle between "skin" view and "model" view by hitting

  enter.



For the Ambitious:



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.



---------

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*).



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

------------------



The emulator 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). Some key toggles

for the emulator:



Space Bar - toggles the framerate display

W         - toggles wireframe mode



-----

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 putting up

with all the messages I send him on ICQ, and Dave Taylor for

tolerating the fact that I still write Quake/Quake2 utils.



Also thanks to |nsane for his helpful beta testing of the

md2view <-> glideemu.dll combo and his wonderful suggestion

of the .lst option.



Trey Harrison

trey@crack.com

