Both sides previous revisionPrevious revisionNext revision | Previous revision |
trs:file_formats [2017/06/03 14:57] – [Differences between “normal” TRs and Demos] zdimension | trs:file_formats [2021/04/29 21:53] (current) – [TR1 Level Format] zdimension |
---|
| {{indexmenu_n>9}} |
| |
====== Entire Level File Formats ====== | ====== Entire Level File Formats ====== |
| |
<code cpp> | <code cpp> |
uint32_t Version; // version (4 bytes) | uint32_t Version; // version (4 bytes) |
uint32_t NumTextiles; // number of texture tiles (4 bytes) | uint32_t NumImages; // number of texture images (4 bytes) |
tr_textile8 Textile8[NumTextiles]; // 8-bit (palettized) textiles (NumTextiles * 65536 bytes) | tr_image8 Images8[NumImages]; // 8-bit (palettized) images (NumImages * 65536 bytes) |
uint32_t Unused; // 32-bit unused value (4 bytes) | uint32_t Unused; // supposed to be the level number but TOM2PC didn't allow changing it, always 0 (4 bytes) |
uint16_t NumRooms; // number of rooms (2 bytes) | uint16_t NumRooms; // number of rooms (2 bytes) |
tr_room Rooms[NumRooms]; // room list (variable length) | tr_room Rooms[NumRooms]; // room list (variable length) |
tr_colour Palette[256]; // 8-bit palette (768 bytes) | tr_colour Palette[256]; // 8-bit palette (768 bytes) |
tr_colour4 Palette16[256]; // (1024 bytes) | tr_colour4 Palette16[256]; // (1024 bytes) |
uint32_t NumTextiles; // number of texture tiles (4 bytes) | uint32_t NumImages; // number of texture images (4 bytes) |
tr_textile8 Textile8[NumTextiles]; // 8-bit (palettized) textiles (NumTextiles * 65536 bytes) | tr_teximage8 Images8[NumImages]; // 8-bit (palettized) images (NumImages * 65536 bytes) |
tr_textile16 Textile16[NumTextiles]; // 16-bit (ARGB) textiles (NumTextiles * 131072 bytes) | tr_teximage16 Images16[NumImages]; // 16-bit (ARGB) images (NumImages * 131072 bytes) |
uint32_t Unused; // 32-bit unused value (4 bytes) | uint32_t Unused; // supposed to be the level number but TOM2PC didn't allow changing it, always 0 (4 bytes) |
uint16_t NumRooms; // number of rooms (2 bytes) | uint16_t NumRooms; // number of rooms (2 bytes) |
tr2_room Rooms[NumRooms]; // room list (variable length) | tr2_room Rooms[NumRooms]; // room list (variable length) |
tr_colour Palette[256]; // 8-bit palette (768 bytes) | tr_colour Palette[256]; // 8-bit palette (768 bytes) |
tr_colour4 Palette16[256]; // (1024 bytes) | tr_colour4 Palette16[256]; // (1024 bytes) |
uint32_t NumTextiles; // number of texture tiles (4 bytes) | uint32_t NumImages; // number of texture images (4 bytes) |
tr_textile8 Textile8[NumTextiles]; // 8-bit (palettized) textiles (NumTextiles * 65536 bytes) | tr_image8 Images8[NumImages]; // 8-bit (palettized) images (NumImages * 65536 bytes) |
tr_textile16 Textile16[NumTextiles]; // 16-bit (ARGB) textiles (NumTextiles * 131072 bytes) (absent from TR1) | tr_image16 Images16[NumImages]; // 16-bit (ARGB) images (NumImages * 131072 bytes) (absent from TR1) |
uint32_t Unused; // 32-bit unused value (4 bytes) | // "VICT.TR2" stops here, nothing after |
| uint32_t Unused; // supposed to be the level number but TOM2PC didn't allow changing it, always 0 (4 bytes) |
uint16_t NumRooms; // number of rooms (2 bytes) | uint16_t NumRooms; // number of rooms (2 bytes) |
tr3_room Rooms[NumRooms]; // room list (variable length) | tr3_room Rooms[NumRooms]; // room list (variable length) |
<code cpp> | <code cpp> |
uint32_t Version; // version (4 bytes) | uint32_t Version; // version (4 bytes) |
uint16_t NumRoomTextiles; // number of non bumped room tiles (2 bytes) | uint16_t NumRoomImages; // number of non.bumpmapped room images (2 bytes) |
uint16_t NumObjTextiles; // number of object tiles (2 bytes) | uint16_t NumObjImages; // number of object images (2 bytes) |
uint16_t NumBumpTextiles; // number of bumped room tiles (2 bytes) | uint16_t NumBumpmaps; // number of bump-mapped room images (2 bytes) |
uint32_t Textile32_UncompSize; // uncompressed size (in bytes) of the 32-bit textures chunk (4 bytes) | uint32_t Image32_UncompSize; // uncompressed size (in bytes) of the 32-bit textures chunk (4 bytes) |
uint32_t Textile32_CompSize; // compressed size (in bytes) of the 32-bit textures chunk (4 bytes) | uint32_t Image32_CompSize; // compressed size (in bytes) of the 32-bit textures chunk (4 bytes) |
uint8_t Textile32_Compressed[Textile32_CompSize]; // zlib-compressed 32-bit textures chunk (Textile32_CompSize bytes) | uint8_t Image32_Compressed[Image32_CompSize]; // zlib-compressed 32-bit textures chunk (Image32_CompSize bytes) |
{ | { |
tr4_textile32 Textile32[NumRoomTextiles + NumObjTextiles + NumBumpTextiles]; | tr4_image32 Image32[NumRoomImages + NumObjImages + NumBumpmaps]; |
} | } |
uint32_t Textile16_UncompSize; // uncompressed size (in bytes) of the 16-bit textures chunk (4 bytes) | uint32_t Image16_UncompSize; // uncompressed size (in bytes) of the 16-bit textures chunk (4 bytes) |
uint32_t Textile16_CompSize; // compressed size (in bytes) of the 16-bit textures chunk (4 bytes) | uint32_t Image16_CompSize; // compressed size (in bytes) of the 16-bit textures chunk (4 bytes) |
uint8_t Textile16_Compressed[Textile32_CompSize]; // zlib-compressed 16-bit textures chunk (Textile16_CompSize bytes) | uint8_t Image16_Compressed[Image32_CompSize]; // zlib-compressed 16-bit textures chunk (Image16_CompSize bytes) |
{ | { |
tr_textile16 Textile16[NumRoomTextiles + NumObjTextiles + NumBumpTextiles]; | tr_image16 Image16[NumRoomImages + NumObjImages + NumBumpmaps]; |
} | } |
uint32_t Textile32Misc_UncompSize; // uncompressed size (in bytes) of the 32-bit misc textures chunk (4 bytes), should always be 524288 | uint32_t Image32Misc_UncompSize; // uncompressed size (in bytes) of the 32-bit misc textures chunk (4 bytes), should always be 524288 |
uint32_t Textile32Misc_CompSize; // compressed size (in bytes) of the 32-bit misc textures chunk (4 bytes) | uint32_t Image32Misc_CompSize; // compressed size (in bytes) of the 32-bit misc textures chunk (4 bytes) |
uint8_t Textile32Misc_Compressed[Textile32Misc_CompSize]; // zlib-compressed 32-bit misc textures chunk (Textile32Misc_CompSize bytes) | uint8_t Image32Misc_Compressed[Image32Misc_CompSize]; // zlib-compressed 32-bit misc textures chunk (Image32Misc_CompSize bytes) |
{ | { |
tr4_textile32 Textile32Misc[2]; | tr4_image32 Image32Misc[2]; |
} | } |
uint32_t LevelData_UncompSize; // uncompressed size (in bytes) of the level data chunk (4 bytes) | uint32_t LevelData_UncompSize; // uncompressed size (in bytes) of the level data chunk (4 bytes) |
uint8_t LevelData_Compressed[LevelData_CompSize]; // zlib-compressed level data chunk (LevelData_CompSize bytes) | uint8_t LevelData_Compressed[LevelData_CompSize]; // zlib-compressed level data chunk (LevelData_CompSize bytes) |
{ | { |
uint32_t Unused; // 32-bit unused value, always 0 (4 bytes) | uint32_t Unused; // supposed to be the level number but TOM2PC didn't allow changing it, always 0 (4 bytes) |
uint16_t NumRooms; // number of rooms (2 bytes) | uint16_t NumRooms; // number of rooms (2 bytes) |
tr4_room Rooms[NumRooms]; // room list (variable length) | tr4_room Rooms[NumRooms]; // room list (variable length) |
uint16_t AnimatedTextures[NumAnimatedTextures]; // animated texture data (NumAnimatedTextures * 2 bytes) | uint16_t AnimatedTextures[NumAnimatedTextures]; // animated texture data (NumAnimatedTextures * 2 bytes) |
uint8_t AnimatedTexturesUVCount; | uint8_t AnimatedTexturesUVCount; |
| uint8_t TEX[3]; // T E X (0x54, 0x45, 0x58) |
uint32_t NumObjectTextures; // number of object textures to follow (4 bytes) (after AnimatedTextures in TR3) | uint32_t NumObjectTextures; // number of object textures to follow (4 bytes) (after AnimatedTextures in TR3) |
tr4_object_texture ObjectTextures[NumObjectTextures]; // object texture list (NumObjectTextures * 38 bytes) | tr4_object_texture ObjectTextures[NumObjectTextures]; // object texture list (NumObjectTextures * 38 bytes) |
uint32_t NumSampleIndices; // number of sample indices to follow (4 bytes) + | uint32_t NumSampleIndices; // number of sample indices to follow (4 bytes) + |
uint32_t SampleIndices[NumSampleIndices]; // sample indices (NumSampleIndices * 4 bytes) | uint32_t SampleIndices[NumSampleIndices]; // sample indices (NumSampleIndices * 4 bytes) |
| uint8_t Separator[6]; // 6 0x00 bytes |
} | } |
uint32_t NumSamples; // number of sound samples (4 bytes) | uint32_t NumSamples; // number of sound samples (4 bytes) |
<code cpp> | <code cpp> |
uint32_t Version; // version (4 bytes) | uint32_t Version; // version (4 bytes) |
uint16_t NumRoomTextiles; // number of non bumped room tiles (2 bytes) | uint16_t NumRoomImages; // number of non-bumpmapped room images (2 bytes) |
uint16_t NumObjTextiles; // number of object tiles (2 bytes) | uint16_t NumObjImages; // number of object images (2 bytes) |
uint16_t NumBumpTextiles; // number of bumped room tiles (2 bytes) | uint16_t NumBumpmaps; // number of bumpmaps (2 bytes) |
uint32_t Textile32_UncompSize; // uncompressed size (in bytes) of the 32-bit textures chunk (4 bytes) | uint32_t Image32_UncompSize; // uncompressed size (in bytes) of the 32-bit textures chunk (4 bytes) |
uint32_t Textile32_CompSize; // compressed size (in bytes) of the 32-bit textures chunk (4 bytes) | uint32_t Image32_CompSize; // compressed size (in bytes) of the 32-bit textures chunk (4 bytes) |
uint8_t Textile32_Compressed[Textile32_CompSize]; // zlib-compressed 32-bit textures chunk (Textile32_CompSize bytes) | uint8_t Image32_Compressed[Image32_CompSize]; // zlib-compressed 32-bit textures chunk (Image32_CompSize bytes) |
{ | { |
tr4_textile32 Textile32[NumRoomTextiles + NumObjTextiles + NumBumpTextiles]; | tr4_image32 Image32[NumRoomImages + NumObjImages + NumBumpmaps]; |
} | } |
uint32_t Textile16_UncompSize; // uncompressed size (in bytes) of the 16-bit textures chunk (4 bytes) | uint32_t Image16_UncompSize; // uncompressed size (in bytes) of the 16-bit textures chunk (4 bytes) |
uint32_t Textile16_CompSize; // compressed size (in bytes) of the 16-bit textures chunk (4 bytes) | uint32_t Image16_CompSize; // compressed size (in bytes) of the 16-bit textures chunk (4 bytes) |
uint8_t Textile16_Compressed[Textile32_CompSize]; // zlib-compressed 16-bit textures chunk (Textile16_CompSize bytes) | uint8_t Image16_Compressed[Image32_CompSize]; // zlib-compressed 16-bit textures chunk (Image16_CompSize bytes) |
{ | { |
tr_textile16 Textile16[NumRoomTextiles + NumObjTextiles + NumBumpTextiles]; | tr_image16 Image16[NumRoomImages + NumObjImages + NumBumpmaps]; |
} | } |
uint32_t Textile32Misc_UncompSize; // uncompressed size (in bytes) of the 32-bit misc textures chunk (4 bytes), should always be 786432 | uint32_t Image32Misc_UncompSize; // uncompressed size (in bytes) of the 32-bit misc textures chunk (4 bytes), should always be 786432 |
uint32_t Textile32Misc_CompSize; // compressed size (in bytes) of the 32-bit misc textures chunk (4 bytes) | uint32_t Image32Misc_CompSize; // compressed size (in bytes) of the 32-bit misc textures chunk (4 bytes) |
uint8_t Textile32Misc_Compressed[Textile32Misc_CompSize]; // zlib-compressed 32-bit misc textures chunk (Textile32Misc_CompSize bytes) | uint8_t Image32Misc_Compressed[Image32Misc_CompSize]; // zlib-compressed 32-bit misc textures chunk (Image32Misc_CompSize bytes) |
{ | { |
tr4_textile32 Textile32Misc[3]; | tr4_image32 Image32Misc[3]; |
} | } |
uint16_t LaraType; | uint16_t LaraType; |
uint32_t LevelData_CompSize; // compressed size (in bytes) of the level data chunk, equal to LevelData_UncompSize (4 bytes) | uint32_t LevelData_CompSize; // compressed size (in bytes) of the level data chunk, equal to LevelData_UncompSize (4 bytes) |
// NOT COMPRESSED | // NOT COMPRESSED |
uint32_t Unused; // 32-bit unused value, always 0 (4 bytes) | uint32_t LevelNumber; // supposed to be the level number but TOM2PC didn't allow changing it, always 0 (4 bytes) |
uint16_t NumRooms; // number of rooms (2 bytes) | uint16_t NumRooms; // number of rooms (2 bytes) |
tr5_room Rooms[NumRooms]; // room list (variable length) | tr5_room Rooms[NumRooms]; // room list (variable length) |
* There are no more 8-bit textures. | * There are no more 8-bit textures. |
* There are now 32-bit textures. | * There are now 32-bit textures. |
* Texture tiles are now divided into three parts: //non-bumped room texture tiles//, //model texture tiles// and //bumped room texture tiles//. | * Texture atlases are now divided into three parts: //non-bumpmapped room texture atlases//, //model texture atlases// and //bumpmapped room texture atlases//. |
* Level file divided in several chunks, with each chunk compressed using //zlib//: | * Level file divided in several chunks, with each chunk compressed using //zlib//: |
* Chunk 1: 32-bit texture tiles. | * Chunk 1: 32-bit texture atlases. |
* Chunk 2: 16-bit texture tiles. | * Chunk 2: 16-bit texture atlases. |
* Chunk 3: 32-bit //sky and font graphics//. | * Chunk 3: 32-bit //sky and font graphics//. |
* Chunk 4: Level data. | * Chunk 4: Level data. |
===== Changes in TR4 vs. TR5 ===== | ===== Changes in TR4 vs. TR5 ===== |
| |
* There is no more //bumped room texture tiles// block. | * There is no more //bump-mapped room texture atlases// block. |
* There are now two extra ''%%uint16_t%%'' values after last texture block specifying [[trs:file_formats#LaraType|Lara type]] and [[trs:file_formats#WeatherType|weather type]]. | * There are now two extra ''%%uint16_t%%'' values after last texture block specifying [[trs:file_formats#LaraType|Lara type]] and [[trs:file_formats#WeatherType|weather type]]. |
* Also, it is followed by 28 bytes zero padding. | * Also, it is followed by 28 bytes zero padding. |