Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
trs:room_geometry [2020/05/23 15:16]
zdimension [TR5 Room Structure]
trs:room_geometry [2020/05/25 12:26] (current)
zdimension
Line 118: Line 118:
 ''<​nowiki>​BoxIndex</​nowiki>''​ 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</​nowiki>''​ 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).
  
-{{:​icons:​tr3.png?​nolink&​}}{{:​icons:​tr4.png?​nolink&​}}{{:​icons:​tr5.png?​nolink&​}}In these games, ''<​nowiki>​BoxIndex</​nowiki>''​ field is more complicated, and actually contains ​//two packed values//. Bits 4..14 contain the //actual ​box index//, and bits 0..contain ​//material index//, which is used to produce specific footstep sound, when Lara is walking or running in this sector. On PlayStation game versions, this index was also used to determine if footprint textures should be applied to this particular place. Both procedures are invoked via ''​FOOTPRINT_FX''​ flipeffect, which is described in [[trs:​miscellany#​flipeffects|corresponding section]].+{{:​icons:​tr3.png?​nolink&​}}{{:​icons:​tr4.png?​nolink&​}}{{:​icons:​tr5.png?​nolink&​}}In these games, ''<​nowiki>​BoxIndex</​nowiki>''​ field is more complicated
 + 
 +<code cpp> 
 +struct tr3_room_sector ​// 8 bytes 
 +
 +    uint16_t FDindex; ​   ​// Index into FloorData[] 
 +    uint16_t Material : 4// Material index, used 
 +    uint16_t Box : 11; // Actual ​box index 
 +    uint16_t Stopper : 1; 
 +    uint8_t ​ RoomBelow;  ​// 255 is none 
 +    int8_t ​  ​Floor; ​     // Absolute height of floor 
 +    uint8_t ​ RoomAbove; ​ // 255 if none 
 +    int8_t ​  ​Ceiling; ​   // Absolute height of ceiling 
 +}; 
 +</​code>​ 
 + 
 +^ Hex value ^ ''​%%0x8000%%''​ ^ ''​%%0x7FF0%%''​ ^^^^^^^^^^^ ''​%%0x000F%%''​ ^^^^ 
 +^ Bit ^ 15 ^ 14 ^ 13 ^ 12 ^ 11 ^ 10 ^ 9 ^ 8 ^ 7 ^ 6 ^ 5 ^ 4 ^ ^ 2 ^ 1 ^ 0 ^ 
 +^ Field |  ''​%%Stopper%%'' ​ |  ''​%%Box%%'' ​ ||||||||||| ​ ''​%%Material%%'' ​ |||| 
 + 
 +''​Material''​ is the //material index//, which is used to produce specific footstep sound, when Lara is walking or running in this sector. On PlayStation game versions, this index was also used to determine if footprint textures should be applied to this particular place. Both procedures are invoked via ''​FOOTPRINT_FX''​ flipeffect, which is described in [[trs:​miscellany#​flipeffects|corresponding section]].
  
 Majority of //material index// values are the same across game versions, but some of them exist only in particular game. Here is the description:​ Majority of //material index// values are the same across game versions, but some of them exist only in particular game. Here is the description:​
  
-   * **0** — Mud+  ​* **0** — Mud
   * **1** — Snow (TR3 and TR5 only)   * **1** — Snow (TR3 and TR5 only)
   * **2** — Sand   * **2** — Sand
Line 138: Line 158:
 Mud, snow, sand, grass and maybe some other materials produce footprints in PlayStation version. Mud, snow, sand, grass and maybe some other materials produce footprints in PlayStation version.
  
-Furthermore,​ in TR3-5, //actual box index// ​ may contain special value 2047, which is most likely indicates that this sector is a slope on which Lara can slide (and, therefore, possibly impassable by most NPCs).+Furthermore,​ in TR3-5, //actual box index// ​ may contain special value 2047 (full 1s), which is most likely indicates that this sector is a slope on which Lara can slide (and, therefore, possibly impassable by most NPCs).
  
 ==== Room Light Structure ==== ==== Room Light Structure ====
Line 660: Line 680:
     uint16_t NumZsectors; ​                                 // ``Width''​ of sector list     uint16_t NumZsectors; ​                                 // ``Width''​ of sector list
     uint16_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+    ​tr3_room_sector ​SectorList[NumXsectors * NumZsectors]; ​ // List of sectors in this room
  
     int16_t AmbientIntensity; ​ // Affects externally-lit objects     int16_t AmbientIntensity; ​ // Affects externally-lit objects
Line 701: Line 721:
     uint16_t NumZsectors; ​                                 // ``Width''​ of sector list     uint16_t NumZsectors; ​                                 // ``Width''​ of sector list
     uint16_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+    ​tr3_room_sector ​SectorList[NumXsectors * NumZsectors];​ // List of sectors in this room
  
     uint32_t RoomColour; ​       // In ARGB format!     uint32_t RoomColour; ​       // In ARGB format!
Line 745: Line 765:
  
     uint16_t* NumPortals; // points to tr5_room_data.NumPortals     uint16_t* NumPortals; // points to tr5_room_data.NumPortals
-    ​tr_room_sector* SectorList; // points to tr5_room_data.SectorList+    ​tr3_room_sector* SectorList; // points to tr5_room_data.SectorList
  
     tr5_room_light* Lights; ​    // points to tr5_room_data.Lights     tr5_room_light* Lights; ​    // points to tr5_room_data.Lights
Line 829: Line 849:
     tr5_room_light Lights[NumLights]; ​   // Data for the lights (88 bytes * NumRoomLights)     tr5_room_light Lights[NumLights]; ​   // Data for the lights (88 bytes * NumRoomLights)
     tr5_fog_bulb FogBulbs[NumFogBulbs]; ​     // Data for the fog bulbs (36 bytes * NumFogBulbs)     tr5_fog_bulb FogBulbs[NumFogBulbs]; ​     // Data for the fog bulbs (36 bytes * NumFogBulbs)
-    ​tr_room_sector ​SectorList[NumXSectors * NumZSectors];​ // List of sectors in this room+    ​tr3_room_sector ​SectorList[NumXSectors * NumZSectors];​ // List of sectors in this room
  
     uint16_t NumPortals; ​                // Number of visibility portals to other rooms     uint16_t NumPortals; ​                // Number of visibility portals to other rooms
trs/room_geometry.1590239783.txt.gz · Last modified: 2020/05/23 15:16 by zdimension
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0