Main Page   Compound List   File List   Compound Members  

TR_Level Class Reference

A complete TR level. More...

#include <l_main.h>

List of all members.

Public Methods

void read_level (SDL_RWops *const src, tr_version_e game_version)
 reads the level.


Public Attributes

tr_version_e game_version
 game engine version.

bitu32 num_textiles
 number of 256x256 textiles.

bitu32 num_room_textiles
 number of 256x256 room textiles (TR4-5).

bitu32 num_obj_textiles
 number of 256x256 object textiles (TR4-5).

bitu32 num_bump_textiles
 number of 256x256 bump textiles (TR4-5).

bitu32 num_misc_textiles
 number of 256x256 misc textiles (TR4-5).

std::vector< tr_textile8_ttextile8
 8-bit 256x256 textiles(TR1-3).

std::vector< tr2_textile16_ttextile16
 16-bit 256x256 textiles(TR2-5).

std::vector< tr4_textile32_ttextile32
 32-bit 256x256 textiles(TR4-5).

bool read_32bit_textiles
 are other 32bit textiles than misc ones read?

std::vector< tr5_room_trooms
 all rooms (normal and alternate).

std::vector< bitu16 > floor_data
 the floor data.

std::vector< tr4_mesh_tmeshes
 all meshes (static and moveables).

std::vector< bitu32 > mesh_indices
 mesh index table.

std::vector< tr_animation_tanimations
 animations for moveables.

std::vector< tr_state_change_tstate_changes
 state changes for moveables.

std::vector< tr_anim_dispatch_tanim_dispatches
 animation dispatches for moveables.

std::vector< tr_anim_command_tanim_commands
 animation commands for moveables.

std::vector< tr_meshtree_tmesh_trees
 mesh trees for moveables.

std::vector< tr_frame_tframes
 frames for moveables.

std::vector< tr_moveable_tmoveables
 data for the moveables.

std::vector< tr_staticmesh_tstatic_meshes
 data for the static meshes.

std::vector< tr4_object_texture_tobject_textures
 object texture definitions.

std::vector< tr_animated_textures_tanimated_textures
 animated textures.

std::vector< tr_sprite_texture_tsprite_textures
 sprite texture definitions.

std::vector< tr_sprite_sequence_tsprite_sequences
 sprite sequences for animation.

std::vector< tr_camera_tcameras
 cameras.

std::vector< tr4_extra_camera_tflyby_cameras
 flyby cameras.

std::vector< tr_sound_source_tsound_sources
 sound sources.

std::vector< tr_box_tboxes
 boxes.

std::vector< bitu16 > overlaps
 overlaps.

std::vector< bit16 > zones
 zones.

std::vector< tr2_item_titems
 items.

tr_lightmap_t lightmap
 ligthmap (TR1-3).

tr2_palette_t palette
 colour palette (TR1-3).

tr2_palette_t palette16
 colour palette (TR2-3).

std::vector< tr4_ai_object_tai_objects
 ai objects (TR4-5).

std::vector< tr_cinematic_frame_tcinematic_frames
 cinematic frames (TR1-3).

std::vector< bitu8 > demo_data
 demo data.

bit16 soundmap [450]
 soundmap (TR: 256 values TR2-4: 370 values TR5: 450 values).

std::vector< tr_sound_details_tsound_details
 sound details.

std::vector< bitu8 > samples
 samples.

std::vector< bitu32 > sample_indices
 sample indices.


Protected Methods

bit8 read_bit8 (SDL_RWops *const src)
 reads signed 8-bit value.

bitu8 read_bitu8 (SDL_RWops *const src)
 reads unsigned 8-bit value.

bit16 read_bit16 (SDL_RWops *const src)
 reads signed 16-bit value.

bitu16 read_bitu16 (SDL_RWops *const src)
 reads unsigned 16-bit value.

bit32 read_bit32 (SDL_RWops *const src)
 reads signed 32-bit value.

bitu32 read_bitu32 (SDL_RWops *const src)
 reads unsigned 32-bit value.

float read_float (SDL_RWops *const src)
 reads float value.

