DZB - LordNed/WindEditor GitHub Wiki

Collision data is stored in DZB files. They begin with a header listing all of the sections along with a count of the elements within each section.

###Header


//0x2C/44 bytes long
/*0x00*/ int vertexCount;
/*0x04*/ int vertexOffset;

/*0x08*/ int triangleCount;
/*0x0C*/ int triangleOffset;

/*0x10*/ int SpatialListCount;
/*0x14*/ int SpatialListOffset;

/*0x18*/ int FaceGroupDataCount;
/*0x1C*/ int FaceGroupDataOffset;

/*0x20*/ int stringGroupCount;
/*0x24*/ int stringGroupOffset;

/*0x28*/ int SurfacePropertyCount;
/*0x2C*/ int SurfacePropertyOffset; 

###Vertices


//0xC/12 bytes long
/*0x00*/ float xCoord;
/*0x04*/ float yCoord;
/*0x08*/ float zCoord;

###Faces


//0xC/12 bytes long
/*0x00*/ short vert1;
/*0x02*/ short vert2;
/*0x04*/ short vert3;
/*0x08*/ short surfacePropIndex;
/*0x0A*/ short stringGroupIndex;

###Spatial List


//0x2/2 bytes long
/*0x00*/ short faceIndex;

Spatial list is used by the face group section in order to link faces into a string group.

###Face Group


Type 257:

//0x10/16 bytes long
/*0x00*/ short elementType; //0x0101/257 in this case
/*0x02*/ short elementID;
/*0x04*/ short spatialListIndex;
/*0x08*/ int padding;
/*0x0C*/ int padding;

Type 256:

//0x10/16 bytes long
/*0x00*/ short elementType; //0x0100/256 in this case
/*0x02*/ short elementID:
/*0x04*/ byte[12] faceGroupIndices;

The face group section forms a tree, with a string group forming the top level. A string group contains the index of a type 256 face group element. That face group element, in turn, contains indices of other face group elements. Type 256 can reference either a type 257 (returning the index of a spatial list element) or another type 256 element, which creates more possible branches on the tree.

###String Group


//To-Do

###Surface Property


/*This section really needs more investigation. Most (read: all) of the doc here is dubious at best*/
//0x10/16 bytes long
/*0x00*/ byte unknown;
/*0x01*/ byte padding; 
/*0x02*/ byte hitSound;
/*0x03*/ byte padding;
/*0x04*/ byte unknown;
/*0x05*/ byte colType; //Collision type byte 1
/*0x06*/ byte colType; //Collision type byte 2
/*0x07*/ byte unknown;
/*0x08*/ byte unknown;
/*0x09*/ byte unknown;
/*0x0A*/ byte unknown;
/*0x0B*/ byte unknown;
/*0x0C*/ byte unknown;
/*0x0D*/ byte unknown;
/*0x0E*/ byte unknown;
/*0x0F*/ byte unknown;