Difference between revisions of "Linedef"

From DoomWiki.org

[checked revision][checked revision]
(Linedef structure: Roll out suggested change)
m (Hexen level format: oops)
Line 70: Line 70:
 
| 12 || 2 || int16_t || style="text-align: left;" | Front Sidedef <ref group="hexen" name="side" />
 
| 12 || 2 || int16_t || style="text-align: left;" | Front Sidedef <ref group="hexen" name="side" />
 
|-
 
|-
| 14 || 2 || uint8_t || style="text-align: left;" | Back Sidedef <ref group="hexen" name="side" />
+
| 14 || 2 || int16_t || style="text-align: left;" | Back Sidedef <ref group="hexen" name="side" />
 
|}
 
|}
  

Revision as of 14:50, 11 August 2016

Linedefs are what make up the 'shape' (for lack of a better word) of a map. Every linedef is between two vertices and contains one or two sidedefs (which contain wall texture data). There are two major purposes of linedefs. The first is to divide the map into sectors, and the second is to trigger action specials.

Any area of a map directly behind a one-sided linedef is void space (which cannot be occupied except by using the idclip cheat code). A two-sided linedef is needed (to separate the two sectors) any time there is a change in (1) the height or texture of the floor or ceiling, (2) the light level, or (3) the sector tag or type.

There are three ways to trigger an action:

  1. walkover
  2. "use" (or "push") (with the space bar, by default)
  3. shoot (with an impact weapon)

Which of these applies depends on the linedef type number, which also specifies what particular action will occur.

The specified action usually will take place in the sector or sectors that have the same tag number as the linedef. Exceptions to this include local doors (which act on the sector on the other side of the line), special effects that apply to the linedef itself, and the exit-level actions.

Most actions can be specified as either once-only or repeating (by using different linedef types).

Linedef structure

Doom level format

Doom level format

Each linedef is 14 bytes long.

Offset Size in bytes C99 type [doom 1] Description
0 2 int16_t Start Vertex
2 2 int16_t End Vertex
4 2 int16_t Flags
6 2 int16_t Special Type
8 2 int16_t Sector Tag
10 2 int16_t Front Sidedef [doom 2]
12 2 int16_t Back Sidedef [doom 2]
  1. The original source code uses type short. Most source ports and modern utilities change the interpretation of vertex and sidedef indices in this structure to be unsigned. This extends the limits on vertices and sidedefs from 32768 to 65535 items.
  2. 2.0 2.1 The special value -1 (hexadecimal 0xFFFF) is used to indicate no sidedef, in one-sided lines.

Hexen level format

Each linedef is 16 bytes long.

Offset Size in bytes C99 type [hexen 1] Description
0 2 int16_t Start Vertex
2 2 int16_t End Vertex
4 2 int16_t Flags
6 1 uint8_t Special Type
7 1 uint8_t Argument 1
8 1 uint8_t Argument 2
9 1 uint8_t Argument 3
10 1 uint8_t Argument 4
11 1 uint8_t Argument 5
12 2 int16_t Front Sidedef [hexen 2]
14 2 int16_t Back Sidedef [hexen 2]
  1. The original source code uses types short and byte (an alias for unsigned char). Most source ports and modern utilities change the interpretation of vertex and sidedef indices in this structure to be unsigned. This extends the limits on vertices and sidedefs from 32768 to 65535 items.
  2. 2.0 2.1 The special value -1 (hexadecimal 0xFFFF) is used to indicate no sidedef, in one-sided lines.

Linedef flags

Linedefs contain a two-byte (16 bit) field reserved for various flags. Flags are as follows:

Doom level format

Bit Hex Description
0 0x0001 blocks players and monsters
1 0x0002 blocks monsters
2 0x0004 two sided
3 0x0008 upper texture is unpegged
4 0x0010 lower texture is unpegged
5 0x0020 secret (shows as one-sided on

automap), and monsters cannot open if it is a door (type 1)

6 0x0040 blocks sound
7 0x0080 never shows on automap
8 0x0100 always shows on automap

Boom level format

Boom added one flag to Doom's linedef flags:

Bit Hex Description
9 0x0200 The "use" action can activate other linedefs in the back (in Doom the "use" action only activates the closest linedef in the line of sight). Usually called "PassThru".

Hexen level format

All Doom flags and also the following:

Bit Hex Description
9 0x0200 can be activated more than once
10-12 0x0400 activated when used by player
10-12 0x0800 activated when crossed by monster
10-12 0x0C00 activated when hit by projectile
10-12 0x1000 activated when player bumps into it
10-12 0x1400 activated when crossed by projectile
10-12 0x1800 activated when used by player (with

pass through)

13 0x2000 line can be activated by players and

monsters

14 0x4000
15 0x8000 blocks everything (includes

gunshots & missiles)

See also