Daggerfall Mod:BLOCKS.BSA/Map Block Records
Map Block Records describe the exterior block data for locations from MAPS.BSA. Each Map Block Record describes one exterior block, which fits into a two-dimensional grid with the other blocks for that location's exterior. The architecture, the doors, the automap, flats, etc are all here.
Each Map Block Record name must be one of the defined combinations found in Block Record Indexes and must end with the string ".RMB". Ex: "TVRNAL00.RMB".
General File Layout[edit]
The Map Block Record (RMB) is the most common type found in the file. It is a variably sized record, but the RmbHeader is fixed at 6776 bytes long. This contains all the necessary information to compute the record's total length. It is a composite structure organized as follows:
RmbHeader |
---|
BlockList |
?ModelList |
?FlatList |
RmbHeader[edit]
Each Map Block Record begins with a 6776 byte long header structure. This structure itself is a composite structure organized as follows:
ObjectCount |
---|
BlockPositionList |
BuildingDataList |
Section2 |
GroundData |
Automap |
FileNameList |
These substructures are contiguous within the RmbHeader; this is to say the FileNameList immediately follows the Automap. Some of these subsections are to be subdivided into 32 further subrecords as described in each section below.
ObjectCount[edit]
This structure reports the counts of the variably-sized data which compose the Map Block Record.
Offset | Type | Name | Description |
---|---|---|---|
0 | UInt8 | BlockCount | This field reports the number of Block structures. This value must be less-than-or-equal to 32. |
1 | UInt8 | ModelCount | This field reports the number of Model structures. |
2 | UInt8 | FlatCount | This field reports the number of RecordFlat structures. |
BlockPositionList[edit]
The BlockPositionList is a contiguous list of 32 BlockPosition structures, each 20 bytes long. Only ObjectCount.BlockCount elements are used; the remainder may be ignored but all 32 must be read. The BlockPosition structure is detailed below:
Offset | Type | Name | Description |
---|---|---|---|
0-3 | UInt32 | Unknown1 | Unknown Purpose. |
4-7 | UInt32 | Unknown2 | Unknown Purpose. |
8-11 | Int32 | X | Gives the X position of the block in map coordinates. |
12-15 | Int32 | Z | Gives the Z position of the block in map coordinates. |
16-19 | Int32 | RotationAngle | This values specifies, in Daggerfall Angles (Da), how the block (including all meshes, flats, etc.) should be rotated about the Y-axis. See Angle Mathematics. |
BuildingDataList[edit]
Found immediately following the BlockPositionList is a contiguous list of 32 BuildingData elements, as found in MAPS.BSA.
Section2[edit]
Immediately following the BuildingDataList is the following structure:
Offset | Type | Name | Description |
---|---|---|---|
0-127 | UInt32[ 32 ] | BlockPtr | Reserved. |
128-255 | UInt32[ 32 ] | BlockSize | Indicates the size in bytes of the Block elements which follow. Only ObjectCount.BlockCount elements are used; the remaining elements may be ignored but all 32 must be read. |
256-259 | UInt32 | ModelPtr | Reserved. |
260-263 | UInt32 | FlatPtr | Reserved. |
GroundData[edit]
The GroundData structure immediately follows the BlockSizeList. This 512 byte fixed-size structure is a composite structure which specifies the ground textures and one additional piece of unknown data.
GroundTextureList |
---|
GroundDecoration |
GroundTextureList[edit]
Following the GroundDataHeader structure is a contiguous list of 256 GroundTexture structures, each a 1 byte long. These are to be considered a 16x16 GroundTexture grid, detailed as follows:
bits | Name | Description |
---|---|---|
0-5 | TextureIndex | This value, ranging from 0-63, gives the new texture index to display. The texture file to use will depend on the current location (desert, temperate, etc…) and the time (raining, summer, winter, etc…). |
6-7 | Rotation | Indicates that the texture is rotated Rotation * 90° counterclockwise. |
GroundDecoration[edit]
Immediately following the GroundTextureList is a byte array, 256 bytes long. It corresponds to the same 16x16 grid.
bits | Name | Description |
---|---|---|
0-1 | Unknown | Some bitflag. |
2-7 | Decoration | Index of a decoration to place, increased by 1. |
The unspecified bytes seem to have a value of 0xff.
Automap[edit]
Immediately following the GroundData are 4096 bytes used to generate a 64x64 pixel bitmap. This is the location's automap, as displayed in the game. The bitmap does not control the placement of any architecture; it is merely displayed to the user. Value 0x00 indicates a transparent pixel; otherwise subtract one from the value and it conforms to the Building Type enumeration values. Ship, Special1, Special2, Special3, and Special4 are never displayed on the automap.
FileNameList[edit]
Offset | Type | Name | Description |
---|---|---|---|
0-12 | 7-bit ASCII string | BlockFileName | This null-terminated 8.3 (13 total characters) filename seems to be the name of the block record itself, as it would exist as a separate file. |
13-428 | 7-bit ASCII string[ 32 ] | FileNameList | This is an array of null-terminated 8.3 filenames (13 total characters each). The list itself is not null-terminated since it is a fixed size. |
BlockList[edit]
Following the RmbHeader is a contiguous list Block structures, RmbHeader.ObjectCount.BlockCount elements in count. The byte length of each element is reported by the BlockSizeList.
A Block structure is a composite structure containing two BlockData structures; the first structure defines the exterior of the block and the second BlockData structure defines the interior of the block. A Block structure is variably-sized. The size of each Block structure is provided by the BlockSizeList in the RmbHeader via ordinal index; that is to say the second element of the BlockSizeList declares the size of the second Block element of the BlockList. Therefore these two lists must be synchronized for proper operation.
Fundamental Structures[edit]
Before delving into the Block structure it is important to understand some basic types used by Daggerfall.
BlockSectionBase[edit]
This structure is used as a base template for the Section3, Flat, Person, and Door structures. The format is as follows:
Offset | Type | Name | Description |
---|---|---|---|
0-11 | Point | Position | This is a standard Daggerfall Point structure, as defined in ARCH3D.BSA. |
12-13 | UInt16 | BaseField1 | This field is overloaded in each of the derived structures. |
14-15 | UInt16 | BaseField2 | This field is overloaded in each of the derived structures. |
The structures which rely on BlockSectionBase each redefine the BaseField1 and BaseField2 fields for their own specific purposes.
Section3[edit]
The Section3 structure is a standard BlockSectionBase, with the following redefinitions:
Original Field Name | New Field Name | Description |
---|---|---|
BaseField1 | Unknown1 | Unknown Purpose |
BaseField2 | Unknown2 | Unknown Purpose |
Door[edit]
The Door structure both extends and redefines the BlockSectionBase. These describe the doors which one may open and close within a scene, such as those found in buildings.
Offset | Type | Name | Description |
---|---|---|---|
0-15 | BlockSectionBase | RootData | This is the core data, with field redefinitions below. |
16-17 | UInt16 | Unknown2 | Unknown purpose. |
18 | UInt8 | NullValue | This value is always 0x00. |
Original Field Name | New Field Name | New Field Type | Description |
---|---|---|---|
BaseField1 | Unknown1 | UInt16 | Unknown purpose. |
BaseField2 | RotationAngle | Int16 | The angle of rotation the door should swing about her hinges in Degrees. See Angle Mathematics. |
FlatBase[edit]
The FlatBase structure is an extension of the BlockSectionBase. The structure is as follows:
Offset | Type | Name | Description |
---|---|---|---|
0-15 | BlockSectionBase | RootData | This is the core data, with field redefinitions below. |
16 | UInt8 | Flag | Unknown purpose. |
Original Field Name | New Field Name | Description |
---|---|---|
BaseField1 | Texture | This field is a standard Daggerfall Texture structure, as defined in ARCH3D.BSA. |
Flat[edit]
Flat structures redefine the FlatBase structure. Flat structures are just that: merely textures painted on planes which always face the viewer (often called "decals" or "billboards" in Direct3D or OpenGL).
Original Field Name | New Field Name | Description |
---|---|---|
BaseField2 | Unknown1 | Unknown Purpose. |
Person[edit]
Person structures redefine the FlatBase structure. These are the people with whom the character may interact (receive quests, ask for directions, etc).
Original Field Name | New Field Name | Description |
---|---|---|
BaseField2 | FactionId | The specific faction to which this person represents. For vaild FactionIDs see here. |
Model[edit]
The Model structure is a composite structure which reports the 3D object information for the block.
Offset | Type | Name | Description |
---|---|---|---|
0-2 | ModelId | ModelId | This field specifies which record should be loaded from ARCH3D.BSA. |
3 | UInt8 | Unknown1 | Unknown Purpose. |
4-7 | UInt32 | Unknown2 | Unknown Purpose. Non-zero only in 1297 of 236250 records. Seems to repeat within the same file. Could be two or four separate fields. |
8-13 | UInt32 | Unknown3 | Unknown Purpose. |
14-17 | UInt32 | Unknown4 | Unknown Purpose. Non-zero only in 272 of 236250 records. Seems to repeat within the same file. Could be two or four separate fields. |
16-23 | UInt64 | NullValue1 | Always 0x0000000000000000. |
24-35 | Point | Point1 | A coordinate of some form. Only 370 records have non-zero values. Most likely an input into a translation matrix. |
36-47 | Point | Point2 | The coordinates used for placing the model within the scene. |
48-51 | UInt32 | NullValue2 | Always 0x00000000. |
52-53 | Int16 | RotationAngle | This values specifies, in Daggerfall Angles (Da), how the model should be rotated about her Y-axis. See Angle Mathematics. |
54-55 | UInt16 | Unknown5 | Unknown Purpose. |
56-59 | UInt32 | Unknown6 | Unknown Purpose. |
60-63 | UInt32 | Unknown8 | Unknown Purpose. Only non-zero in "CUSTAA45.RMB", where it is 0x00000200. CUSTAA45.RMB is referenced only by Wayrest. |
64-65 | UInt16 | NullValue4 | Always 0x0000. |
The ModelId structure is used to reference an ARCH3D.BSA record.
Offset | Type | Name | Description |
---|---|---|---|
0-1 | UInt16 | Id1 | This is combined with Id2 to calculate the RecordId for the model from ARCH3D.BSA, as below. |
2 | UInt8 | Id2 | This is combined with Id1 to calculate the RecordId for the model from ARCH3D.BSA, as below. |
To compute the RecordId for the ARCH3D.BSA record to which this structure refers, multiply Id1 by 100 and add Id2: ( Id1 * 100 ) + Id2
.
BlockDataHeader[edit]
The BlockDataHeader structure reports the counts of Models, Flats, etc. found within the BlockData the header describes.
Offset | Type | Name | Description |
---|---|---|---|
0 | UInt8 | ModelCount | The count of Model elements within the BlockData structure. |
1 | UInt8 | FlatCount | The count of Flat elements within the BlockData structure. |
2 | UInt8 | Section3Count | The count of Section3 elements within the BlockData structure. |
3 | UInt8 | PersonCount | The count of Person elements within the BlockData structure. |
4 | UInt8 | DoorCount | The count of Door elements within the BlockData structure. |
5-16 | UInt32[3] | Pointers | Reserved. |
BlockData[edit]
A BlockData structure is a composite structure containing a BlockDataHeader, and the data described by that header.
BlockDataHeader | A single BlockDataHeader. |
---|---|
ModelList | Contiguous list of Model structures. |
FlatList | Contiguous list of Flat structures. |
Section3List | Contiguous list of Section3 structures. |
PersonList | Contiguous list of Person structures. |
DoorList | Contiguous list of Door structures. |
The count for each of the list is provided by the BlockDataHeader structure.
Block[edit]
A Block structure is a composite structure which defines all external and internal elements for the block. It consists of two BlockData structures. Some records include an additional padding byte, which editors can safely ignore and omit. The BlockSize array
Type | Name | Description |
---|---|---|
BlockData | Exterior | This section describes the exterior data for the block. This would be the models and textures for the exterior of the tavern or house, as well as any flats such as sign posts or kittens. |
BlockData | Interior | This section describes the interior data for the block. This would be the models and textures for the interior of the tavern or house, as well as any flats such as prostitutes or barkeeps. |
ModelList[edit]
Following the BlockList, there is a contiguous list of Model elements. These further decorate the scene described by the current block. Models can be placed arbitrarily within the scene via this list, rather than associating them with specific BlockData elements. There are RmbHeader.ObjectCount.ModelCount elements.
FlatList[edit]
Following the ModelList, there is a contiguous list of Flat elements. These further decorate the scene described by the current block. Flats can be placed arbitrarily within the scene via this list, rather than associating them with specific BlockData elements. There are RmbHeader.ObjectCount.FlatCount elements.