| name | size |
|---|---|
| bit8 | a signed 8 bits |
| bitu8 | an unsigned 8 bits |
| bit16 | a signed 16 bits |
| bitu16 | an unsigned 16 bits |
| bit32 | a signed 32 bits |
| bitu32 | an unsigned 32 bits |
| float | a 4 bytes float |
| bitu32 | "TR4",0 | |
| bitu16 | Number of non bumped room tiles | |
| bitu16 | Number of tiles for objects | |
| bitu16 | Number of bumped room tiles | |
| bitu32 | Uncompressed size of texture 1 | |
| bitu32 | Compressed size of texture 1 | |
| bitu8[] | (compressed) Texture 1 (32 bits texture) | |
| bitu32 | Uncompressed size of texture 2 | |
| bitu32 | Compressed size of texture 2 | |
| bitu8[] | (compressed) Texture 2 (16 bits texture) | |
| bitu32 | Uncompressed size of texture 3 | |
| bitu32 | Compressed size of texture 3 | |
| bitu8[] | (compressed) Texture 3 (32 bits texture) | -> a 256x512 texture with the font & sky |
| bitu32 | Uncompressed size of geometry | |
| bitu32 | Compressed size of geometry | |
| bitu8[] | (compressed) Geometry | |
| bitu32 | num_sounds | |
| num_sounds * struct TR4_TrailingSound | ||
| { | ||
| bitu32 | UncompSize; | // Uncompressed sound size |
| bitu32 | CompSize; | // Compressed sound size -> compression is ADPCM (WAV format) |
| bitu8 | sound_data[]; | // data of the sound - size is CompSize bitu8 |
| } | ||
| // Follows a D3D light structure, I think, could be wrong (46 bytes) | ||
| typedef struct | ||
| { | ||
| bit32 | Xposition; | // world coords |
| bit32 | Yposition; | // world coords |
| bit32 | Zposition; | // world coords |
| tr2_colour | Color; | // three bytes rgb values |
| bitu8 | LightType; | // same as D3D (i.e. 2 is for spotlight) |
| bitu8 | unknown; | // always 0xff? |
| bitu8 | Intensity; | |
| float | In; | |
| float | Out; | |
| float | Length; | |
| float | Cutoff; | |
| float | X,Y,Z; | // direction?? |
| } tr4_room_light; | ||
| // Triangle surface (10 bytes) | ||
| typedef struct | ||
| { | ||
| bitu16 | Vertices[3]; | // The 3 vertices of a tri |
| bitu16 | Texture; | // Object-texture index |
| bitu16 | Lighting; | // transparency flag & strength of the hilight |
| } tr4_face3; | ||
| // Quadrangle surface (12 bytes) | ||
| typedef struct | ||
| { | ||
| bitu16 | Vertices[4]; | // The 4 vertices of a quad |
| bitu16 | Texture; | // Object-texture index |
| bitu16 | Lighting; | // transparency flag & strength of the hilight |
| } tr4_face4; | ||
| if set, alpha channel = intensity (same meaning that when the Attribute field of tr2_object_texture is 2. Cf TRosetta stone document) | strength of the hilight. In TR4, objects can exhibit some kind of light reflection when seen from some particular angles. These bits give the strength of this effect: the more bigger the value is, the more visible is the effect. |
| bitu32 | Number_of_FBCameras; | |
| // Data for a flyby camera (40 bytes) | ||
| typedef struct | ||
| { | ||
| bit32 | pos[6]; | // Positions ? (x1,y1,z1,x2,y2,z2) |
| bitu8 | index[2]; | // A pair of indices |
| bitu16 | Unknown[5]; | // ?? |
| bit32 | ID; | // Index of something |
| } tr4_extra_camera; | ||
| bitu32 | num_AIData; | // this field replaces the bitu16 NumCinematicFrames of TR1/2/3 levels |
| // Data for a AI object (24 bytes) | ||
| typedef struct | ||
| { | ||
| bitu16 | ObjectID; | // the objectID from the AI object (AI_FOLLOW is 402) |
| bitu16 | Room; | |
| bit32 | X,Y,A; | |
| bitu16 | OCB; | |
| bitu16 | Flags; | // The trigger flags (button 1-5, first button has value 2) |
| bit32 | Angle; | // rotation |
| } tr4_AI_object; | ||
| // Data for a sprite (16 bytes) | ||
| typedef struct | ||
| { | ||
| bitu16 | Tile; | |
| bitu8 | unknown1; | // ?? |
| bitu8 | unknown2; | // ?? |
| bit16 | Width; | // = (real_width-1) * 256 |
| bit16 | Height; | // = (real_height-1) * 256 |
| bit16 | x1,y1; | // top-left corner of the texture |
| bit16 | x2,y2; | // bottom-right corner of the texture |
| } tr4_sprite_texture; | ||
| // Data for an object texture (38 bytes vice 20 in TR1/2/3) | ||
| typedef struct | ||
| { | ||
| bitu16 | Attribute; | // same meaning than in TR3 |
| bitu16 | Tile; | // same meaning than in TR3 |
| bitu16 | Flags; | // new in TR4 |
| tr2_object_texture_vert | Vertices[4]; | // same meaning than in TR3 |
| bitu32 | Unknown1,Unknown2; | // new in TR4: x & y offset in something ? |
| bitu32 | XSize,YSize; | // new in TR4: width-1 & height-1 of the object texture |
| } tr4_object_texture; | ||
| mapping correction. It seems that these bits change the way the texture is applied... | |
| 2 bits giving the bump mapping type. Can be 0x01 or 0x10. It's 0x00 if not bump mapped. Only textures for room or animated textures can be bump mapped, not meshes | |
| if set, the texture is for a tri/quad from a room or animated texture. If not set, the texture is for a mesh |
| // Data for an animation structure (40 bytes vice 32 in TR1/2/3) | ||
| typedef struct | ||
| { | ||
| bitu32 | dwFrameOffset; | // same meaning than in TR3 |
| bitu8 | bFrameRate; | // same meaning than in TR3 |
| bitu8 | bFrameSize; | // same meaning than in TR3 |
| bitu16 | wStateId; | // same meaning than in TR3 |
| bit16 | Unknown; | // same meaning than in TR3 |
| bit16 | sSpeed; | // same meaning than in TR3 |
| bitu16 | wAccelLo; | // same meaning than in TR3 |
| bit16 | sAccelHi; | // same meaning than in TR3 |
| bitu8 | Unknown2[8]; | // new in TR4 |
| bitu16 | wFrameStart; | // same meaning than in TR3 |
| bitu16 | wFrameEnd; | // same meaning than in TR3 |
| bitu16 | wNextAnimation; | // same meaning than in TR3 |
| bitu16 | wNextFrame; | // same meaning than in TR3 |
| bitu16 | wNumStateChanges; | // same meaning than in TR3 |
| bitu16 | wStateChangeOffset; | // same meaning than in TR3 |
| bitu16 | wNumAnimCommands; | // same meaning than in TR3 |
| bitu16 | wAnimCommand; | // same meaning than in TR3 |
| } tr4_animation; | ||