Difference between revisions of "Sector"

From DoomWiki.org

[unchecked revision][checked revision]
(fixup)
m (Sources: add Doom 64 source)
(21 intermediate revisions by 10 users not shown)
Line 1: Line 1:
A '''sector''' is an area referenced by [[sidedef]]s on the [[linedef]]s.  Sectors should be closed areas, meaning that all the sidedefs that reference a particular sector should make up a closed shape.  Unclosed sectors can be used for a few special effects, but under many circumstances they can cause undesirable results (including crashes).
+
A '''sector''' is an area referenced by [[sidedef]]s on the [[linedef]]s.  Sectors should be closed areas, meaning that all the sidedefs that reference a particular sector should make up a closed shape.  Unclosed sectors can be used for a few special effects, but under some circumstances they can lead to undesirable results (including crashes).
 +
 
 +
A sector does not have to be a single polygon. For instance, two squares can be separate and non-contiguous, but still be part of the same sector.
  
 
A sector entry specifies the following:
 
A sector entry specifies the following:
Line 13: Line 15:
 
'''Lighting''' - How bright the sector is.
 
'''Lighting''' - How bright the sector is.
  
'''Sector tag''' - A number that makes this sector a target of the action specified by any linedef with the same [[tag]] number. Used, for example, to alter the sector's ceiling and/or floor height, lighting level or flats.
+
'''Sector tag''' - A number that makes the sector a target of the action specified by any linedef with the same [[tag]] number. Used, for example, to alter the sector's ceiling and/or floor height, lighting level or flats.
  
'''Sector type''' - A defining property of the sector.  This is used to give a sector a [[damaging floor]] (for things like [[lava]] and slime), have the sector's light level change constantly, enable wind or currents or even push the player in a certain direction. See below.
+
'''Sector type''' - Special properties of the sector.  This is used to give the sector a [[damaging floor]] (for things like [[lava]] and slime), have the sector's light level change constantly, enable wind or currents or even push the player in a certain direction. See below.
  
 
==Sector structure==
 
==Sector structure==
 
{{Doom level format}}
 
{{Doom level format}}
Sectors are stored in WAD files in the following format:
+
Each sector is 26 bytes large. Sectors are stored in [[WAD]] files in the following format:
{| {{prettytable}}
+
 
! Offset !! Size (bytes) !! Description
+
{| {{prettytable|style=text-align: center;}}
 +
! Offset !! Size (bytes) !! C99 type !! Description
 +
|-
 +
| 0 || 2 || int16_t || style="text-align: left;" | Floor height
 +
|-
 +
| 2 || 2 || int16_t || style="text-align: left;" | Ceiling height
 +
|-
 +
| 4 || 8 || int8_t[8] || style="text-align: left;" | Name of floor texture
 +
|-
 +
| 12 || 8 || int8_t[8] || style="text-align: left;" | Name of ceiling texture
 +
|-
 +
| 20 || 2 || int16_t || style="text-align: left;" | Light level
 +
|-
 +
| 22 || 2 || int16_t || style="text-align: left;" | Special Type
 +
|-
 +
| 24 || 2 || int16_t || style="text-align: left;" | Tag number
 +
|}
 +
 
 +
At level load time, several additional variables are generated for each sector and stored in the internal sector data structure. These include:
 +
 
 +
'''linecount''' - the total number of linedefs associated with the sector.
 +
 
 +
'''lines''' - a list of every linedef associated with the sector.
 +
 
 +
'''blockbox''' - the coordinates defining a rectangular bounding box enclosing the sector, with the bounding box enlarged so that the edges line up with the [[blockmap]].
 +
 
 +
'''soundorg''' - the coordinates for any sound emitted by the sector; automatically set to the center of a precise bounding box surrounding the sector.
 +
 
 +
===Doom 64 format===
 +
The [[Doom 64]] sector format differs from the Doom format in multiple places: textures are represented by indexes into a hash table of texture names, the light level is replaced by five color values, and a flags field is added. Thus each sector is 24 bytes long.
 +
 
 +
{| {{prettytable|style=text-align: center;}}
 +
! Offset !! Size (bytes) !! C99 type !! Description
 +
|-
 +
| 0 || 2 || int16_t || style="text-align: left;" | Floor height
 
|-
 
|-
| align="center" | 0 || align="center" | 2 || Floor height
+
| 2 || 2 || int16_t || style="text-align: left;" | Ceiling height
 
|-
 
|-
| align="center" | 2 || align="center" | 2 || Ceiling height
+
| 4 || 2 || uint16_t || style="text-align: left;" | Index of floor texture
 
|-
 
|-
| align="center" | 4 || align="center" | 8 || Name of floor texture
+
| 6 || 2 || uint16_t || style="text-align: left;" | Index of ceiling texture
 
|-
 
|-
| align="center" | 12 || align="center" | 8 || Name of ceiling texture
+
| 8 || 10 || uint16_t[5] || style="text-align: left;" | Color indexes (floor, ceiling, thing, wall top, wall bottom)
 
|-
 
|-
| align="center" | 20 || align="center" | 2 || Light level
+
| 18 || 2 || int16_t || style="text-align: left;" | Special Type
 
|-
 
|-
| align="center" | 22 || align="center" | 2 || Type
+
| 20 || 2 || int16_t || style="text-align: left;" | Tag number
 
|-
 
|-
| align="center" | 24 || align="center" | 2 || Tag number
+
| 22 || 2 || uint16_t || style="text-align: left;" | Flags
 
|}
 
|}
  
 
==Sector types==
 
==Sector types==
 
The ''type'' field of the sector structure is used to specify lighting, damage, and a few other special effects.
 
The ''type'' field of the sector structure is used to specify lighting, damage, and a few other special effects.
* There are [[linedef type]]s that can change the sector type field during gameplay, either to zero or to a copy of another sector's type field. This is how, for example, a safe bridge rises out of a pool of [[nukage]].
+
* There are [[linedef type]]s that can change the sector type field during gameplay, either to zero or to a copy of another sector's type field. This is how, for example, a safe bridge rises out of a pool of [[Damaging floor|nukage]].
 
* Damage is halved at [[skill level]] 1.
 
