123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728 |
-
-
- #ifndef _TOMBRAIDER_H_
- #define _TOMBRAIDER_H_
-
- #include <cstdint>
- #include <cstdio>
-
- #include "TombRaiderData.h"
-
-
- class TombRaider {
- public:
-
-
-
- TombRaider();
-
-
-
- ~TombRaider();
-
-
-
-
-
- int NumRooms();
-
- int NumMoveables();
-
- int NumTextures();
-
-
-
- int NumSpecialTextures();
-
- int NumAnimations();
-
- unsigned int NumFrames();
-
- int NumStaticMeshes();
-
- int NumSpriteSequences();
-
- int NumItems();
-
- tr2_version_type Engine();
-
- unsigned short* Frame();
-
- tr2_animation_t* Animation();
-
- tr2_item_t* Item();
-
- tr2_box_t* Box();
-
- tr2_mesh_t* Mesh();
-
-
-
- int getNumAnimsForMoveable(int moveable_index);
-
- tr2_staticmesh_t* StaticMesh();
-
- tr2_moveable_t* Moveable();
-
- tr2_meshtree_t* MeshTree();
-
-
-
- tr2_sprite_texture_t* Sprite();
-
- tr2_sprite_sequence_t* SpriteSequence();
-
-
-
- void Texture(int texture, unsigned char** image, unsigned char** bumpmap);
-
-
-
-
- tr2_room_t* Room();
-
-
-
- int Load(const char* filename);
-
-
-
- void computeRotationAngles(unsigned short** frame,
- unsigned int* frame_offset,
- unsigned int* angle_offset,
- float* x, float* y, float* z);
-
-
-
- void computeUV(tr2_object_texture_vert_t* st, float* u, float* v);
-
- void getColor(int index, float color[4]);
-
- tr2_version_type getEngine();
-
-
-
- void getMeshCollisionInfo(unsigned int meshIndex,
- float center[3], float* radius);
-
-
-
- int getMeshCount();
-
-
-
- void getMeshColoredRectangle(unsigned int meshIndex,
- unsigned int faceIndex,
- int index[6], float color[4]);
-
-
-
- void getMeshColoredTriangle(unsigned int meshIndex,
- unsigned int faceIndex,
- int index[3], float color[4]);
-
-
-
- void getMeshTexturedRectangle(unsigned int meshIndex,
- unsigned int faceIndex,
- int index[6], float st[12], int* texture,
- unsigned short* transparency);
-
-
-
- void getMeshTexturedTriangle(unsigned int meshIndex,
- unsigned int faceIndex,
- int index[3], float st[6], int* texture,
- unsigned short* transparency);
-
-
-
- int getMeshTexturedTriangleCount(unsigned int meshIndex);
-
-
-
- int getMeshColoredTriangleCount(unsigned int meshIndex);
-
-
-
- int getMeshTexturedRectangleCount(unsigned int meshIndex);
-
-
-
- int getMeshColoredRectangleCount(unsigned int meshIndex);
-
-
-
- void getMeshVertexArrays(unsigned int meshIndex,
- unsigned int* vertexCount, float** verts,
- unsigned int* normalCount, float** norms,
- unsigned int* colorCount, float** colors);
-
-
-
- int getRoomBox(unsigned int roomIndex, unsigned int index,
- float* xyzA, float* xyzB, float* xyzC, float* xyzD);
-
-
-
- unsigned int getRoomBoxCount(unsigned int roomIndex);
-
- void getRoomInfo(unsigned int index,
- unsigned int* flags, float pos[3],
- float bboxMin[3], float bboxMax[3]);
-
-
-
- int getRoomLight(unsigned int roomIndex, unsigned int index,
- float pos[4], float color[4], float dir[3],
- float* attenuation, float* cutoffAngle,
- unsigned int* type, unsigned int* flags);
-
-
-
- unsigned int getRoomLightCount(unsigned int roomIndex);
-
-
-
- int getRoomModel(unsigned int roomIndex, unsigned int index,
- int* modelIndex, float pos[3], float* yaw);
-
-
-
- unsigned int getRoomModelCount(unsigned int roomIndex);
-
-
-
- int getRoomPortal(unsigned int roomIndex, unsigned int index,
- int* adjoiningRoom, float normal[3], float vertices[12]);
-
-
-
- unsigned int getRoomPortalCount(unsigned int roomIndex);
-
-
-
- void getRoomRectangle(unsigned int roomIndex, unsigned int rectangleIndex,
- unsigned int* indices, float* texCoords, int* texture,
- unsigned int* flags);
-
-
-
- unsigned int getRoomRectangleCount(unsigned int roomIndex);
-
-
-
- int getRoomSector(unsigned int roomIndex, unsigned int index,
- unsigned int* flags, float* ceiling, float* floor,
- int* floorDataIndex, int* boxIndex,
- int* roomBelow, int* roomAbove);
-
-
-
- unsigned int getRoomSectorCount(unsigned int roomIndex,
- unsigned int* zSectorsCount,
- unsigned int* xSectorsCount);
-
- void getRoomSprite(unsigned int roomIndex, unsigned int index,
- float scale, int* texture,
- float* pos, float* vertices, float* texcoords);
-
-
-
- unsigned int getRoomSpriteCount(unsigned int roomIndex);
-
-
-
- void getRoomTriangle(unsigned int roomIndex, unsigned int triangleIndex,
- unsigned int* indices, float* texCoords, int* texture,
- unsigned int* flags);
-
-
-
- void getRoomTriangles(unsigned int index, int textureOffset,
- unsigned int* count, unsigned int** indices,
- float** texCoords, int** textures,
- unsigned int** flags);
-
-
-
- void getRoomTriangles(unsigned int roomIndex, int textureOffset,
- unsigned int* count,
- unsigned int** indices, float** vertices,
- float** texCoords, float** colors,
- int** textures, unsigned int** flags);
-
-
-
- unsigned int getRoomTriangleCount(unsigned int roomIndex);
-
-
-
- void getRoomVertex(unsigned int roomIndex, unsigned int vertexIndex,
- float* xyz, float* rgba);
-
-
-
- void getRoomVertexArrays(unsigned int roomIndex,
- unsigned int* vertexCount, float** vertices,
- unsigned int* normalCount, float** normals,
- unsigned int* colorCount, float** colors);
-
-
-
- unsigned int getRoomVertexCount(unsigned int roomIndex);
-
-
-
- int getSkyModelId();
-
-
-
- void getSoundSample(unsigned int index,
- unsigned int* bytes, unsigned char** data);
-
-
-
- unsigned int getSoundSamplesCount();
-
-
-
- bool isMeshValid(int index);
-
-
-
- bool isRoomValid(int index);
-
-
-
- int loadSFX(const char* filename);
-
- void reset();
-
- private:
-
- void extractMeshes(unsigned char* mesh_data,
- unsigned int num_mesh_pointers,
- unsigned int* mesh_pointers);
-
- int Fread(void* buffer, size_t size, size_t count, FILE* f);
-
-
-
- void getRiffData(unsigned int* bytes, unsigned char** data);
-
-
-
- void getRiffDataTR4(unsigned int index,
- unsigned int* bytes, unsigned char** data);
-
-
-
- int getRiffOffsets(unsigned char* riffData, unsigned int riffDataBytes,
- unsigned int** offsets, unsigned int numOffsets);
-
-
-
- unsigned char* getTexTile(int texture);
-
-
-
- int loadTR5(FILE* f);
-
- static void print(const char* methodName, const char* s, ...) __attribute__((format(printf, 2, 3)));
-
- void printDebug(const char* methodName, const char* s, ...) __attribute__((format(printf, 3, 4)));
-
- bool mDebug;
- unsigned int mPakVersion;
- tr2_version_type mEngineVersion;
- tr2_colour_t _palette8[256];
- unsigned int _palette16[256];
- unsigned int _num_textiles;
- unsigned short _num_room_textures;
- unsigned short _num_misc_textures;
- unsigned short _num_bump_map_textures;
- tr2_textile8_t* _textile8;
- tr2_textile16_t* _textile16;
- tr2_textile32_t* _textile32;
- unsigned int _num_tex_special;
- unsigned char* _tex_special;
- unsigned int _unknown_t;
- unsigned short _num_rooms;
- tr2_room_t* _rooms;
- tr5_room_t* mRoomsTR5;
- unsigned int _num_floor_data;
- unsigned short* _floor_data;
- int mMeshCount;
- tr2_mesh_t* mMeshes;
- unsigned int _num_animations;
- tr2_animation_t* _animations;
- unsigned int _num_state_changes;
- tr2_state_change_t* _state_changes;
- unsigned int _num_anim_dispatches;
- tr2_anim_dispatch_t* _anim_dispatches;
- unsigned int _num_anim_commands;
- tr2_anim_command_t* _anim_commands;
- unsigned int _num_mesh_trees;
- tr2_meshtree_t* _mesh_trees;
- unsigned int _num_frames;
- unsigned short* _frames;
- unsigned int _num_moveables;
- tr2_moveable_t* _moveables;
-
- uint32_t numMoveablesTR5;
- tr5_moveable_t* moveablesTR5;
-
- uint32_t numAnimationsTR5;
- tr5_animation_t* animationsTR5;
-
- uint32_t numObjectTexturesTR5;
- tr5_object_texture_t* objectTexturesTR5;
-
- uint32_t numCinematicFramesTR5;
- tr5_cinematic_frame_t* cinematicFramesTR5;
-
- uint32_t numFlyByCamerasTR5;
- tr5_flyby_camera_t* flyByCamerasTR5;
-
- unsigned int _num_static_meshes;
- tr2_staticmesh_t* _static_meshes;
- unsigned int _num_object_textures;
- tr2_object_texture_t* _object_textures;
-
- unsigned int _num_sprite_textures;
- tr2_sprite_texture_t* _sprite_textures;
- unsigned int _num_sprite_sequences;
- tr2_sprite_sequence_t* _sprite_sequences;
- int _num_cameras;
- tr2_camera_t* _cameras;
- int _num_sound_sources;
- tr2_sound_source_t* _sound_sources;
- int _num_boxes;
- tr2_box_t* _boxes;
-
- int _num_overlaps;
- short* _overlaps;
-
- short* _zones;
- int _num_animated_textures;
- short* _animated_textures;
- int _num_items;
- tr2_item_t* _items;
- unsigned char* _light_map;
- unsigned int _num_cinematic_frames;
- tr2_cinematic_frame_t* _cinematic_frames;
- short _num_demo_data;
- unsigned char* _demo_data;
- float mRoomVertexLightingFactor;
- float mTexelScale;
-
-
- short* mSoundMap;
- int mNumSoundDetails;
- tr2_sound_details_t* mSoundDetails;
- int mNumSampleIndices;
- int* mSampleIndices;
- unsigned int* mSampleIndicesTR5;
- bool mRiffAlternateLoaded;
- unsigned int* mRiffAlternateOffsets;
-
-
- int mRiffDataSz;
- unsigned char* mRiffData;
- unsigned int mNumTR4Samples;
- unsigned char** mTR4Samples;
- unsigned int* mTR4SamplesSz;
-
-
- unsigned char*
- mCompressedLevelData;
- unsigned int mCompressedLevelDataOffset;
- unsigned int mCompressedLevelSize;
- tr_fread_mode_t mFreadMode;
- };
-
- #endif
|