Open Source Tomb Raider Engine
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

TombRaider.h 29KB

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