12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261 |
-
-
-
- #ifndef _TOMBRAIDER_H_
- #define _TOMBRAIDER_H_
-
- #ifdef WIN32
-
- #define __attribute__(packed)
-
-
- #define TR2_H 1
- #pragma pack(push, tr2_h, 1)
- #endif
-
-
-
- typedef enum {
- TR_VERSION_UNKNOWN,
- TR_VERSION_1,
- TR_VERSION_2,
- TR_VERSION_3,
- TR_VERSION_4,
- TR_VERSION_5
- } tr2_version_type;
-
-
- typedef enum {
- TR_FREAD_NORMAL = 0,
- TR_FREAD_COMPRESSED
- } tr_fread_mode_t;
-
-
- typedef enum {
- tombraiderLight_typeDirectional = 1,
- tombraiderLight_typeSpot = 2,
- tombraiderLight_typePoint = 3
- } tombraiderLightType;
-
- typedef enum {
- tombraiderLight_useCutoff = 1,
- tombraiderLight_useAttenuation = 2
- } tombraiderLightFlags;
-
- typedef enum {
- tombraiderRoom_underWater = 1
- } tombraiderRoomFlags;
-
- typedef enum {
- tombraiderSector_wall = 1
- } tombraiderSectorFlags;
-
- typedef enum {
- tombraiderFace_Alpha = 1,
- tombraiderFace_Colored = 2,
- tombraiderFace_PartialAlpha = 4
- } tombraiderFace_Flags;
-
-
- #define TR_SOUND_FOOTSTEP0 1
- #define TR_SOUND_F_PISTOL 12
-
- enum TR4_Objects {
- TR4_LARA = 0,
- TR4_PISTOLS_ANIM = 1,
- TR4_UZI_ANIM = 2,
- TR4_SHOTGUN_ANIM = 3,
- TR4_CROSSBOW_ANIM = 4,
- TR4_GRENADE_GUN_ANIM = 5,
- TR4_SIXSHOOTER_ANIM = 6,
- TR4_FLARE_ANIM = 7,
- TR4_LARA_SKIN = 8,
- TR4_LARA_SKIN_JOINTS = 9,
- TR4_LARA_SCREAM = 10,
- TR4_LARA_CROSSBOW_LASER = 11,
- TR4_LARA_REVOLVER_LASER = 12,
- TR4_LARA_HOLSTERS = 13,
- TR4_LARA_HOLSTERS_PISTOLS = 14,
- TR4_LARA_HOLSTERS_UZIS = 15,
- TR4_LARA_HOLSTERS_SIXSHOOTER = 16,
- TR4_LARA_SPEECH_HEAD1 = 17,
- TR4_LARA_SPEECH_HEAD2 = 18,
- TR4_LARA_SPEECH_HEAD3 = 19,
- TR4_LARA_SPEECH_HEAD4 = 20
- };
-
- #define TR_ANIAMTION_RUN 0
- #define TR_ANIAMTION_STAND 11
- #define TR_ANIAMTION_TURN_L 12
- #define TR_ANIAMTION_TURN_R 13
- #define TR_ANIAMTION_HIT_WALL_FRONT 53
- #define TR_ANIAMTION_SWIM_IDLE 87
- #define TR_ANIAMTION_SWIM 86
- #define TR_ANIAMTION_SWIM_L 143
- #define TR_ANIAMTION_SWIM_R 144
- #define TR_ANIAMTION_GRAB_LEDGE 96
- #define TR_ANIAMTION_PULLING_UP 97
-
-
- typedef struct {
- unsigned char r;
- unsigned char g;
- unsigned char b;
- } __attribute__ ((packed)) tr2_colour_t;
-
-
-
- typedef struct {
- short x;
- short y;
- short z;
- } __attribute__ ((packed)) tr2_vertex_t;
-
-
- typedef struct {
- unsigned short vertices[4];
- unsigned short texture;
- } __attribute__ ((packed)) tr2_quad_t;
-
- typedef struct {
- unsigned short vertices[4];
- unsigned short texture;
- unsigned short lighting;
-
-
- } __attribute__ ((packed)) tr4_quad_t;
-
-
- typedef struct tr2_tri_s
- {
- unsigned short vertices[3];
- unsigned short texture;
- } __attribute__ ((packed)) tr2_tri_t;
-
- typedef struct tr4_tri_s
- {
- unsigned short vertices[3];
- unsigned short texture;
- unsigned short lighting;
-
- } __attribute__ ((packed)) tr4_tri_t;
-
-
- typedef struct tr2_textile8_s
- {
- unsigned char tile[256 * 256];
- } __attribute__ ((packed)) tr2_textile8_t;
-
-
-
- typedef struct tr2_textile16_s
- {
- unsigned short tile[256 * 256];
- } __attribute__ ((packed)) tr2_textile16_t;
-
-
-
- typedef struct tr2_textile32_s
- {
- unsigned int tile[256 * 256];
- } __attribute__ ((packed)) tr2_textile32_t;
-
-
-
- typedef struct tr2_room_info_s
- {
- int x;
- int z;
- int y_bottom;
-
- int y_top;
-
- } __attribute__ ((packed)) tr2_room_info_t;
-
-
-
- typedef struct tr2_room_portal_s
- {
- unsigned short adjoining_room;
- tr2_vertex_t normal;
- tr2_vertex_t vertices[4];
- } __attribute__ ((packed)) tr2_room_portal_t;
-
-
-
- typedef struct tr2_room_sector_s
- {
- unsigned short fd_index;
- unsigned short box_index;
- unsigned char room_below;
-
- char floor;
-
- unsigned char room_above;
-
- char ceiling;
-
- } __attribute__ ((packed)) tr2_room_sector_t;
-
-
-
- typedef struct tr2_room_light_s
- {
- int x;
- int y;
- int z;
- unsigned short intensity1;
- unsigned short intensity2;
- unsigned int fade1;
- unsigned int fade2;
- } __attribute__ ((packed)) tr2_room_light_t;
-
- typedef struct tr4_room_light_s
- {
- int xPosition;
- int yPosition;
- int zPosition;
- tr2_colour_t color;
- unsigned char lightType;
- unsigned char unknown;
- unsigned char intensity;
- float in;
- float out;
- float length;
- float cutoff;
- float xDir, yDir, zDir;
-
- } __attribute__ ((packed)) tr4_room_light_t;
-
-
-
- typedef struct tr2_vertex_room_s
- {
- tr2_vertex_t vertex;
-
- short lighting1;
-
-
-
-
- unsigned short attributes;
-
-
-
-
-
-
-
- short lighting2;
- } __attribute__ ((packed)) tr2_vertex_room_t;
-
-
-
- typedef struct tr2_room_sprite_s
- {
- short vertex;
- short texture;
- } __attribute__ ((packed)) tr2_room_sprite_t;
-
-
-
- typedef struct tr2_room_data_s
- {
- short num_vertices;
- tr2_vertex_room_t *vertices;
- short num_rectangles;
- tr2_quad_t *rectangles;
- short num_triangles;
- tr2_tri_t *triangles;
- short num_sprites;
- tr2_room_sprite_t *sprites;
- } __attribute__ ((packed)) tr2_room_data_t;
-
-
-
- typedef struct tr2_room_staticmesh_s
- {
- int x;
- int y;
- int z;
- unsigned short rotation;
-
- unsigned short intensity1;
- unsigned short intensity2;
- unsigned short object_id;
- } __attribute__ ((packed)) tr2_room_staticmesh_t;
-
-
-
- typedef struct tr2_room_s
- {
- tr2_room_info_t info;
- unsigned int num_data_words;
- unsigned char *data;
-
- tr2_room_data_t room_data;
- unsigned short num_portals;
-
- tr2_room_portal_t *portals;
- unsigned short num_zsectors;
- unsigned short num_xsectors;
- tr2_room_sector_t *sector_list;
- short intensity1;
- short intensity2;
- short light_mode;
- unsigned short num_lights;
- tr2_room_light_t *lights;
- unsigned short num_static_meshes;
- tr2_room_staticmesh_t *static_meshes;
- short alternate_room;
- short flags;
-
-
-
- tr2_colour_t room_light_colour;
- tr4_room_light_t *tr4Lights;
-
- } __attribute__ ((packed)) tr2_room_t;
-
-
- typedef struct tr2_animation_s
- {
- unsigned int frame_offset;
-
- unsigned char frame_rate;
- unsigned char frame_size;
-
- short state_id;
- short unknown1;
- short unknown2;
- short unknown3;
- short unknown4;
-
- unsigned short frame_start;
- unsigned short frame_end;
-
- unsigned short next_animation;
- unsigned short next_frame;
- unsigned short num_state_changes;
-
- unsigned short state_change_offset;
- unsigned short num_anim_commands;
- unsigned short anim_command;
- } __attribute__ ((packed)) tr2_animation_t;
-
-
- typedef struct tr4_animation_s
- {
- unsigned int frame_offset;
- unsigned char frame_rate;
- unsigned char frame_size;
- unsigned short state_id;
- short unknown;
- short speed;
- unsigned short accel_lo;
- short accel_hi;
- unsigned char unknown2[8];
-
- unsigned short frame_start;
- unsigned short frame_end;
- unsigned short next_animation;
- unsigned short next_frame;
-
- unsigned short num_state_changes;
- unsigned short state_change_offset;
- unsigned short num_anim_commands;
- unsigned short anim_command;
- } __attribute__ ((packed)) tr4_animation_t;
-
-
- typedef struct tr2_state_change_s
- {
- unsigned short state_id;
- unsigned short num_anim_dispatches;
-
- unsigned short anim_dispatch;
- } __attribute__ ((packed)) tr2_state_change_t;
-
-
-
- typedef struct tr2_anim_dispatch_s
- {
- short low;
- short high;
- short next_animation;
- short next_frame;
- } __attribute__ ((packed)) tr2_anim_dispatch_t;
-
-
-
- typedef struct tr2_anim_command_s
- {
- short value;
- } __attribute__ ((packed)) tr2_anim_command_t;
-
-
-
- typedef struct tr2_meshtree_s
- {
- int flags;
- int x;
- int y;
- int z;
- } __attribute__ ((packed)) tr2_meshtree_t;
-
-
-
- typedef struct tr2_moveable_s
- {
- unsigned int object_id;
- unsigned short num_meshes;
- unsigned short starting_mesh;
- unsigned int mesh_tree;
- unsigned int frame_offset;
-
- unsigned short animation;
- } __attribute__ ((packed)) tr2_moveable_t;
-
-
-
- typedef struct tr2_staticmesh_s
- {
- unsigned int object_id;
- unsigned short starting_mesh;
- tr2_vertex_t bounding_box[2][2];
- unsigned short flags;
- } __attribute__ ((packed)) tr2_staticmesh_t;
-
-
-
- typedef struct tr2_object_texture_vert_s
- {
- unsigned char xcoordinate;
- unsigned char xpixel;
- unsigned char ycoordinate;
- unsigned char ypixel;
- } __attribute__ ((packed)) tr2_object_texture_vert_t;
-
-
-
- typedef struct tr2_object_texture_s
- {
- unsigned short transparency_flags;
-
-
-
-
- unsigned short tile;
- tr2_object_texture_vert_t vertices[4];
- } __attribute__ ((packed)) tr2_object_texture_t;
-
-
-
- typedef struct tr2_sprite_texture_s
- {
- unsigned short tile;
- unsigned char x;
- unsigned char y;
- unsigned short width;
- unsigned short height;
- short left_side;
- short top_side;
- short right_side;
- short bottom_side;
- } __attribute__ ((packed)) tr2_sprite_texture_t;
-
-
-
- typedef struct tr2_sprite_sequence_s
- {
- int object_id;
- short negative_length;
- short offset;
- } __attribute__ ((packed)) tr2_sprite_sequence_t;
-
-
-
- typedef struct tr2_mesh_s
- {
- tr2_vertex_t centre;
-
-
-
- int collision_size;
- short num_vertices;
- tr2_vertex_t *vertices;
- short num_normals;
-
- tr2_vertex_t *normals;
- short *mesh_lights;
-
- short num_textured_rectangles;
- tr2_quad_t *textured_rectangles;
-
- short num_textured_triangles;
- tr2_tri_t *textured_triangles;
-
- short num_coloured_rectangles;
- tr2_quad_t *coloured_rectangles;
-
- short num_coloured_triangles;
- tr2_tri_t *coloured_triangles;
- } __attribute__ ((packed)) tr2_mesh_t;
-
-
-
- typedef struct tr2_frame_s
- {
- tr2_vertex_t vector[3];
- int num_words;
- unsigned short *words;
- } __attribute__ ((packed)) tr2_frame_t;
-
-
-
- typedef struct tr2_item_s
- {
- short object_id;
- short room;
- int x;
- int y;
- int z;
- short angle;
- short intensity1;
- short intensity2;
- short flags;
- } __attribute__ ((packed)) tr2_item_t;
-
-
-
- typedef struct tr2_sound_source_s
- {
- int x;
- int y;
- int z;
- unsigned short sound_id;
- unsigned short flags;
- } __attribute__ ((packed)) tr2_sound_source_t;
-
-
-
- typedef struct tr2_boxes_s
- {
- unsigned char zmin;
- unsigned char zmax;
- unsigned char xmin;
- unsigned char xmax;
- short true_floor;
- short overlap_index;
- } __attribute__ ((packed)) tr2_box_t;
-
-
-
- typedef struct tr2_animated_texture_s
- {
- short num_texture_ids;
- short *texture_list;
- } __attribute__ ((packed)) tr2_animated_texture_t;
-
-
-
- typedef struct tr2_camera_s
- {
- int x;
- int y;
- int z;
- short room;
- unsigned short unknown1;
- } __attribute__ ((packed)) tr2_camera_t;
-
-
- typedef struct tr4_extra_camera_s
- {
- int pos[6];
- unsigned char index[2];
- unsigned short unknown[5];
- int id ;
- } __attribute__ ((packed)) tr4_extra_camera_t;
-
-
-
- typedef struct tr2_sound_details_s
- {
- short sample;
- short volume;
- short sound_range;
- short flags;
-
- } __attribute__ ((packed)) tr2_sound_details_t;
-
-
-
- typedef struct tr2_cinematic_frame_s
- {
- short roty;
- short rotz;
- short rotz2;
-
- short posz;
- short posy;
- short posx;
- short unknown1;
- short rotx;
- } __attribute__ ((packed)) tr2_cinematic_frame_t;
-
-
-
- typedef struct tr4_ai_object_s
- {
- unsigned short int object_id;
-
- unsigned short int room;
- int x, y, a;
- unsigned short int ocb;
- unsigned short int flags;
-
- int angle;
- } __attribute__ ((packed)) tr4_ai_object_t;
-
-
-
- typedef struct tr4_object_texture_s
- {
- unsigned short attribute;
- unsigned short tile;
- unsigned short flags;
- tr2_object_texture_vert_t vertices[4];
- unsigned int unknown1, unknown2;
- unsigned int xsize,ysize;
-
- } __attribute__ ((packed)) tr4_object_texture_t;
-
-
- typedef struct tr5_room_layer_s
- {
- u_int32_t numLayerVertices;
-
- u_int16_t unknownL1;
-
- u_int16_t numLayerRectangles;
-
- u_int16_t numLayerTriangles;
-
- u_int16_t unknownL2;
-
- u_int16_t filler;
-
- u_int16_t filler2;
-
-
-
- float layerBoundingBoxX1;
- float layerBoundingBoxY1;
- float layerBoundingBoxZ1;
- float layerBoundingBoxX2;
- float layerBoundingBoxY2;
- float layerBoundingBoxZ2;
-
- u_int32_t filler3;
-
- u_int32_t unknownL6;
-
- u_int32_t unknownL7;
-
- u_int32_t unknownL8;
-
- } tr5_room_layer_t;
-
-
- typedef struct tr5_face4_s
- {
- u_int16_t vertices[4];
-
- u_int16_t texture;
-
- u_int16_t unknownF4;
-
- } tr5_face4_t;
-
-
- typedef struct tr5_face3_s
- {
- u_int16_t vertices[3];
-
- u_int16_t texture;
-
- u_int16_t unknownF3;
-
- } tr5_face3_t;
-
- typedef struct tr5_vertex_s
- {
- float x;
- float y;
- float z;
-
- float nx;
- float ny;
- float nz;
-
- u_int32_t vColor;
-
- } tr5_vertex_t;
-
- typedef struct tr5_room_geometry_s
- {
-
- tr5_face4_t *quads;
- tr5_face3_t *tris;
- tr5_vertex_t *verts;
-
- } tr5_room_geometry_t;
-
-
- typedef struct tr5_light_s
- {
-
-
-
- float x;
- float y;
- float z;
-
-
- float red;
- float green;
- float blue;
-
- u_int32_t seperator;
-
-
-
-
- float input;
- float output;
-
-
- float radInput;
- float radOutput;
-
-
- float range;
-
-
-
-
- float directionVectorX;
- float directionVectorY;
- float directionVectorZ;
-
-
-
- int32_t x2;
- int32_t y2;
- int32_t z2;
-
-
- int32_t directionVectorX2;
- int32_t directionVectorY2;
- int32_t directionVectorZ2;
-
-
- u_int8_t lightType;
-
- u_int8_t seperator2[3];
-
- } tr5_light_t;
-
-
- typedef struct tr5_room_s
- {
- u_int32_t checkXELA;
-
- u_int32_t roomDataSize;
-
-
- u_int32_t seperator;
-
- u_int32_t endSDOffset;
-
-
- u_int32_t startSDOffset;
-
-
- u_int32_t seperator2;
-
- u_int32_t endPortalOffset;
-
-
- int32_t x;
-
- int32_t seperator3;
-
- int32_t z;
-
- int32_t yBottom;
-
- int32_t yTop;
-
- u_int16_t numZSectors;
-
- u_int16_t numXSectors;
-
- u_int32_t roomAmbientColor;
-
- u_int16_t numRoomLights;
-
- u_int16_t numStaticMeshes;
-
- u_int16_t unknownR1;
-
- u_int16_t unknownR2;
-
- u_int32_t filler;
-
- u_int32_t filler2;
-
- u_int32_t seperator4;
-
- u_int32_t seperator5;
-
- unsigned char seperator6[6];
-
- u_int16_t roomFlag;
-
- u_int16_t unknownR5;
-
- unsigned char seperator7[10];
-
- u_int32_t seperator8;
-
- u_int32_t unknownR6;
-
- float roomX;
-
- u_int32_t seperator9;
-
- float roomZ;
-
- u_int32_t seperator10;
-
- u_int32_t seperator11;
-
- u_int32_t seperator12;
-
- u_int32_t seperator13;
-
- u_int32_t seperator14;
-
- u_int32_t seperator15;
-
- u_int32_t numRoomTriangles;
-
- u_int32_t numRoomRectangles;
-
- u_int32_t seperator16;
-
- u_int32_t lightSize;
-
- u_int32_t numTotalRoomLights;
-
- u_int32_t unknownR7;
-
- int32_t unknownR8;
-
- int32_t lyBottom;
-
- u_int32_t numLayers;
-
- u_int32_t layerOffset;
-
- u_int32_t verticesOffset;
-
- u_int32_t polyOffset;
-
- u_int32_t polyOffset2;
-
- u_int32_t verticesSize;
-
- u_int32_t seperator17;
-
- u_int32_t seperator18;
-
- u_int32_t seperator19;
-
- u_int32_t seperator20;
-
- tr5_light_t *lights;
-
- tr2_room_sector_t *sectors;
-
- u_int16_t numDoors;
-
- tr2_room_portal_t *doors;
-
- u_int16_t seperator21;
-
- tr2_room_staticmesh_t *meshes;
-
- tr5_room_layer_t *layers;
-
- tr5_room_geometry_t *faces;
-
-
-
- tr5_vertex_t *vertices;
-
-
-
- } tr5_room_t;
-
- typedef struct tr5_object_texture_vertex_s
- {
- u_int8_t xCoordinate;
-
- u_int8_t xPixel;
-
- u_int8_t yCoordinate;
-
- u_int8_t yPixel;
-
- } tr5_object_texture_vertex_t;
-
- typedef struct tr5_object_texture_s
- {
- u_int16_t attribute;
-
- u_int32_t tile;
-
- tr5_object_texture_vertex_t vertices[4];
-
- u_int32_t uv1;
-
- u_int32_t uv2;
-
- u_int32_t xSize;
-
- u_int32_t ySize;
-
- u_int16_t seperator;
-
- } tr5_object_texture_t;
-
- typedef struct tr5_flyby_camera_s
- {
- int32_t cameraX;
- int32_t cameraY;
- int32_t cameraZ;
-
- int32_t targetX;
- int32_t targetY;
- int32_t targetZ;
-
- int8_t sequence;
-
- int8_t cameraNumber;
-
- u_int16_t fov;
-
- u_int16_t roll;
-
- u_int16_t timer;
-
- u_int16_t speed;
-
- u_int16_t flags;
-
- u_int32_t room;
-
- } tr5_flyby_camera_t;
-
- typedef struct tr5_moveable_s
- {
- u_int32_t objectId;
-
- u_int16_t numMeshes;
-
- u_int16_t startingMesh;
-
- u_int32_t meshTree;
-
- u_int32_t frameOffset;
-
- u_int16_t animation;
-
- u_int16_t filler;
-
- } tr5_moveable_t;
-
-
- typedef struct tr5_mesh_s
- {
- tr2_vertex_t center;
- u_int8_t unknown1[4];
- int16_t numVertices;
- tr2_vertex_t *vertices;
- int16_t numNormals;
- tr2_vertex_t *normals;
- int16_t numTexturedRectangles;
- tr5_face4_t *texturedRectangles;
- int16_t numTexturedTriangles;
- tr5_face3_t *texturedTriangles;
-
- } tr5_mesh_t;
-
-
- typedef struct tr5_animation_s
- {
- u_int32_t FrameOffset;
-
- u_int8_t FrameRate;
-
- u_int8_t FrameSize;
-
- u_int16_t StateId;
-
- int16_t Unknown;
-
- int16_t Speed;
-
- u_int16_t AccelLo;
-
- int16_t AccelHi;
-
- u_int8_t AUnknown[8];
-
- u_int16_t FrameStart;
-
- u_int16_t FrameEnd;
-
- u_int16_t NextAnimation;
-
- u_int16_t NextFrame;
-
- u_int16_t NumStateChanges;
-
- u_int16_t StateChangeOffset;
-
- u_int16_t NumAnimCommands;
-
- u_int16_t AnimCommand;
-
- } tr5_animation_t;
-
- typedef struct {
- unsigned int unknown[24];
- } tr5_cinematic_frame_t;
-
- #ifdef WIN32
- #pragma pack(pop, tr2_h, 1)
- #endif
-
- class TombRaider {
- public:
-
-
-
- TombRaider();
-
-
-
- ~TombRaider();
-
-
-
-
-
- int NumRooms();
-
- int NumMoveables();
-
- int NumTextures();
-
-
-
- int NumSpecialTextures();
-
- int NumAnimations();
-
- unsigned int NumFrames();
-
- int NumStaticMeshes();
-
- int NumSprites();
-
- int NumSpriteSequences();
-
- int NumItems();
-
- tr2_version_type Engine();
-
- unsigned short *Frame();
-
- tr2_animation_t *Animation();
-
- tr2_item_t *Item();
-
- tr2_object_texture_t *ObjectTextures();
-
-
-
- unsigned int getNumBoxes();
-
- 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();
-
- unsigned char *SpecialTexTile(int texture);
-
-
-
- void Texture(int texture, unsigned char **image, unsigned char **bumpmap);
-
-
-
- unsigned int *Palette16();
-
- unsigned char *Palette8();
-
- tr2_room_t *Room();
-
- int checkMime(char *filename);
-
-
-
- int Load(char *filename, void (*percent)(int));
-
-
-
-
-
-
-
-
-
- float adjustTexel(unsigned char texel, char offset);
-
-
-
- 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);
-
-
-
-
-
- int getBumpMapCount();
-
- 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 getSprites();
-
- void getSoundSample(unsigned int index,
- unsigned int *bytes, unsigned char **data);
-
-
-
-
-
- unsigned int getSoundSamplesCount();
-
- bool isMeshValid(int index);
-
-
-
-
-
- bool isRoomValid(int index);
-
-
-
- int loadSFX(char *filename);
-
- void reset();
-
- void setDebug(bool toggle);
-
-
-
- void setRoomVertexLightingFactor(float f);
-
-
-
- void setTexelScalingFactor(float f);
-
- 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, void (*percent)(int));
-
-
-
- void print(const char *methodName, const char *s, ...) __attribute__((format(printf, 3, 4)));
-
- void printDebug(const char *methodName, const char *s, ...) __attribute__((format(printf, 3, 4)));
-
-
-
-
-
-
-
- bool mReset;
- 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;
-
- u_int32_t numMoveablesTR5;
- tr5_moveable_t *moveablesTR5;
-
- u_int32_t numAnimationsTR5;
- tr5_animation_t *animationsTR5;
-
- u_int32_t numObjectTexturesTR5;
- tr5_object_texture_t *objectTexturesTR5;
-
- u_int32_t numCinematicFramesTR5;
- tr5_cinematic_frame_t *cinematicFramesTR5;
-
- u_int32_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
|