Linedef

A linedef is a map component that connects two vertices on a map in a straight line. Linedefs mark the boundaries between sectors, and a typical sector is defined by a closed loop of linedefs. No two linedefs may cross, and they all must be shorter than 32768 fracunits in length.
Rendering
Somewhat contrary to intuition, linedefs themselves are not rendered by the game engine. Instead, each linedef is associated with one or two sidedefs, which set the textures displayed on the front and back side of the linedef. Every linedef must have a front sidedef; the sector it faces is called the front sector. Most linedefs also have a back sidedef, which faces the back sector. However, linedefs that form the boundary of the map have a back side that faces into empty space which the player cannot enter, rather than a back sector; these linedefs do not need a back sidedef (except if they use a special effect that requires it) and are thus called one-sided linedefs. These settings are normally automatically set by the map editor.
Relationship to sectors
The sectors to which a linedef belongs are not determined by the geometrical structure of the map, but by the sector references of the linedef's sidedefs. This allows sectors to be disjoint. However, it also means that illegal sector configurations such as unclosed sectors are possible (for example, multiple linedefs facing the same region but with different sector references on the relevant sidedefs), which can lead to crashes. Such circumstances can often arise when deleting linedefs in such a way that the map editor does not correct the sector references automatically. In these cases, the mapper has to correct the references manually.
Specification
The linedefs of a map are stored in the LINEDEFS
lump as a list. Each linedef has a 14-byte entry consisting of the following:
Bytes | Data type | Description |
---|---|---|
0–1 | Signed 16-bit integer | Beginning vertex |
2–3 | Signed 16-bit integer | Ending vertex |
4–5 | Signed 16-bit integer | Flags |
6–7 | Signed 16-bit integer | Action |
8–9 | Signed 16-bit integer | Tag |
10–11 | Unsigned 16-bit integer | Front sidedef |
12–13 | Unsigned 16-bit integer | Back sidedef (or 0xFFFF if the linedef has no back sidedef)
|
Linedef properties