void read_mesh_data (SDL_RWops *const src)
 reads the mesh data.

void read_frame_moveable_data (SDL_RWops *const src)
 reads frame and moveable data.

void read_tr_colour (SDL_RWops *const src, tr2_colour_t &colour)
 reads rgb colour.

void read_tr_vertex16 (SDL_RWops *const src, tr5_vertex_t &vertex)
 reads three 16-bit vertex components.

void read_tr_vertex32 (SDL_RWops *const src, tr5_vertex_t &vertex)
 reads three 32-bit vertex components.

void read_tr_face3 (SDL_RWops *const src, tr4_face3_t &face)
 reads a triangle definition.

void read_tr_face4 (SDL_RWops *const src, tr4_face4_t &face)
 reads a triangle definition.

void read_tr_textile8 (SDL_RWops *const src, tr_textile8_t &textile)
 reads a 8-bit 256x256 textile.

void read_tr_lightmap (SDL_RWops *const src, tr_lightmap_t &lightmap)
 reads the lightmap.

void read_tr_palette (SDL_RWops *const src, tr2_palette_t &palette)
 reads the 256 colour palette values.

void read_tr_room_sprite (SDL_RWops *const src, tr_room_sprite_t &room_sprite)
 reads a room sprite definition.

void read_tr_room_portal (SDL_RWops *const src, tr_room_portal_t &portal)
 reads a room portal definition.

void read_tr_room_sector (SDL_RWops *const src, tr_room_sector_t &room_sector)
 reads a room sector definition.

void read_tr_room_light (SDL_RWops *const src, tr5_room_light_t &light)
 reads a room light definition.

void read_tr_room_vertex (SDL_RWops *const src, tr5_room_vertex_t &room_vertex)
 reads a room vertex definition.

void read_tr_room_staticmesh (SDL_RWops *const src, tr2_room_staticmesh_t &room_static_mesh)
 reads a room staticmesh definition.

void read_tr_room (SDL_RWops *const src, tr5_room_t &room)
 reads a room definition.

void read_tr_object_texture_vert (SDL_RWops *const src, tr4_object_texture_vert_t &vert)
 reads object texture vertex definition.

void read_tr_object_texture (SDL_RWops *const src, tr4_object_texture_t &object_texture)
 reads object texture definition.

void read_tr_sprite_texture (SDL_RWops *const src, tr_sprite_texture_t &sprite_texture)
 reads sprite texture definition.

void read_tr_sprite_sequence (SDL_RWops *const src, tr_sprite_sequence_t &sprite_sequence)
 reads sprite sequence definition.

void read_tr_mesh (SDL_RWops *const src, tr4_mesh_t &mesh)
 reads mesh definition.

void read_tr_animation (SDL_RWops *const src, tr_animation_t &animation)
 reads an animation definition.

void read_tr_meshtree (SDL_RWops *const src, tr_meshtree_t &meshtree)
 reads a mesh tree value.

void read_tr_frame (SDL_RWops *const src, tr_frame_t &frame, bitu32 num_rotations)
void read_tr_moveable (SDL_RWops *const src, tr_moveable_t &moveable)
 reads a moveable definition.

void read_tr_item (SDL_RWops *const src, tr2_item_t &item)
 reads an item definition.

void read_tr_staticmesh (SDL_RWops *const src, tr_staticmesh_t &mesh)
 reads a static mesh definition.

