123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
-
- #############################################################################
- #
- # TR5 File Format?
- # rgbold, Turbo Pascal, and Mongoose spec merge
- #
- # NOTES:
- # I use ISO style types to be more clear, not word sizes
- #
- # Int : unsigned short : bitu16
- # Dword : unsigned int : bitu32
- #
- # Some other markers? I think these may be:
- #
- # 58 50 50 FF "XPP." | "PPX"
- # 58 50 48 FF "XPH." | "HPX"
- # 50 50 48 FF "PPH." | "PPH"
- #
- # They appear in a patern like:
- # ALEX
- # XPP XPP ...
- # ALEX
- #
- #
- # - Mongoose
- #
- # 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.
- # - Roy
- #
- #############################################################################
-
-
- uint32 version;
-
-
- bitu16 num_room_textures
- bitu16 number of num_other_textures
- bitu16 number of num_bump_map_textures
- bitu32 UncompressedSize1
- bitu32 CompressedSize1
- TextureBlock1
- bitu32 UncompressedSize2
- bitu32 CompressedSize2
- TextureBlock2
- bitu32 UncompressedSize3
- bitu32 CompressedSize3
- TextureBlock3
-
-
-
-
- 32 bytes unknown
- bitu32 SizeData
- bitu32 SizeData
- bitu32 Unknown
- bitu32 NumberRooms
-
- { Following Repeats for each Room in level
-
- bitu32 "XELA" (someone named Alex or "dirX Enhanced Level Archive"
- bitu32 size
- bitu32 CDCDCDCD
-
- Block1 60 bytes
- {
-
- bitu32 ublock1
- but have seen 0xffffffff. Better using next data
- and compute FD size the old way of X*Z*8
- bitu32 ublock2
- bitu32 ublock3
- bitu32 ublock4
-
- bitu32 Room X
- bitu32 unknown1
- bitu32 Room Z
- bitu32 Ybottom
- bitu32 Ytop
-
- Int NumZSectors
- Int NumXSectors
-
- tr2_color4
-
- Int NumLights
- Int NumStaticMeshes
-
- bitu32 Unknown2
- bitu32 Unknown3
- bitu32 Unknown4
-
- }close 60 byte block
-
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
-
- 20 byte block
- {
- 6 bytes 0xff
- Int Room_Flag
- Int unknown5
- 10 bytes 0x00
- } close 20 byte block
-
- bitu32 CDCDCDCD
-
- 16 byte block
- {
- unknown 16 bytes
- }close 16 byte block
-
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
-
- bitu32 Unknown6
-
- bitu32 CDCDCDCD
-
- 56 byte block
- {
- bitu32 NumberTriangles
- bitu32 NumberRectangles
- bitu32 Unknown7
- bitu32 LightSize
- bitu32 NumberLights
- bitu32 NumUnknown_36_byte_struct
- bitu32 Unknown9
- bitu32 Unknown10
- bitu32 NumberLayers
- bitu32 Unknown11
- layer
- info
- bitu32 Unknown12
- vertices
- bitu32 Unknown13
- rect/tri
- bitu32 Unknown14
- bitu32 Unknown15
- "XELA"
- }close 56 byte block
-
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
- bitu32 CDCDCDCD
-
-
- if lights then 85 bytes light data followed by CDCDCD for each light
-
-
- if NumUnknown_36_byte_struct then read them too
-
-
- Sector Data (sectors times 8 bytes) normal sector data structure
-
-
- Int NumberDoors
-
- NumberDoors times 32 bytes (normal portal structure)
-
- Int CDCD
-
-
- if StaticMeshes than numberofstatics times 20 bytes each (normal
- structure)
-
-
-
- Layer Data blocks. 56 bytes each.
- {
- bitu32 NumberVertices
- Int Unknown16
- Int NumberRectangles
- Int NumberTriangles
-
- unknown 46 bytes
-
- }close Layer Data block
-
- following the Layer Data block are:
- rectangles for Layer1
- triangles for Layer1
- 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
-
-
|