I found some more information on .ZON files.
I have to go to work now so this is just a quick post, I'll write it up properly later.
There is a 28byte/7 long header.
7 longs (a, b, c, d, e, f, g)
a is a magic number
b is always 1
c seems to be the length of the name table
d seems to be the number of 4 byte entries in an unidentified table follwoing the names
e seems to be the number of placable objects in the ZON file
Next is a model name table which consists of a whole lot of null terminated strings in the form
name, name, name, name.MOD
Where the names are one or more internal names for the model file name which follows.
Then there is a section which I've not identified.
And then the objects which are a big array of
struct Object
{
long id; // Not sure how to use this
long model_name;
float x, y, z; // World coordinates of object
float r1, r2, r2; // Rotations about the 3 axis
float scale; // Multiplier of the scale of the object
}
If the 28 byte header is longs a, b, c, d, e, f, g etc. you can find this table by going to location c + d * 4 + 28 in the file. I think "c" is the size of the string table and "d" is the number of 4 byte entries which preceed the objects in the ZON file. "e" is the number of entries in the object table.
The model_name long in the objects is an offset into the string table, so add 28 to the start of the ZON file and use it as an offset from there. This is a pointer into the name table at the start to the "name" of the model to put in the world at that point.
After the objects is another table, something to do with lighting I think but I've not really looked at that yet.
My wireframe render in another posting seems to work with the objects where I expect so I think this is basically right.
|