|Doom level format
A subsector is a range of seg (linedef segment) numbers. These segs form part (or all) of a single sector. Each subsector is constructed so that when a player is anywhere within a particular subsector, no part of any one seg will block the view of any other in that subsector.
A subsector can be considered to be a convex polygon, but some of its edges may be implicit. This is because segs are generated only where linedefs already exist. (It is not uncommon for a subsector to consist of a single seg.) The Doom engine uses the partition lines in the nodes structure to determine which subsector any particular point lies in.
Subsectors are referenced from the nodes lump.
|First seg number
The subsectors and segs are both stored in sequential order. That is, the seg numbers in subsector 0 are 0 through N0 - 1 (where N0 is the subsector 0 seg count), the seg numbers in subsector 1 are N0 through N0 + N1 - 1 (where N1 is the subsector 1 seg count), and so on.
At level load time, the sector that each subsector is a part of is determined by looking at the first seg, and a link to this sector is saved in the internal subsector data structure.