Open Source Tomb Raider Engine
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. // Mongoose, Terms in this file related to what we use:
  2. // Int : unsigned short : bitu16
  3. // Dword : unsigned int : bitu32
  4. //
  5. // Also, I'm appending TP's findings to the format
  6. *******************************************************
  7. TR4 Possible File Format
  8. rgbold March '01
  9. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  10. Dword "TR4",0
  11. Int number of RoomTextures?
  12. Int number of OtherTextures?
  13. Int number of BumpMapTextures?
  14. Dword UncompressedSize1
  15. Dword CompressedSize1
  16. TextureBlock1
  17. Dword UncompressedSize2
  18. Dword CompressedSize2
  19. TextureBlock2
  20. Dword UncompressedSize3
  21. Dword CompressedSize3
  22. TextureBlock3
  23. /// Other data follows after textures structures are same as TR3 except
  24. where noted
  25. NOTES:
  26. Texture needs to be masked with 0xfff (high 4 bits are flags)
  27. Room Lights now 46 bytes:
  28. TR4_RoomLight //
  29. //Follows a D3D light structure, I think, could be wrong
  30. Dword Xposition // world coords
  31. Dword Yposition // world coords
  32. Dword Zposition // world coords
  33. TR2_Color // three bytes rgb values
  34. bitu8 LightType // same as D3D (i.e. 2 is for spotlight)
  35. bitu8 unknown // always 0xff?
  36. byte Intensity
  37. float In
  38. float Out
  39. float Length
  40. float Cutoff
  41. floats X,Y,Z //direction??
  42. Before SoundSources is a new field for Flyby_Camera data
  43. bitu32 Number_of_FBCameras
  44. followed by data for each camera. Data field is 40 bytes.
  45. [Andy had previously stated NumXYZ as a new field incorrectly.
  46. His NumXYZ field was the SoundSources in normal structure format]
  47. Cinematic Frames now 24 bytes
  48. There are no colored rectangles or triangles in mesh data.
  49. Mesh Rectangles and Triangles now
  50. MeshRects: v0,v1,v2,v3,texture,int unknown
  51. MeshTris: v0,v1,v2,texture,int unknown
  52. Texture Objects now preceeded by TEX/0 (4bytes)
  53. Object Textures now 38 bytes vice 20
  54. Tile is now a bitu32 vice bitu16 seems need to mask with 0xff as other
  55. bits are flags. Seems bit15 set means triangle.
  56. In the texture coords now 0 is used for low value vice 1
  57. The extra 16 bytes are at the end of ObjectTexture structure
  58. Attributes using 1 or 2 for transparent. 2 used for 2 sided textures
  59. (water surface,etc)
  60. Animation now 40 vice 32 bytes. extra 8 seem to be zero right before
  61. /after the old 8 unknowns
  62. "SPR" 3 byte ascii before sprite textures
  63. There are no 8bit or 16 bit palettes (no colored rects or tris)
  64. No lightmap
  65. No 8bit textures
  66. Following level data are Riff Wave Formats.
  67. Lara 2 meshes , skin and joints.
  68. #############################################################################
  69. #
  70. # TR5 Possible File Format
  71. # rgbold March '01
  72. #
  73. #############################################################################
  74. // Header ///////////////////
  75. Dword "TR4",0
  76. // Textures /////////////////
  77. Int number of RoomTextures?
  78. Int number of OtherTextures?
  79. Int number of BumpMapTextures?
  80. Dword UncompressedSize1
  81. Dword CompressedSize1
  82. TextureBlock1
  83. Dword UncompressedSize2
  84. Dword CompressedSize2
  85. TextureBlock2
  86. Dword UncompressedSize3
  87. Dword CompressedSize3
  88. TextureBlock3
  89. /// Follows after textures
  90. 32 bytes unknown //mostly zero
  91. Dword SizeData // size of file to Riffs
  92. Dword SizeData // repeat of above
  93. Dword Unknown // seems always zero
  94. Dword NumberRooms // number of rooms this level
  95. { Following Repeats for each Room in level
  96. Dword "XELA" (someone named Alex or "dirX Enhanced Level Archive"
  97. Dword size //size to next XELA block
  98. Dword CDCDCDCD
  99. Block1 60 bytes
  100. {
  101. Dword ublock1 //mostly: start of "XELA" +216 + ublock1 = FD end,
  102. but have seen 0xffffffff. Better using next data
  103. and compute FD size the old way of X*Z*8
  104. Dword ublock2 // start of "XELA" + 216 + ublock2 = FD start
  105. Dword ublock3 // unknown
  106. Dword ublock4 // possibly start of "XELA" + 216 + ublock4 = end portals
  107. Dword Room X // room's x position in world coords
  108. Dword unknown1 // always seems to be 0000
  109. Dword Room Z // room's z position in world coords
  110. Dword Ybottom // room's y bottom positon in world coords
  111. Dword Ytop // room's y top positon in world coords
  112. Int NumZSectors // number of z sectors
  113. Int NumXSectors // number of x sectors
  114. tr2_color4 // 4 bytes color info rgba
  115. Int NumLights
  116. Int NumStaticMeshes
  117. Dword Unknown2 // seems always 0x0001
  118. Dword Unknown3 // seems always 0x7fff
  119. Dword Unknown4 // seems always 0x7fff
  120. }close 60 byte block
  121. Dword CDCDCDCD
  122. Dword CDCDCDCD
  123. 20 byte block
  124. {
  125. 6 bytes 0xff
  126. Int Room_Flag //room attributes (rain,etc)
  127. Int unknown5
  128. 10 bytes 0x00
  129. } close 20 byte block
  130. Dword CDCDCDCD
  131. 16 byte block
  132. {
  133. unknown 16 bytes
  134. }close 16 byte block
  135. Dword CDCDCDCD
  136. Dword CDCDCDCD
  137. Dword CDCDCDCD
  138. Dword CDCDCDCD
  139. Dword Unknown6
  140. Dword CDCDCDCD
  141. 56 byte block
  142. {
  143. Dword NumberTriangles
  144. Dword NumberRectangles
  145. Dword Unknown7 // always 0x0000 ??
  146. Dword LightSize // number lights times 88 bytes
  147. Dword NumberLights
  148. Dword NumUnknown_36_byte_struct
  149. Dword Unknown9
  150. Dword Unknown10
  151. Dword NumberLayers //TR5 'layers' room pieces
  152. Dword Unknown11 // start of "XELA" + 216 + Unknown11 = start of
  153. layer
  154. info
  155. Dword Unknown12 // start of "XELA" + 216 + Unknown12 = start of
  156. vertices
  157. Dword Unknown13 // start of "XELA" + 216 + Unknown13 = start of
  158. rect/tri
  159. Dword Unknown14 // same as Unknown13???
  160. Dword Unknown15 // start of vertices + Unknown15 = start of next
  161. "XELA"
  162. }close 56 byte block
  163. Dword CDCDCDCD
  164. Dword CDCDCDCD
  165. Dword CDCDCDCD
  166. Dword CDCDCDCD
  167. // Lights //////////////////////////
  168. if lights then 85 bytes light data followed by CDCDCD for each light
  169. // Unknown /////////////////////////
  170. if NumUnknown_36_byte_struct then read them too
  171. // Sectors /////////////////////////
  172. Sector Data (sectors times 8 bytes) normal sector data structure
  173. // Portals /////////////////////////
  174. Int NumberDoors
  175. NumberDoors times 32 bytes (normal portal structure)
  176. Int CDCD
  177. // Static meshes //////////////////
  178. if StaticMeshes than numberofstatics times 20 bytes each (normal
  179. structure)
  180. // Layers ////////////////////////
  181. Layer Data blocks. 56 bytes each.
  182. {
  183. Dword NumberVertices
  184. Int Unknown16
  185. Int NumberRectangles
  186. Int NumberTriangles
  187. unknown 46 bytes // was 48 in older docs
  188. }close Layer Data block
  189. following the Layer Data block are:
  190. rectangles for Layer1 // see format under NOTES
  191. triangles for Layer1 // see format under NOTES
  192. rectangles for Layer2
  193. triangles for Layer2
  194. ...and so on untill all layers are done
  195. after the rectangle and triangle information are the room vertices
  196. which are described under NOTES
  197. }Close Rooms Loop
  198. NOTES:
  199. Room Vertices are 28 bytes each
  200. 3 floats representing the x,y,z values of vertex
  201. 3 floats probably the vertex normals
  202. 1 DWORD probably diffuse color for the vertex
  203. Rectangles are same old format of V0,V1,V2,V3,Texture, followed by
  204. Int unknown, usually zero.
  205. Texture needs to be masked with 0xfff (high 4 bits are flags)
  206. Triangles are same old format of V0,V1,V2,Texture, followed by
  207. Int unknown, usually zero.
  208. Texture needs to be masked with 0xfff (high 4 bits are flags)
  209. TR5 uses D3D extensively. The light format is a prime example. The last
  210. byte in the light field before the CDCDCD is the light type which in
  211. D3d is 1,2, or 3 for point, spot, or directional lights respectively.
  212. Also somewhere in the unknowns must be the fog values.
  213. Sound Map is now 900 bytes
  214. Before SoundSources is a new field for Flyby_Camera data
  215. bitu32 Number_of_FBCameras
  216. followed by data for each camera. Data field is 40 bytes.
  217. [Andy had previously stated NumXYZ as a new field incorrectly.
  218. His NumXYZ field was the SoundSources in normal structure format]
  219. Cinematic Frames now 24 bytes
  220. There are no colored rectangles or triangles in mesh data.
  221. Mesh Rectangles and Triangles now same format as room rects and tris,
  222. MeshRects: v0,v1,v2,v3,texture,int unknown
  223. MeshTris: v0,v1,v2,texture,int unknown
  224. Texture Objects now preceeded by TEX/0 (4bytes)
  225. Object Textures now 38 bytes vice 20
  226. Tile is now a bitu32 vice bitu16 seems need to mask with 0xff as other
  227. bits are flags. Seems bit15 set means triangle.
  228. In the texture coords now 0 is used for low value vice 1
  229. The extra 16 bytes at the end of ObjectTexture structure are 4 Dword
  230. coords, UV?.
  231. Attributes using 1 or 2 for transparent. 2 used for 2 sided textures
  232. (water surface,etc)
  233. Animation now 40 vice 32 bytes. extra 8 seem to be zero right before
  234. /after the old 8 unknowns
  235. "SPR" 3 byte ascii before sprite textures
  236. As TR4 there are no 8bit or 16 bit palettes (no colored rects or tris)
  237. No lightmap
  238. No 8bit textures
  239. 3 blocks of zlib compressed textures (32bit,16bit,sprite/misc)before
  240. level data.
  241. Level data not compressed.
  242. Following level data are Riff Wave Formats.
  243. Lara 2 meshes as TR4, skin and joints.
  244. also , I was just reading thru the rectanges and triangles and
  245. thought the vertices always followed right after but appears
  246. that sometimes there is a 'pad' int of 0xCDCD.
  247. Also as Michiel has just posted the Object Textures for TR5 are
  248. 40bytes, sorry about that.
  249. ************************************************************
  250. Good Luck,
  251. Roy...