Tes2Mod:BLOCKS.BSA/Dungeon Block Records

Dungeon Block Records contain the block data for dungeons.  Each Dungeon Block Record describes one dungeon block, which fits into a two-dimensional grid with the other blocks of the dungeon.  There are two connecting passages in each of the four cardinal directions, so there are eight paths leading out of each block.  The architecture of the block, the doors, various action scripts and light sources, etc are all described here.  

Each Dungeon Block Record begins with a letter and is followed by a 7-digit decimal integer.  The name of Dungeon Block Records all terminate with the string ".RDB".  Ex: "N0000019.RDB".  These files are referenced in the dungeon records of MAPS.BSA.

General Format



RdbHeader
Each Dungeon Block Record begins with a 20 byte long Header structure.  


ModelReferenceList
Following the Header structure, is a contiguous list of 750 ModelReference structures.  This list must always be 750 elements long.  Unused elements are filled with 0xff.  Each element of the ModelReferenceList refers to an ARCH3D.BSA record via the ModelId field.  



ModelDataList
Next is a contiguous list of 750 records, each 4 bytes long.  They seem to correspond to the elements of the ModelReferenceList. The format of these bytes is unknown.  Unused records are filled with 0x00.

ObjectSection
The ObjectSection is a variably sized section containing a fixed-size header, a list of offsets to the Object structures, the Object structures, and any additional data such as Action structures.  



ObjectHeader



ObjectRootList
This section is a contiguous list of Int32 values, RdbHeader.Width * RdbHeader.Height elements in count.  Each entry is an offset to an Object structure.  All offsets are relative from the beginning of the Dungeon Block Record.  Negative values indicate no record is present.  The meaning of the grid layout is unknown.  

ObjectList
Following the ObjectRootList is a contiguous list of Object structures, in no particular order.  Each Object structure is a node of a doubly linked list.  Use the Object Roots Section to find the heads of the lists, and iterate using the Next and Previous fields of each head, to load the Object structures.  



ObjectType
Each specific type must be decoded differently (see tables below), based on the Type field, according to the ObjectType enumeration below.  The location of this data is reported by the Offset field.  



Type-Specific Structures
At the location specified by the Object's Offset field, the object's type-specific data is found.  Each of the three types must be decoded differently, but each is of a fixed size.  The format is reported by the Object's Type field.  

Model


LightSource


These values presumably control the color, intensity, and possibly range of the emitted light.

Flat




ActionList
Models may reference an Action structure via their ActionOffset field.  The target object (and the target object of its action, etc.) is activated simultaneously with the source object.  In this way targets can be chained together for several simultaneous effects.  



ActionType



ActionData
Rotation and Translation actions format the Action.Data field in this way: 


Axis


Rotations rotate about the Axis while translations move along them.

Doors do not appear to use the Action Record. It is not known whether teleporting walls use it. Switches, levers, and moving platforms appear to use it.

For example, in Privateer's Hold there is a switch next to a platform with a throne on it. Flipping the switch invokes the switch's action, which rotates it into the flipped position. That action targets the platform, which makes it rise. The platform's action targets the throne, which also rises. All these are performed simultaneously.