Structs:LevelLocals

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


The LevelLocals struct contains information and methods about the current level. These can be accessed through the global variable level.

LevelLocals also has static methods for performing some geometry calculations, which account for portals in the level.

Methods

Static

Static methods are called through the name LevelLocals, e.g. LevelLocals.Vec3Diff(…)

  • Vector3 Vec3Diff(Vector3 v1, Vector3 v2)
Computes the difference between two vectors (v2 - v1), accounting for portals.
  • Vector2 Vec2Diff(Vector2 v1, Vector2 v2)
Does the same as above, but with Vector2 variables that only store the XY coordinates instead.
  • Vector3 SphericalCoords(Vector3 viewpoint, Vector3 targetPos [, Vector2 viewAngles] [, bool absolute])
Computes spherical coordinates (yaw, pitch, and distance) between two points in the level.
  • Void MakeScreenShot()
Takes a screenshot of the current game window.
  • Void MakeAutoSave()
Creates an autosave.
  • Bool IsJumpingAllowed()
Returns true if jumping is allowed in the current level.
  • Bool IsCrouchingAllowed()
Returns true if crouching is allowed in the current level.
  • Bool IsFreelookAllowed()
Returns true if freelook is allowed in the current level.
  • String GetChecksum()
Retrieves the MD5 checksum of the current level.
Works similarly to the ACS ChangeSky function, but accepts TextureIDs instead of using texture names.
  • Int IsFrozen()
Returns 1 or above if the level is frozen. And 0 if it is not.
  • Bool SetFrozen(Bool On)
Freezes the level if the On boolean is set to true.
  • Void ExitLevel(Int Position, Bool KeepFacing)
Exits the level at the specified player spot of the next map defined in MAPINFO, is 0 by default. If KeepFacing is true, the player retains the direction they were facing.
  • Void SecretExitLevel(Int Position)
Exits to the secret map defined for the current map in MAPINFO, position specifies which player start spot to start the new level in. Default is 0.
  • Void ChangeLevel(String LevelName, Int Position, Int Flags, Int Skill)
Changes the level to the one given to the LevelName parameter. Also includes parameters to specify the position to enter at, and the flags and skill level to use.
  • Void GiveSecret(Actor Activator, Bool PrintMsg, Bool PlaySound)
Gives a secret to an actor, who is the actor that run the function by default. The PrintMsg and PlaySound booleans print the "A secret is revealed !" message and play the secret sound if set to true, respectively.
  • Void StartSlideshow(Name WhichOne)
Starts a Strife slideshow, the name of the slideshow to start is defined on the WhichOne parameter.
  • Void SetInterMusic(String NextMap)
Sets the music of the current level to that of the map specified in the NextMap parameter.
Replace all the textures in the level specified in the From parameter to the ones specified in To, also includes several flags to set exceptions for what instances of the From texture are replaced.
  • Bool IsPointInLevel(Vector3 P)
Returns true if the P vector is a within the level boundaries, false if it is in the void.

Variables

This is a list of all the level variables inside the LevelLocals struct, with descriptions of what each of them contains, they can be read to retrieve level info, and if they aren't set as read only, modify it as well.

Level geometry arrays

The arrays below store the levels' geometry.

  • Array<@Sector> Sectors
This array stores all of the sectors in the current map.
  • Array<@Line> Lines
This array stores all of the linedefs in the current map.
  • ReadOnly Array<@Side> Sides
This array stores all of the sidedefs in the current map.
  • Array<@SectorPortal> SectorPortals
This array stores all of the sector portals in the current map.

Level data

  • ReadOnly Int Time
The time in tics that has elapsed in the current hub.
  • ReadOnly Int MapTime
The time in tics since the beginning of the current map.
  • ReadOnly Int TotalTime
The total time in tics that has elapsed inside the game, hubs included.
  • ReadOnly Int StartTime
The time in tics in which the current map begun.
  • ReadOnly Int ParTime
The par time of the current level, in seconds.
  • ReadOnly Int SuckTime
The suck time of the current level, in hours.
  • ReadOnly Int Cluster
The number of the cluster the map is in.
  • ReadOnly Int ClusterFlags
(Need more info)
  • ReadOnly Int LevelNum
The identification number of the current level. Used by the Teleport_NewMap special.
  • ReadOnly String LevelName
Contains the "nice" name of the current level. That is to say, the one that appears in places such as the intermission screens.
  • ReadOnly String MapName
Contains the lump/file name of the current level. e.g MAP32
  • ReadOnly String NextMap
