4DS

Introduction
The .4ds format in version 41 is the basic format for 3D objects in Hidden & Dangerous 2. 4ds was also used for Mafia and Chameleon but in different versions.

Structure
For having a better and easier understanding, we split the file into three parts: header, images and objects.

Header
Each .4ds file has following values at its beginning.



Images
Here all images listed which are used. Allowed are Bitmaps(.bmp) and Targa Image Files (.tga) First we have the attribute for the total amount of pictures. If you added a picture in your map.4ds file, don't forget to update this value.

It's a 16-bit INT e.g. 0700, 7 images.

After the amount, each image is listed after the following structure:

Objects
The last image is followed by a 16-bit INT, which represents the number of objects e.g. 0A00 (10 objects).

Each object has a header, which is described below. After the header comes the actual object data. A list of all object types can be found here: object types

Object header
The visual object type and flags are only present if the object type is a visual object.

SingleMesh
Inherits MeshObject data.

SingleMorph
Inherits SingleMesh and Morph data.

Billboard
Inherits MeshObject data.

Morph
Inherits MeshObject data.

Dummy
Dummies are cuboids, mostly cubes. The 2 extents are two points in space which form the diagonal of a cuboid/box.

Animation
Finally, at the end of each .4ds file comes a 8-bit INT value, which is always 0 unless an corresponding .5ds animation file exists.