1 #ifndef _L_MAIN_H_
2 #define _L_MAIN_H_
3 
4 #include <SDL2/SDL_rwops.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include "tr_types.h"
9 #include "tr_versions.h"
10 
11 
12 // Audio map size is a size of effect ID array, which is used to translate
13 // global effect IDs to level effect IDs. If effect ID in audio map is -1
14 // (0xFFFF), it means that this effect is absent in current level.
15 // Normally, audio map size is a constant for each TR game version and
16 // won't change from level to level.
17 
18 #define TR_AUDIO_MAP_SIZE_NONE (-1)
19 #define TR_AUDIO_MAP_SIZE_TR1  256
20 #define TR_AUDIO_MAP_SIZE_TR2  370
21 #define TR_AUDIO_MAP_SIZE_TR3  370
22 #define TR_AUDIO_MAP_SIZE_TR4  370
23 #define TR_AUDIO_MAP_SIZE_TR5  450
24 
25 // Default range and pitch values are required for compatibility with
26 // TR1 and TR2 levels, as there is no such parameters in SoundDetails
27 // structures.
28 
29 #define TR_AUDIO_DEFAULT_RANGE 8
30 #define TR_AUDIO_DEFAULT_PITCH 1.0       // 0.0 - only noise
31 
32 /** \brief A complete TR level.
33   *
34   * This contains all necessary functions to load a TR level.
35   * Some corrections to the data are done, like converting to OpenGLs coordinate system.
36   * All indexes are converted, so they can be used directly.
37   * Endian conversion is done at the lowest possible layer, most of the time this is in the read_bitxxx functions.
38   */
39 class TR_Level
40 {
41       public:
TR_Level()42         TR_Level()
43         {
44             this->game_version = TR_UNKNOWN;
45             strncpy(this->sfx_path, "MAIN.SFX", 256);
46 
47             this->textile8_count = 0;
48             this->textile16_count = 0;
49             this->textile32_count = 0;
50             this->textile8 = NULL;
51             this->textile16 = NULL;
52             this->textile32 = NULL;
53 
54             this->floor_data_size = 0;          // destroyed
55             this->floor_data = NULL;            // destroyed
56             this->mesh_indices_count = 0;       // destroyed
57             this->mesh_indices = NULL;          // destroyed
58 
59             this->animations_count = 0;         // destroyed
60             this->animations = NULL;            // destroyed
61             this->state_changes_count = 0;      // destroyed
62             this->state_changes = NULL;         // destroyed
63             this->anim_dispatches_count = 0;    // destroyed
64             this->anim_dispatches = NULL;       // destroyed
65             this->anim_commands_count = 0;      // destroyed
66             this->anim_commands = NULL;         // destroyed
67 
68             this->moveables_count = 0;          // destroyed
69             this->moveables = NULL;             // destroyed
70             this->static_meshes_count = 0;      // destroyed
71             this->static_meshes = NULL;         // destroyed
72             this->object_textures_count = 0;    // destroyed
73             this->object_textures = NULL;       // destroyed
74             this->animated_textures_count = 0;  // destroyed
75             this->animated_textures_uv_count = 0; // destroyed
76             this->animated_textures = NULL;     // destroyed
77             this->sprite_textures_count = 0;    // destroyed
78             this->sprite_textures = NULL;       // destroyed
79             this->sprite_sequences_count = 0;   // destroyed
80             this->sprite_sequences = NULL;      // destroyed
81             this->cameras_count = 0;            // destroyed
82             this->cameras = NULL;               // destroyed
83             this->flyby_cameras_count = 0;      // destroyed
84             this->flyby_cameras = NULL;         // destroyed
85             this->sound_sources_count = 0;      // destroyed
86             this->sound_sources = NULL;         // destroyed
87 
88             this->boxes_count = 0;              // destroyed
89             this->boxes = NULL;                 // destroyed
90             this->overlaps_count = 0;           // destroyed
91             this->overlaps = NULL;              // destroyed
92             this->zones = NULL;                 // destroyed
93             this->items_count = 0;              // destroyed
94             this->items = NULL;                 // destroyed
95             this->ai_objects_count = 0;         // destroyed
96             this->ai_objects = NULL;            // destroyed
97             this->cinematic_frames_count = 0;   // destroyed
98             this->cinematic_frames = NULL;      // destroyed
99 
100             this->demo_data_count = 0;          // destroyed
101             this->demo_data = NULL;             // destroyed
102             this->soundmap = NULL;              // destroyed
103             this->sound_details_count = 0;      // destroyed
104             this->sound_details = NULL;         // destroyed
105             this->sample_indices_count = 0;     // destroyed
106             this->sample_indices = NULL;        // destroyed
107             this->samples_data_size = 0;
108             this->samples_count = 0;            // destroyed
109             this->samples_data = NULL;          // destroyed
110 
111             this->frame_data_size = 0;          // destroyed
112             this->frame_data = NULL;            // destroyed
113             this->mesh_tree_data_size = 0;      // destroyed
114             this->mesh_tree_data = NULL;        // destroyed
115 
116             this->meshes_count = 0;             // destroyed
117             this->meshes = NULL;                // destroyed
118             this->rooms_count = 0;              // destroyed
119             this->rooms = NULL;                 // destroyed
120         }
121 
~TR_Level()122         virtual ~TR_Level()
123         {
124             uint32_t i;
125 
126             /**destroy all textiles**/
127             if(this->textile8_count)
128             {
129                 this->textile8_count = 0;
130                 free(this->textile8);
131                 this->textile8 = NULL;
132             }
133 
134             if(this->textile16_count)
135             {
136                 this->textile16_count = 0;
137                 free(this->textile16);
138                 this->textile16 = NULL;
139             }
140 
141             if(this->textile32_count)
142             {
143                 this->textile32_count = 0;
144                 free(this->textile32);
145                 this->textile32 = NULL;
146             }
147 
148             /**destroy other data**/
149             if(this->floor_data_size)
150             {
151                 this->floor_data_size = 0;
152                 free(this->floor_data);
153                 this->floor_data = NULL;
154             }
155 
156             if(this->mesh_indices_count)
157             {
158                 this->mesh_indices_count = 0;
159                 free(this->mesh_indices);
160                 this->mesh_indices = NULL;
161             }
162 
163             if(this->animations_count)
164             {
165                 this->animations_count = 0;
166                 free(this->animations);
167                 this->animations = NULL;
168             }
169 
170             if(this->state_changes_count)
171             {
172                 this->state_changes_count = 0;
173                 free(this->state_changes);
174                 this->state_changes = NULL;
175             }
176 
177             if(this->anim_dispatches_count)
178             {
179                 this->anim_dispatches_count = 0;
180                 free(this->anim_dispatches);
181                 this->anim_dispatches = NULL;
182             }
183 
184             if(this->anim_commands_count)
185             {
186                 this->anim_commands_count = 0;
187                 free(this->anim_commands);
188                 this->anim_commands = NULL;
189             }
190 
191             if(this->moveables_count)
192             {
193                 this->moveables_count = 0;
194                 free(this->moveables);
195                 this->moveables = NULL;
196             }
197 
198             if(this->static_meshes_count)
199             {
200                 this->static_meshes_count = 0;
201                 free(this->static_meshes);
202                 this->static_meshes = NULL;
203             }
204 
205             if(this->object_textures_count)
206             {
207                 this->object_textures_count = 0;
208                 free(this->object_textures);
209                 this->object_textures = NULL;
210             }
211 
212             if(this->animated_textures_count)
213             {
214                 this->animated_textures_count = 0;
215                 free(this->animated_textures);
216                 this->animated_textures = NULL;
217             }
218 
219             if(this->sprite_textures_count)
220             {
221                 this->sprite_textures_count = 0;
222                 free(this->sprite_textures);
223                 this->sprite_textures = NULL;
224             }
225 
226             if(this->sprite_sequences_count)
227             {
228                 this->sprite_sequences_count = 0;
229                 free(this->sprite_sequences);
230                 this->sprite_sequences = NULL;
231             }
232 
233             if(this->cameras_count)
234             {
235                 this->cameras_count = 0;
236                 free(this->cameras);
237                 this->cameras = NULL;
238             }
239 
240             if(this->flyby_cameras_count)
241             {
242                 this->flyby_cameras_count = 0;
243                 free(this->flyby_cameras);
244                 this->flyby_cameras = NULL;
245             }
246 
247             if(this->sound_sources_count)
248             {
249                 this->sound_sources_count = 0;
250                 free(this->sound_sources);
251                 this->sound_sources = NULL;
252             }
253 
254             if(this->boxes_count)
255             {
256                 this->boxes_count = 0;
257                 free(this->boxes);
258                 this->boxes = NULL;
259                 free(this->zones);
260                 this->zones = NULL;
261             }
262 
263             if(this->overlaps_count)
264             {
265                 this->overlaps_count = 0;
266                 free(this->overlaps);
267                 this->overlaps = NULL;
268             }
269 
270             if(this->items_count)
271             {
272                 this->items_count = 0;
273                 free(this->items);
274                 this->items = NULL;
275             }
276 
277             if(this->ai_objects_count)
278             {
279                 this->ai_objects_count = 0;
280                 free(this->ai_objects);
281                 this->ai_objects = NULL;
282             }
283 
284             if(this->cinematic_frames_count)
285             {
286                 this->cinematic_frames_count = 0;
287                 free(this->cinematic_frames);
288                 this->cinematic_frames = NULL;
289             }
290 
291             if(this->demo_data_count)
292             {
293                 this->demo_data_count = 0;
294                 free(this->demo_data);
295                 this->demo_data = NULL;
296             }
297 
298             if(this->soundmap)
299             {
300                 free(this->soundmap);
301                 this->soundmap = NULL;
302             }
303 
304             if(this->sound_details_count)
305             {
306                 this->sound_details_count = 0;
307                 free(this->sound_details);
308                 this->sound_details = NULL;
309             }
310 
311             if(this->samples_data)
312             {
313                 this->samples_data_size = 0;
314                 this->samples_count = 0;
315                 free(this->samples_data);
316                 this->samples_data = NULL;
317             }
318 
319             if(this->sample_indices_count)
320             {
321                 this->sample_indices_count = 0;
322                 free(this->sample_indices);
323                 this->sample_indices = NULL;
324             }
325 
326             if(this->frame_data_size)
327             {
328                 this->frame_data_size = 0;
329                 free(this->frame_data);
330                 this->frame_data = NULL;
331             }
332 
333             if(this->mesh_tree_data_size)
334             {
335                 this->mesh_tree_data_size = 0;
336                 free(this->mesh_tree_data);
337                 this->mesh_tree_data = NULL;
338             }
339 
340 
341             if(this->meshes_count)
342             {
343                 for(i = 0; i < this->meshes_count; i ++)
344                 {
345                     if(this->meshes[i].lights)
346                     {
347                         free(this->meshes[i].lights);
348                         this->meshes[i].lights = NULL;
349                     }
350 
351                     if(this->meshes[i].num_textured_triangles)
352                     {
353                         free(this->meshes[i].textured_triangles);
354                         this->meshes[i].textured_triangles = NULL;
355                         this->meshes[i].num_textured_triangles = 0;
356                     }
357 
358                     if(this->meshes[i].num_textured_rectangles)
359                     {
360                         free(this->meshes[i].textured_rectangles);
361                         this->meshes[i].textured_rectangles = NULL;
362                         this->meshes[i].num_textured_rectangles = 0;
363                     }
364 
365                     if(this->meshes[i].num_coloured_triangles)
366                     {
367                         free(this->meshes[i].coloured_triangles);
368                         this->meshes[i].coloured_triangles = NULL;
369                         this->meshes[i].num_coloured_triangles = 0;
370                     }
371 
372                     if(this->meshes[i].num_coloured_rectangles)
373                     {
374                         free(this->meshes[i].coloured_rectangles);
375                         this->meshes[i].coloured_rectangles = NULL;
376                         this->meshes[i].num_coloured_rectangles = 0;
377                     }
378 
379                     if(this->meshes[i].normals)
380                     {
381                         free(this->meshes[i].normals);
382                         this->meshes[i].normals = NULL;
383                     }
384 
385                     if(this->meshes[i].vertices)
386                     {
387                         free(this->meshes[i].vertices);
388                         this->meshes[i].vertices = NULL;
389                     }
390                 }
391                 this->meshes_count = 0;
392                 free(this->meshes);
393                 this->meshes = NULL;
394             }
395 
396             if(this->rooms_count)
397             {
398                 for(i = 0; i < this->rooms_count; i ++)
399                 {
400                     if(this->rooms[i].num_layers)
401                     {
402                         this->rooms[i].num_layers = 0;
403                         free(this->rooms[i].layers);
404                         this->rooms[i].layers = NULL;
405                     }
406 
407                     if(this->rooms[i].num_lights)
408                     {
409                         this->rooms[i].num_lights = 0;
410                         free(this->rooms[i].lights);
411                         this->rooms[i].lights = NULL;
412                     }
413 
414                     if(this->rooms[i].num_portals)
415                     {
416                         this->rooms[i].num_portals = 0;
417                         free(this->rooms[i].portals);
418                         this->rooms[i].portals = NULL;
419                     }
420 
421                     if(this->rooms[i].num_xsectors * this->rooms[i].num_zsectors)
422                     {
423                         this->rooms[i].num_xsectors = 0;
424                         this->rooms[i].num_zsectors = 0;
425                         free(this->rooms[i].sector_list);
426                         this->rooms[i].sector_list = NULL;
427                     }
428 
429                     if(this->rooms[i].num_sprites)
430                     {
431                         this->rooms[i].num_sprites = 0;
432                         free(this->rooms[i].sprites);
433                         this->rooms[i].sprites = NULL;
434                     }
435 
436                     if(this->rooms[i].num_static_meshes)
437                     {
438                         this->rooms[i].num_static_meshes = 0;
439                         free(this->rooms[i].static_meshes);
440                         this->rooms[i].static_meshes = NULL;
441                     }
442 
443                     if(this->rooms[i].num_triangles)
444                     {
445                         this->rooms[i].num_triangles = 0;
446                         free(this->rooms[i].triangles);
447                         this->rooms[i].triangles = NULL;
448                     }
449 
450                     if(this->rooms[i].num_rectangles)
451                     {
452                         this->rooms[i].num_rectangles = 0;
453                         free(this->rooms[i].rectangles);
454                         this->rooms[i].rectangles = NULL;
455                     }
456 
457                     if(this->rooms[i].num_vertices)
458                     {
459                         this->rooms[i].num_vertices = 0;
460                         free(this->rooms[i].vertices);
461                         this->rooms[i].vertices = NULL;
462                     }
463                 }
464                 this->rooms_count = 0;
465                 free(this->rooms);
466                 this->rooms = NULL;
467             }
468         }
469 
470     int32_t game_version;                   ///< \brief game engine version.
471 
472     uint32_t textile8_count;
473     uint32_t textile16_count;
474     uint32_t textile32_count;
475     tr_textile8_t *textile8;                ///< \brief 8-bit 256x256 textiles(TR1-3).
476     tr2_textile16_t *textile16;             ///< \brief 16-bit 256x256 textiles(TR2-5).
477     tr4_textile32_t *textile32;             ///< \brief 32-bit 256x256 textiles(TR4-5).
478     uint32_t rooms_count;
479     tr5_room_t *rooms;                      ///< \brief all rooms (normal and alternate).
480     uint32_t floor_data_size;               ///< \brief the floor data size
481     uint16_t *floor_data;                   ///< \brief the floor data.
482     uint32_t meshes_count;
483     tr4_mesh_t *meshes;                     ///< \brief all meshes (static and moveables).
484     uint32_t mesh_indices_count;
485     uint32_t *mesh_indices;                 ///< \brief mesh index table.
486     uint32_t animations_count;
487     tr_animation_t *animations;             ///< \brief animations for moveables.
488     uint32_t state_changes_count;
489     tr_state_change_t *state_changes;       ///< \brief state changes for moveables.
490     uint32_t anim_dispatches_count;
491     tr_anim_dispatch_t *anim_dispatches;    ///< \brief animation dispatches for moveables.
492     uint32_t anim_commands_count;
493     int16_t *anim_commands;                 ///< \brief animation commands for moveables.
494     uint32_t moveables_count;
495     tr_moveable_t *moveables;               ///< \brief data for the moveables.
496     uint32_t static_meshes_count;
497     tr_staticmesh_t *static_meshes;         ///< \brief data for the static meshes.
498     uint32_t object_textures_count;
499     tr4_object_texture_t *object_textures;  ///< \brief object texture definitions.
500     uint32_t animated_textures_count;
501     uint16_t *animated_textures;            ///< \brief animated textures.
502     uint32_t animated_textures_uv_count;
503     uint32_t sprite_textures_count;
504     tr_sprite_texture_t *sprite_textures;   ///< \brief sprite texture definitions.
505     uint32_t sprite_sequences_count;
506     tr_sprite_sequence_t *sprite_sequences; ///< \brief sprite sequences for animation.
507     uint32_t cameras_count;
508     tr_camera_t *cameras;                   ///< \brief cameras.
509     uint32_t flyby_cameras_count;
510     tr4_flyby_camera_t *flyby_cameras;      ///< \brief flyby cameras.
511     uint32_t sound_sources_count;
512     tr_sound_source_t *sound_sources;       ///< \brief sound sources.
513     uint32_t boxes_count;
514     tr_box_t *boxes;                        ///< \brief boxes.
515     tr2_zone_t *zones;                      ///< \brief zones.
516     uint32_t overlaps_count;
517     uint16_t *overlaps;                     ///< \brief overlaps.
518     uint32_t items_count;
519     tr2_item_t *items;                      ///< \brief items.
520     tr_lightmap_t lightmap;                 ///< \brief ligthmap (TR1-3).
521     tr2_palette_t palette;                  ///< \brief colour palette (TR1-3).
522     tr2_palette_t palette16;                ///< \brief colour palette (TR2-3).
523     uint32_t ai_objects_count;
524     tr4_ai_object_t *ai_objects;            ///< \brief ai objects (TR4-5).
525     uint32_t cinematic_frames_count;
526     tr_cinematic_frame_t *cinematic_frames; ///< \brief cinematic frames (TR1-3).
527     uint32_t demo_data_count;
528     uint8_t *demo_data;                     ///< \brief demo data.
529     int16_t *soundmap;                      ///< \brief soundmap (TR: 256 values TR2-4: 370 values TR5: 450 values).
530     uint32_t sound_details_count;
531     tr_sound_details_t *sound_details;      ///< \brief sound details.
532     uint32_t samples_count;
533     uint32_t samples_data_size;
534     uint8_t *samples_data;                  ///< \brief samples.
535     uint32_t sample_indices_count;
536     uint32_t *sample_indices;               ///< \brief sample indices.
537 
538     uint32_t frame_data_size;               ///< \brief frame data array size
539     uint16_t *frame_data;                   ///< \brief frame data array
540     uint32_t mesh_tree_data_size;
541     uint32_t *mesh_tree_data;
542 
543     char     sfx_path[256];
544 
545     void read_level(const char *filename, int32_t game_version);
546     void read_level(SDL_RWops * const src, int32_t game_version);
547     tr_mesh_thee_tag_t get_mesh_tree_tag_for_model(tr_moveable_t *model, int index);
548     void get_anim_frame_data(tr5_vertex_t min_max_pos[3], tr5_vertex_t *rotations, int meshes_count, tr_animation_t *anim, int frame);
549 
550     protected:
551     uint32_t num_textiles;          ///< \brief number of 256x256 textiles.
552     uint32_t num_room_textiles;     ///< \brief number of 256x256 room textiles (TR4-5).
553     uint32_t num_obj_textiles;      ///< \brief number of 256x256 object textiles (TR4-5).
554     uint32_t num_bump_textiles;     ///< \brief number of 256x256 bump textiles (TR4-5).
555     uint32_t num_misc_textiles;     ///< \brief number of 256x256 misc textiles (TR4-5).
556     bool read_32bit_textiles;       ///< \brief are other 32bit textiles than misc ones read?
557 
558     int8_t read_bit8(SDL_RWops * const src);
559     uint8_t read_bitu8(SDL_RWops * const src);
560     int16_t read_bit16(SDL_RWops * const src);
561     uint16_t read_bitu16(SDL_RWops * const src);
562     int32_t read_bit32(SDL_RWops * const src);
563     uint32_t read_bitu32(SDL_RWops * const src);
564     float read_float(SDL_RWops * const src);
565     float read_mixfloat(SDL_RWops * const src);
566 
567     void read_mesh_data(SDL_RWops * const src);
568     void read_frame_moveable_data(SDL_RWops * const src);
569 
570     void read_tr_colour(SDL_RWops * const src, tr2_colour_t & colour);
571     void read_tr_vertex16(SDL_RWops * const src, tr5_vertex_t & vertex);
572     void read_tr_vertex32(SDL_RWops * const src, tr5_vertex_t & vertex);
573     void read_tr_face3(SDL_RWops * const src, tr4_face3_t & face);
574     void read_tr_face4(SDL_RWops * const src, tr4_face4_t & face);
575     void read_tr_textile8(SDL_RWops * const src, tr_textile8_t & textile);
576     void read_tr_lightmap(SDL_RWops * const src, tr_lightmap_t & lightmap);
577     void read_tr_palette(SDL_RWops * const src, tr2_palette_t & palette);
578     void read_tr_box(SDL_RWops * const src, tr_box_t & box);
579     void read_tr_zone(SDL_RWops * const src, tr2_zone_t & zone);
580     void read_tr_room_sprite(SDL_RWops * const src, tr_room_sprite_t & room_sprite);
581     void read_tr_room_portal(SDL_RWops * const src, tr_room_portal_t & portal);
582     void read_tr_room_sector(SDL_RWops * const src, tr_room_sector_t & room_sector);
583     void read_tr_room_light(SDL_RWops * const src, tr5_room_light_t & light);
584     void read_tr_room_vertex(SDL_RWops * const src, tr5_room_vertex_t & room_vertex);
585     void read_tr_room_staticmesh(SDL_RWops * const src, tr2_room_staticmesh_t & room_static_mesh);
586     void read_tr_room(SDL_RWops * const src, tr5_room_t & room);
587     void read_tr_object_texture_vert(SDL_RWops * const src, tr4_object_texture_vert_t & vert);
588     void read_tr_object_texture(SDL_RWops * const src, tr4_object_texture_t & object_texture);
589     void read_tr_sprite_texture(SDL_RWops * const src, tr_sprite_texture_t & sprite_texture);
590     void read_tr_sprite_sequence(SDL_RWops * const src, tr_sprite_sequence_t & sprite_sequence);
591     void read_tr_mesh(SDL_RWops * const src, tr4_mesh_t & mesh);
592     void read_tr_state_changes(SDL_RWops * const src, tr_state_change_t & state_change);
593     void read_tr_anim_dispatches(SDL_RWops * const src, tr_anim_dispatch_t & anim_dispatch);
594     void read_tr_animation(SDL_RWops * const src, tr_animation_t & animation);
595     void read_tr_moveable(SDL_RWops * const src, tr_moveable_t & moveable);
596     void read_tr_item(SDL_RWops * const src, tr2_item_t & item);
597     void read_tr_cinematic_frame(SDL_RWops * const src, tr_cinematic_frame_t & cf);
598     void read_tr_staticmesh(SDL_RWops * const src, tr_staticmesh_t & mesh);
599     void read_tr_level(SDL_RWops * const src, bool demo_or_ub);
600 
601     void read_tr2_colour4(SDL_RWops * const src, tr2_colour_t & colour);
602     void read_tr2_palette16(SDL_RWops * const src, tr2_palette_t & palette16);
603     void read_tr2_textile16(SDL_RWops * const src, tr2_textile16_t & textile);
604     void read_tr2_box(SDL_RWops * const src, tr_box_t & box);
605     void read_tr2_zone(SDL_RWops * const src, tr2_zone_t & zone);
606     void read_tr2_room_light(SDL_RWops * const src, tr5_room_light_t & light);
607     void read_tr2_room_vertex(SDL_RWops * const src, tr5_room_vertex_t & room_vertex);
608     void read_tr2_room_staticmesh(SDL_RWops * const src, tr2_room_staticmesh_t & room_static_mesh);
609     void read_tr2_room(SDL_RWops * const src, tr5_room_t & room);
610     void read_tr2_item(SDL_RWops * const src, tr2_item_t & item);
611     void read_tr2_level(SDL_RWops * const src, bool demo);
612 
613     void read_tr3_room_light(SDL_RWops * const src, tr5_room_light_t & light);
614     void read_tr3_room_vertex(SDL_RWops * const src, tr5_room_vertex_t & room_vertex);
615     void read_tr3_room_staticmesh(SDL_RWops * const src, tr2_room_staticmesh_t & room_static_mesh);
616     void read_tr3_room(SDL_RWops * const src, tr5_room_t & room);
617     void read_tr3_item(SDL_RWops * const src, tr2_item_t & item);
618     void read_tr3_level(SDL_RWops * const src);
619 
620     void read_tr4_vertex_float(SDL_RWops * const src, tr5_vertex_t & vertex);
621     void read_tr4_textile32(SDL_RWops * const src, tr4_textile32_t & textile);
622     void read_tr4_face3(SDL_RWops * const src, tr4_face3_t & meshface);
623     void read_tr4_face4(SDL_RWops * const src, tr4_face4_t & meshface);
624     void read_tr4_room_light(SDL_RWops * const src, tr5_room_light_t & light);
625     void read_tr4_room_vertex(SDL_RWops * const src, tr5_room_vertex_t & room_vertex);
626      void read_tr4_room_staticmesh(SDL_RWops * const src, tr2_room_staticmesh_t & room_static_mesh);
627     void read_tr4_room(SDL_RWops * const src, tr5_room_t & room);
628     void read_tr4_item(SDL_RWops * const src, tr2_item_t & item);
629     void read_tr4_object_texture_vert(SDL_RWops * const src, tr4_object_texture_vert_t & vert);
630     void read_tr4_object_texture(SDL_RWops * const src, tr4_object_texture_t & object_texture);
631     void read_tr4_sprite_texture(SDL_RWops * const src, tr_sprite_texture_t & sprite_texture);
632     void read_tr4_mesh(SDL_RWops * const src, tr4_mesh_t & mesh);
633     void read_tr4_animation(SDL_RWops * const src, tr_animation_t & animation);
634     void read_tr4_level(SDL_RWops * const _src);
635 
636     void read_tr5_room_light(SDL_RWops * const src, tr5_room_light_t & light);
637     void read_tr5_room_layer(SDL_RWops * const src, tr5_room_layer_t & layer);
638     void read_tr5_room_vertex(SDL_RWops * const src, tr5_room_vertex_t & vert);
639     void read_tr5_room(SDL_RWops * const orgsrc, tr5_room_t & room);
640     void read_tr5_moveable(SDL_RWops * const src, tr_moveable_t & moveable);
641     void read_tr5_level(SDL_RWops * const src);
642 };
643 
644 #endif // _L_MAIN_H_
645