A flat is a graphic that is displayed on the floor or ceiling surfaces of a sector in a map. Like other graphics, flats are stored as lumps in WAD files and then referenced by name in the maps that use them. To ensure that flats flow into each other smoothly, the game always aligns them to a fixed grid. In situations where the default alignment is unwanted, linedef type 7 can be used to displace or rotate the flats of a sector.
Flats are simply stored as lumps of raw data. Instead of storing the color value of each pixel directly, flats simply store an index number that corresponds to an entry in the game's palette of 256 colors. Therefore, changing the palette that is used by the game will also change the appearance of all flats. If SRB2's palette is applied onto an image using a graphics editing program such as Paint Shop Pro, they will display in the same colors as they do in the game.
Unlike textures, it is not normally possible for flats to have transparent pixels. If this is wanted, the color cyan, which is present at index 247 in SRB2's palette, must be used on the pixels that should turn transparent. Then, if the flat is used on a translucent FOF (such as linedef type 102) with an alpha of
#255, these pixels will not be drawn. However, this means the color cyan itself cannot be used as a normal color on flats that are intended to be used with such FOFs, whether or not any pixels on them are meant to be transparent. Otherwise, flats are free to use cyan as a normal color for pixels rather than for transparency.
For easy navigability and in order to make lump editors and SRB2 itself recognize them as such, flats are stored in a WAD file between empty marker lumps called
F_END. The alternative marker lumps
FF_END are also supported by SRB2, but the former pair are generally favored.
Flats can only have a few specific sizes. In the original Doom engine, only square flats with 4096 bytes (a 64×64-pixel image) were permitted. As such, many WAD editors only support flats of this size and cannot import bigger or smaller images. SRB2, however, supports flat sizes ranging from 32×32 to 2048×2048, but the flats must still be square, and their dimensions must still be powers of 2.
|Flat dimensions||Lump size (bytes)||Lump size (kb)|
Programs to import flats
Managing flats is a common tool in lump editors. Most of them will convert BMP and/or PNG files to the flat format Doom recognizes. However, some of them only recognize 64×64-pixel flats, while others also support specific additional sizes. Below is a list of common editors along with the image sizes they can import:
|XWE (older versions)||64×64|
|XWE (newest beta)||64×64, 128×128, 256×256|
1 By default, SLADE supports all flat sizes for SRB2 except for 32×32; flats of this size will not be displayed properly. However, this can be fixed manually by opening up
slade.pk3 in the folder for SLADE (using SLADE itself), going to the path
config/entry_types and modifying the
types_gfx_doom.txt file. Here, "1024" must be added to the list of numbers for the "size" attribute in the
gfx_flat section of the file – this number corresponds to the lump size for 32×32 flats. After saving the changes and reopening SLADE, flats of this size will be displayed properly.
LumpMod is a special case since it is only able to import pre-processed flats into WAD files and cannot convert image files itself.