====== TRLE .PRJ file format ====== ===== Entire format ===== uint8_t signature[8]; // "PROJFILE" uint32_t version; // Version of RoomEdit (49/0x31 for standard TRLE, 51/0x33 for leaked TR5 RoomEdit) uint32_t numRooms; PRJ_Room rooms[numRooms]; // variable size uint32_t numObjects; uint32_t maxObjects; uint32_t unusedObjects[2000]; uint32_t numLights; uint32_t unusedLights[768]; uint32_t numTriggers; uint32_t unusedTriggers[512]; uint8_t textureFile[]; // ASCII-encoded string, terminated by a space (0x20) <-- space NOT included in the string, just skip it and continue reading #if TextureFile != "NA" uint32_t numTextInfo; PRJ_TextInfo textInfo[numTextInfo]; #endif uint8_t objectFile[]; // ASCII string terminated by a non-included space, as above with textureFile uint32_t numObjectData; PRJ_ObjectData objectData[numObjectData]; uint32_t numAnimTextures; uint32_t unusedAnimTextures[40]; uint32_t animTextures[256]; PRJ_AnimText animRanges[40]; uint8_t terrain[256]; uint8_t bump[256]; ''Terrain'' items can be one of the following values: * 0 -- Mud * 1 -- Snow * 2 -- Sand * 3 -- Gravel * 4 -- Ice * 5 -- Water * 6 -- Stone * 7 -- Wood * 8 -- Metal * 9 -- Marble * 10 -- Grass * 11 -- Concrete * 12 -- OldWood * 13 -- OldMetal ''Bump'' items can be one of the following values: * 0 -- None * 1 -- Level 1 * 2 -- Level 2 ===== Structures ===== //not in order, todo// ==== Texture info ==== struct PRJ_TextInfo // 8 bytes { uint8_t x; uint8_t y; uint16_t atlas; uint8_t flipX; uint8_t xSize; uint8_t flipY; uint8_t ySize; } * ''x'' -- The pixel offset of the left side of the texture within the TGA. This only permits the texture file to be 256 pixels wide at most. For full atlases, it must be a multiple of 64 (0, 64, 128, 192). For partial atlases, it may be any multiple of 16. * ''y'' -- The pixel offset of the top of the texture within the TGA. The maximum height allowed for a TGA file is 4096 (for width of 256). Since 512 pixel wide TGA files are converted to 256, that makes 4096 the true maximum height. This offset can be at most 4032 for full atlases, or 4080 for partial atlases. For full atlases, it must be a multiple of 64. For partial atlases, it may be any multiple of 16. * ''xSize'' -- This is the pixel offset of the rightmost pixel within the atlas. For full atlases, it must be 63. For partial atlases it must be 15, 31, 47, or 63. It is basically the pixel width of the texture minus 1. It cannot be set so that the texture would cross an atlas boundary. * ''ySize'' -- This is the pixel offset of the bottom pixel within the atlas. For full atlases, it must be 63. For partial atlases it must be 15, 31, 47, or 63. It is basically the pixel height of the texture minus 1. It cannot be set so that the texture would cross an atlas boundary. ==== Animation range ==== struct PRJ_AnimText // 12 bytes { uint32_t defined; // 0 = animation range not used, 1 = being used uint32_t firstAtlas; // atlas number of the first atlas in the animation range uint32_t lastAtlas; // atlas number of the last atlas in the animation range } ==== 32-bit color ==== struct PRJ_Color4 // 4 bytes { uint32_t red; uint32_t green; uint32_t blue; uint32_t alpha; } ==== Camera ==== struct PRJ_Camera // 40 bytes { uint16_t xPos; uint16_t zPos; int32_t unknown1; int32_t yPos; int8_t fov; int8_t camID; int32_t timer; int32_t worldZpos; int32_t worldYpos; int32_t worldXpos; int16_t xRot; int16_t yRot; int16_t zRot; // roll int16_t speed; // speed * 655 int16_t flags; // the buttons 0-15 in the camera settings } ==== Sink ==== struct PRJ_Sink { int16_t xPos; int16_t zPos; int16_t xSize; int16_t zSize; uint16_t yPos; uint16_t room; uint16_t slot; uint16_t timer; PRJObjectOrientation orientation; int32_t worldZpos; int32_t worldYpos; int32_t worldXpos; }