void read_tr_level (SDL_RWops *const src, bool demo_or_ub)
void read_tr2_colour4 (SDL_RWops *const src, tr2_colour_t &colour)
void read_tr2_palette16 (SDL_RWops *const src, tr2_palette_t &palette16)
void read_tr2_textile16 (SDL_RWops *const src, tr2_textile16_t &textile)
void read_tr2_room_light (SDL_RWops *const src, tr5_room_light_t &light)
void read_tr2_room_vertex (SDL_RWops *const src, tr5_room_vertex_t &room_vertex)
void read_tr2_room_staticmesh (SDL_RWops *const src, tr2_room_staticmesh_t &room_static_mesh)
void read_tr2_room (SDL_RWops *const src, tr5_room_t &room)
void read_tr2_frame (SDL_RWops *const src, tr_frame_t &frame, bitu32 num_rotations)
void read_tr2_item (SDL_RWops *const src, tr2_item_t &item)
void read_tr2_level (SDL_RWops *const src, bool demo)
void read_tr3_room_vertex (SDL_RWops *const src, tr5_room_vertex_t &room_vertex)
void read_tr3_room_staticmesh (SDL_RWops *const src, tr2_room_staticmesh_t &room_static_mesh)
void read_tr3_room (SDL_RWops *const src, tr5_room_t &room)
void read_tr3_item (SDL_RWops *const src, tr2_item_t &item)
void read_tr3_level (SDL_RWops *const src)
void read_tr4_vertex_float (SDL_RWops *const src, tr5_vertex_t &vertex)
void read_tr4_textile32 (SDL_RWops *const src, tr4_textile32_t &textile)
void read_tr4_face3 (SDL_RWops *const src, tr4_face3_t &meshface)
void read_tr4_face4 (SDL_RWops *const src, tr4_face4_t &meshface)
void read_tr4_room_light (SDL_RWops *const src, tr5_room_light_t &light)
void read_tr4_room (SDL_RWops *const src, tr5_room_t &room)
void read_tr4_object_texture_vert (SDL_RWops *const src, tr4_object_texture_vert_t &vert)
void read_tr4_object_texture (SDL_RWops *const src, tr4_object_texture_t &object_texture)
void read_tr4_mesh (SDL_RWops *const src, tr4_mesh_t &mesh)
void read_tr4_animation (SDL_RWops *const src, tr_animation_t &animation)
 reads an animation definition.

void read_tr4_level (SDL_RWops *const _src)
void read_tr5_room_light (SDL_RWops *const src, tr5_room_light_t &light)
void read_tr5_room_layer (SDL_RWops *const src, tr5_room_layer_t &layer)
void read_tr5_room_vertex (SDL_RWops *const src, tr5_room_vertex_t &vert)
void read_tr5_room (SDL_RWops *const orgsrc, tr5_room_t &room)
void read_tr5_moveable (SDL_RWops *const src, tr_moveable_t &moveable)
void read_tr5_level (SDL_RWops *const src)


Detailed Description

A complete TR level.

This contains all necessary functions to load a TR level. Some corrections to the data are done, like converting to OpenGLs coordinate system. All indexes are converted, so they can be used directly. Endian conversion is done at the lowest possible layer, most of the time this is in the read_bitxxx functions.


Member Function Documentation

bit16 TR_Level::read_bit16 SDL_RWops *const    src [protected]
 

reads signed 16-bit value.

uses current position from src. does endian correction. throws trxReadError when not successful.

bit32 TR_Level::read_bit32 SDL_RWops *const    src [protected]
 

reads signed 32-bit value.

uses current position from src. does endian correction. throws trxReadError when not successful.

bit8 TR_Level::read_bit8 SDL_RWops *const    src [protected]
 

reads signed 8-bit value.

uses current position from src. throws trxReadError when not successful.

bitu16 TR_Level::read_bitu16 SDL_RWops *const    src [protected]
 

reads unsigned 16-bit value.

uses current position from src. does endian correction. throws trxReadError when not successful.

bitu32 TR_Level::read_bitu32 SDL_RWops *const    src [protected]
 

reads unsigned 32-bit value.

uses current position from src. does endian correction. throws trxReadError when not successful.

bitu8 TR_Level::read_bitu8 SDL_RWops *const    src [protected]
 

reads unsigned 8-bit value.

uses current position from src. throws trxReadError when not successful.

float TR_Level::read_float SDL_RWops *const    src [protected]
 

reads float value.

uses current position from src. does endian correction. throws trxReadError when not successful.

void TR_Level::read_level SDL_RWops *const    src,
tr_version_e    game_version
 

reads the level.

Takes a SDL_RWop and the game_version of the file and reads the structures into the members of TR_Level.

void TR_Level::read_tr_colour SDL_RWops *const    src,
tr2_colour_t   colour
[protected]
 

reads rgb colour.

