Seg

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
The direction field may be interpreted as a "side flag": direction=0 indicates the seg runs along the "right" or front side of the linedef; direction=1 indicates it runs along the "left" or back side.

Note that the original source code utilizes the C type, for a signed 2-byte integer, for each of the fields in this structure. This imposes a limit of 32786 vertices and linedefs in a map. Many limit-removing source ports and modern editing utilities change the interpretation of the vertex numbers and linedef number to unsigned in order to support larger maps with up to 65536 vertices and 65535 linedefs (one less linedef is available due to linedefs' inability to address more than 65535 sidedefs).

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.

Source

 * Unofficial Doom Specs