# Differences

This shows you the differences between two versions of the page.

 trs:room_geometry [2017/02/04 17:32]stohrendorf ↷ Links adapted because of a move operation trs:room_geometry [2019/05/21 22:41] (current)zdimension [TR5 Room Structure] Both sides previous revision Previous revision 2019/05/21 22:41 zdimension [TR5 Room Structure] 2017/11/17 12:17 stohrendorf 2017/09/15 23:55 zdimension [TR5 Room Layer Structure] 2017/09/15 22:58 zdimension [Room Sector Structure] 2017/08/27 23:32 zdimension [TR1 Room Structure] 2017/06/04 23:53 zdimension [TR5 Room Structure] 2017/06/04 23:51 zdimension [TR4 Room Structure] 2017/06/04 23:50 zdimension [TR3 Room Structure] 2017/06/04 23:50 zdimension [TR1 Room Structure] 2017/06/04 23:48 zdimension [Room Static Mesh Structure] 2017/06/04 23:47 zdimension [Room Vertex Structure] 2017/06/04 23:45 zdimension [Room Light Structure] 2017/06/04 19:11 zdimension [TR5 Room Structure] 2017/06/04 19:09 zdimension [TR4 Room Structure] 2017/06/04 19:08 zdimension [TR2 Room Structure] 2017/06/04 19:07 zdimension [Room Static Mesh Structure] 2017/06/04 19:06 zdimension [Room Light Structure] 2017/06/04 18:04 zdimension [Room Light Structure] 2017/02/04 17:34 stohrendorf ↷ Links adapted because of a move operation2017/02/04 17:32 stohrendorf ↷ Links adapted because of a move operation2017/02/02 20:56 stohrendorf ↷ Links adapted because of a move operation2017/02/02 20:56 stohrendorf ↷ Page moved from opentomb:trs:room_geometry to trs:room_geometry2017/02/02 14:34 zdimension [Room Static Mesh Structure] 2017/02/02 14:33 zdimension [Room Static Mesh Structure] 2017/01/25 13:44 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:43 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Page moved from room_geometry to opentomb:trs:room_geometry2017/01/25 13:41 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:39 stohrendorf old revision restored (2017/01/11 18:23)2017/01/25 10:33 stohrendorf removed2017/01/11 18:23 zdimension [Common Fields of a Room Structure] 2017/01/11 00:26 zdimension [Room Static Mesh Structure] 2017/01/07 19:45 external edit2017/01/07 19:44 external edit2017/01/06 12:42 stohrendorf 2017/01/04 23:10 zdimension [Room Light Structure] 2017/01/04 23:05 zdimension 2017/01/04 22:56 zdimension 2017/01/04 14:45 zdimension 2017/01/04 14:10 zdimension 2017/01/04 14:09 zdimension 2017/01/04 13:38 zdimension created Next revision Previous revision 2019/05/21 22:41 zdimension [TR5 Room Structure] 2017/11/17 12:17 stohrendorf 2017/09/15 23:55 zdimension [TR5 Room Layer Structure] 2017/09/15 22:58 zdimension [Room Sector Structure] 2017/08/27 23:32 zdimension [TR1 Room Structure] 2017/06/04 23:53 zdimension [TR5 Room Structure] 2017/06/04 23:51 zdimension [TR4 Room Structure] 2017/06/04 23:50 zdimension [TR3 Room Structure] 2017/06/04 23:50 zdimension [TR1 Room Structure] 2017/06/04 23:48 zdimension [Room Static Mesh Structure] 2017/06/04 23:47 zdimension [Room Vertex Structure] 2017/06/04 23:45 zdimension [Room Light Structure] 2017/06/04 19:11 zdimension [TR5 Room Structure] 2017/06/04 19:09 zdimension [TR4 Room Structure] 2017/06/04 19:08 zdimension [TR2 Room Structure] 2017/06/04 19:07 zdimension [Room Static Mesh Structure] 2017/06/04 19:06 zdimension [Room Light Structure] 2017/06/04 18:04 zdimension [Room Light Structure] 2017/02/04 17:34 stohrendorf ↷ Links adapted because of a move operation2017/02/04 17:32 stohrendorf ↷ Links adapted because of a move operation2017/02/02 20:56 stohrendorf ↷ Links adapted because of a move operation2017/02/02 20:56 stohrendorf ↷ Page moved from opentomb:trs:room_geometry to trs:room_geometry2017/02/02 14:34 zdimension [Room Static Mesh Structure] 2017/02/02 14:33 zdimension [Room Static Mesh Structure] 2017/01/25 13:44 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:43 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:42 stohrendorf ↷ Page moved from room_geometry to opentomb:trs:room_geometry2017/01/25 13:41 stohrendorf ↷ Links adapted because of a move operation2017/01/25 13:39 stohrendorf old revision restored (2017/01/11 18:23)2017/01/25 10:33 stohrendorf removed2017/01/11 18:23 zdimension [Common Fields of a Room Structure] 2017/01/11 00:26 zdimension [Room Static Mesh Structure] 2017/01/07 19:45 external edit2017/01/07 19:44 external edit2017/01/06 12:42 stohrendorf 2017/01/04 23:10 zdimension [Room Light Structure] 2017/01/04 23:05 zdimension 2017/01/04 22:56 zdimension 2017/01/04 14:45 zdimension 2017/01/04 14:10 zdimension 2017/01/04 14:09 zdimension 2017/01/04 13:38 zdimension created Line 1: Line 1: + {{indexmenu_n>​2}} + ====== Room Geometry ====== ====== Room Geometry ====== Line 17: Line 19: The rooms are stored sequentially in an array, and “Room Numbers” are simply indices into this array (e.g. “Room Number 5” is simply ''<​nowiki>​Rooms[5]'';​ the first room is ''<​nowiki>​Rooms[0]''​). The rooms are stored sequentially in an array, and “Room Numbers” are simply indices into this array (e.g. “Room Number 5” is simply ''<​nowiki>​Rooms[5]'';​ the first room is ''<​nowiki>​Rooms[0]''​). - Rooms are divided into //sectors// (or //​squares//​),​ which are 1024×1024 unit squares that form a grid on the $X-Z$ plane. Sectors are the defining area for floor/​ceiling heights and triggers (e.g. a tiger appears and attacks when Lara steps on a given square); the various attributes of each sector are stored in the Sector Data (described in this section) and the [[trs:​savegame:​trs:​floordata|[FloorData]]]. As an aside, Sectors correspond to the “squares,​” easily visible in all of the Tomb Raider games, that experienced players count when gauging jumps; they also account for some of the game’s less-appealing graphic artifacts. Careful tiling and texture construction can make these “squares” almost invisible. + Rooms are divided into //sectors// (or //​squares//​),​ which are 1024×1024 unit squares that form a grid on the $X-Z$ plane. Sectors are the defining area for floor/​ceiling heights and triggers (e.g. a tiger appears and attacks when Lara steps on a given square); the various attributes of each sector are stored in the Sector Data (described in this section) and the [[trs:​floordata|[FloorData]]]. As an aside, Sectors correspond to the “squares,​” easily visible in all of the Tomb Raider games, that experienced players count when gauging jumps; they also account for some of the game’s less-appealing graphic artifacts. Careful tiling and texture construction can make these “squares” almost invisible. <​note>​ Each room has two types of surface geometry — //​rendered//​ and //​collisional//​. The former are what is //seen//, while the latter control how objects //collide// and //​interact//​ with the world. Furthermore,​ these two types are specified separately in the room data — each type is //​completely independent of other//, i. e. collisional geometry shouldn’t exactly match visible room geometry. <​note>​ Each room has two types of surface geometry — //​rendered//​ and //​collisional//​. The former are what is //seen//, while the latter control how objects //collide// and //​interact//​ with the world. Furthermore,​ these two types are specified separately in the room data — each type is //​completely independent of other//, i. e. collisional geometry shouldn’t exactly match visible room geometry. Line 83: Line 85: ==== Room Sector Structure ==== ==== Room Sector Structure ==== + + //**Core: **''​FLOOR_INFO''//​ All the geometry specified here is //​collisional geometry//. All the geometry specified here is //​collisional geometry//. Line 110: Line 114: Also, ''<​nowiki>​RoomBelow''​ value is extensively used by engine to determine actual sector data and triggers in so-called //stacked room setups//, when one room is placed above another through collisional portal. The thing is, engine uses sector data and triggers //only for the lowest sector// of the stacked room setup, so it recursively scans for a lowest room to determine which sector to use. Also, ''<​nowiki>​RoomBelow''​ value is extensively used by engine to determine actual sector data and triggers in so-called //stacked room setups//, when one room is placed above another through collisional portal. The thing is, engine uses sector data and triggers //only for the lowest sector// of the stacked room setup, so it recursively scans for a lowest room to determine which sector to use. - ''<​nowiki>​FDindex''​ is a pointer to specific entry in [[trs:​savegame:​trs:​floordata|[FloorData]]] array, which keeps all the information about sector flags, triggers and other parameters. While it is implied that one ''<​nowiki>​FDindex''​ entry may be shared between several sectors, it is usually not the case with original Tomb Raider levels built with //TRLE//. However, //Dxtre3d// takes advantage of this feature and may optimize similar sectors to share same FDindex pointer. + ''<​nowiki>​FDindex''​ is a pointer to specific entry in [[trs:​floordata|[FloorData]]] array, which keeps all the information about sector flags, triggers and other parameters. While it is implied that one ''<​nowiki>​FDindex''​ entry may be shared between several sectors, it is usually not the case with original Tomb Raider levels built with //TRLE//. However, //Dxtre3d// takes advantage of this feature and may optimize similar sectors to share same FDindex pointer. ''<​nowiki>​BoxIndex''​ is a pointer to special [[trs:​npc_behaviour#​boxes|[Boxes]]] array entry, which is basically a subset of sectors with same height configuration. It is primarily used for AI pathfinding (see the [[trs:​npc_behaviour|Non-player character behaviour]] chapter for more details). ''<​nowiki>​BoxIndex''​ is a pointer to special [[trs:​npc_behaviour#​boxes|[Boxes]]] array entry, which is basically a subset of sectors with same height configuration. It is primarily used for AI pathfinding (see the [[trs:​npc_behaviour|Non-player character behaviour]] chapter for more details). Line 157: Line 161: ''<​nowiki>​X/​Y/​Z'' ​ are in world coordinates. ''<​nowiki>​Intensity1/​Intensity2'' ​ are almost always equal. This lighting only affects //​externally-lit// ​ objects. Tomb Raider 1 has only the first of the paired ''<​nowiki>​Intensity'' ​ and ''<​nowiki>​Fade'' ​ values. ''<​nowiki>​X/​Y/​Z'' ​ are in world coordinates. ''<​nowiki>​Intensity1/​Intensity2'' ​ are almost always equal. This lighting only affects //​externally-lit// ​ objects. Tomb Raider 1 has only the first of the paired ''<​nowiki>​Intensity'' ​ and ''<​nowiki>​Fade'' ​ values. - ''<​nowiki>​Intensity1'' ​ ranges from 0 (dark) to 0x1FFF (bright). However, some rooms occasionally have some lights with intensity greater than 0x1FFF (for example, look at room #9, 2nd light in ''<​nowiki>​level1.phd''​). ''<​nowiki>​Fade1'' ​ is the maximum distance the light shines on, and ranges from 0 to 0x7FFF. + ''<​nowiki>​Intensity1'' ​ ranges from ''​0'' ​(dark) to ''​0x1FFF'' ​(bright). However, some rooms occasionally have some lights with intensity greater than ''​0x1FFF'' ​(for example, look at room #9, 2nd light in ''<​nowiki>​level1.phd''​). ''<​nowiki>​Fade1'' ​ is the maximum distance the light shines on, and ranges from ''​0'' ​to ''​0x7FFF''​. === TR2 Room Lighting === === TR2 Room Lighting === Line 176: Line 180: ​ - ''<​nowiki>​Intensity2'' ​ and ''<​nowiki>​Fade2'' ​ values are seemingly not used. ''<​nowiki>​Intensity1'' ​ can go very well beyond 0x1FFF, right to 0x7FFF (ultra bright light). Above 0x7FFF, it is always black, so the number is pseudo-signed (negative values are always treated as zero). + ''<​nowiki>​Intensity2'' ​ and ''<​nowiki>​Fade2'' ​ values are seemingly not used. ''<​nowiki>​Intensity1'' ​ can go very well beyond ​''​0x1FFF''​, right to ''​0x7FFF'' ​(ultra bright light). Above ''​0x7FFF''​, it is always black, so the number is pseudo-signed (negative values are always treated as zero). === TR3 Room Lighting === === TR3 Room Lighting === Line 192: Line 196: ​ - ''<​nowiki>​Intensity'' ​ is the power of the light and ranges mainly from 0 (low power) to 0x1FFF (high power). Though, values greater than 0x1FFF do exist and their meanings are unknown. ''<​nowiki>​Fade'' ​ is the distance max the light can shine on. Range is mainly from 0 to 0x7FFF, but negative values do exist and their meanings are unknown. + ''<​nowiki>​Intensity'' ​ is the power of the light and ranges mainly from ''​0'' ​(low power) to ''​0x1FFF'' ​(high power). Though, values greater than ''​0x1FFF'' ​do exist and their meanings are unknown. ''<​nowiki>​Fade'' ​ is the distance max the light can shine on. Range is mainly from ''​0'' ​to ''​0x7FFF''​, but negative values do exist and their meanings are unknown. === TR4 Room Lighting === === TR4 Room Lighting === Line 276: Line 280: ''<​nowiki>​dx'',​ ''<​nowiki>​dy'' ​ and ''<​nowiki>​dz'' ​ values are used only by the //​sun// ​ and //​spot// ​ type lights. They describe the directional vector of the light. This can be obtained by: ''<​nowiki>​dx'',​ ''<​nowiki>​dy'' ​ and ''<​nowiki>​dz'' ​ values are used only by the //​sun// ​ and //​spot// ​ type lights. They describe the directional vector of the light. This can be obtained by: - * if both ''<​nowiki>​x'' ​ and ''<​nowiki>​y'' ​ $\text{LightDirectionVectorX} = \cos(X) ​* \sin(Y)$ + * if both ''<​nowiki>​x'' ​ and ''<​nowiki>​y'' ​ $\text{LightDirectionVectorX} = \cos(X) ​\cdot \sin(Y)$ * $\text{LightDirectionVectorY} = \sin(X)$ * $\text{LightDirectionVectorY} = \sin(X)$ - * $\text{LightDirectionVectorZ} = \cos(X) ​* \cos(Y)$ + * $\text{LightDirectionVectorZ} = \cos(X) ​\cdot \cos(Y)$ ''<​nowiki>​x2'',​ ''<​nowiki>​y2'',​ ''<​nowiki>​z2'',​ ''<​nowiki>​dx2'',​ ''<​nowiki>​dy2'' ​ and ''<​nowiki>​dz2'' ​ values repeat previous corresponding information in long data types instead of floats. ''<​nowiki>​x2'',​ ''<​nowiki>​y2'',​ ''<​nowiki>​z2'',​ ''<​nowiki>​dx2'',​ ''<​nowiki>​dy2'' ​ and ''<​nowiki>​dz2'' ​ values repeat previous corresponding information in long data types instead of floats. Line 302: Line 306: ''<​nowiki>​Vertex'' ​ is the coordinates of the vertex, relative to [[trs:​room_geometry#​tr_room_info|[tr_room_info]]] ''<​nowiki>​x'' ​ and ''<​nowiki>​z'' ​ values. ''<​nowiki>​Vertex'' ​ is the coordinates of the vertex, relative to [[trs:​room_geometry#​tr_room_info|[tr_room_info]]] ''<​nowiki>​x'' ​ and ''<​nowiki>​z'' ​ values. - ''<​nowiki>​Lighting'' ​ ranges from 0 (bright) to 0x1FFF (dark). This value is ignored by TR2, and ''<​nowiki>​Lighting2'' ​ is used instead with the same brightness range. + ''<​nowiki>​Lighting'' ​ ranges from ''​0'' ​(bright) to ''​0x1FFF'' ​(dark). This value is ignored by TR2, and ''<​nowiki>​Lighting2'' ​ is used instead with the same brightness range. TR2 uses an extended version of the structure: TR2 uses an extended version of the structure: Line 349: Line 353: ''<​nowiki>​Colour'' ​ value specifies vertex colour in 15-bit format (each colour occupies 5 bits). Therefore, each colour value’s maximum is //31//. You can use this code to get each colour: ''<​nowiki>​Colour'' ​ value specifies vertex colour in 15-bit format (each colour occupies 5 bits). Therefore, each colour value’s maximum is //31//. You can use this code to get each colour: - * //Red://''<​nowiki>​((Colour & 0x7C00) >> 10)''​ + * Red: ''<​nowiki>​((Colour & 0x7C00) >> 10)''​ - * //Green://''<​nowiki>​((Colour & 0x03E0) >> 5)''​ + * Green: ''<​nowiki>​((Colour & 0x03E0) >> 5)''​ - * //Blue://''<​nowiki>​(Colour & 0x001F)''​ + * Blue: ''<​nowiki>​(Colour & 0x001F)''​ === TR5 Room Vertex Structure === === TR5 Room Vertex Structure === Line 434: Line 438: In ''<​nowiki>​Rotation'' ​ field, high two bits (''<​nowiki>​0xC000''​) indicate steps of 90 degrees (e.g. ''​%%(Rotation >> 14) * 90%%''​). However, when parsing this value, no extra bitshifting is needed, as you can simply interpret it using this formula: In ''<​nowiki>​Rotation'' ​ field, high two bits (''<​nowiki>​0xC000''​) indicate steps of 90 degrees (e.g. ''​%%(Rotation >> 14) * 90%%''​). However, when parsing this value, no extra bitshifting is needed, as you can simply interpret it using this formula: - + $RealRotation ​= \frac{Rotation}{16384} \cdot -90$ - float Real_Rotation ​= (float)Rotation ​/ 16384.0f * -90; + - ​ + === TR2 Room Static Mesh Structure === === TR2 Room Static Mesh Structure === Line 509: Line 511: uint32_t Filler3; ​    // Always 0 (4 bytes) uint32_t Filler3; ​    // Always 0 (4 bytes) - uint32_t ​UnknownL6;   // ​Unknown + uint32_t ​VerticesOffset;   // ​Those fields are overwritten at level loading ​ - uint32_t ​UnknownL7;   ​// Unknown + uint32_t ​PolyOffset;       ​// by the ones present in the tr5_room struct + an offset - uint32_t ​UnknownL8;   ​// Always ​the same throughout ​the level. + uint32_t ​PolyOffset2;      // i.e. the values are not read, the fields are there for storage purposes } } ​ Line 545: Line 547: uint16_t NumZsectors; ​                                 // Width''​ of sector list uint16_t NumZsectors; ​                                 // Width''​ of sector list - ​uint16&#​95;​t ​NumXsectors; ​                                 // Height''​ of sector list + ​uint16_t ​NumXsectors; ​                                 // Height''​ of sector list tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room Line 561: Line 563: ​ - ''<​nowiki>​AmbientIntensity'' ​ is a brightness value which affects only //​externally-lit// ​ objects. It ranges from 0 (bright) to 0x1FFF (dark). + ''<​nowiki>​AmbientIntensity'' ​ is a brightness value which affects only //​externally-lit// ​ objects. It ranges from ''​0'' ​(bright) to ''​0x1FFF'' ​(dark). ''<​nowiki>​AlternateRoom'' ​ (or, as it is called in TRLE terms, //flipped room//) is the number of the room that this room can //​flip// ​ with. In the terms of the gameplay, //​flipped// ​ room is a state change of the same room — for example, empty or flooded with water, filled with sand or debris. Alternate room usually has the same boundaries as original room, but altered geometry and/or texturing. Detailed description of //alternate rooms// ​ will be provided in a separate section. ''<​nowiki>​AlternateRoom'' ​ (or, as it is called in TRLE terms, //flipped room//) is the number of the room that this room can //​flip// ​ with. In the terms of the gameplay, //​flipped// ​ room is a state change of the same room — for example, empty or flooded with water, filled with sand or debris. Alternate room usually has the same boundaries as original room, but altered geometry and/or texturing. Detailed description of //alternate rooms// ​ will be provided in a separate section. Line 582: Line 584: tr_room_portal Portals[NumPortals]; ​ // List of visibility portals tr_room_portal Portals[NumPortals]; ​ // List of visibility portals - uint16_t NumZsectors; ​                                 // Width'' ​of sector list + uint16_t NumZsectors; ​                                 // "Width" ​of sector list - ​uint16&#​95;​t ​NumXsectors; ​                                 // Height'' ​of sector list + ​uint16_t ​NumXsectors; ​                                 // "Height" ​of sector list tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room Line 626: Line 628: uint16_t NumZsectors; ​                                 // Width''​ of sector list uint16_t NumZsectors; ​                                 // Width''​ of sector list - ​uint16&#​95;​t ​NumXsectors; ​                                 // Height''​ of sector list + ​uint16_t ​NumXsectors; ​                                 // Height''​ of sector list tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room tr_room_sector SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room Line 666: Line 668: uint16_t NumZsectors; ​                                 // Width''​ of sector list uint16_t NumZsectors; ​                                 // Width''​ of sector list - ​uint16&#​95;​t ​NumXsectors; ​                                 // Height''​ of sector list + ​uint16_t ​NumXsectors; ​                                 // Height''​ of sector list tr_room_sector SectorList[NumXsectors * NumZsectors];​ // List of sectors in this room tr_room_sector SectorList[NumXsectors * NumZsectors];​ // List of sectors in this room Line 687: Line 689: ​ - ''<​nowiki>​RoomColour'' ​ replaces ''<​nowiki>​AmbientIntensity'' ​ and ''<​nowiki>​AmbientIntensity2'' ​ values from [[trs:​room_geometry#​tr2_room|[tr2_room]]] structure. Note it’s //not in [[trs:​savegame:​trs:​fundamentals#​tr_colour4|[tr_colour4]]] format//, because colour order is reversed. It should be treated as ARGB, where A is unused. + ''<​nowiki>​RoomColour'' ​ replaces ''<​nowiki>​AmbientIntensity'' ​ and ''<​nowiki>​AmbientIntensity2'' ​ values from [[trs:​room_geometry#​tr2_room|[tr2_room]]] structure. Note it’s //not in [[trs:​fundamentals#​tr_colour4|[tr_colour4]]] format//, because colour order is reversed. It should be treated as ARGB, where A is unused. - ''<​nowiki>​AlternateGroup'' ​ was introduced in TR4 to solve long-existing engine limitation, which flipped //all alternate rooms at once// ​ (see [[trs:​savegame:​trs:​floordata#​trigfunc_0x03|//flipmap// trigger action]] description in [[trs:​savegame:​trs:​floordata#​trigger_actions|Trigger actions]] section). Since TR4, engine only flips rooms which have similar index in room’s ''<​nowiki>​AlternateGroup'' ​ field and trigger operand. + ''<​nowiki>​AlternateGroup'' ​ was introduced in TR4 to solve long-existing engine limitation, which flipped //all alternate rooms at once// ​ (see [[trs:​floordata#​trigfunc_0x03|flipmap trigger action]] description in [[trs:​floordata#​trigger_actions|Trigger actions]] section). Since TR4, engine only flips rooms which have similar index in room’s ''<​nowiki>​AlternateGroup'' ​ field and trigger operand. ==== TR5 Room Structure ==== ==== TR5 Room Structure ==== Line 799: Line 801: ''<​nowiki>​RoomDataSize'' ​ is a handy value determining the size of the following data. You can use this value to quickly //parse thru// ​ to the next room. ''<​nowiki>​RoomDataSize'' ​ is a handy value determining the size of the following data. You can use this value to quickly //parse thru// ​ to the next room. - ''<​nowiki>​EndSDOffset'':​ usually this number ''<​nowiki>​+216'' ​ will give you the offset from the start of the room data to the end of the ''<​nowiki>​SectorData'' ​ section. However, it is known that this uint32_t could be equal to ''<​nowiki>​0xFFFFFFFF'',​ so to calculate the end of ''<​nowiki>​SectorData'',​ it is better to use the following value ''<​nowiki>​StartSDOffset + 216 + ((NumXSectors ​* NumZSectors)*8)''​, if you need to obtain this information. + ''<​nowiki>​EndSDOffset'':​ usually this number ''<​nowiki>​+216'' ​ will give you the offset from the start of the room data to the end of the ''<​nowiki>​SectorData'' ​ section. However, it is known that this uint32_t could be equal to ''<​nowiki>​0xFFFFFFFF'',​ so to calculate the end of ''<​nowiki>​SectorData'',​ it is better to use the following value $StartSDOffset + 216 + ((NumXSectors ​\cdot NumZSectors) ​\cdot 8)$, if you need to obtain this information. ''<​nowiki>​StartSDOffset'':​ This number ''<​nowiki>​+216'' ​ will give you the offset from the start of the room to the start of the ''<​nowiki>​SectorData'' ​ section. ''<​nowiki>​StartSDOffset'':​ This number ''<​nowiki>​+216'' ​ will give you the offset from the start of the room to the start of the ''<​nowiki>​SectorData'' ​ section. Line 811: Line 813: ''<​nowiki>​LightDataSize'' ​ is the size of the light data in bytes (//​not// ​ in [[trs:​room_geometry#​tr5_room_light|[tr5_room_light]]] units). ''<​nowiki>​LightDataSize'' ​ is the size of the light data in bytes (//​not// ​ in [[trs:​room_geometry#​tr5_room_light|[tr5_room_light]]] units). - ''<​nowiki>​Unknown6'' ​ could probably be a copy of ''<​nowiki>​ReverbInfo'' ​ (see further), as its value usually ranges from 0 to 3. + ''<​nowiki>​Unknown6'' ​ could probably be a copy of ''<​nowiki>​ReverbInfo'' ​ (see further), as its value usually ranges from 0 to 3. It is used for fog bulbs in TR5. ''<​nowiki>​RoomYTop'' ​ and ''<​nowiki>​RoomYBottom'' ​ are equal to ''<​nowiki>​yTop'' ​ and ''<​nowiki>​yBottom'' ​ values in [[trs:​room_geometry#​tr_room_info|[tr_room_info]]] structure. If room is a //null room//, both of these values are ''<​nowiki>​0xCDCDCDCD''​. ''<​nowiki>​RoomYTop'' ​ and ''<​nowiki>​RoomYBottom'' ​ are equal to ''<​nowiki>​yTop'' ​ and ''<​nowiki>​yBottom'' ​ values in [[trs:​room_geometry#​tr_room_info|[tr_room_info]]] structure. If room is a //null room//, both of these values are ''<​nowiki>​0xCDCDCDCD''​. Line 825: Line 827: ''<​nowiki>​VerticesSize'' ​ is the size of vertex data block in bytes. Therefore, it //​must// ​ be a multiple of [[trs:​room_geometry#​tr5_room_vertex|[tr5_room_vertex]]] size, else it means the block size is wrong. ''<​nowiki>​VerticesSize'' ​ is the size of vertex data block in bytes. Therefore, it //​must// ​ be a multiple of [[trs:​room_geometry#​tr5_room_vertex|[tr5_room_vertex]]] size, else it means the block size is wrong. - ''<​nowiki>​Faces'' ​ is a sequential data array for the room polygons (both [[trs:​savegame:​trs:​fundamentals#​tr_face4|[tr_face4]]] and [[trs:​savegame:​trs:​fundamentals#​tr_face3|[tr_face3]]]),​ + ''<​nowiki>​Faces'' ​ is a sequential data array for the room polygons (both [[trs:​fundamentals#​tr_face4|[tr_face4]]] and [[trs:​fundamentals#​tr_face3|[tr_face3]]]),​ <​note>​ ''<​nowiki>​Faces'' ​ array is strictly linked with ''<​nowiki>​NumLayers'' ​ value. The data is sequentially structured for each layer — at first it lists first layer’s rectangles then triangles, followed by the second layer’s rectangles and triangles, and so on, until all layers are done. ​ <​note>​ ''<​nowiki>​Faces'' ​ array is strictly linked with ''<​nowiki>​NumLayers'' ​ value. The data is sequentially structured for each layer — at first it lists first layer’s rectangles then triangles, followed by the second layer’s rectangles and triangles, and so on, until all layers are done.