BM files store textures used in a variety of ways in DF.
They serve as wall textures, as floor and ceiling textures (in which case they must be 64*64), as 3DO facet textures, as weapons, and as the Heads Up Display.
Here is the data structure for the BM file header.
BM_Header IS
{
| MAGIC | char[4] | // = 'BM ' + 0x1E |
| SizeX | int | // if = 1 then multiple BM in the file |
| SizeY | int | // EXCEPT if SizeY also = 1, in which case // it is a 1x1 BM |
| idemX | int | // unused by engine |
| idemY | int | // unused by engine |
| Transparent | byte | // 0x36 for normal // 0x3E for transparent // 0x08 for weapons |
| logSizeY | byte | // logSizeY = log2(SizeY) // logSizeY = 0 for weapons |
| Compressed | int | // 0 = not compressed
// 1 = compressed (RLE) // 2 = compressed (RLE0) |
| DataSize | long | // Data size for compressed BM
// excluding header and columns starts table // If not compressed, DataSize is unused |
| pad1 | byte[12] | // 12 times 0x00 |
}
Please note that BM must have height and width which are powers of 2 (except weapons).
The data follows, encoded by COLUMNS from the bottom to the top.
See also: