Structs:Sector

From ZDoom Wiki
Jump to navigation Jump to search

Sector contains information related to a sector including colors, specials, floor and ceiling plane data, lines, etc. The current map's sectors can be accessed through LevelLocal's Sectors array. Many values can be directly modified here allowing for a large amount of control over a sector from within ZScript.

Fields

  • readonly FColormap ColorMap
A struct that contains information related to the colormap of the current sector
  • Color LightColor - The current ARGB color of the sector
  • Color FadeColor - The current ARGB of the sector's fade
  • uint8 Desaturation - The current level of desaturation in the sector
  • uint8 BlendFactor - The current amount of blending in the sector
  • uint16 FogDensity - How thick the fog density currently is in the sector
  • readonly Color SpecialColors[5]
An array that stores individual ARGB colors for the floor, ceiling, top of the walls, bottom of the walls, and sprites respectively in the sector
  • readonly Color AdditiveColors[5]
Same as SpecialColors but stores additive color values instead of blended
  • Actor SoundTarget
Used for sound checking when an enemy calls A_Look. This is used to determine who last made a sound that propagated to this sector
  • int special
The special action that the sector currently has
  • int16 lightlevel
The current brightness of the sector
  • int16 seqType
The current type of light sequence in the sector
  • int sky
Which MAPINFO sky is being displayed. 0 for Sky1, 0x40000000 for Sky2
  • Name SeqName
The name of the sector's current light sequence
  • readonly Vector2 centerspot
The pre-calculated center of the sector. Note that this is not guaranteed to be in the sector itself if it has holes in its middle
  • int validcount
Used to keep track of whether or not the sector has already been visited across various functions
  • Actor thinglist
Stores a pointer to the head of the linked list of all Actors in the sector. Each Actor stores the next one in its snext pointer
  • double friction
The friction factor of the sector
  • double movefactor
The movement speed factor of the sector
  • int terrainnum[2]
The index for the Sector's floor and ceiling TerrainDefs respectively in the Terrains global array. -1 if none is present
  • SectorEffect floordata
Stores information about the sector's current floor action e.g. when it's raising
  • SectorEffect ceilingdata
Stores information about the sector's current ceiling action e.g. when it's crushing
  • SectorEffect lightingdata
Stores information about the sector's current lighting action e.g. when lights are strobing
  • uint8 soundtraversed
Determines whether or not the sector has already been traversed when propagating sounds
  • int8 stairlock
If -2, the sector is currently building stairs. If -1, it is done building and waiting for connected stair sectors to finish. If 0, it's not building stairs at all
  • int prevsec
Index of the previous linked sector in the Sectors global array
  • int nextsec
Index of the next linked sector in the Sectors global array
  • readonly Array<Line> lines
An array that contains all the lines linked to the sector
  • readonly @SecPlane floorplane
Pointer to the plane that makes up the sector's floor
  • readonly @SecPlane ceilingplane
Pointer to the plane that makes up the sector's ceiling
  • readonly Sector heightsec
Pointer to the control sector used when transferring sector height (e.g. with Boom's deep water)
  • uint bottommap
Special blend to use when viewer is below the floor. Used with height control sectors
  • uint midmap
Special blend to use when viewer is in the sector. Used with height control sectors
  • uint topmap
Special blend to use when viewer is above the ceiling. Used with height control sectors
  • double gravity
The gravity factor in this sector
  • Name damagetype
The name of the damage type applied when this sector hurts an Actor
  • int damageamount
The amount of damage this sector deals when it hurts an Actor
  • int16 damageinterval
The interval in tics that this sector damages Actors
  • int16 leakydamage
Chance sector leaks damage through the radiation suit
  • readonly uint16 ZoneNumber
Index of the sector's sound environment in the Zones array (array is currently inaccessible)
  • readonly int healthceiling
The current health of the sector's ceiling
  • readonly int healthfloor
The current health of the sector's floor
  • readonly int healthceilinggroup
The id of the geometry the ceiling is linked to when it takes damage
  • readonly int healthfloorgroup
The id of the geometry the floor is linked to when it takes damage
  • uint Flags
Contains flags related to the sector
  • SECF_SILENT - Actors in this sector make no noise
  • SECF_NOFALLINGDAMAGE - Disable falling damage in this sector
  • SECF_FLOORDROP - Keep any Actors attached to the floor when lowering quickly
  • SECF_NORESPAWN - Player cannot respawn in this sector
  • SECF_FRICTION - Enable friction in this sector
  • SECF_PUSH - Enable pushers in this sector
  • SECF_SILENTMOVE - Sector makes no sound when moving
  • SECF_DMGTERRAINFX - When damage is inflicted by the sector, spawn the associated terrain splash
  • SECF_ENDGODMODE - The sector ends god mode of any Actor damaged by it
  • SECF_ENDLEVEL - If health is below 10, end the current level
  • SECF_HAZARD - Use Strife's sector damage handling instead of regular sector damage
  • SECF_NOATTACK - Monsters can't start attacks when in this sector
  • SECF_WASSECRET - The sector was a secret that got discovered
  • SECF_SECRET - The sector is currently still considered a secret
  • SECF_DAMAGEFLAGS - Combination of SECF_ENDGODMODE, SECF_ENDLEVEL, SECF_DMGTERRAINFX, and SECF_HAZARD
  • SECF_NOMODIFY - Combination of SECF_SECRET and SECF_WASSECRET
  • SECF_SPECIALFLAGS - Combination of SECF_DAMAGEFLAGS, SECF_FRICTION, and SECF_PUSH
  • uint16 MoreFlags
Contains additional flags related to the sector
  • SECMF_FAKEFLOORONLY - If a height control sector, only transfer the floor
  • SECMF_CLIPFAKEPLANES - If a height control sector, clip floor and ceiling to target sector's
  • SECMF_NOFAKELIGHT - If a height control sector, don't transfer light level
  • SECMF_IGNOREHEIGHTSEC - If a height sector, only trigger sector actions and nothing else
  • SECMF_UNDERWATER - Sector is considered under water
  • SECMF_FORCEDUNDERWATER - Forcefully consider the sector under water
  • SECMF_UNDERWATERMASK - Combination of SECMF_UNDERWATER and SECMF_FORCEDUNDERWATER
  • SECMF_DRAWN - The sector has been rendered at least once
  • SECMF_HIDDEN - Don't draw this sector's textures on the automap
  • SectorAction SecActTarget
The SectorAction that gets activated when its specific sector action requirement is met (e.g. something hits the floor). If there are multiple SectorActions present, they're stored in a linked list where each SectorAction stores the next one in its tracer field
  • internal uint Portals[2]
The index for the Sector's floor and ceiling SectorPortal respectively in the SectorPortals global array. 0 if none is present
  • readonly int PortalGroup
The id the sector uses to connect it to other portal-linked sectors
  • readonly int sectornum
The index of the sector in the Sectors global array

Methods

Non-static

Whenever functions below have an int pos argument, the valid values for it are Sector.floor for floor plane and Sector.ceiling for ceiling plane.

  • int Index()
Returns the index of the sector.
  • double, Sector, F3DFloor NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0)
Returns the highest ceiling point closest to the specified position.
  • double, Sector, F3DFloor NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0)
Returns the lowes floor point closest to the specified position.
Returns a pointer to a 3D floor that is in this sector based on the index passed.
  • int Get3DFloorCount()
Returns the total number of 3D floors attached to this sector.
  • Sector GetAttached(int index)
Returns a pointer to the control sector of a 3D floor that is in this sector based on the index passed. (Verification needed)
  • int GetAttachedCount()
Returns the total number of 3D floor control sectors attached to this sector.
  • void RemoveForceField()
Removes all forcefields in the sector. Meaning that it removes the ForceField special from all lines in the sector that have it, along with removing the lines' middle textures. And their ML_BLOCKING and ML_BLOCKEVERYTHING flags.
  • bool PlaneMoving(int pos)
Returns true if the sectors' planes are moving.
  • int GetFloorLight()
Returns the floor's light level.
  • int GetCeilingLight()
Returns the ceiling's light level.
  • Sector GetHeightSec()
Returns a pointer to the control sector which is applying the Transfer_Heights special to the sector.
  • void TransferSpecial(Sector model)
Transfer the damage variables, sector special, and sector flags of the model sector to the calling one.
(Need more info)
Obtains [[Structs:TerrainDef|]] at the position.
  • void CheckPortalPlane(int plane)
(Need more info)
  • double, Sector HighestCeilingAt(Vector2 a)
Returs the absolute height and a pointer to the sector of the highest ceiling at the specified XY position. a is a Vector2 that determines the 2D position.
  • double, Sector LowestFloorAt(Vector2 a)
Returs the absolute height and a pointer to the sector of the lowest ceiling at the specified XY position. a is a Vector2 that determines the 2D position.


The following functions get and set the transforms of the sectors' floor and ceiling textures.

  • void SetXOffset(int pos, double o)}}
Sets the X texture offset of the specified plane. o is what to set the offset to.
  • void AddXOffset(int pos, double o)
Ditto, but o is relative to the textures' current offset.
  • double GetXOffset(int pos)
Returns the X texture offset of the specified plane.
  • void SetYOffset(int pos, double o)
Sets the Y texture offset of the specified plane. o is what to set the offset to.
  • void AddYOffset(int pos, double o)
Ditto, but o is relative to the textures' current offset.
  • double GetYOffset(int pos, bool addbase = true)
Returns the X texture offset of the specified plane. addbase (Need more info)
  • void SetXScale(int pos, double o)
Sets the X scale of the texture on the specified plane, o is the scale to set.
  • double GetXScale(int pos)
Returns the X scale of the texture on the specified plane.
  • void SetYScale(int 'pos, double o)
Sets the Y scale of the texture on the specified plane, o is the scale to set.
  • double GetYScale(int pos)
Returns the Y scale of the texture on the specified plane.
  • void SetAngle(int pos, double o)
Sets the angle of the texture on the specified plane.
  • double GetAngle(int pos, bool addbase = true)
Returns the angle of the texture on the specified plane. addbase (Need more info)
  • void SetBase(int pos, double y, double o)
(Need more info)
  • void SetAlpha(int pos, double o)
(Need more info)
  • double GetAlpha(int pos)
(Need more info)
  • int GetFlags(int pos)
(Need more info)
  • int GetVisFlags(int pos)
Returns the sector's visibility flags, which include:
  • PLANEF_ABSLIGHTING - floor/ceiling light is absolute, not relative
  • PLANEF_BLOCKED - can not be moved anymore.
  • PLANEF_ADDITIVE - rendered additive
  • PLANEF_NORENDER
  • PLANEF_NOPASS - impassable linked portal (Verification needed)
  • PLANEF_DISABLED - disabled linked portal (Verification needed)
  • PLANEF_OBSTRUCTED - if the portal plane is beyond the sector's floor or ceiling (linked portal)
  • PLANEF_LINKED - plane is flagged as a linked portal
  • void ChangeFlags(int pos, int And, int Or)
(Need more info)
  • int GetPlaneLight(int pos)
(Need more info)
  • void SetPlaneLight(int pos, int level)
(Need more info)
  • void SetColor(Color c, int desat = 0)
Sets the sectors' color. desat is a desaturation value ranging from 0.0 (No desaturation) to 1.0 (Full desaturation).
  • void SetFade(Color c)
Sets the sectors' fade/fog color.
  • void SetFogDensity(int dens)
The sectors' fog density. The maximum value is 65535.
  • double GetGlowHeight(int pos)
(Need more info)
  • Color GetGlowColor(int pos)
(Need more info)
  • void SetGlowHeight(int pos, double height)
(Need more info)
  • void SetGlowColor(int pos, Color color)
(Need more info)
  • void SetSpecialColor(int pos, Color color)
(Need more info)
  • void SetAdditiveColor(int pos, Color color)
(Need more info)
  • void SetColorization(int tier, Name cname)
(Need more info)
  • TextureID GetTexture(int pos)
Returns the TextureID of the floor or ceiling texture.
  • void SetTexture(int pos, TextureID tex, bool floorclip = true)
Sets the texture of the specified plane to tex.If floorclip is true, the floorclip of any actors in the sector will also be adjusted.
  • double GetPlaneTexZ(int pos)
(Need more info)
  • void SetPlaneTexZ(int pos, double val, bool dirtify = false)
(Need more info)
  • void ChangeLightLevel(int newval)
Changes the sectors' light level relative to the current one. The maximum is 255.
  • void SetLightLevel(int newval)
Sets the light level to the exact amount specified. The maximum is 255.
  • int GetLightLevel()
Returns the sectors' light level.
  • bool IsLinked(Sector other, bool ceiling)
(Need more info)
  • bool PortalBlocksView(int plane)
(Need more info)
  • bool PortalBlocksSight(int plane)
(Need more info)
  • bool PortalBlocksMovement(int plane)
(Need more info)
  • bool PortalBlocksSound(int plane)
(Need more info)
  • bool PortalIsLinked(int plane)
(Need more info)
  • void ClearPortal(int plane)
(Need more info)
  • double GetPortalPlaneZ(int plane)
(Need more info)
  • Vector2 GetPortalDisplacement(int plane)
(Need more info)
  • int GetPortalType(int plane)
(Need more info)
  • int GetOppositePortalGroup(int plane)
(Need more info)
  • double CenterFloor()
Gets the height of the floors' center.
  • double CenterCeiling()
Gets the height of the ceilings' center.
Set the sectors' sound environment based on its' name (e.g Castle Alcove, City Abandoned)
  • void SetEnvironmentID(int envnum)
Set the sectors' sound environment based on its' ID. (Need more info)
  • SeqNode StartSoundSequenceID(int chan, int sequence, int type, int modenum, bool nostop }}={{c| false)
  • SeqNode StartSoundSequence(int chan, Name seqname, int modenum)
  • SeqNode CheckSoundSequence(int chan)
  • void StopSoundSequence(int chan)
Stops the sound sequence on the specified sound channel.
  • bool IsMakingLoopingSound()
Returns true if the sectors' sound sequence is looping.
  • bool IsSecret]()
Returns true if the sector is secret. (Has the SECF_SECRET flag)
  • bool WasSecret()
Returns true if the sector was secret. (Has the SECF_WASSECRET flag)
  • void ClearSecret()
Clears SECF_SECRET from the sector.
  • int GetUDMFInt(Name nm)
Returns the integer value of the specified UDMF key (e.g user_customvalue).
  • double GetUDMFFloat(Name nm)
Returns the float value of the specified UDMF key (e.g user_customvalue).
  • string GetUDMFString(Name nm)
Returns the string value of the specified UDMF key (e.g user_linedefname).
Returns the total number of tags attached to the sector. The resulting value can be used in a FOR loop to iterate over tag indexes and get the actual tags with GetTag().
  • int GetTag(int index) (New from 4.11.0)
Returns the tag at the specified index. The maximum index can be obtained with CountTags() (Verification needed)