-----------------------------------------------------------------------
My Quake Specs, v1.0                     written by Denis Moeller, 2/96
                          e-mail: tic@rendsburg.netsurf.de, #irc: panza
-----------------------------------------------------------------------
Quake, Copyright (C) 1996 id Software, inc.
Logo and likenesses are trademarks of id Software, inc.
-----------------------------------------------------------------------

Quake is the new  incredible game by id software, these Specs are based 
upon the testversion, released by id software in february 1996. 
Since this  testversion was  released to test  Network Play,  Sound and
Graphic Engine on many different machines it is likely that id software
does not wish that this  version of Quake  is altered nor edited in any
way. Therefore  I am  not  responsible  for  any  damage  or  copyright 
violations due to the usage of the information this textfile contains.

-----------------------------------------------------------------------
Quick Overview

All codes, type-names etc.  are based  upon C-style.  Don't blame me if 
some info here is obsolete, wrong or missing.  This is just the stuff I 
found  out while  programming 'quip'.  I don't think I'll add any stuff
here, someone else can do 'real' Specs. I don't care.

The testversion  of Quake uses  one big file to store all the necessary 
data files.  It contains several sounds (WAV files),  sprites, 3D-model 
files, level-data and wall textures.
This file is called ID1.PAK and is a simple collection of all resources
with an internal directory.  Several of the files stored  in there have
their own structure, some are collections of files again.

-----------------------------------
PAK-file format:

The first 4 bytes are the identification bytes, they should be 'PACK'.
The  next  long int  value  is  the  offset (DirPos) to  the  directory 
counting from the beginning of the file.  The following  long int gives 
you the  size (DirLen) of  the  directory.  Each entry in the directory 
consists of 64 bytes, to get the number of entries simply do this: 

    Entries = DirLen / 64.

An entry in the directory looks like this:

typedef struct {
	char EntryName[56];    
	long EntryPos, EntryLen;
} Entry;

EntryName contains the full path and name of the file stored.

As I said,  the PAK file is just a collection of a few different files,
which have their own format. I'll list them right now.

WAV-files:
----------
This is quite easy. It's a WAV-file, which contains digitized sounds.

SPR-files:
----------
These files contain sprites (which will probably obsolete when the full
version of Quake comes out).  Mostly there are more than  one sprite in 
one file, either the entire animation (e.g.torches) or  different sizes
of the sprite. As you might see, I did not get into this that well.

The Header of this SPR-files looks like this:

typedef struct {
	char id[4];
	char unknown[36];
} Header;

Each sprite following right after this header has its own header:

typedef struct {
	long dunno;
	char unknown[dunno * 4];
	long offset1, offset2;
	long x, y;
} SpriteHeader;

The actual sprite-gfx-data follows this header,  the size of this block
is calculated like this: 

     Size = x * y

That's all I know about the sprites -  oh I nearly forgot:  the palette
of these sprites is different than the normal game-palette. I could not
find a good palette to display 'em right.

MDL-files:
----------
Well, these files are even more strange. I think they contain the data 
for the 3D-models. No more info here.

WAD-files:
----------
Yes, the PAK-file contains  one WAD-file.  Though, it's not exactly the
WAD-format of Doom. It contains graphics resources and a palette.

The first 4 bytes are for identification. It should contain 'WAD2'.
The next 2 long values give us the number of entries in the WAD and the
position of the directory relative to the beginning of the file.
For each entry in the directory are 32 bytes:

typedef struct {
  long EntryPos, EntryLen;
  long dummy1, dummy2;
  char EntryName[16];
} Entry;

Yes, the name is 16 bytes  long - pretty  shitty for using filenames in
good old DOS... 

The gfx in this WAD are very easy to read, no compression here.  Mostly
the first 2 long values of an Entry  are X and Y of the picture.  Well,
sometimes not (e.g. CONBACK, straight picture data, 320x200 here).  The 
picture data follows, line by line.

I think there is one  picture with  chars in it too,  but didn't bother 
displaying it yet. Btw, the transparent color in all pictures is 255.

RC-files:
---------
Quake's control-files. No more info here, pretty easy though.

BSP-files:
----------
These are the most  interesting files stored here,  they contain levels
(e.g.TEST1.BSP)  or other  (still unknown) stuff.  Each BSP-file has 14
entries, which can be level-data,  scripts for levels, wall-textures or
some unknown stuff.

The first  long int is always 0x17 - kinda identification.  Right after 
this the directory  of the SPR-file  is saved.  Two long ints for every
entry are in here - giving the position and length.

That's it for now. If someone wants to correct, add or change the stuff
I wrote here - go ahead, I'm not the guy for writing Specs anyway. :)


2/29/96, denis moeller
-----------------------------------------------------------------------
This is the end. 
-----------------------------------------------------------------------