Action
Also known as linedef type, linedef special or linedef effect, this property is a number that specifies a special effect. Some actions directly affect the linedef itself, while others affect a specified target sector, the player, or other Objects or events in the game. Many linedef actions depend on additional parameters, which are supplied via the properties of the linedef (e.g., length or flags), its sidedefs (e.g., texture offsets) or its adjacent sectors (e.g., floor or ceiling height). Because of this, linedefs with special actions that do not affect the linedef itself should usually be placed in a control sector outside of the playable part of the map, so that the properties of the control sector and its linedefs do not interfere with the layout of the map. Linedefs without a special effect have linedef type 0.
Tag
This property specifies which sector(s) the linedef action will affect. The effect will be applied to all sectors whose tags match this property. Certain effects, such as the Change Music special, do not affect specific sectors; in this case, the tag can be left as 0. Note that if a linedef that needs a tag is tagged with 0, it will affect all sectors with tag 0, which are generally considered "untagged". Certain linedefs can be tagged with 65535 to affect all sectors in the map. This is useful for certain visual effects that should apply to the whole map.
Flags
Linedef flags are used to give special properties to a linedef or the effect it exhibits. The table below lists the normal significance of the linedef flags. For some linedef specials, the flags have different meanings. In those cases, the effects will be listed in the corrsponding article for the linedef type. Note that in Zone Builder, the names of certain flags change dynamically, depending on the current selected linedef action. For example, when viewing a linedef with the Bustable Block special selected, the flag "[6] Not Climbable" becomes "[6] Strong characters only".
Decimal | Hexadecimal | Editor name | Internal name | Description |
---|---|---|---|---|
1 | 0x0001
|
Impassable | ML_IMPASSIBLE
|
Makes the linedef impassable for the player and other Objects. |
2 | 0x0002
|
Block Enemies | ML_BLOCKMONSTERS
|
Prevents almost all moving enemies and bosses from crossing the linedef. Does not prevent enemies from detecting the player if the linedef is between them. This flag is also often used for other purposes by specific linedef types. |
4 | 0x0004
|
Double-Sided | ML_TWOSIDED
|
Indicates that a linedef has a back sidedef, i.e., that its back side does not face into empty space. This flag is normally set automatically by map editors. |
8 | 0x0008
|
Upper Unpegged | ML_DONTPEGTOP
|
(Two-sided linedefs only)
If this flag is set, the upper textures are attached to the higher of the two ceilings that border the linedef. Otherwise, they are attached to the lower of the two ceilings. See Pegging. This flag is also used to make timed linedef executors and to enable texture skewing on FOFs. |
16 | 0x0010
|
Lower Unpegged | ML_DONTPEGBOTTOM
|
(Two-sided linedefs only)
If this flag is set, the lower textures are attached to the lower of the two floors that border the linedef, and the middle textures are attached to the higher of the two floors. Otherwise, the lower textures are attached to the higher of the two floors, and the middle textures are attached to the lower of the two ceilings that border the linedef. See Pegging. |
32 | 0x0020
|
Slope Skew | ML_EFFECT1
|
(Two-sided linedefs only)
If any of the linedef's upper or lower textures are attached to a slope, setting this flag will cause them to be skewed to match the angle of the slope. See Slope > Texture skewing for further details. This flag is also often used for other purposes by specific linedef types. |
64 | 0x0040
|
Not Climbable | ML_NOCLIMB
|
Prevents climbing characters, e.g., Knuckles, from climbing walls on this linedef. This flag is also often used for other purposes by specific linedef types. |
128 | 0x0080
|
No Midtexture Skew | ML_EFFECT2
|
If the middle textures are attached to a slope, they will usually be skewed to match the angle of the slope. Setting this flag disables the skewing effect. See Slope > Texture skewing for further details. This flag is also often used for other purposes by specific linedef types. |
256 | 0x0100
|
Peg Midtexture | ML_EFFECT3
|
(Two-sided linedefs only)
Inverts the pegging behavior of the middle textures. If the middle textures would be attached to the ceiling otherwise, setting this flag will make them attach to the floor. If they would be attached to the floor otherwise, setting this flag will make them attach to the ceiling. This flag is also often used for other purposes by specific linedef types. |
512 | 0x0200
|
Solid Midtexture | ML_EFFECT4
|
(Two-sided linedefs only)
Makes the middle textures solid. This flag is also often used for other purposes by specific linedef types. |
1024 | 0x0400
|
Repeat Midtexture | ML_EFFECT5
|
(Two-sided linedefs only)
Tiles the middle textures so that they fill up the empty space between the upper and lower texture, rather than just being rendered once. Additionally, the X offset can be used to control how often the texture is tiled: For each extra copy of the texture, 4096 should be added to the X offset. For example, an offset of 8192 will cause the texture to be rendered three times. This flag is also often used for other purposes by specific linedef types. |
2048 | 0x0800
|
Netgame Only | ML_NETONLY
|
Prevents a linedef action from having an effect in Single Player games. |
4096 | 0x1000
|
No Netgame | ML_NONET
|
Prevents a linedef action from having an effect in multiplayer games. |
8192 | 0x2000
|
Effect 6 | ML_EFFECT6
|
Used for miscellaneous purposes by specific linedef types. |
16384 | 0x4000
|
Bouncy Wall | ML_BOUNCY
|
Causes Objects to bounce off walls on this linedef. This flag is also occasionally used for other purposes by specific linedef types. |
32768 | 0x8000
|
Transfer Line | ML_TFERLINE
|
Allows the attributes for each side of an FOF to be specified individually, rather than using the attributes of the control linedef for every side. The control sector must have at least the same number of linedefs as the target sector(s); each linedef of the target sector(s) is then controlled by one linedef of the control sector. Useful for making multi-property FOFs where each side has its own properties. |
Map components | [view] | |
Thing • Linedef • Sidedef • Vertex • Node • Sector • Reject • Blockmap |