Unofficial Descent Specs v0.1 by Matt Ayres

Ok, well, just for those who want to know early, here are a FEW, very rough
specs for Descent.  Do what you like with them.  If you add to them, or have 
anything to add to them, please email me your findings.  There's probably
some wrong information here too.  You might possibly be laughing at it too.
Well that's why I'm distributing it, I WANT feedback (mainly specs tho!)
I'm sure Parallax will probably distribute their specs sometime soon, but
oh well...  I have a feeling they're not going to release they editor (and
I can understand why), so I definately plan on writing a complete editor.
I've already started a working viewer.  Mainly we're all awaiting the release
of the registered version (and hopefully official specs).  Much thanks to: 
Greg Lewis (gregl@umich.com) and Mike Leach.

   -Matt Ayres
    ayres@cdrom.com


=============================================================================
 Descent uses has a set of vertices, each vertex has a X, Y, and Z value,
 supposedly a long int.  People are arguing that it's only a short int.  I
 thought so at first too, but I found only long ints work if you try to plot
 the level (however, you must divide by 1024 to have reasonable values).

 Descent is broken up into cubes (not always perfect cubes of course).  Cubes
 (referenced as sectors also) have 6 sides (referenced as panels also), and 
 8 vertices.  Each sector points to 8 vertices from the table of vertices.
 It then has 28 bytes of information for each of its panels.  Not every side
 of a sector has to have a panel (side) defined for it.

file: DESCENT.HOG

12DCF9: level01.sdl
12DCED: ints, long ints, info here?
12DD13: E2 03 00 00, long int, number of vertices in level01 (994)
12DD1B: beginning of vertices, 994*3 long ints, (X, Y, Z cords)
130BB3: beginning of sectors (cubes)

130BB0: 00 5A 00 FF FF FF FF FF FF FF FF 01 00 C8 00 00 00
                 ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ ^^^^^ ^^^^^
                 begin first sector        ?     ?   1st vertex

130BC1: 01 00 02 00 03 00 04 00 05 00 06 00 07 00
        ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^ ^^^^^
        2nd   3rd   4th   5th   6th   7th   8th

130BD1: 00 FF 00 00 3F 40 FF FF FF FF FF 01 00 00 00 00 00
        ^^^^^ ^^^^^ ^^^^^ ^^^^^^^^^^^^^^^^^ ^^^
        EOV     ?     ?   unknown           beginning of info for 1st panel
        
EOV = End of vertices, every sectors set of vertices end with 00 FF

notes: beginning of each sector tends to begin with FF FF FF FF FF FF FF FF
       or xx xx FF FF xx xx FF FF or similiar.  before the panel information
       there always seems to be 5 or 6 FF's in a row.  each panel is 28
       bytes, and there is currently no known way to determine how many
       panels each sector has.  blank panels are clear and you can move
       through them.  sectors have from 1 to 6 panels (?)

panel structure:

each panel consists of 28 bytes, the first 4 determine it's color and
texture.  the other 24 are broken into 4 blocks of 6 bytes.  each block
of 6 bytes seems to effect a different corner (vertex) of the panel.
modifying the first panel of the first sector (wall to the left of you
when you begin level01), the 1st block of 6 bytes changes the top-right of
that panel.  the 2nd block modifies the bottom-right, and so on, clockwise.

offset   effect               color/texture notes:
-------------------             the color and textures entries seem
00       color (int)            confusing.  If you pick a combination
01       ^^                     that doesn't work, Descent either aborts,
02       texture (int)          or draws a red X on pure blue.
03       ^^                     
-------------------
04       weird!
05       n?                   known colors:
06       n?                     00 grey, 01 dark grey
07       weird!                 0A red, 0B blue
08       weird!
09       light                light notes:
-------------------             light comes from the vertices of the 
10       n?                     panel.  the 4 light sources (offsets 9, 15,
11       weird!                 21, and 27) go clock-wise around the panel
12       n?                     possibly an integer?
13       weird!   
14       n?                   weird notes:
15       light                  changing the values at these offsets does
-------------------             strange things.  it looks like it controls
16       n?                     how the texture is pasted to that panel,
17       weird!                 based on the panels around it... ??
18       n?                     they look like they might be integers too.
19       weird!
20       n?                   n? (nothing) notes:
21       light                  changing these seems to do nothing, quite
-------------------             possibly settings and attributes that have
22       n?                     no apparent effect, yet...  they might
23       weird!                 also sometimes be the lesser significant
24       n?                     byte of an integer, and changing it just
25       weird!                 doesn't do enough to be noticable... ??
26       n?                     
27       light
-------------------


file: DESCENT.PIG

long int: num of entries in graphics directory
long int: num of sounds in sound directory

graphics dir (17 bytes per entry)
  8 bytes: name
  1 byte: ??
  1 byte: x size?
  1 byte: y size?
  2 bytes: ??
  long int: offset of graphic
            (from end of directory info?)

sound dir (20 bytes per entry)
  8 bytes: name
  8 bytes: ??
  long int: offset of sound
            (from end of directory info?)

graphics (referenced from graphics dir)
sounds (referenced from sounds dir)

format of graphics and sounds are unknown and unexplored...?


