Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TombRaider.h 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /*!
  2. * \file include/TombRaider.h
  3. * \brief Loads maps, meshes, textures...
  4. *
  5. * \todo WARNING: No endian routines as of yet
  6. * \author Mongoose
  7. */
  8. #ifndef _TOMBRAIDER_H_
  9. #define _TOMBRAIDER_H_
  10. #include <cstdint>
  11. #include <cstdio>
  12. #include "TombRaiderData.h"
  13. /*!
  14. * \brief Loads maps, meshes, textures...
  15. */
  16. class TombRaider {
  17. public:
  18. /*!
  19. * \brief Constructs an object of TombRaider
  20. */
  21. TombRaider();
  22. /*!
  23. * \brief Deconstructs an object of TombRaider
  24. */
  25. ~TombRaider();
  26. ////////////////////////////////////////
  27. // Wash me -- not part of cleaned API //
  28. ////////////////////////////////////////
  29. int NumRooms();
  30. int NumMoveables();
  31. int NumTextures();
  32. /*!
  33. * \brief Get number of _special_ textures/images
  34. * \returns number of special textures/images
  35. */
  36. int NumSpecialTextures();
  37. int NumAnimations();
  38. unsigned int NumFrames();
  39. int NumStaticMeshes();
  40. int NumSpriteSequences();
  41. int NumItems();
  42. tr2_version_type Engine();
  43. unsigned short* Frame();
  44. tr2_animation_t* Animation();
  45. tr2_item_t* Item();
  46. tr2_box_t* Box();
  47. tr2_mesh_t* Mesh();
  48. /*!
  49. * \brief Get number of animations for a moveable
  50. * \param moveable_index valid moveable id
  51. * \returns number of animations for specified moveable
  52. */
  53. int getNumAnimsForMoveable(int moveable_index);
  54. tr2_staticmesh_t* StaticMesh();
  55. tr2_moveable_t* Moveable();
  56. tr2_meshtree_t* MeshTree();
  57. /*!
  58. * \brief Get the sprites
  59. * \returns the sprite array
  60. */
  61. tr2_sprite_texture_t* Sprite();
  62. tr2_sprite_sequence_t* SpriteSequence();
  63. /*!
  64. * \brief Get copies of texture and it's bumpmap
  65. * \param texture valid textile index
  66. * \param image will be set to texture if found, or NULL
  67. * \param bumpmap will be set to bumpmap if found, or NULL
  68. */
  69. void Texture(int texture, unsigned char** image, unsigned char** bumpmap);
  70. //unsigned int* Palette16();
  71. //unsigned char* Palette8();
  72. tr2_room_t* Room();
  73. /*!
  74. * \brief Loads TombRaider 1-5 pak into memory
  75. * and does some processing.
  76. * \param filename points to valid TombRaider pak
  77. * \returns 0 on success, < 0 on error
  78. * \sa TombRaider::loadTR5()
  79. */
  80. int Load(const char* filename);
  81. /*!
  82. * \brief Compute rotation angles from moveable animation data
  83. * \param frame moveable animation data
  84. * \param frame_offset moveable animation data
  85. * \param angle_offset moveable animation data
  86. * \param x will be set to computed angle
  87. * \param y will be set to computed angle
  88. * \param z will be set to computed angle
  89. */
  90. void computeRotationAngles(unsigned short** frame,
  91. unsigned int* frame_offset,
  92. unsigned int* angle_offset,
  93. float* x, float* y, float* z);
  94. /*!
  95. * \brief Returns computed UV in u and v
  96. * \param st object texture vert, its coordinates are added to the pixels and divided by 255.0
  97. * \param u will contain calculated x value
  98. * \param v will contain calculated y value
  99. */
  100. void computeUV(tr2_object_texture_vert_t* st, float* u, float* v);
  101. void getColor(int index, float color[4]);
  102. tr2_version_type getEngine();
  103. /*!
  104. * \brief Get the collision sphere for a mesh
  105. * \param meshIndex mesh index
  106. * \param center will be filled with center coordinates, not NULL
  107. * \param radius will be filled with radius, not NULL
  108. */
  109. void getMeshCollisionInfo(unsigned int meshIndex,
  110. float center[3], float* radius);
  111. /*!
  112. * \brief Get SIGNED mesh count (TR encoded < 0 errors)
  113. * \returns signed mesh count
  114. */
  115. int getMeshCount();
  116. /*!
  117. * \brief This method is made to let you fill arrays or
  118. * create single faces. There may be an allocatin version that
  119. * passes back arrays later.
  120. * Returns Quads/Rects as 2 triangles,
  121. * because returning quads would be too trivial :)
  122. * \param meshIndex mesh index
  123. * \param faceIndex face index
  124. * \param index allocated RGBA
  125. * \param color allocated RGBA
  126. * \fixme This method interface may change later
  127. */
  128. void getMeshColoredRectangle(unsigned int meshIndex,
  129. unsigned int faceIndex,
  130. int index[6], float color[4]);
  131. /*!
  132. * \brief This method is made to let you fill arrays or
  133. * create single faces. There may be an allocating version that
  134. * passes back arrays later.
  135. * \param meshIndex mesh index
  136. * \param faceIndex face index
  137. * \param index allocated RGBA
  138. * \param color allocated RGBA
  139. * \fixme This method interface may change later
  140. */
  141. void getMeshColoredTriangle(unsigned int meshIndex,
  142. unsigned int faceIndex,
  143. int index[3], float color[4]);
  144. /*!
  145. * \brief This method is made to let you fill arrays or
  146. * create single faces. There may be an allocatin version that
  147. * passes back arrays later.
  148. * Returns Quads/Rects as 2 triangles,
  149. * because returning quads would be too trivial :)
  150. * \param meshIndex mesh index
  151. * \param faceIndex face index
  152. * \param index allocated
  153. * \param st allocated
  154. * \param texture allocated
  155. * \param transparency allocated
  156. * \fixme This method interface may change later
  157. */
  158. void getMeshTexturedRectangle(unsigned int meshIndex,
  159. unsigned int faceIndex,
  160. int index[6], float st[12], int* texture,
  161. unsigned short* transparency);
  162. /*!
  163. * \brief This method is made to let you fill arrays or
  164. * create single faces. There may be an allocatin version that
  165. * passes back arrays later.
  166. * \param meshIndex mesh index
  167. * \param faceIndex face index
  168. * \param index allocated
  169. * \param st allocated
  170. * \param texture allocated
  171. * \param transparency allocated
  172. * \fixme This method interface may change later
  173. */
  174. void getMeshTexturedTriangle(unsigned int meshIndex,
  175. unsigned int faceIndex,
  176. int index[3], float st[6], int* texture,
  177. unsigned short* transparency);
  178. /*!
  179. * \brief Get face counts for a given mesh.
  180. *
  181. * \todo This method interface may change later...
  182. * \param meshIndex mesh index
  183. * \returns number of textured triangles in mesh
  184. */
  185. int getMeshTexturedTriangleCount(unsigned int meshIndex);
  186. /*!
  187. * \brief Get face counts for a given mesh.
  188. * \param meshIndex mesh index
  189. * \returns number of colored triangles in mesh
  190. */
  191. int getMeshColoredTriangleCount(unsigned int meshIndex);
  192. /*!
  193. * \brief Get face counts for a given mesh.
  194. * \param meshIndex mesh index
  195. * \returns number of textured rectangles in mesh
  196. */
  197. int getMeshTexturedRectangleCount(unsigned int meshIndex);
  198. /*!
  199. * \brief Get face counts for a given mesh.
  200. * \returns number if colored rectangles in mesh
  201. */
  202. int getMeshColoredRectangleCount(unsigned int meshIndex);
  203. /*!
  204. * \brief Get vertex, normal and color arrays for a mesh
  205. * \param meshIndex mesh index
  206. * \param vertexCount will be set to length of vertex array
  207. * \param verts will be set to allocated vertex array (XYX)
  208. * \param normalCount will be set to length of normal array
  209. * \param norms will be set to allocated normal array (IJK)
  210. * \param colorCount will be set to length of color array
  211. * \param colors will be set to allocated color array (I)
  212. */
  213. void getMeshVertexArrays(unsigned int meshIndex,
  214. unsigned int* vertexCount, float** verts,
  215. unsigned int* normalCount, float** norms,
  216. unsigned int* colorCount, float** colors);
  217. /*!
  218. * \brief Get a single collision box from room (unified)
  219. * \param roomIndex room index
  220. * \param index index of box in room
  221. * \param xyzA will contain first corner of box
  222. * \param xyzB will contain second corner of box
  223. * \param xyzC will contain third corner of box
  224. * \param xyzD will contain fourth corner of box
  225. * \returns 0 on success, < 0 on error
  226. */
  227. int getRoomBox(unsigned int roomIndex, unsigned int index,
  228. float* xyzA, float* xyzB, float* xyzC, float* xyzD);
  229. /*!
  230. * \brief Get number of collision boxes in room (unified)
  231. * \param roomIndex room index
  232. * \returns number of collision boxes in room
  233. */
  234. unsigned int getRoomBoxCount(unsigned int roomIndex);
  235. void getRoomInfo(unsigned int index,
  236. unsigned int* flags, float pos[3],
  237. float bboxMin[3], float bboxMax[3]);
  238. /*!
  239. * \brief Get a single light from a room (unified)
  240. * \param roomIndex valid room index
  241. * \param index valid light index in room
  242. * \param pos allocated, will contain position
  243. * \param color allocated, will contain color
  244. * \param dir allocated, will contain direction
  245. * \param attenuation will contain attenuation
  246. * \param cutoffAngle will contain cutoff angle
  247. * \param type will contain type
  248. * \param flags will contain flags
  249. * \returns 0 on success, < 0 on error
  250. */
  251. int getRoomLight(unsigned int roomIndex, unsigned int index,
  252. float pos[4], float color[4], float dir[3],
  253. float* attenuation, float* cutoffAngle,
  254. unsigned int* type, unsigned int* flags);
  255. /*!
  256. * \brief Get number of lights in room (unified)
  257. * \param roomIndex room index
  258. * \returns number of lights in room
  259. */
  260. unsigned int getRoomLightCount(unsigned int roomIndex);
  261. /*!
  262. * \brief Get a single model info from a room
  263. * \param roomIndex valid room index
  264. * \param index valid model index in room
  265. * \param modelIndex will contain starting mesh
  266. * \param pos will contain pos
  267. * \param yaw will contain yaw angle
  268. * \returns 0 on success, < 0 on error
  269. */
  270. int getRoomModel(unsigned int roomIndex, unsigned int index,
  271. int* modelIndex, float pos[3], float* yaw);
  272. /*!
  273. * \brief Get number of room models in room (unified)
  274. * \param roomIndex room index
  275. * \returns number of room models in room
  276. */
  277. unsigned int getRoomModelCount(unsigned int roomIndex);
  278. /*!
  279. * \brief Get a single portal from room (unified)
  280. * \param roomIndex valid room index
  281. * \param index valid portal index in room
  282. * \param adjoiningRoom will contain adjoining room index
  283. * \param normal allocated, will contain normal vector
  284. * \param vertices allocated, will contain vertices
  285. * \returns 0 on success, < 0 on error
  286. */
  287. int getRoomPortal(unsigned int roomIndex, unsigned int index,
  288. int* adjoiningRoom, float normal[3], float vertices[12]);
  289. /*!
  290. * \brief Get number of portals from room (unified)
  291. * \param roomIndex room index
  292. * \returns number of portals from room
  293. */
  294. unsigned int getRoomPortalCount(unsigned int roomIndex);
  295. /*!
  296. * \brief Get rectangle data with texCoords for non-matching
  297. * vertex/uv for each vertex in TombRaider room (unified)
  298. * \param roomIndex valid room index
  299. * \param rectangleIndex rectangle index in room
  300. * \param indices will contain indices
  301. * \param texCoords will contain texCoords
  302. * \param texture will contain texture
  303. * \param flags will contain flags
  304. */
  305. void getRoomRectangle(unsigned int roomIndex, unsigned int rectangleIndex,
  306. unsigned int* indices, float* texCoords, int* texture,
  307. unsigned int* flags);
  308. /*!
  309. * \brief Get number of rectangles from room (unified)
  310. * \param roomIndex room index
  311. * \returns number of rectangles from room
  312. */
  313. unsigned int getRoomRectangleCount(unsigned int roomIndex);
  314. /*!
  315. * \brief Get a single sector from room (unified)
  316. * \param roomIndex room index
  317. * \param index sector index
  318. * \param flags will contain flags
  319. * \param ceiling will contain ceiling
  320. * \param floor will contain floor
  321. * \param floorDataIndex will contain floor data index
  322. * \param boxIndex will contain boxIndex
  323. * \param roomBelow will contain roomBelow
  324. * \param roomAbove will contain roomAbove
  325. * \return 0 on success, < 0 on error
  326. */
  327. int getRoomSector(unsigned int roomIndex, unsigned int index,
  328. unsigned int* flags, float* ceiling, float* floor,
  329. int* floorDataIndex, int* boxIndex,
  330. int* roomBelow, int* roomAbove);
  331. /*!
  332. * \brief Get number of sectors in room (unified)
  333. * \param roomIndex room index
  334. * \param zSectorsCount will contain width of sector list
  335. * \param xSectorsCount will contain height of sector list
  336. * \returns number of sectors in room
  337. */
  338. unsigned int getRoomSectorCount(unsigned int roomIndex,
  339. unsigned int* zSectorsCount,
  340. unsigned int* xSectorsCount);
  341. void getRoomSprite(unsigned int roomIndex, unsigned int index,
  342. float scale, int* texture,
  343. float* pos, float* vertices, float* texcoords);
  344. /*!
  345. * \brief Get number of sprites in room (unified)
  346. * \param roomIndex room index
  347. * \returns number of sprites in room
  348. */
  349. unsigned int getRoomSpriteCount(unsigned int roomIndex);
  350. /*!
  351. * \brief Gets triangle data with texCoords for non-matching
  352. * vertex/uv for each vertex in TombRaider room (unified)
  353. * \param roomIndex room index
  354. * \param triangleIndex triangle index
  355. * \param indices will contain indices
  356. * \param texCoords will contain texCoords
  357. * \param texture will contain texture
  358. * \param flags will contain flags
  359. */
  360. void getRoomTriangle(unsigned int roomIndex, unsigned int triangleIndex,
  361. unsigned int* indices, float* texCoords, int* texture,
  362. unsigned int* flags);
  363. /*!
  364. * \brief Gets triangle data with texCoords for non-matching
  365. * vertex/uv for each vertex in TombRaider room.
  366. *
  367. * This is used with vertices, colors, etc. to do partial array
  368. * rendering, since the texcoords will never match vertives
  369. * (Tomb Raider is textile based).
  370. * \param index room index
  371. * \param textureOffset texture offset
  372. * \param count will contain count
  373. * \param indices will contain indices
  374. * \param texCoords will contain texCoords
  375. * \param textures will contain textures
  376. * \param flags will contain flags
  377. */
  378. void getRoomTriangles(unsigned int index, int textureOffset,
  379. unsigned int* count, unsigned int** indices,
  380. float** texCoords, int** textures,
  381. unsigned int** flags);
  382. /*!
  383. * \brief Gets triangle data with duplicated vertex/color/normal
  384. * data for each face vertex to match the textile based texcoords.
  385. *
  386. * This uses more memory, but lets you do direct array rendering
  387. * with OpenGL, D3D, etc.
  388. * \param roomIndex room index
  389. * \param textureOffset texture offset
  390. * \param count will contain count
  391. * \param indices will contain indices
  392. * \param vertices will contain vertices
  393. * \param texCoords will contain texCoords
  394. * \param colors will contain colors
  395. * \param textures will contain textures
  396. * \param flags will contain flags
  397. */
  398. void getRoomTriangles(unsigned int roomIndex, int textureOffset,
  399. unsigned int* count,
  400. unsigned int** indices, float** vertices,
  401. float** texCoords, float** colors,
  402. int** textures, unsigned int** flags);
  403. /*!
  404. * \brief Get number of triangles from room (unified)
  405. * \param roomIndex room index
  406. * \returns number of triangles from room
  407. */
  408. unsigned int getRoomTriangleCount(unsigned int roomIndex);
  409. /*!
  410. * \brief Gets vertex position and color
  411. * \param roomIndex room index
  412. * \param vertexIndex vertex index
  413. * \param xyz will contain vertex position, has to be allocated
  414. * \param rgba will contain vertex color, has to be allocated
  415. */
  416. void getRoomVertex(unsigned int roomIndex, unsigned int vertexIndex,
  417. float* xyz, float* rgba);
  418. /*!
  419. * \brief Get allocated vertex and color arrays and their element counts (unified)
  420. * \param roomIndex valid room index
  421. * \param vertexCount will contain vertex array length
  422. * \param vertices will contain vertex array
  423. * \param normalCount will contain normal array length
  424. * \param normals will contain normal array
  425. * \param colorCount will contain color array length
  426. * \param colors will contain color array
  427. */
  428. void getRoomVertexArrays(unsigned int roomIndex,
  429. unsigned int* vertexCount, float** vertices,
  430. unsigned int* normalCount, float** normals,
  431. unsigned int* colorCount, float** colors);
  432. /*!
  433. * \brief Get number of lights in room (unified)
  434. * \param roomIndex room index
  435. * \returns number of lights in room
  436. */
  437. unsigned int getRoomVertexCount(unsigned int roomIndex);
  438. /*!
  439. * \brief Get sky mesh ID
  440. * \returns moveable id of sky mesh or -1 if none
  441. */
  442. int getSkyModelId();
  443. /*!
  444. * \brief Get a copy of a sound sample and its byte size
  445. * \param index sound sample index
  446. * \param bytes will contain byte size of sound sample
  447. * \param data will contain sound sample
  448. */
  449. void getSoundSample(unsigned int index,
  450. unsigned int* bytes, unsigned char** data);
  451. /*!
  452. * \brief Get number of loaded sound samples
  453. * \returns number of sound samples loaded
  454. */
  455. unsigned int getSoundSamplesCount();
  456. /*!
  457. * \brief Check if a mesh is valid
  458. * \param index mesh index (?)
  459. * \returns true if mesh is valid
  460. */
  461. bool isMeshValid(int index);
  462. /*!
  463. * \brief Check if a room is valid (TRC support)
  464. * \param index room index
  465. * \returns true if room is valid
  466. */
  467. bool isRoomValid(int index);
  468. /*!
  469. * \brief Load an external sound pak for TR2 and TR3
  470. * \param filename pak to load
  471. * \returns < 0 on error
  472. */
  473. int loadSFX(const char* filename);
  474. void reset();
  475. private:
  476. void extractMeshes(unsigned char* mesh_data,
  477. unsigned int num_mesh_pointers,
  478. unsigned int* mesh_pointers);
  479. int Fread(void* buffer, size_t size, size_t count, FILE* f);
  480. /*!
  481. * \brief Get a copy of the sound samples
  482. * \param bytes will contain size of sound samples
  483. * \param data will contain sound samples themselves
  484. */
  485. void getRiffData(unsigned int* bytes, unsigned char** data);
  486. /*!
  487. * \brief Get a copy of a TR4 sound sample
  488. * \param index sound sample index
  489. * \param bytes will contain length of sound sample
  490. * \param data will contain sound sample itself
  491. */
  492. void getRiffDataTR4(unsigned int index,
  493. unsigned int* bytes, unsigned char** data);
  494. /*!
  495. * \brief Get an array of offsets for a contiguous RIFF data stream in chunks.
  496. *
  497. * Offsets will be allocated with enough space to hold expected
  498. * number of offsets. (Should be known number, otherwise not all RIFFs
  499. * will be parsed.)
  500. * \param riffData riff data
  501. * \param riffDataBytes length of riff data
  502. * \param offsets will contain offsets
  503. * \param numOffsets known number
  504. * \returns number of RIFFs found
  505. */
  506. int getRiffOffsets(unsigned char* riffData, unsigned int riffDataBytes,
  507. unsigned int** offsets, unsigned int numOffsets);
  508. /*!
  509. * \brief Makes a 32bit RGBA image from a textile.
  510. *
  511. * This handles all selection and conversion, including
  512. * alpha layering flags, now.
  513. * \param texture valid index into textile list
  514. * \returns 32bit RGBA image or NULL on error
  515. */
  516. unsigned char* getTexTile(int texture);
  517. /*!
  518. * \brief Loads a TR5 pak into memory.
  519. * \param f valid FILE
  520. * \returns 0 on success, < 0 on error
  521. */
  522. int loadTR5(FILE* f);
  523. static void print(const char* methodName, const char* s, ...) __attribute__((format(printf, 2, 3)));
  524. void printDebug(const char* methodName, const char* s, ...) __attribute__((format(printf, 3, 4)));
  525. bool mDebug; //!< Debug output toggle
  526. unsigned int mPakVersion; //!< TombRaider pak file header version
  527. tr2_version_type mEngineVersion; //!< TombRaider engine version
  528. tr2_colour_t _palette8[256]; //!< 8-bit palette
  529. unsigned int _palette16[256]; //!< 16-bit palette
  530. unsigned int _num_textiles; //!< Total number of texture tiles
  531. unsigned short _num_room_textures; //!< Num textures only for room use?
  532. unsigned short _num_misc_textures; //!< Num of textures for misc use?
  533. unsigned short _num_bump_map_textures; //!< Num of textures that are bump map, texture pairs
  534. tr2_textile8_t* _textile8; //!< 8-bit (palettised) textiles
  535. tr2_textile16_t* _textile16; //!< 16-bit (ARGB) textiles
  536. tr2_textile32_t* _textile32; //!< 32-bit (BGRA) textiles
  537. unsigned int _num_tex_special; //!< Special textures and bump maps count
  538. unsigned char* _tex_special; //!< Special textures and bump maps
  539. unsigned int _unknown_t; //!< 32-bit unknown (always 0 in real TR2 levels)
  540. unsigned short _num_rooms; //!< Number of rooms in this level
  541. tr2_room_t* _rooms; //!< List of rooms (TR1,TR2,TR3,TR4)
  542. tr5_room_t* mRoomsTR5; //!< Rooms ( TR5 / TRC ) Only
  543. unsigned int _num_floor_data; //!< Num of words of floor data this level
  544. unsigned short* _floor_data; //!< Floor data
  545. int mMeshCount; //!< Number of meshes this level
  546. tr2_mesh_t* mMeshes; //!< list of meshes
  547. unsigned int _num_animations; //!< number of animations this level
  548. tr2_animation_t* _animations; //!< list of animations
  549. unsigned int _num_state_changes; //!< number of structures(?) this level
  550. tr2_state_change_t* _state_changes; //!< list of structures
  551. unsigned int _num_anim_dispatches; //!< number of ranges(?) this level
  552. tr2_anim_dispatch_t* _anim_dispatches; //!< list of ranges
  553. unsigned int _num_anim_commands; //!< number of Bone1s this level
  554. tr2_anim_command_t* _anim_commands; //!< list of Bone1s
  555. unsigned int _num_mesh_trees; //!< number of Bone2s this level
  556. tr2_meshtree_t* _mesh_trees; //!< list of Bone2s
  557. unsigned int _num_frames; //!< num of words of frame data this level
  558. unsigned short* _frames; //!< frame data
  559. unsigned int _num_moveables; //!< number of moveables this level
  560. tr2_moveable_t* _moveables; //!< list of moveables
  561. uint32_t numMoveablesTR5;
  562. tr5_moveable_t* moveablesTR5;
  563. uint32_t numAnimationsTR5;
  564. tr5_animation_t* animationsTR5;
  565. uint32_t numObjectTexturesTR5;
  566. tr5_object_texture_t* objectTexturesTR5;
  567. uint32_t numCinematicFramesTR5;
  568. tr5_cinematic_frame_t* cinematicFramesTR5;
  569. uint32_t numFlyByCamerasTR5;
  570. tr5_flyby_camera_t* flyByCamerasTR5;
  571. unsigned int _num_static_meshes; //!< number of static meshes this level
  572. tr2_staticmesh_t* _static_meshes; //!< static meshes
  573. unsigned int _num_object_textures; //!< number of object textures this level
  574. tr2_object_texture_t* _object_textures; //!< list of object textures
  575. unsigned int _num_sprite_textures; //!< num of sprite textures this level
  576. tr2_sprite_texture_t* _sprite_textures; //!< list of sprite textures
  577. unsigned int _num_sprite_sequences; //!< num of sprite sequences this level
  578. tr2_sprite_sequence_t* _sprite_sequences; //!< sprite sequence data
  579. int _num_cameras; //!< Number of Cameras
  580. tr2_camera_t* _cameras; //!< cameras
  581. int _num_sound_sources; //!< Number of Sounds
  582. tr2_sound_source_t* _sound_sources; //!< sounds
  583. int _num_boxes; //!< Number of Boxes
  584. tr2_box_t* _boxes; /*!< boxes - looks like
  585. * struct { unsigned short value[4]; }
  586. * - value[0..2] might be a vector;
  587. * value[3] seems to be index into
  588. * Overlaps[] */
  589. int _num_overlaps; //!< Number of Overlaps
  590. short* _overlaps; /*!< Overlaps -
  591. * looks like ushort; 0x8000 is flag
  592. * of some sort appears to be an
  593. * offset into Boxes[] and/or
  594. * Boxes2[] */
  595. short* _zones; //!< Boxes2
  596. int _num_animated_textures; //!< Number of AnimTextures
  597. short* _animated_textures; //!< Animtextures
  598. int _num_items; //!< Number of Items
  599. tr2_item_t* _items; //!< Items
  600. unsigned char* _light_map; //!< Colour-light maps
  601. unsigned int _num_cinematic_frames; //!< Number of cut-scene frames
  602. tr2_cinematic_frame_t* _cinematic_frames; //!< Cut-scene frames
  603. short _num_demo_data; //!< Number of Demo Data
  604. unsigned char* _demo_data; //!< Demo data
  605. float mRoomVertexLightingFactor;
  606. float mTexelScale;
  607. // Sound data
  608. short* mSoundMap; //!< Sound map
  609. int mNumSoundDetails; //!< Number of SampleModifiers
  610. tr2_sound_details_t* mSoundDetails; //!< Sample modifiers
  611. int mNumSampleIndices; //!< Number of Sample Indices
  612. int* mSampleIndices; //!< Sample indices
  613. unsigned int* mSampleIndicesTR5;
  614. bool mRiffAlternateLoaded; //!< Is a TR2,TR3 SFX loaded?
  615. unsigned int* mRiffAlternateOffsets; //!< After parsing this will
  616. //!< hold byte offsets for TR2,TR3
  617. //!< RIFFs in the buffered SFX
  618. int mRiffDataSz; //!< Byte size of a loaded SFX
  619. unsigned char* mRiffData; //!< SFX RIFF data in chunks
  620. unsigned int mNumTR4Samples;
  621. unsigned char** mTR4Samples;
  622. unsigned int* mTR4SamplesSz;
  623. // For packed Fread emu/wrapper
  624. unsigned char*
  625. mCompressedLevelData; //!< Buffer used to emulate fread with uncompressed libz data
  626. unsigned int mCompressedLevelDataOffset; //!< Offset into buffer
  627. unsigned int mCompressedLevelSize; //!< Size of buffer
  628. tr_fread_mode_t mFreadMode; //!< Fread mode file|buffer
  629. };
  630. #endif