* Damage is halved at [[skill level]] 1.
* Damage is split between [[health]] and [[armor]] (if any).
+
* Damage is split between [[health]] and [[armors|armor]] (if any).
===Vanilla Doom===
+
 
In [[vanilla Doom]], the sector type values are mutually exclusive.
+
===Doom===
{| {{prettytable}}
+
In [[Doom]], the sector type values are mutually exclusive.
 +
 
 +
{| {{prettySortable}}
 
! Type
 
! Type
 
! Class
 
! Class
Line 116: Line 154:
  
 
===Boom===
 
===Boom===
 
 
[[Boom]] (and compatible [[source ports]]) support the Doom sector types above, and also provide "generalized" sector types. The latter are based on bit fields, which allows several sector type properties to be independently specified for a sector. Texture change [[linedef types]] can be used to switch some or all of these properties dynamically, outside lighting.
 
[[Boom]] (and compatible [[source ports]]) support the Doom sector types above, and also provide "generalized" sector types. The latter are based on bit fields, which allows several sector type properties to be independently specified for a sector. Texture change [[linedef types]] can be used to switch some or all of these properties dynamically, outside lighting.
  
Bits 0 thru 4 specify the lighting type in the sector, and the same codes that Doom uses are employed (0, 1, 2, 3, 4, 8, 12, 13 and 17 from above).
+
Bits 0 through 4 specify the lighting type in the sector, and the same codes that Doom uses are employed (0, 1, 2, 3, 4, 8, 12, 13 and 17 from above).
  
Bits 5 and 6 set the damage type of the sector, with the usual 5/10/20 damage units per second.
+
{| {{prettySortable}}
{| {{prettytable}}
+
! Flag
! Dec
+
! Bits
! Bits 6-5
 
 
! Effect
 
! Effect
 
|-
 
|-
 
| align="right" | 32
 
| align="right" | 32
| align="center" | 01
+
| align="center" | 5
 
| 5% damage per second
 
| 5% damage per second
 
|-
 
|-
 
| align="right" | 64
 
| align="right" | 64
| align="center" | 10
+
| align="center" | 6
 
| 10% damage per second
 
| 10% damage per second
 
|-
 
|-
 
| align="right" | 96
 
| align="right" | 96
 +
| align="center" | 5+6
 +
| 20% damage per second
 +
|-
 +
| align="right" | 128
 +
| align="center" | 7
 +
| Secret sector
 +
|-
 +
| align="right" | 256
 +
| align="center" | 8
 +
| Enable [[friction]] effects
 +
|-
 +
| align="right" | 512
 +
| align="center" | 9
 +
| Enable [[pusher/puller]] effects
 +
|}
 +
 +
===Heretic===
 +
[[Heretic]] uses a greater variety of sector types, notably to control its own [[friction]] and [[wind]] effects. Like in ''Doom'', the values are mutually exclusive.
 +
 +
{| {{prettySortable}}
 +
! Type
 +
! Class
 +
! Effect
 +
|-
 +
| align="right" | 0
 +
|
 +
| Normal
 +
|-
 +
| align="right" | 1
 +
| Light
 +
| Blink random
 +
|-
 +
| align="right" | 2
 +
| Light
 +
| Blink 0.5 second
 +
|-
 +
| align="right" | 3
 +
| Light
 +
| Blink 1.0 second
 +
|-
 +
| align="right" | 4
 +
| Combo
 +
| 5% lava damage per second plus scroll east 28 and light blink 0.5 second
 +
|-
 +
| align="right" | 5
 +
| Damage
 +
| 5% lava damage per second
 +
|-
 +
| align="right" | 7
 +
| Damage
 +
| 4% sludge damage per second
 +
|-
 +
| align="right" | 8
 +
| Light
 +
| Oscillates
 +
|-
 +
| align="right" | 9
 +
| Secret
 +
| Player entering this sector gets credit for finding a secret
 +
|-
 +
| align="right" | 10
 +
| Door
 +
| 30 seconds after level start, ceiling closes like a door
 +
|-
 +
| align="right" | 11
 +
| No-op
 +
| Does nothing
 +
|-
 +
| align="right" | 12
 +
| Light
 +
| Blink 0.5 second, synchronized
 +
|-
 +
| align="right" | 13
 +
| Light
 +
| Blink 1.0 second, synchronized
 +
|-
 +
| align="right" | 14
 +
| Door
 +
| 300 seconds after level start, ceiling opens like a door
 +
|-
 +
| align="right" | 15
 +
| Friction
 +
| Low friction
 +
|-
 +
| align="right" | 16
 +
| Damage
 +
| 8% lava damage per second
 +
|-
 +
| align="right" | 20
 +
| Scroller
 +
| Scroll east 5
 +
|-
 +
| align="right" | 21
 +
| Scroller
 +
| Scroll east 10
 +
|-
 +
| align="right" | 22
 +
| Scroller
 +
| Scroll east 25
 +
|-
 +
| align="right" | 23
 +
| Scroller
 +
| Scroll east 30
 +
|-
 +
| align="right" | 24
 +
| Scroller
 +
| Scroll east 35
 +
|-
 +
| align="right" | 25
 +
| Scroller
 +
| Scroll north 5
 +
|-
 +
| align="right" | 26
 +
| Scroller
 +
| Scroll north 10
 +
|-
 +
| align="right" | 27
 +
| Scroller
 +
| Scroll north 25
 +
|-
 +
| align="right" | 28
 +
| Scroller
 +
| Scroll north 30
 +
|-
 +
| align="right" | 29
 +
| Scroller
 +
| Scroll north 35
 +
|-
 +
| align="right" | 30
 +
| Scroller
 +
| Scroll south 5
 +
|-
 +
| align="right" | 31
 +
| Scroller
 +
| Scroll south 10
 +
|-
 +
| align="right" | 32
 +
| Scroller
 +
| Scroll south 25
 +
|-
 +
| align="right" | 33
 +
| Scroller
 +
| Scroll south 30
 +
|-
 +
| align="right" | 34
 +
| Scroller
 +
| Scroll south 35
 +
|-
 +
| align="right" | 35
 +
| Scroller
 +
| Scroll west 5
 +
|-
 +
| align="right" | 36
 +
| Scroller
 +
| Scroll west 10
 +
|-
 +
| align="right" | 37
 +
| Scroller
 +
| Scroll west 25
 +
|-
 +
| align="right" | 38
 +
| Scroller
 +
| Scroll west 30
 +
|-
 +
| align="right" | 39
 +
| Scroller
 +
| Scroll west 35
 +
|-
 +
| align="right" | 40
 +
| Wind
 +
| Push east 5
 +
|-
 +
| align="right" | 41
 +
| Wind
 +
| Push east 10
 +
|-
 +
| align="right" | 42
 +
| Wind
 +
| Push east 25
 +
|-
 +
| align="right" | 43
 +
| Wind
 +
| Push north 5
 +
|-
 +
| align="right" | 44
 +
| Wind
 +
| Push north 10
 +
|-
 +
| align="right" | 45
 +
| Wind
 +
| Push north 25
 +
|-
 +
| align="right" | 46
 +
| Wind
 +
| Push south 5
 +
|-
 +
| align="right" | 47
 +
| Wind
 +
| Push south 10
 +
|-
 +
| align="right" | 48
 +
| Wind
 +
| Push south 25
 +
|-
 +
| align="right" | 49
 +
| Wind
 +
| Push west 5
 +
|-
 +
| align="right" | 50
 +
| Wind
 +
| Push west 10
 +
|-
 +
| align="right" | 51
 +
| Wind
 +
| Push west 25
 +
|}
 +
 +
===Hexen===
 +
Like ''Heretic'', [[Hexen]] uses a large number of mutually-exclusive sector types.
 +
 +
{| {{prettySortable}}
 +
! Type
 +
! Class
 +
! Effect
 +
|-
 +
| align="right" | 0
 +
|
 +
| Normal
 +
|-
 +
| align="right" | 1
 +
| Light
 +
| Phased light (use lightlevel between 0 and 63 for the starting phase)
 +
|-
 +
| align="right" | 2
 +
| Light
 +
| Phased light sequence start (use types 3 and 4 in neighboring sectors)
 +
|-
 +
| align="right" | 3
 +
| Light
 +
| Light sequence step (to be used alternatively with type 4 for a light sequence)
 +
|-
 +
| align="right" | 4
 +
| Light
 +
| Light sequence step (to be used alternatively with type 3 for a light sequence)
 +
|-
 +
| align="right" | 9
 +
| Secret (Unused)
 +
| Player entering this sector gets credit for finding a secret — however this is nonfunctional and pointless since Hexen does not have an [[intermission screen]].
 +
|-
 +
| align="right" | 26
 +
| Stairs
 +
| Mark sector to be used for building normal stairs
 +
|-
 +
| align="right" | 27
 +
| Stairs
 +
| Mark sector to be used for building synchronized stairs
 +
|-
 +
| align="right" | 40
 +
| Wind
 +
| Push east 5
 +
|-
 +
| align="right" | 41
 +
| Wind
 +
| Push east 10
 +
|-
 +
| align="right" | 42
 +
| Wind
 +
| Push east 25
 +
|-
 +
| align="right" | 43
 +
| Wind
 +
| Push north 5
 +
|-
 +
| align="right" | 44
 +
| Wind
 +
| Push north 10
 +
|-
 +
| align="right" | 45
 +
| Wind
 +
| Push north 25
 +
|-
 +
| align="right" | 46
 +
| Wind
 +
| Push south 5
 +
|-
 +
| align="right" | 47
 +
| Wind
 +
| Push south 10
 +
|-
 +
| align="right" | 48
 +
| Wind
 +
| Push south 25
 +
|-
 +
| align="right" | 49
 +
| Wind
 +
| Push west 5
 +
|-
 +
| align="right" | 50
 +
| Wind
 +
| Push west 10
 +
|-
 +
| align="right" | 51
 +
| Wind
 +
| Push west 25
 +
|-
 +
| align="right" | 198
 +
| Lightning
 +
| Light level increases by up to 64 units during a lightning flash
 +
|-
 +
| align="right" | 199
 +
| Lightning
 +
| Light level increases by up to 32 units during a lightning flash
 +
|-
 +
| align="right" | 200
 +
| Sky
 +
| Use the secondary sky texture if the level doesn't use a double sky
 +
|-
 +
| align="right" | 201
 +
| Scroller
 +
| Scroll north 5
 +
|-
 +
| align="right" | 202
 +
| Scroller
 +
| Scroll north 10
 +
|-
 +
| align="right" | 203
 +
| Scroller
 +
| Scroll north 25
 +
|-
 +
| align="right" | 204
 +
| Scroller
 +
| Scroll east 5
 +
|-
 +
| align="right" | 205
 +
| Scroller
 +
| Scroll east 10
 +
|-
 +
| align="right" | 206
 +
| Scroller
 +
| Scroll east 25
 +
|-
 +
| align="right" | 207
 +
| Scroller
 +
| Scroll south 5
 +
|-
 +
| align="right" | 208
 +
| Scroller
 +
| Scroll south 10
 +
|-
 +
| align="right" | 209
 +
| Scroller
 +
| Scroll south 25
 +
|-
 +
| align="right" | 210
 +
| Scroller
 +
| Scroll west 5
 +
|-
 +
| align="right" | 211
 +
| Scroller
 +
| Scroll west 10
 +
|-
 +
| align="right" | 212
 +
| Scroller
 +
| Scroll west 25
 +
|-
 +
| align="right" | 213
 +
| Scroller
 +
| Scroll northwest 5
 +
|-
 +
| align="right" | 214
 +
| Scroller
 +
| Scroll northwest 10
 +
|-
 +
| align="right" | 215
 +
| Scroller
 +
| Scroll northwest 25
 +
|-
 +
| align="right" | 216
 +
| Scroller
 +
| Scroll northeast 5
 +
|-
 +
| align="right" | 217
 +
| Scroller
 +
| Scroll northeast 10
 +
|-
 +
| align="right" | 218
 +
| Scroller
 +
| Scroll northeast 25
 +
|-
 +
| align="right" | 219
 +
| Scroller
 +
| Scroll southeast 5
 +
|-
 +
| align="right" | 220
 +
| Scroller
 +
| Scroll southeast 10
 +
|-
 +
| align="right" | 221
 +
| Scroller
 +
| Scroll southeast 25
 +
|-
 +
| align="right" | 222
 +
| Scroller
 +
| Scroll southwest 5
 +
|-
 +
| align="right" | 223
 +
| Scroller
 +
| Scroll southwest 10
 +
|-
 +
| align="right" | 224
 +
| Scroller
 +
| Scroll southwest 25
 +
|}
 +
 +
===Strife===
 +
In [[Strife]], the sector type values are also mutually exclusive.
 +
 +
{| {{prettySortable}}
 +
! Type
 +
! Class
 +
! Effect
 +
|-
 +
| align="right" | 0
 +
|
 +
| Normal
 +
|-
 +
| align="right" | 1
 +
| Light
 +
| Blink random
 +
|-
 +
| align="right" | 2
 +
| Light
 +
| Blink 0.5 second
 +
|-
 +
| align="right" | 3
 +
| Light
 +
| Blink 1.0 second
 +
|-
 +
| align="right" | 4
 +
| Both
 +
| 5% damage every 32 tics plus light blink 0.5 second
 +
|-
 +
| align="right" | 5
 +
| Damage
 +
| +2 increase to nukagecount
 +
|-
 +
| align="right" | 7
 +
| Damage
 +
| 5% damage every 32 tics
 +
|-
 +
| align="right" | 8
 +
| Light
 +
| Oscillates
 +
|-
 +
| align="right" | 9
 +
| Secret
 +
| Player entering this sector gets credit for finding a secret
 +
|-
 +
| align="right" | 10
 +
| Door
 +
| 30 seconds after level start, ceiling closes like a door
 +
|-
 +
| align="right" | 11
 +
| End
 +
| 20% damage per second. When player dies, level ends
 +
|-
 +
| align="right" | 12
 +
| Light
 +
| Blink 0.5 second, synchronized
 +
|-
 +
| align="right" | 13
 +
| Light
 +
| Blink 1.0 second, synchronized
 +
|-
 +
| align="right" | 14
 +
| Door
 +
| 300 seconds after level start, ceiling opens like a door
 +
|-
 +
| align="right" | 15
 +
| Damage
 +
| Instant death: 999% damage every tic
 +
|-
 +
| align="right" | 16
 +
| Damage
 +
| +4 to nukagecount
 +
|-
 +
| align="right" | 17
 +
| Light
 +
| Flickers randomly
 +
|-
 +
| align="right" | 18
 +
| Scroller
 +
| Water current, angle and strength depend on sector tag value
 +
|}
 +
 +
===ZDoom===
 +
[[ZDoom]] and compatible source ports provide a superset of all sector types based on the ''Hexen'' types, including both mutually-exclusive types and generalized flags. The following table is used for maps in the Hexen map format or in [[UDMF]] with the ZDoom namespace.
 +
 +
{| {{prettySortable}}
 +
! Type
 +
! Class
 +
! Effect
 +
|-
 +
| align="right" | 0
 +
|
 +
| Normal
 +
|-
 +
| align="right" | 1
 +
| Light
 +
| Phased light (use lightlevel between 0 and 63 for the starting phase)
 +
|-
 +
| align="right" | 2
 +
| Light
 +
| Phased light sequence start (use types 3 and 4 in neighboring sectors)
 +
|-
 +
| align="right" | 3
 +
| Light
 +
| Light sequence step (to be used alternatively with type 4 for a light sequence)
 +
|-
 +
| align="right" | 4
 +
| Light
 +
| Light sequence step (to be used alternatively with type 3 for a light sequence)
 +
|-
 +
| align="right" | 26
 +
| Stairs
 +
| Mark sector to be used for building normal stairs
 +
|-
 +
| align="right" | 27
 +
| Stairs
 +
| Mark sector to be used for building synchronized stairs
 +
|-
 +
| align="right" | 40
 +
| Wind
 +
| Push east 5
 +
|-
 +
| align="right" | 41
 +
| Wind
 +
| Push east 10
 +
|-
 +
| align="right" | 42
 +
| Wind
 +
| Push east 25
 +
|-
 +
| align="right" | 43
 +
| Wind
 +
| Push north 5
 +
|-
 +
| align="right" | 44
 +
| Wind
 +
| Push north 10
 +
|-
 +
| align="right" | 45
 +
| Wind
 +
| Push north 25
 +
|-
 +
| align="right" | 46
 +
| Wind
 +
| Push south 5
 +
|-
 +
| align="right" | 47
 +
| Wind
 +
| Push south 10
 +
|-
 +
| align="right" | 48
 +
| Wind
 +
| Push south 25
 +
|-
 +
| align="right" | 49
 +
| Wind
 +
| Push west 5
 +
|-
 +
| align="right" | 50
 +
| Wind
 +
| Push west 10
 +
|-
 +
| align="right" | 51
 +
| Wind
 +
| Push west 25
 +
|-
 +
| align="right" | 65
 +
| Light
 +
| Blink random
 +
|-
 +
| align="right" | 66
 +
| Light
 +
| Blink 0.5 second
 +
|-
 +
| align="right" | 67
 +
| Light
 +
| Blink 1.0 second
 +
|-
 +
| align="right" | 68
 +
| Both
 +
| 20% damage per second plus light blink 0.5 second
 +
|-
 +
| align="right" | 69
 +
| Damage
 +
| 10% damage per second
 +
|-
 +
| align="right" | 71
 +
| Damage
 +
| 5% damage per second
 +
|-
 +
| align="right" | 72
 +
| Light
 +
| Oscillates
 +
|-
 +
| align="right" | 74
 +
| Door
 +
| 30 seconds after level start, ceiling closes like a door
 +
|-
 +
| align="right" | 75
 +
| End
 +
| 20% damage per second. When player dies, level ends
 +
|-
 +
| align="right" | 76
 +
| Light
 +
| Blink 0.5 second, synchronized
 +
|-
 +
| align="right" | 77
 +
| Light
 +
| Blink 1.0 second, synchronized
 +
|-
 +
| align="right" | 78
 +
| Door
 +
| 300 seconds after level start, ceiling opens like a door
 +
|-
 +
| align="right" | 79
 +
| Friction
 +
| Low friction
 +
|-
 +
| align="right" | 80
 +
| Damage
 +
| 20% damage per second
 +
|-
 +
| align="right" | 81
 +
| Light
 +
| Flickers randomly
 +
|-
 +
| align="right" | 82
 +
| Damage
 +
| 5% lava damage per second
 +
|-
 +
| align="right" | 83
 +
| Damage
 +
| 8% lava damage per second
 +
|-
 +
| align="right" | 84
 +
| Combo
 +
| 5% lava damage per second plus scroll east and light blink 0.5 second
 +
|-
 +
| align="right" | 85
 +
| Damage
 +
| 4% sludge damage per second
 +
|-
 +
| align="right" | 87
 +
| Fog
 +
| Sector uses outside fog even if the ceiling texture isn't the sky texture
 +
|-
 +
| align="right" | 105
 +
| Damage
 +
| +2 increase to nukagecount
 +
|-
 +
| align="right" | 115
 +
| Damage
 +
| Instant death: 999% damage every tic
 +
|-
 +
| align="right" | 116
 +
| Damage
 +
| +4 to nukagecount
 +
|-
 +
| align="right" | 118
 +
| Scroller
 +
| Water current, angle and strength depend on sector tag value
 +
|-
 +
| align="right" | 195
 +
| Automap
 +
| Hidden: sector texture is not shown on the textured [[automap]]
 +
|-
 +
| align="right" | 196
 +
| Healing
 +
| Restores 1 hit point every 32 tics
 +
|-
 +
| align="right" | 197
 +
| Lightning
 +
| Light level increases as much as outdoor sectors do during a lightning flash
 +
|-
 +
| align="right" | 198
 +
| Lightning
 +
| Light level increases by up to 64 units during a lightning flash
 +
|-
 +
| align="right" | 199
 +
| Lightning
 +
| Light level increases by up to 32 units during a lightning flash
 +
|-
 +
| align="right" | 200
 +
| Sky
 +
| Use the secondary sky texture if the level doesn't use a double sky
 +
|-
 +
| align="right" | 201
 +
| Scroller
 +
| Scroll north 5
 +
|-
 +
| align="right" | 202
 +
| Scroller
 +
| Scroll north 10
 +
|-
 +
| align="right" | 203
 +
| Scroller
 +
| Scroll north 25
 +
|-
 +
| align="right" | 204
 +
| Scroller
 +
| Scroll east 5
 +
|-
 +
| align="right" | 205
 +
| Scroller
 +
| Scroll east 10
 +
|-
 +
| align="right" | 206
 +
| Scroller
 +
| Scroll east 25
 +
|-
 +
| align="right" | 207
 +
| Scroller
 +
| Scroll south 5
 +
|-
 +
| align="right" | 208
 +
| Scroller
 +
| Scroll south 10
 +
|-
 +
| align="right" | 209
 +
| Scroller
 +
| Scroll south 25
 +
|-
 +
| align="right" | 210
 +
| Scroller
 +
| Scroll west 5
 +
|-
 +
| align="right" | 211
 +
| Scroller
 +
| Scroll west 10
 +
|-
 +
| align="right" | 212
 +
| Scroller
 +
| Scroll west 25
 +
|-
 +
| align="right" | 213
 +
| Scroller
 +
| Scroll northwest 5
 +
|-
 +
| align="right" | 214
 +
| Scroller
 +
| Scroll northwest 10
 +
|-
 +
| align="right" | 215
 +
| Scroller
 +
| Scroll northwest 25
 +
|-
 +
| align="right" | 216
 +
| Scroller
 +
| Scroll northeast 5
 +
|-
 +
| align="right" | 217
 +
| Scroller
 +
| Scroll northeast 10
 +
|-
 +
| align="right" | 218
 +
| Scroller
 +
| Scroll northeast 25
 +
|-
 +
| align="right" | 219
 +
| Scroller
 +
| Scroll southeast 5
 +
|-
 +
| align="right" | 220
 +
| Scroller
 +
| Scroll southeast 10
 +
|-
 +
| align="right" | 221
 +
| Scroller
 +
| Scroll southeast 25
 +
|-
 +
| align="right" | 222
 +
| Scroller
 +
| Scroll southwest 5
 +
|-
 +
| align="right" | 223
 +
| Scroller
 +
| Scroll southwest 10
 +
|-
 +
| align="right" | 224
 +
| Scroller
 +
| Scroll southwest 25
 +
|-
 +
| align="right" | 225
 +
| Scroller
 +
| Scroll east 5
 +
|-
 +
| align="right" | 226
 +
| Scroller
 +
| Scroll east 10
 +
|-
 +
| align="right" | 227
 +
| Scroller
 +
| Scroll east 25
 +
|-
 +
| align="right" | 228
 +
| Scroller
 +
| Scroll east 30
 +
|-
 +
| align="right" | 229
 +
| Scroller
 +
| Scroll east 35
 +
|-
 +
| align="right" | 230
 +
| Scroller
 +
| Scroll north 5
 +
|-
 +
| align="right" | 231
 +
| Scroller
 +
| Scroll north 10
 +
|-
 +
| align="right" | 232
 +
| Scroller
 +
| Scroll north 25
 +
|-
 +
| align="right" | 233
 +
| Scroller
 +
| Scroll north 30
 +
|-
 +
| align="right" | 234
 +
| Scroller
 +
| Scroll north 35
 +
|-
 +
| align="right" | 235
 +
| Scroller
 +
| Scroll south 5
 +
|-
 +
| align="right" | 236
 +
| Scroller
 +
| Scroll south 10
 +
|-
 +
| align="right" | 237
 +
| Scroller
 +
| Scroll south 25
 +
|-
 +
| align="right" | 238
 +
| Scroller
 +
| Scroll south 30
 +
|-
 +
| align="right" | 239
 +
| Scroller
 +
| Scroll south 35
 +
|-
 +
| align="right" | 240
 +
| Scroller
 +
| Scroll west 5
 +
|-
 +
| align="right" | 241
 +
| Scroller
 +
| Scroll west 10
 +
|-
 +
| align="right" | 242
 +
| Scroller
 +
| Scroll west 25
 +
|-
 +
| align="right" | 243
 +
| Scroller
 +
| Scroll west 30
 +
|-
 +
| align="right" | 244
 +
| Scroller
 +
| Scroll west 35
 +
|-
 +
! Flag
 +
! Bits
 +
! Effect
 +
|-
 +
| align="right" | 0x0100
 +
| align="center" | 8
 +
| 5% damage per second
 +
|-
 +
| align="right" | 0x0200
 +
| align="center" | 9
 +
| 10% damage per second
 +
|-
 +
| align="right" | 0x0300
 +
| align="center" | 8+9
 +
| 20% damage per second
 +
|-
 +
| align="right" | 0x0400
 +
| align="center" | 10
 +
| Secret sector
 +
|-
 +
| align="right" | 0x0800
 
| align="center" | 11
 
| align="center" | 11
| 20% damage per second
+
| Enable [[friction]] effects
 +
|-
 +
| align="right" | 0x1000
 +
| align="center" | 12
 +
| Enable pusher/puller effects
 +
|}
 +
 
 +
===Doom 64===
 +
In [[Doom 64]], the sector type values are mutually exclusive like before, but mainly pertain to lighting behavior.
 +
 
 +
{| {{prettySortable}}
 +
! Type !! Class !! Effect
 +
|-
 +
| style="text-align: right;" | 0 || || Normal
 +
|-
 +
| style="text-align: right;" | 1 || Light || Random flickering light
 +
|-
 +
| style="text-align: right;" | 2 || Light || Blink light 0.5 seconds
 +
|-
 +
| style="text-align: right;" | 3 || Light || Blink light 1.0 seconds
 +
|-
 +
| style="text-align: right;" | 8 || Light || Normal pulsing light
 +
|-
 +
| style="text-align: right;" | 9 || Light || Slow pulsing light
 +
|-
 +
| style="text-align: right;" | 11 || Light || Random pulsing light
 +
|-
 +
| style="text-align: right;" | 12 || Light || Same as type 3
 +
|-
 +
| style="text-align: right;" | 13 || Light || Same as type 2
 +
|-
 +
| style="text-align: right;" | 17 || Light || Fire light flickering
 +
|-
 +
| style="text-align: right;" | 202 || Light || Constant blink light slow
 +
|-
 +
| style="text-align: right;" | 204 || Light || Blink light rapid
 +
|-
 +
| style="text-align: right;" | 205 || Light || Start of sequenced light sectors
 +
|-
 +
| style="text-align: right;" | 206 || Light || Blink light very rapid
 +
|-
 +
| style="text-align: right;" | 208 || Light || Constant blink light fast
 +
|-
 +
| style="text-align: right;" | 666 || Damage || Instant kill thing when being crushed
 
|}
 
|}
Bit 7, when set, makes the sector count towards the secrets total at game end.
 
  
Bit 8, when set, enables the ice/mud effect controlled by linedef 223.
+
The extra ''flags'' field controls further sector characteristics that were defined as sector types in the original ''Doom''.
  
Bit 9, when set, enables the wind effects controlled by linedefs 224–226.
+
{| {{prettytable}}
 +
! Flag !! Bit !! Description
 +
|-
 +
| 0x0001 || 0 || Reverb sounds (echo) played in sector
 +
|-
 +
| 0x0002 || 1 || Reverb sounds (echo) played in sector and multiply factor by 2
 +
|-
 +
| 0x0004 || 2 || Water effect (floors only)
 +
|-
 +
| 0x0008 || 3 || All flagged sectors with same special type will sync all light flickers/strobe across all sectors
 +
|-
 +
| 0x0010 || 4 || Scrolling floors/ceilings will scroll at twice the speed
 +
|-
 +
| 0x0020 || 5 || Count as secret on [[intermission screen]] when entering this sector
 +
|-
 +
| 0x0040 || 6 || Damage player x5
 +
|-
 +
| 0x0080 || 7 || Damage player x10
 +
|-
 +
| 0x0100 || 8 || Damage player x20
 +
|-
 +
| 0x0200 || 9 || Hide sector in [[automap]] (textured mode)
 +
|-
 +
| 0x0400 || 10 || Enable ceiling scrolling
 +
|-
 +
| 0x0800 || 11 || Enable floor scrolling
 +
|-
 +
| 0x1000 || 12 || Scroll texture west
 +
|-
 +
| 0x2000 || 13 || Scroll texture east
 +
|-
 +
| 0x4000 || 14 || Scroll texture north
 +
|-
 +
| 0x8000 || 15 || Scroll texture south
 +
|}
  
 
==Sources==
 
==Sources==
 
* [[Unofficial Doom Specs]]
 
* [[Unofficial Doom Specs]]
 
* [[Boom]] source code: <tt>boomref.txt</tt>
 
* [[Boom]] source code: <tt>boomref.txt</tt>
 +
* {{idgames|file=docs/editing/d64techbible|title=Doom 64 Tech Bible}}
  
 
[[Category:Doom engine]]
 
[[Category:Doom engine]]
 +
[[Category:Lists]]
 +
[[Category:WAD lumps]]

Revision as of 05:28, 25 July 2020

A sector is an area referenced by sidedefs on the linedefs. Sectors should be closed areas, meaning that all the sidedefs that reference a particular sector should make up a closed shape. Unclosed sectors can be used for a few special effects, but under some circumstances they can lead to undesirable results (including crashes).

A sector does not have to be a single polygon. For instance, two squares can be separate and non-contiguous, but still be part of the same sector.

A sector entry specifies the following:

Ceiling flat - Name of the flat (texture) used on the ceiling of the sector.

Floor flat - Name of the flat used on the floor.

Ceiling height - Height of the ceiling.

Floor height - Height of the floor.

Lighting - How bright the sector is.

Sector tag - A number that makes the sector a target of the action specified by any linedef with the same tag number. Used, for example, to alter the sector's ceiling and/or floor height, lighting level or flats.

Sector type - Special properties of the sector. This is used to give the sector a damaging floor (for things like lava and slime), have the sector's light level change constantly, enable wind or currents or even push the player in a certain direction. See below.

Sector structure

Doom level format

Each sector is 26 bytes large. Sectors are stored in WAD files in the following format:

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 8 int8_t[8] Name of floor texture
12 8 int8_t[8] Name of ceiling texture
20 2 int16_t Light level
22 2 int16_t Special Type
24 2 int16_t Tag number

At level load time, several additional variables are generated for each sector and stored in the internal sector data structure. These include:

linecount - the total number of linedefs associated with the sector.

lines - a list of every linedef associated with the sector.

blockbox - the coordinates defining a rectangular bounding box enclosing the sector, with the bounding box enlarged so that the edges line up with the blockmap.

soundorg - the coordinates for any sound emitted by the sector; automatically set to the center of a precise bounding box surrounding the sector.

Doom 64 format

The Doom 64 sector format differs from the Doom format in multiple places: textures are represented by indexes into a hash table of texture names, the light level is replaced by five color values, and a flags field is added. Thus each sector is 24 bytes long.

Offset Size (bytes) C99 type Description
0 2 int16_t Floor height
2 2 int16_t Ceiling height
4 2 uint16_t Index of floor texture
6 2 uint16_t Index of ceiling texture
8 10 uint16_t[5] Color indexes (floor, ceiling, thing, wall top, wall bottom)
18 2 int16_t Special Type
20 2 int16_t Tag number
22 2 uint16_t Flags

Sector types

The type field of the sector structure is used to specify lighting, damage, and a few other special effects.

  • There are linedef types that can change the sector type field during gameplay, either to zero or to a copy of another sector's type field. This is how, for example, a safe bridge rises out of a pool of nukage.
  • Damage is halved at skill level 1.
  • Damage is split between health and armor (if any).

Doom

In Doom, the sector type values are mutually exclusive.

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Both 20% damage per second plus light blink 0.5 second
5 Damage 10% damage per second
7 Damage 5% damage per second
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 End 20% damage per second. When player dies, level ends
12 Light Blink 0.5 second, synchronized
13 Light Blink 1.0 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
16 Damage 20% damage per second
17 Light Flickers randomly

Boom

Boom (and compatible source ports) support the Doom sector types above, and also provide "generalized" sector types. The latter are based on bit fields, which allows several sector type properties to be independently specified for a sector. Texture change linedef types can be used to switch some or all of these properties dynamically, outside lighting.

Bits 0 through 4 specify the lighting type in the sector, and the same codes that Doom uses are employed (0, 1, 2, 3, 4, 8, 12, 13 and 17 from above).

Flag Bits Effect
32 5 5% damage per second
64 6 10% damage per second
96 5+6 20% damage per second
128 7 Secret sector
256 8 Enable friction effects
512 9 Enable pusher/puller effects

Heretic

Heretic uses a greater variety of sector types, notably to control its own friction and wind effects. Like in Doom, the values are mutually exclusive.

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Combo 5% lava damage per second plus scroll east 28 and light blink 0.5 second
5 Damage 5% lava damage per second
7 Damage 4% sludge damage per second
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 No-op Does nothing
12 Light Blink 0.5 second, synchronized
13 Light Blink 1.0 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
15 Friction Low friction
16 Damage 8% lava damage per second
20 Scroller Scroll east 5
21 Scroller Scroll east 10
22 Scroller Scroll east 25
23 Scroller Scroll east 30
24 Scroller Scroll east 35
25 Scroller Scroll north 5
26 Scroller Scroll north 10
27 Scroller Scroll north 25
28 Scroller Scroll north 30
29 Scroller Scroll north 35
30 Scroller Scroll south 5
31 Scroller Scroll south 10
32 Scroller Scroll south 25
33 Scroller Scroll south 30
34 Scroller Scroll south 35
35 Scroller Scroll west 5
36 Scroller Scroll west 10
37 Scroller Scroll west 25
38 Scroller Scroll west 30
39 Scroller Scroll west 35
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25

Hexen

Like Heretic, Hexen uses a large number of mutually-exclusive sector types.

Type Class Effect
0 Normal
1 Light Phased light (use lightlevel between 0 and 63 for the starting phase)
2 Light Phased light sequence start (use types 3 and 4 in neighboring sectors)
3 Light Light sequence step (to be used alternatively with type 4 for a light sequence)
4 Light Light sequence step (to be used alternatively with type 3 for a light sequence)
9 Secret (Unused) Player entering this sector gets credit for finding a secret — however this is nonfunctional and pointless since Hexen does not have an intermission screen.
26 Stairs Mark sector to be used for building normal stairs
27 Stairs Mark sector to be used for building synchronized stairs
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25
198 Lightning Light level increases by up to 64 units during a lightning flash
199 Lightning Light level increases by up to 32 units during a lightning flash
200 Sky Use the secondary sky texture if the level doesn't use a double sky
201 Scroller Scroll north 5
202 Scroller Scroll north 10
203 Scroller Scroll north 25
204 Scroller Scroll east 5
205 Scroller Scroll east 10
206 Scroller Scroll east 25
207 Scroller Scroll south 5
208 Scroller Scroll south 10
209 Scroller Scroll south 25
210 Scroller Scroll west 5
211 Scroller Scroll west 10
212 Scroller Scroll west 25
213 Scroller Scroll northwest 5
214 Scroller Scroll northwest 10
215 Scroller Scroll northwest 25
216 Scroller Scroll northeast 5
217 Scroller Scroll northeast 10
218 Scroller Scroll northeast 25
219 Scroller Scroll southeast 5
220 Scroller Scroll southeast 10
221 Scroller Scroll southeast 25
222 Scroller Scroll southwest 5
223 Scroller Scroll southwest 10
224 Scroller Scroll southwest 25

Strife

In Strife, the sector type values are also mutually exclusive.

Type Class Effect
0 Normal
1 Light Blink random
2 Light Blink 0.5 second
3 Light Blink 1.0 second
4 Both 5% damage every 32 tics plus light blink 0.5 second
5 Damage +2 increase to nukagecount
7 Damage 5% damage every 32 tics
8 Light Oscillates
9 Secret Player entering this sector gets credit for finding a secret
10 Door 30 seconds after level start, ceiling closes like a door
11 End 20% damage per second. When player dies, level ends
12 Light Blink 0.5 second, synchronized
13 Light Blink 1.0 second, synchronized
14 Door 300 seconds after level start, ceiling opens like a door
15 Damage Instant death: 999% damage every tic
16 Damage +4 to nukagecount
17 Light Flickers randomly
18 Scroller Water current, angle and strength depend on sector tag value

ZDoom

ZDoom and compatible source ports provide a superset of all sector types based on the Hexen types, including both mutually-exclusive types and generalized flags. The following table is used for maps in the Hexen map format or in UDMF with the ZDoom namespace.

Type Class Effect
0 Normal
1 Light Phased light (use lightlevel between 0 and 63 for the starting phase)
2 Light Phased light sequence start (use types 3 and 4 in neighboring sectors)
3 Light Light sequence step (to be used alternatively with type 4 for a light sequence)
4 Light Light sequence step (to be used alternatively with type 3 for a light sequence)
26 Stairs Mark sector to be used for building normal stairs
27 Stairs Mark sector to be used for building synchronized stairs
40 Wind Push east 5
41 Wind Push east 10
42 Wind Push east 25
43 Wind Push north 5
44 Wind Push north 10
45 Wind Push north 25
46 Wind Push south 5
47 Wind Push south 10
48 Wind Push south 25
49 Wind Push west 5
50 Wind Push west 10
51 Wind Push west 25
65 Light Blink random
66 Light Blink 0.5 second
67 Light Blink 1.0 second
68 Both 20% damage per second plus light blink 0.5 second
69 Damage 10% damage per second
71 Damage 5% damage per second
72 Light Oscillates
74 Door 30 seconds after level start, ceiling closes like a door
75 End 20% damage per second. When player dies, level ends
76 Light Blink 0.5 second, synchronized
77 Light Blink 1.0 second, synchronized
78 Door 300 seconds after level start, ceiling opens like a door
79 Friction Low friction
80 Damage 20% damage per second
81 Light Flickers randomly
82 Damage 5% lava damage per second
83 Damage 8% lava damage per second
84 Combo 5% lava damage per second plus scroll east and light blink 0.5 second
85 Damage 4% sludge damage per second
87 Fog Sector uses outside fog even if the ceiling texture isn't the sky texture
105 Damage +2 increase to nukagecount
115 Damage Instant death: 999% damage every tic
116 Damage +4 to nukagecount
118 Scroller Water current, angle and strength depend on sector tag value
195 Automap Hidden: sector texture is not shown on the textured automap
196 Healing Restores 1 hit point every 32 tics
197 Lightning Light level increases as much as outdoor sectors do during a lightning flash
198 Lightning Light level increases by up to 64 units during a lightning flash
199 Lightning Light level increases by up to 32 units during a lightning flash
200 Sky Use the secondary sky texture if the level doesn't use a double sky
201 Scroller Scroll north 5
202 Scroller Scroll north 10
203 Scroller Scroll north 25
204 Scroller Scroll east 5
205 Scroller Scroll east 10
206 Scroller Scroll east 25
207 Scroller Scroll south 5
208 Scroller Scroll south 10
209 Scroller Scroll south 25
210 Scroller Scroll west 5
211 Scroller Scroll west 10
212 Scroller Scroll west 25
213 Scroller Scroll northwest 5
214 Scroller Scroll northwest 10
215 Scroller Scroll northwest 25
216 Scroller Scroll northeast 5
217 Scroller Scroll northeast 10
218 Scroller Scroll northeast 25
219 Scroller Scroll southeast 5
220 Scroller Scroll southeast 10
221 Scroller Scroll southeast 25
222 Scroller Scroll southwest 5
223 Scroller Scroll southwest 10
224 Scroller Scroll southwest 25
225 Scroller Scroll east 5
226 Scroller Scroll east 10
227 Scroller Scroll east 25
228 Scroller Scroll east 30
229 Scroller Scroll east 35
230 Scroller Scroll north 5
231 Scroller Scroll north 10
232 Scroller Scroll north 25
233 Scroller Scroll north 30
234 Scroller Scroll north 35
235 Scroller Scroll south 5
236 Scroller Scroll south 10
237 Scroller Scroll south 25
238 Scroller Scroll south 30
239 Scroller Scroll south 35
240 Scroller Scroll west 5
241 Scroller Scroll west 10
242 Scroller Scroll west 25
243 Scroller Scroll west 30
244 Scroller Scroll west 35
Flag Bits Effect
0x0100 8 5% damage per second
0x0200 9 10% damage per second
0x0300 8+9 20% damage per second
0x0400 10 Secret sector
0x0800 11 Enable friction effects
0x1000 12 Enable pusher/puller effects

Doom 64

In Doom 64, the sector type values are mutually exclusive like before, but mainly pertain to lighting behavior.

Type Class Effect
0 Normal
1 Light Random flickering light
2 Light Blink light 0.5 seconds
3 Light Blink light 1.0 seconds
8 Light Normal pulsing light
9 Light Slow pulsing light
11 Light Random pulsing light
12 Light Same as type 3
13 Light Same as type 2
17 Light Fire light flickering
202 Light Constant blink light slow
204 Light Blink light rapid
205 Light Start of sequenced light sectors
206 Light Blink light very rapid
208 Light Constant blink light fast
666 Damage Instant kill thing when being crushed

The extra flags field controls further sector characteristics that were defined as sector types in the original Doom.

Flag Bit Description
0x0001 0 Reverb sounds (echo) played in sector
0x0002 1 Reverb sounds (echo) played in sector and multiply factor by 2
0x0004 2 Water effect (floors only)
0x0008 3 All flagged sectors with same special type will sync all light flickers/strobe across all sectors
0x0010 4 Scrolling floors/ceilings will scroll at twice the speed
0x0020 5 Count as secret on intermission screen when entering this sector
0x0040 6 Damage player x5
0x0080 7 Damage player x10
0x0100 8 Damage player x20
0x0200 9 Hide sector in automap (textured mode)
0x0400 10 Enable ceiling scrolling
0x0800 11 Enable floor scrolling
0x1000 12 Scroll texture west
0x2000 13 Scroll texture east
0x4000 14 Scroll texture north
0x8000 15 Scroll texture south

Sources