The name of the next map that is defined in MAPINFO.
  • ReadOnly String NextSecretMap
The name of the next secret map that is defined in MAPINFO.
  • ReadOnly String F1Pic
The name of the graphic that appears when you press F1.
  • ReadOnly Int MapType
(Need more info)
  • ReadOnly String AuthorName
The name of the maps' author.
  • ReadOnly String Music
The name of the current music file playing on the map.
  • ReadOnly Int MusicOrder
The number of the current track playing on the map, useful if the map uses a music file that can contain multiple tracks. Otherwise returns 0.
  • ReadOnly TextureID SkyTexture1
The TextureID of the texture currently used by the main sky layer.
  • ReadOnly TextureID SkyTexture2
Same as above, but for the second/background sky layer.
  • Float SkySpeed1
The speed which the main sky layer scrolls at. 0 by default.
  • Float SkySpeed2
Same as above, but for the backgroud sky layer.
  • Int Total_Secrets
The total amount of secrets on the map.
  • Int Found_Secrets
The amount of secrets that have been found so far.
  • Int Total_Items
The total amount of items on the map.
  • Int Found_Items
The amount of items that have been acquired so far.
  • Int Total_Monsters
The total monster count of the map.
  • Int Killed_Monsters
The amount of monsters that have been killed so far.
  • Double Gravity
The level-wide amount of gravity on the map. Defaults to 800.
  • Double AirControl
The amount of control the player has over their movement while airborne. Defaults to 0.00390625.
  • Double AirFriction
The amount of friction the player and other actors experience while airborne. Defaults to 65321 (99.67% of momentum is retained.)
  • Int AirSupply
The amount of time in seconds the player can stay underwater before beginning to drown.
  • ReadOnly Double TeamDamage
A multiplier that increases or decreases the amount of damage players receive by other team mates in Team Deathmatch and Cooperative modes. Defaults to 1.
  • ReadOnly Bool NoInventoryBar
Prevents the inventory bar from appearing in the map if set to true.
  • ReadOnly Bool MonsterTelefrag
If true, allows all monsters to be able to telefrag each other and players, with the exception of monsters with the NOTELESTOMP flag.
  • ReadOnly Bool ActOwnSpecial
If true, when an actor with a special dies, it is considered its' own activator instead of the actors' killer, which is the default behaviour.
  • ReadOnly Bool SndSeqTotalCtrl
If true, the sound sequence that a sector plays when it moves is whichver has an ID of 0. Instead of whatever sound sequence is defined by the special used to move the sector playing.
  • Bool Allmap
(Need more info)
  • ReadOnly Bool MissilesActiveImpact
If true, the missile that hit a line is considered to be the lines' activator, instead of the missiles' shooter.
  • ReadOnly Bool MonsterFallingDamage
If set to true, monsters will receive falling damage from falling from too high.
  • ReadOnly Bool CheckSwitchRange
If set to true, a height check is performed when the player uses a switch, to prevent them from being able to activate switches far above their hitbox, false by default.
  • ReadOnly Bool PolyGrind
If set to true, polyobjects crush monster and player corpses to gibs when crossing over them. False by default.
  • ReadOnly Bool NoMonsters
If set to true, no monsters will spawn in the map.
  • ReadOnly Bool AllowRespawn
If set to true, the player will respawn after being killed like in a co-op game.
  • ReadOnly Bool Infinite_Flight
If set to true, flight powerups will last indefinitely in the map.
  • ReadOnly Bool No_Dlg_Freeze
(Need more info)
  • ReadOnly Bool KeepFullInventory
If set to true, players will not have the quantity of all their inventory items reduced to 1 when they exit this map, if it isn't part of a hub.
  • ReadOnly Bool RemoveItems
If set to true, the player loses all their items once leaving the map, except for those with the INVENTORY_UNDROPPABLE flag.
  • ReadOnly Int FogDensity
The level-wide fog density of a map.
  • ReadOnly Int OutsideFogDensity
The level-wide outside fog density of a map.
  • ReadOnly Int SkyFog
(Need more info)
  • ReadOnly Double PixelStretch
The amount by which pixels are stretched in the level, used to emulate Dooms' aspect ratio correction. Is 1.2 by default.
  • ReadOnly Double MusicVolume
The volume at which the music on the map plays, is 1.0 by default and cannot go higher.
  • Name DeathSequence
The intermission sequence the player goes in if they die in the current map.
  • ReadOnly Int CompatFlags
The field in which map-specific compatibility options are stored.
  • ReadOnly Int CompatFlags
Same as above, but this is the second field used by compatibility flags.