// Mongoose, Terms in this file related to what we use: // Int : unsigned short : bitu16 // Dword : unsigned int : bitu32 // // Also, I'm appending TP's findings to the format ******************************************************* TR4 Possible File Format rgbold March '01 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Dword "TR4",0 Int number of RoomTextures? Int number of OtherTextures? Int number of BumpMapTextures? Dword UncompressedSize1 Dword CompressedSize1 TextureBlock1 Dword UncompressedSize2 Dword CompressedSize2 TextureBlock2 Dword UncompressedSize3 Dword CompressedSize3 TextureBlock3 /// Other data follows after textures structures are same as TR3 except where noted NOTES: Texture needs to be masked with 0xfff (high 4 bits are flags) Room Lights now 46 bytes: TR4_RoomLight // //Follows a D3D light structure, I think, could be wrong Dword Xposition // world coords Dword Yposition // world coords Dword Zposition // world coords TR2_Color // three bytes rgb values bitu8 LightType // same as D3D (i.e. 2 is for spotlight) bitu8 unknown // always 0xff? byte Intensity float In float Out float Length float Cutoff floats X,Y,Z //direction?? Before SoundSources is a new field for Flyby_Camera data bitu32 Number_of_FBCameras followed by data for each camera. Data field is 40 bytes. [Andy had previously stated NumXYZ as a new field incorrectly. His NumXYZ field was the SoundSources in normal structure format] Cinematic Frames now 24 bytes There are no colored rectangles or triangles in mesh data. Mesh Rectangles and Triangles now MeshRects: v0,v1,v2,v3,texture,int unknown MeshTris: v0,v1,v2,texture,int unknown Texture Objects now preceeded by TEX/0 (4bytes) Object Textures now 38 bytes vice 20 Tile is now a bitu32 vice bitu16 seems need to mask with 0xff as other bits are flags. Seems bit15 set means triangle. In the texture coords now 0 is used for low value vice 1 The extra 16 bytes are at the end of ObjectTexture structure Attributes using 1 or 2 for transparent. 2 used for 2 sided textures (water surface,etc) Animation now 40 vice 32 bytes. extra 8 seem to be zero right before /after the old 8 unknowns "SPR" 3 byte ascii before sprite textures There are no 8bit or 16 bit palettes (no colored rects or tris) No lightmap No 8bit textures Following level data are Riff Wave Formats. Lara 2 meshes , skin and joints. ############################################################################# # # TR5 Possible File Format # rgbold March '01 # ############################################################################# // Header /////////////////// Dword "TR4",0 // Textures ///////////////// Int number of RoomTextures? Int number of OtherTextures? Int number of BumpMapTextures? Dword UncompressedSize1 Dword CompressedSize1 TextureBlock1 Dword UncompressedSize2 Dword CompressedSize2 TextureBlock2 Dword UncompressedSize3 Dword CompressedSize3 TextureBlock3 /// Follows after textures 32 bytes unknown //mostly zero Dword SizeData // size of file to Riffs Dword SizeData // repeat of above Dword Unknown // seems always zero Dword NumberRooms // number of rooms this level { Following Repeats for each Room in level Dword "XELA" (someone named Alex or "dirX Enhanced Level Archive" Dword size //size to next XELA block Dword CDCDCDCD Block1 60 bytes { Dword ublock1 //mostly: start of "XELA" +216 + ublock1 = FD end, but have seen 0xffffffff. Better using next data and compute FD size the old way of X*Z*8 Dword ublock2 // start of "XELA" + 216 + ublock2 = FD start Dword ublock3 // unknown Dword ublock4 // possibly start of "XELA" + 216 + ublock4 = end portals Dword Room X // room's x position in world coords Dword unknown1 // always seems to be 0000 Dword Room Z // room's z position in world coords Dword Ybottom // room's y bottom positon in world coords Dword Ytop // room's y top positon in world coords Int NumZSectors // number of z sectors Int NumXSectors // number of x sectors tr2_color4 // 4 bytes color info rgba Int NumLights Int NumStaticMeshes Dword Unknown2 // seems always 0x0001 Dword Unknown3 // seems always 0x7fff Dword Unknown4 // seems always 0x7fff }close 60 byte block Dword CDCDCDCD Dword CDCDCDCD 20 byte block { 6 bytes 0xff Int Room_Flag //room attributes (rain,etc) Int unknown5 10 bytes 0x00 } close 20 byte block Dword CDCDCDCD 16 byte block { unknown 16 bytes }close 16 byte block Dword CDCDCDCD Dword CDCDCDCD Dword CDCDCDCD Dword CDCDCDCD Dword Unknown6 Dword CDCDCDCD 56 byte block { Dword NumberTriangles Dword NumberRectangles Dword Unknown7 // always 0x0000 ?? Dword LightSize // number lights times 88 bytes Dword NumberLights Dword NumUnknown_36_byte_struct Dword Unknown9 Dword Unknown10 Dword NumberLayers //TR5 'layers' room pieces Dword Unknown11 // start of "XELA" + 216 + Unknown11 = start of layer info Dword Unknown12 // start of "XELA" + 216 + Unknown12 = start of vertices Dword Unknown13 // start of "XELA" + 216 + Unknown13 = start of rect/tri Dword Unknown14 // same as Unknown13??? Dword Unknown15 // start of vertices + Unknown15 = start of next "XELA" }close 56 byte block Dword CDCDCDCD Dword CDCDCDCD Dword CDCDCDCD Dword CDCDCDCD // Lights ////////////////////////// if lights then 85 bytes light data followed by CDCDCD for each light // Unknown ///////////////////////// if NumUnknown_36_byte_struct then read them too // Sectors ///////////////////////// Sector Data (sectors times 8 bytes) normal sector data structure // Portals ///////////////////////// Int NumberDoors NumberDoors times 32 bytes (normal portal structure) Int CDCD // Static meshes ////////////////// if StaticMeshes than numberofstatics times 20 bytes each (normal structure) // Layers //////////////////////// Layer Data blocks. 56 bytes each. { Dword NumberVertices Int Unknown16 Int NumberRectangles Int NumberTriangles unknown 46 bytes // was 48 in older docs }close Layer Data block following the Layer Data block are: rectangles for Layer1 // see format under NOTES triangles for Layer1 // see format under NOTES rectangles for Layer2 triangles for Layer2 ...and so on untill all layers are done after the rectangle and triangle information are the room vertices which are described under NOTES }Close Rooms Loop NOTES: Room Vertices are 28 bytes each 3 floats representing the x,y,z values of vertex 3 floats probably the vertex normals 1 DWORD probably diffuse color for the vertex Rectangles are same old format of V0,V1,V2,V3,Texture, followed by Int unknown, usually zero. Texture needs to be masked with 0xfff (high 4 bits are flags) Triangles are same old format of V0,V1,V2,Texture, followed by Int unknown, usually zero. Texture needs to be masked with 0xfff (high 4 bits are flags) TR5 uses D3D extensively. The light format is a prime example. The last byte in the light field before the CDCDCD is the light type which in D3d is 1,2, or 3 for point, spot, or directional lights respectively. Also somewhere in the unknowns must be the fog values. Sound Map is now 900 bytes Before SoundSources is a new field for Flyby_Camera data bitu32 Number_of_FBCameras followed by data for each camera. Data field is 40 bytes. [Andy had previously stated NumXYZ as a new field incorrectly. His NumXYZ field was the SoundSources in normal structure format] Cinematic Frames now 24 bytes There are no colored rectangles or triangles in mesh data. Mesh Rectangles and Triangles now same format as room rects and tris, MeshRects: v0,v1,v2,v3,texture,int unknown MeshTris: v0,v1,v2,texture,int unknown Texture Objects now preceeded by TEX/0 (4bytes) Object Textures now 38 bytes vice 20 Tile is now a bitu32 vice bitu16 seems need to mask with 0xff as other bits are flags. Seems bit15 set means triangle. In the texture coords now 0 is used for low value vice 1 The extra 16 bytes at the end of ObjectTexture structure are 4 Dword coords, UV?. Attributes using 1 or 2 for transparent. 2 used for 2 sided textures (water surface,etc) Animation now 40 vice 32 bytes. extra 8 seem to be zero right before /after the old 8 unknowns "SPR" 3 byte ascii before sprite textures As TR4 there are no 8bit or 16 bit palettes (no colored rects or tris) No lightmap No 8bit textures 3 blocks of zlib compressed textures (32bit,16bit,sprite/misc)before level data. Level data not compressed. Following level data are Riff Wave Formats. Lara 2 meshes as TR4, skin and joints. also , I was just reading thru the rectanges and triangles and thought the vertices always followed right after but appears that sometimes there is a 'pad' int of 0xCDCD. Also as Michiel has just posted the Object Textures for TR5 are 40bytes, sorry about that. ************************************************************ Good Luck, Roy...