Linedef

From SRB2 Wiki
Jump to navigation Jump to search
A section of Greenflower Zone Act 1 with a linedef highlighted.

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 surrounded by a closed loop of linedefs. No two linedefs may cross, and they all must be shorter than 32768 fracunits in length.

Rendering

For details on how textures are rendered, see Sidedef.

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

In the binary map format, 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

Zone Builder's linedef properties window. Click to enlarge.

Action

For a list of linedef actions, see Linedef types.

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. In UDMF maps, these are supplied via a set of arguments. In binary maps, the parameters are instead supplied via the properties of the linedef (e.g., tag, 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

See also: Tagging

This is a number chosen by the map designer that identifies the linedef for the purpose of applying special effects to it, such as linedef executors. In the binary format, only one tag can be supplied, whereas UDMF supports multiple tags. In the binary map format, linedef specials often use the linedef's tag to specify the tag of the sector, linedef or Thing that the special effect should be applied to. In UDMF, this is usually done via an argument instead.

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. In binary maps, the flags may also be used as parameters for a linedef action. In this case, they change their meaning depending on the action, and more details are given in the corresponding article for the linedef type. In Zone Builder, the names of the flags change dynamically depending on the currently 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". In UDMF maps, linedef flags are not used as parameters for linedef actions, so they always have the same meaning regardless of the linedef type.

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.
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. In binary maps, 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.

64 0x0040 Not Climbable ML_NOCLIMB Prevents climbing characters, e.g., Knuckles, from climbing walls on this linedef.
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.
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.

512 0x0200 Solid Midtexture ML_EFFECT4 (Two-sided linedefs only)

Makes the middle textures solid.

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. In binary maps, the sidedef's 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. In UDMF maps, the number of repetitions is set via the sidedef's "texture repeats" field.

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 In binary maps, this flags is used for miscellaneous purposes by specific linedef types. In UDMF maps, it is unused and inaccessible.
16384 0x4000 Bouncy Wall ML_BOUNCY Causes Objects to bounce off walls on this linedef.
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.

UDMF-only sector properties

This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

Action arguments

Alpha and rendering style

Linedef executor delay

  Map components [view]

ThingLinedefSidedefVertexNodeSectorRejectBlockmap