Structs:LevelLocals

From ZDoom Wiki
(Redirected from LevelLocals)
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 or Level, e.g. LevelLocals.MakeScreenShot(…).

  • void MakeScreenShot()
Takes a screenshot of the current game window.
  • void MakeAutoSave()
Creates an autosave.
  • clearscope bool IsPointInMap(vector3 p) (deprecated)
Superseded by Level.IsPointInLevel

Dynamic

Dynamic methods are called on the global Level pointer, e.g. Level.Vec3Diff(…).

  • clearscope vector3 Vec3Diff(vector3 v1, vector3 v2)
Computes the difference between two vectors (v2 - v1), accounting for portals.
  • clearscope vector2 Vec2Diff(vector2 v1, vector2 v2)
Does the same as above, but with vector2 variables that only store the XY coordinates instead.
  • clearscope vector3 Vec3Offset(vector3 pos, vector3 dir [, bool absolute = false])
Works exactly like the actor-based Vec3Offset, except that it allows you to specify the origin coordinates with pos, and the offset with dir. Instead of the origin being the calling actors'.
  • clearscope vector3 SphericalCoords(vector3 viewpoint, vector3 targetPos [, vector2 viewAngles] [, bool absolute])
Computes spherical coordinates (yaw, pitch, and distance) between two points in the level.
  • 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 MiniWikipediaLogoIcon.pngMD5 checksum of the current level.
Works similarly to the ACS ChangeSky function, but accepts TextureIDs instead of using texture names.
Forces the map to create a lightning strike. And can also have a custom sound play for that particular strike that's different from the maps' LightningSound. The modes are the same as on the Light_ForceLightning special.
  • SectorTagIterator CreateSectorTagIterator(int tag, line defline = null)
Creates a SectorTagIterator to find sectors with a specified tag.
  • 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 = 0, int flags = 0, int skill = -1)
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.
  • clearscope bool IsPointInLevel(vector3 p)
Returns true if the P vector is a within the level boundaries, false if it is in the void.
  • Sector PointInSector(vector2 pt)
Returns a pointer to the the sector where the specified coordinates are located.
Spawns a particle with parameters passed by a FSpawnParticleParams struct.
Spawns a VisualThinker and returns a pointer to it.
  • String GetUDMFString(int type, int index, Name key)
  • int GetUDMFInt(int type, int index, Name key)
  • double GetUDMFFloat(int type, int index, Name key)
  • play int ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0)
  • void WorldDone()
  • ui Vector2 GetAutomapPosition()
  • String FormatMapName(int mapnamecolor)
  • void StartIntermission(Name type, int state) const
  • play SpotState GetSpotState(bool create = true)
  • int FindUniqueTid(int start = 0, int limit = 0)
  • uint GetSkyboxPortal(Actor actor)
  • clearscope HealthGroup FindHealthGroup(int id)
  • vector3, int PickDeathmatchStart()
  • vector3, int PickPlayerStart(int pnum, int flags = 0)
  • string LookupString(uint index)
  • play bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = 0)
  • play bool CreateFloor(sector sec, int floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false)
  • String GetClusterName()
  • String GetEpisodeName()
  • clearscope Vector2 GetDisplacement(int pg1, int pg2)
  • clearscope int GetPortalGroupCount()
  • clearscope int PointOnLineSide(Vector2 pos, Line l, bool precise = false)
  • clearscope int ActorOnLineSide(Actor mo, Line l)
  • clearscope int BoxOnLineSide(Vector2 pos, double radius, Line l)

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 all the different parts of 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<@Vertex> Vertexes
This array stores all of the vertices in the current map.
  • Array<@LinePortal> LinePortals (New from 4.11.0)
This array stores all the line portals 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 background sky layer.
The sound that lightning makes on this map when it strikes, default is "world/thunder".
  • 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.
  • readonly LevelInfo info
A pointer to the LevelInfo struct for the current map.