Reads three rgb colour components. The read 6-bit values get shifted, so they are 8-bit. The alpha value of tr2_colour_t gets set to 0.

void TR_Level::read_tr_face3 SDL_RWops *const    src,
tr4_face3_t   meshface
[protected]
 

reads a triangle definition.

The lighting value is set to 0, as it is only in TR4-5.

void TR_Level::read_tr_face4 SDL_RWops *const    src,
tr4_face4_t   meshface
[protected]
 

reads a triangle definition.

The lighting value is set to 0, as it is only in TR4-5.

void TR_Level::read_tr_mesh SDL_RWops *const    src,
tr4_mesh_t   mesh
[protected]
 

reads mesh definition.

The read num_normals value is positive when normals are available and negative when light values are available. The values get set appropiatly.

void TR_Level::read_tr_moveable SDL_RWops *const    src,
tr_moveable_t   moveable
[protected]
 

reads a moveable definition.

some sanity checks get done which throw a exception on failure. frame_offset needs to be corrected later in TR_Level::read_tr_level.

void TR_Level::read_tr_object_texture SDL_RWops *const    src,
tr4_object_texture_t   object_texture
[protected]
 

reads object texture definition.

some sanity checks get done and if they fail an exception gets thrown. all values introduced in TR4 get set appropiatly.

void TR_Level::read_tr_room SDL_RWops *const    src,
tr5_room_t   room
[protected]
 

reads a room definition.

intensity1 gets converted, so it matches the 0-32768 range introduced in TR3. intensity2 is introduced in TR2 and is set to intensity1 for TR1. light_mode is only in TR2 and is set 0 for TR1. light_colour is only in TR3-4 and gets set appropiatly.

void TR_Level::read_tr_room_light SDL_RWops *const    src,
tr5_room_light_t   light
[protected]
 

reads a room light definition.

intensity1 gets converted, so it matches the 0-32768 range introduced in TR3. intensity2 and fade2 are introduced in TR2 and are set to intensity1 and fade1 for TR1.

void TR_Level::read_tr_room_portal SDL_RWops *const    src,
tr_room_portal_t   portal
[protected]
 

reads a room portal definition.

A check is preformed to see wether the normal lies on a coordinate axis, if not an exception gets thrown.

void TR_Level::read_tr_room_staticmesh SDL_RWops *const    src,
tr2_room_staticmesh_t   room_static_mesh
[protected]
 

reads a room staticmesh definition.

rotation gets converted to float and scaled appropiatly. intensity1 gets converted, so it matches the 0-32768 range introduced in TR3. intensity2 is introduced in TR2 and is set to intensity1 for TR1.

void TR_Level::read_tr_room_vertex SDL_RWops *const    src,
tr5_room_vertex_t   room_vertex
[protected]
 

reads a room vertex definition.

lighting1 gets converted, so it matches the 0-32768 range introduced in TR3. lighting2 is introduced in TR2 and is set to lighting1 for TR1. attributes is introduced in TR2 and is set 0 for TR1. All other values are introduced in TR5 and get set to appropiate values.

void TR_Level::read_tr_sprite_sequence SDL_RWops *const    src,
tr_sprite_sequence_t   sprite_sequence
[protected]
 

reads sprite sequence definition.

length is negative when read and thus gets negated.

void TR_Level::read_tr_sprite_texture SDL_RWops *const    src,
tr_sprite_texture_t   sprite_texture
[protected]
 

reads sprite texture definition.

some sanity checks get done and if they fail an exception gets thrown.

void TR_Level::read_tr_vertex16 SDL_RWops *const    src,
tr5_vertex_t   vertex
[protected]
 

reads three 16-bit vertex components.

The values get converted from bit16 to float. y and z are negated to fit OpenGLs coordinate system.

void TR_Level::read_tr_vertex32 SDL_RWops *const    src,
tr5_vertex_t   vertex
[protected]
 

reads three 32-bit vertex components.

The values get converted from bit32 to float. y and z are negated to fit OpenGLs coordinate system.


The documentation for this class was generated from the following files:
Generated on Sun Sep 8 17:37:30 2002 for vt by doxygen1.2.17