123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769 |
-
-
-
- #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 tr2_colour_s
- {
- unsigned char r;
- unsigned char g;
- unsigned char b;
- } __attribute__ ((packed)) tr2_colour_t;
-
-
-
- typedef struct tr2_vertex_s
- {
- short x;
- short y;
- short z;
- } __attribute__ ((packed)) tr2_vertex_t;
-
-
-
- typedef struct tr2_quad_s
- {
- unsigned short vertices[4];
- unsigned short texture;
- } __attribute__ ((packed)) tr2_quad_t;
-
- typedef struct tr4_quad_s
- {
- 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 tr5_cinematic_frame_s
- {
- 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, ...);
-
-
-
- void printDebug(const char *methodName, const char *s, ...);
-
-
-
-
-
-
-
-
-
- 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
|