Doom Wiki

SEGS (an abbreviation for segments) is the name of a WAD lump which is a component of a level. It is normally generated automatically from other data for the level using a node builder tool.

Segs are segments of linedefs, and describe the portion of a linedef that borders the subsector that the seg belongs to.

Initially, one seg is created for each one-sided linedef, and two segs are created for each two-sided linedef (one for each side). If the area that a seg borders is later divided into two different subsectors, then a new vertex is created at the division point and the seg is split into two at that vertex. The segs are stored in sequential order corresponding to subsector number. The seg entries are referenced from the subsector entries, which are referenced from the nodes lump.

Seg structure

Offset Size (bytes) Description
0 2 Starting vertex number
2 2 Ending vertex number
4 2 Angle
6 2 Linedef number
8 2 Direction: 0 (same as linedef) or 1 (opposite of linedef)
10 2 Offset: distance along linedef to start of seg

The direction field may be interpreted as a "side flag": direction=0 indicates the seg runs along the right side of the linedef; direction=1 indicates it runs along the left side.

Drawsegs overflow

While constructing a frame, the segs to be drawn are stored for later rendering. In vanilla Doom, they are kept in a static array 256 elements long, and if a frame requires more segs than this, the excess segs are simply not drawn.

See also