1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770 |
-
-
-
- #ifndef __OPENRAIDER_MONGOOSE_TOMBRAIDER_H_
- #define __OPENRAIDER_MONGOOSE_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
- #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
|