text:
# LevelLocals

Most map-relative data is stored in this structure.

```
struct LevelLocals
{
	// Map data
	array<Line>   Lines;
	array<Sector> Sectors;
	array<Side>   Sides;

	internal array<SectorPortal> SectorPortals;
	readonly array<Vertex>       Vertexes;

	// Stats
	int Found_Items;
	int Found_Secrets;
	int Killed_Monsters;
	int Total_Items;
	int Total_Monsters;
	int Total_Secrets;

	// Time
	readonly int MapTime;
	readonly int ParTime;
	readonly int StartTime;
	readonly int SuckTime;
	readonly int Time;
	readonly int TotalTime;

	// Map sequencing
	readonly int    Cluster;
	readonly int    ClusterFlags;
	readonly string LevelName;
	readonly int    LevelNum;
	readonly string MapName;

	string NextMap;
	string NextSecretMap;

	readonly int MapType;

	// Music
	readonly string Music;
	readonly int    MusicOrder;

	// Sky
	readonly textureid SkyTexture1;
	readonly textureid SkyTexture2;

	float SkySpeed1;
	float SkySpeed2;

	// Physics
	play double AirControl;
	play double AirFriction;
	play int    AirSupply;
	play double Gravity;

	readonly int CompatFlags;
	readonly int CompatFlags2;

	// State
	bool AllMap;
	deprecated("3.8") bool Frozen;

	// Static info
	name DeathSequence;

	readonly bool   ActOwnSpecial;
	readonly bool   AllowRespawn;
	readonly bool   CheckSwitchRange;
	readonly string F1Pic;
	readonly int    FogDensity;
	readonly bool   Infinite_Flight;
	readonly bool   KeepFullInventory;
	readonly bool   MissilesActivateImpact;
	readonly bool   MonsterFallingDamage;
	readonly bool   MonstersTelefrag;
	readonly bool   NoInventoryBar;
	readonly bool   NoMonsters;
	readonly bool   No_Dlg_Freeze;
	readonly int    OutsideFogDensity;
	readonly float  PixelStretch;
	readonly bool   PolyGrind;
	readonly bool   RemoveItems;
	readonly int    SkyFog;
	readonly bool   SndSeqTotalCtrl;
	readonly double TeamDamage;

	double GetUdmfFloat(int type, int index, name key);
	int    GetUdmfInt(int type, int index, name key);
	string GetUdmfString(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   ChangeSky(textureid sky1, textureid sky2);
	string FormatMapName(int mapnamecolor);
	string GetChecksum() const;
	void   SetInterMusic(string nextmap);
	void   StartIntermission(name type, int state) const;
	string TimeFormatted(bool totals = false);

	bool IsCrouchingAllowed() const;
	bool IsFreelookAllowed() const;
	bool IsJumpingAllowed() const;

	void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
	void StartSlideshow(name whichone = 'none');
	void WorldDone();

	static void MakeScreenShot();
	static void MakeAutoSave();

	deprecated("3.8") static void RemoveAllBots(bool fromlist);

	ui vector2 GetAutomapPosition();

	play SpotState GetSpotState(bool create = true);
	int FindUniqueTid(int start = 0, int limit = 0);
	uint GetSkyboxPortal(Actor actor);
	void ReplaceTextures(string from, string to, int flags);
	clearscope HealthGroup FindHealthGroup(int id);
	vector3, int PickDeathmatchStart();
	vector3, int PickPlayerStart(int pnum, int flags = 0);
	int IsFrozen() const;
	void SetFrozen(bool on);

	clearscope bool IsPointInLevel(vector3 p) const;
	clearscope Sector PointInSector(vector2 p) const;
	deprecated("3.8") static clearscope bool IsPointInMap(vector3 p);

	clearscope vector3 SphericalCoords(vector3 viewpoint, vector3 targetPos, vector2 viewAngles = (0, 0), bool absolute = false) const;
	clearscope vector2 Vec2Diff(vector2 v1, vector2 v2) const;
	clearscope vector2 Vec2Offset(vector2 pos, vector2 dir, bool absolute = false) const;
	clearscope vector3 Vec2OffsetZ(vector2 pos, vector2 dir, double atz, bool absolute = false) const;
	clearscope vector3 Vec3Diff(vector3 v1, vector3 v2) const;
	clearscope vector3 Vec3Offset(vector3 pos, vector3 dir, bool absolute = false) const;

	SectorTagIterator CreateSectorTagIterator(int tag, Line defline = null);
	LineIDIterator CreateLineIDIterator(int tag);
	ActorIterator CreateActorIterator(int tid, class<Actor> type = "Actor");

	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 type, Line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, bool crushmode = false, bool hereticlower = false);
}
```

TODO

### `ClusterFlags`

Flags for this cluster. May contain any of the following bit flags:

| Name                | Description                      |
| ----                | -----------                      |
| `Level.CLUSTER_HUB` | This cluster uses hub behaviour. |

<!-- EOF -->


text:
# DehInfo

Static DeHackEd information.

```
struct DehInfo
{
	readonly int    BfgCells;
	readonly int    BlueAC;
	readonly double ExplosionAlpha;
	readonly uint8  ExplosionStyle;
	readonly int    MaxHealth;
	readonly int    MaxSoulsphere;
	readonly int    NoAutofreeze;
}
```

### `BfgCells`

The amount of ammunition `A_FireBfg` will deplete. Default is 40.

### `BlueAC`

Multiple of 100 for `BlueArmor`'s `Armor.SaveAmount`. Default is 2 for 200
armor.

### `ExplosionAlpha`

For actors with the `DEHEXPLOSION` flag, the alpha to set the actor to on
explosion.

### `ExplosionStyle`

For actors with the `DEHEXPLOSION` flag, the render style to be applied on
explosion.

### `MaxHealth`

TODO

### `MaxSoulsphere`

The `Inventory.MaxAmount` for `Soulsphere`. Default is 200.

### `NoAutofreeze`

Overrides generic freezing deaths if not zero, making all actors act as if they
had the `NOICEDEATH` flag.

<!-- EOF -->

repo_name: zdoom-docs/stable

repo_language: Ruby

mime_type: text/x-ruby


text:
# String

Strings have many methods attached to them for manipulating text.

```
struct String
{
	static vararg string Format(string format, ...);

	vararg void AppendFormat(string format, ...);

	string CharAt(int pos) const;
	int    CharCodeAt(int pos) const;
	string Filter();
	int    IndexOf(string substr, int startIndex = 0) const;
	string Left(int len) const;
	uint   Length() const;
	string Mid(int pos = 0, int len = int.Max) const;
	void   Remove(int index, int amount);
	void   Replace(string pattern, string replacement);
	int    RightIndexOf(string substr, int endIndex = int.Max) const;
	void   Split(out array<string> tokens, string delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
	double ToDouble() const;
	int    ToInt(int base = 0) const;
	void   ToLower();
	void   ToUpper();
	void   Truncate(int newlen);

	deprecated("3.5.1") int LastIndexOf(string substr, int endIndex = int.Max) const;
}
```

### `Format`

Creates a string using a format string and any amount of arguments.

### `AppendFormat`

Works like `Format`, but appends the result to the string.

### `CharAt`

Returns the character at `pos` as a new string.

### `CharCodeAt`

Returns the character at `pos` as an integer.

### `Filter`

Replaces escape sequences in a string with escaped characters as a new string.

### `IndexOf`

Returns the first index of `substr` starting from the left at `start`.

### `Left`

Returns the first `len` characters as a new string.

### `Length`

Returns the number of characters in this string.

### `Mid`

Returns `len` characters starting at `pos` as a new string.

### `Remove`

Removes `amount` characters starting at `index` in place.

### `Replace`

Replaces all instances of `pattern` with `replacement` in place.

### `RightIndexOf`

Returns the first index of `substr` starting from the right at `end`.

### `Split`

Splits the string by each `delimiter` into `tokens`. `keepEmpty` may be either
`TOK_SKIPEMPTY` (the default) or `TOK_KEEPEMPTY`, which will keep or discard
empty strings found while splitting.

### `ToDouble`

Interprets the string as a double precision floating point number.

### `ToInt`

Interprets the string as a base `base` integer, guessing the base if it is `0`.

### `ToLower`

Converts all characters in the string to lowercase in place.

### `ToUpper`

Converts all characters in the string to uppercase in place.

### `Truncate`

Truncates the string to `len` characters in place.

### `LastIndexOf`

Broken. Use `RightIndexOf` instead.

<!-- EOF -->


text:
# Color

Colors simply store red, green, blue and alpha components. Each component has a
range 0 to 255, inclusive.

```
struct Color
{
	uint8 a, r, g, b;
}
```

<!-- EOF -->


text:
# Array

While ZScript does not have proper user-facing generics, `Array` is one such
type that does have a (hard-coded) type parameter. It mirrors the internal
`TArray` type exactly. Note that all Object types monomorphize to the same
implementation and structures cannot be stored in arrays due to no polymorphic
variant of `TArray` existing in the engine.

```
struct Array<Type>
{
	uint Max() const;
	uint Size() const;

	void Append(array<Type> other);
	void Copy(array<Type> other);
	void Move(array<Type> other);

	void Clear();
	void Delete(uint index, int deletecount = 1);
	bool Pop();

	uint Find(Type item) const;
	void Grow(uint amount);
	void Insert(uint index, Type item);
	uint Push(Type item);
	uint Reserve(uint amount);
	void Resize(uint amount);
	void ShrinkToFit();
}
```

### `Max`

Returns the amount of allocated objects in the array.

### `Size`

Returns the amount of constructed objects in the array.

### `Clear`

Clears out the entire array, possibly destroying all objects in it.

### `Delete`

Removes `count` objects starting at `index`, possibly destroying them. Moves
objects after `index + count` to the left.

### `Pop`

Removes the last item in the array, possibly destroying it. Returns `false` if
there are no items in the array to begin with.

### `Append`

Value-copies another array's contents and places them into this array at the
end.

### `Copy`

Value-copies another array's contents into this array. The contents of `other`
are preserved. This operation can be extremely taxing in some cases.

### `Move`

Moves another array's contents into this array. The contents of `other` are
left indeterminate and shall not be used. This operation is extremely fast
as it only copies pointers but must be used carefully to avoid error.

### `Find`

Finds the index of `item` in the array, or `Size` if it couldn't be found.

### `Grow`

Ensures the array can hold at least `amount` new members, growing the allocated
object amount if necessary.

### `Insert`

Inserts `item` at `index`. Moves objects after `index` to the right.

### `Push`

Places `item` at the end of the array, calling `Grow` if necessary.

### `Reserve`

Adds `amount` new empty-constructed objects at the end of the array, increasing
`Size` and calling `Grow` if necessary. Value types are initialized to zero and
reference types to `null`.

### `Resize`

Adds or removes objects based on `amount`. If it is less than `Size` then
objects are destroyed, if it is more then objects are empty-constructed. New
objects follow the same initialization rules as `Reserve`.

### `ShrinkToFit`

Shrinks `Max` to `Size`. Does not mutate any objects in the array.

<!-- EOF -->


text:
# Vector2/Vector3

Vectors have builtin methods and `Vector3` in particular has a swizzle
operator.

```
struct Vector2
{
	double x, y;

	double  Length() const;
	vector2 Unit() const;
}

struct Vector3
{
	double x, y, z;
	vector2 xy;

	double  Length() const;
	vector3 Unit() const;
}
```

### `Length`

Returns the length (magnitude) of the vector.

### `Unit`

Returns a normalized vector. Equivalent to `vec / vec.Length()`.

<!-- EOF -->


text:
# Type[N]

Fixed-size arrays have a size method attached to them for convenience purposes.

```
struct Type[N]
{
	uint Size() const;
}
```

### `Size`

Returns the size of the array. This is a compile-time constant.

<!-- EOF -->


text:
# StringTable

The localized string table as defined by `LANGUAGE`.

```
struct StringTable
{
	static string Localize(string val, bool prefixed = true);
}
```

### `Localize`

Returns the localized variant of `val`. If `prefixed` is `true`, the string is
returned as-is unless it is prefixed with `$` where the `$` character itself is
ignored. **Not deterministic** unless there is only one variant of `val`. This
is generally fine because this should only be used for visual strings anyway.

<!-- EOF -->


text:
# Thinker

A class representing any object in the game that runs logic every game tick,
i.e., "thinks." Most classes derive from `Thinker`, directly or indirectly.

All thinkers are grouped by their "stat" number, or "statnum," which specifies
the ordering of which thinkers are run, first to last. There are 127 stat
numbers total, 20 of which are not used by the engine and may be used for any
purpose.

The user-defined stat numbers begin at `Thinker.STAT_USER` and end at
`Thinker.STAT_USER_MAX`. Do not attempt to use normal integers as stat numbers
except as relative to these two.

<!--
	NOTE: These tables are not alphabetically organized as their ordering is
	      meaningful.
-->

Thinkers which do not think and are elided from many checks:

| Name                         | Description                                              |
| ----                         | -----------                                              |
| `Thinker.STAT_INFO`          | Info queue (used by `SpecialSpot` and its descendants.)  |
| `Thinker.STAT_DECAL`         | Decals that cannot be deleted.                           |
| `Thinker.STAT_AUTODECAL`     | Decals that can be deleted (were not placed by the map.) |
| `Thinker.STAT_CORPSEPOINTER` | An entry in Hexen's corpse queue.                        |
| `Thinker.STAT_TRAVELLING`    | Any actor travelling between maps in a hub.              |
| `Thinker.STAT_STATIC`        | Thinkers persistent across maps.                         |

Thinkers which do think and are mandatory to many checks:

| Name                         | Description                                              |
| ----                         | -----------                                              |
| `Thinker.STAT_SCROLLER`      | Texture scrollers and carriers.                          |
| `Thinker.STAT_PLAYER`        | All `PlayerPawn` actors.                                 |
| `Thinker.STAT_BOSSTARGET`    | `BossBrain` targets.                                     |
| `Thinker.STAT_LIGHTNING`     | Lightning as used by Hexen.                              |
| `Thinker.STAT_DECALTHINKER`  | Decal animators.                                         |
| `Thinker.STAT_INVENTORY`     | All `Inventory` items.                                   |
| `Thinker.STAT_LIGHT`         | Sector lighting thinkers.                                |
| `Thinker.STAT_LIGHTTRANSFER` | Sector lighting transfer thinkers.                       |
| `Thinker.STAT_EARTHQUAKE`    | Quake effects.                                           |
| `Thinker.STAT_MAPMARKER`     | All `MapMarker` actors.                                  |
| `Thinker.STAT_DLIGHT`        | Dynamic lights.                                          |
| `Thinker.STAT_DEFAULT`       | Anything not in any other category. Most actors go here. |
| `Thinker.STAT_SECTOREFFECT`  | Sector effects that cause floor or ceiling movement.     |
| `Thinker.STAT_ACTORMOVER`    | All `ActorMover` actors.                                 |
| `Thinker.STAT_SCRIPTS`       | The ACS VM.                                              |
| `Thinker.STAT_BOT`           | All bot logic. This is not bound to their actor.         |

```
class Thinker : Object play
{
	const TICRATE;

	LevelLocals Level;

	void ChangeStatNum(int stat);

	virtual void PostBeginPlay();
	virtual void Tick();

	static clearscope int Tics2Seconds(int tics);
}
```

### `TICRATE`

The number of game ticks in a second. This value is always `int(35)`.

### `Level`

The level this `Thinker` is in, which may differ from another one's.

### `ChangeStatNum`

Changes the statnum of this `Thinker`.

### `PostBeginPlay`

Called at the very end of this Thinker's initialization.

### `Tick`

Called every game tick. The order between this thinker's `Tick` and every other
thinker in the same statnum is unspecified.

### `Tics2Seconds`

Roughly converts a number of tics to an integral amount of seconds. Equivalent
to `tics / TICRATE`.

<!-- EOF -->


text:
# CVar

A **C**onsole **Var**iable, either defined in `CVARINFO` or by the engine.
**Not serializable. Do not use as a member unless marked as `transient`.**

All Get and Set operations will work regardless of the real type of the CVar,
as they aren't "strongly" typed.

```
struct CVar
{
	static CVar FindCVar(name n);
	static CVar GetCVar(name n, PlayerInfo player = null);

	bool   GetBool();
	double GetFloat();
	int    GetInt();
	string GetString();

	void SetBool(bool v);
	void SetFloat(double v);
	void SetInt(int v);
	void SetString(string v);

	int GetRealType();
	int ResetToDefault();
}
```

### `FindCVar`

Returns a server CVar by name, or `null` if none is found.

### `GetCVar`

Returns a user or server CVar by name, with `player` as the user if applicable,
or `null` if none is found.

### `GetBool`

Returns a boolean representing the value of the CVar, or `false` if it
cannot be represented.

### `GetFloat`

Returns a float representing the value of the CVar, or `0.0` if it cannot be
represented.

### `GetInt`

Returns an integer representing the value of the CVar, or `0` if it cannot be
represented.

### `GetString`

Returns a string representing the value of the CVar. CVars can always be
represented as strings.

### `SetBool`, `SetFloat`, `SetInt`, `SetString`

Sets the representation of the CVar to `v`. May only be used on mod-defined
CVars.

### `GetRealType`

Returns the type of the CVar as it was defined, which may be one of the
following:

| Name               |
| ----               |
| `CVar.CVAR_BOOL`   |
| `CVar.CVAR_COLOR`  |
| `CVar.CVAR_FLOAT`  |
| `CVar.CVAR_INT`    |
| `CVar.CVAR_STRING` |

### `ResetToDefault`

Resets the CVar to its default value and returns 0. The purpose of the
return is unknown. May only be used on mod-defined CVars.

<!-- EOF -->


text:
# Object

The base class of all `class` types.

```
class Object
{
	bool bDestroyed;

	class  GetClass();
	string GetClassName();
	class  GetParentClass();

	virtualscope void Destroy();

	virtual virtualscope void OnDestroy();
}
```

### `bDestroyed`

This object wants to be destroyed but has not yet been garbage collected.

### `GetClass`

Returns the class type of this object.

### `GetClassName`

Returns a string representation of the class type of this object.

### `GetParentClass`

Returns the class type of this object's parent class.

### `Destroy`

Destroys this object. Do not use the object after calling this. References to
it will be invalidated.

### `OnDestroy`

Called just before the object is collected by the garbage collector. **Not
deterministic** unless the object is linked into the thinker list, in which
case it is destroyed earlier in a deterministic setting. Not all `Thinker`s are
linked into this list, so be careful when overriding this. Any `Actor` will
generally be safe.

<!-- EOF -->


text:
# Line

Also known as a "linedef." A line segment with two sides and two vertices.

```
struct Line play
{
	readonly Sector  BackSector, FrontSector;
	readonly double  BBox[4];
	readonly vector2 Delta;
	readonly Side    Sidedef[2];
	readonly Vertex  V1, V2;

	readonly uint PortalIndex;
	readonly uint PortalTransferred;

	readonly int Health;
	readonly int HealthGroup;

	double Alpha;
	uint   Flags;
	int    ValidCount;

	uint Activation;
	int  Args[5];
	int  LockNumber;
	int  Special;

	int Index();

	bool Activate(Actor activator, int side, int type);
	bool RemoteActivate(Actor activator, int side, int type, vector3 pos);

	Line GetPortalDestination();
	bool IsLinePortal();
	bool IsVisualPortal();

	clearscope int GetHealth();
	void SetHealth(int newhealth);

	double GetUdmfFloat(name nm);
	int    GetUdmfInt(name nm);
	string GetUdmfString(name nm);
}
```

### `BackSector`, `FrontSector`

The sector of the front and back sides of this line.

### `BBox`

The top, bottom, left and right of the line, respective to array index.

### `Delta`

Equivalent to `V2 - V1`.

### `V1`, `V2`

Returns the start and end points of this line segment, respectively.

### `Sidedef`

The front and back sides of this line, 0 and 1 respectively. The aliases
`Line.Front` and `Line.Back` are provided as well.

### `PortalIndex`

TODO

### `PortalTransferred`

TODO

### `Health`

TODO

### `HealthGroup`

TODO

### `Alpha`

Alpha of the middle texture on both sides.

### `Flags`

Any combination of the following bit flags:

| Name                     | Description                                                                       |
| ----                     | -----------                                                                       |
| `ML_3DMIDTEX_IMPASS`     | Middle texture will collide with projectiles and allow them to pass through.      |
| `ML_3DMIDTEX`            | Middle texture can be collided with and walked on as if it were a thin sector.    |
| `ML_ADDTRANS`            | Middle textures are drawn with additive translucency on both sides.               |
| `ML_BLOCKEVERYTHING`     | Line blocks everything.                                                           |
| `ML_BLOCKHITSCAN`        | Line blocks hit scan attacks.                                                     |
| `ML_BLOCKING`            | Line is solid and blocks everything but projectiles and hit scan attacks.         |
| `ML_BLOCKMONSTERS`       | Line blocks non-flying monsters.                                                  |
| `ML_BLOCKPROJECTILE`     | Line blocks projectiles.                                                          |
| `ML_BLOCKSIGHT`          | Line blocks line of sight.                                                        |
| `ML_BLOCKUSE`            | Line blocks use actions.                                                          |
| `ML_BLOCK_FLOATERS`      | Line blocks flying monsters.                                                      |
| `ML_BLOCK_PLAYERS`       | Line blocks players.                                                              |
| `ML_CHECKSWITCHRANGE`    | Checks the activator's vertical position as well as horizontal before activating. |
| `ML_CLIP_MIDTEX`         | Applies `WALLF_CLIP_MIDTEX` to both sides.                                        |
| `ML_DONTDRAW`            | Never shown on the auto-map.                                                      |
| `ML_DONTPEGBOTTOM`       | Lower texture is unpegged on both sides.                                          |
| `ML_DONTPEGTOP`          | Upper texture is unpegged on both sides.                                          |
| `ML_FIRSTSIDEONLY`       | Special can only be activated from the front side.                                |
| `ML_MAPPED`              | Always shown on the auto-map.                                                     |
| `ML_MONSTERSCANACTIVATE` | Monsters may activate this line.                                                  |
| `ML_RAILING`             | Line is a railing that can be jumped over.                                        |
| `ML_REPEAT_SPECIAL`      | Special may be activated multiple times.                                          |
| `ML_SECRET`              | Line will be shown as one-sided on the auto-map.                                  |
| `ML_SOUNDBLOCK`          | Blocks sound propagation after two lines with this flag.                          |
| `ML_TWOSIDED`            | Line has a back side.                                                             |
| `ML_WRAP_MIDTEX`         | Applies `WALLF_WRAP_MIDTEX` to both sides.                                        |
| `ML_ZONEBOUNDARY`        | Reverb zone boundary.                                                             |

### `ValidCount`

Don't use this.

### `Activation`

TODO

### `Args`

Arguments of the line's special action.

### `LockNumber`

TODO

### `Special`

Number of the special action to be executed when this line is activated.

### `Index`

Returns the index of this line.

### `Activate`

TODO

### `RemoteActivate`

TODO

### `GetPortalDestination`

TODO

### `IsLinePortal`

TODO

### `IsVisualPortal`

TODO

### `GetHealth`

TODO

### `SetHealth`

TODO

### `GetUdmfFloat`, `GetUdmfInt`, `GetUdmfString`

Gets a named UDMF property attached to this linedef.

<!-- EOF -->


text:
# SecSpecial

TODO

```
struct SecSpecial play
{
	int   DamageAmount;
	int16 DamageInterval;
	name  DamageType;
	int   Flags;
	int16 LeakyDamage;
	int16 Special;
}
```

### `DamageAmount`

TODO

### `DamageInterval`

TODO

### `DamageType`

TODO

### `Flags`

TODO

### `LeakyDamage`

TODO

### `Special`

TODO

<!-- EOF -->


text:
# Side

Also known as a "sidedef." One of the textured sides of a line. Each sidedef
has three portions: Upper, middle, and lower. The middle texture is special as
it can have translucency.

The three portions of a sidedef can be referred to with:

| Name          | Description         |
| ----          | -----------         |
| `Side.Top`    | The upper portion.  |
| `Side.Mid`    | The middle portion. |
| `Side.Bottom` | The lower portion.  |

```
struct Side play
{
	readonly Line   Linedef;
	readonly Sector Sector;

	uint8 Flags;
	int16 Light;

	int Index();

	clearscope Vertex V1();
	clearscope Vertex V2();

	textureid GetTexture(int which);

	double GetTextureXOffset(int which);
	double GetTextureYOffset(int which);

	double GetTextureXScale(int which);
	double GetTextureYScale(int which);

	void SetTexture(int which, textureid tex);

	void SetTextureXOffset(int which, double offset);
	void SetTextureYOffset(int which, double offset);

	void SetTextureXScale(int which, double scale);
	void SetTextureYScale(int which, double scale);

	void AddTextureXOffset(int which, double delta);
	void AddTextureYOffset(int which, double delta);

	void MultiplyTextureXScale(int which, double delta);
	void MultiplyTextureYScale(int which, double delta);

	void SetSpecialColor(int tier, int position, color cr);

	color GetAdditiveColor(int tier);
	void  SetAdditiveColor(int tier, color cr);

	void EnableAdditiveColor(int tier, bool enable);

	double GetUdmfFloat(name nm);
	int    GetUdmfInt(name nm);
	string GetUdmfString(name nm);
}
```

### `Linedef`

The line this side belongs to.

### `Sector`

The sector this side belongs to.

### `Flags`

Any combination of the following bit flags:

| Name                   | Description                                                                 |
| ----                   | -----------                                                                 |
| `WALLF_ABSLIGHTING`    | Light is absolute instead of relative to the sector.                        |
| `WALLF_CLIP_MIDTEX`    | Clips the middle texture when it goes under the floor or above the ceiling. |
| `WALLF_LIGHT_FOG`      | The wall's lighting will ignore fog effects.                                |
| `WALLF_NOAUTODECALS`   | Don't attach decals to this surface.                                        |
| `WALLF_NOFAKECONTRAST` | Disables the "fake contrast" effect for this side.                          |
| `WALLF_POLYOBJ`        | This sidedef belongs to a polyobject.                                       |
| `WALLF_SMOOTHLIGHTING` | Applies a unique contrast at all angles.                                    |
| `WALLF_WRAP_MIDTEX`    | Repeats the middle texture infinitely on the vertical axis.                 |

### `Light`

The light level of this side. Relative to the sector lighting unless
`WALLF_ABSLIGHTING`.

### `Index`

Returns the index of this side.

### `V1`, `V2`

Returns the start and end points of this sidedef, respectively.

### `GetTexture`, `SetTexture`

Gets or sets the texture of one portion of the sidedef.

### `GetTextureXOffset`, `SetTextureXOffset`, `AddTextureXOffset`

Gets, sets or adds to the texture portion's horizontal offset.

### `GetTextureYOffset`, `SetTextureYOffset`, `AddTextureYOffset`

Gets, sets or adds to the texture portion's vertical offset.

### `GetTextureXScale`, `SetTextureXScale`, `MultiplyTextureXScale`

Gets, sets or multiplies the texture portion's horizontal scale.

### `GetTextureYScale`, `SetTextureYScale`, `MultiplyTextureYScale`

Gets, sets or multiplies the texture portion's vertical scale.

### `SetSpecialColor`

TODO

### `GetAdditiveColor`, `SetAdditiveColor`

TODO

### `EnableAdditiveColor`

TODO

### `GetUdmfFloat`, `GetUdmfInt`, `GetUdmfString`

Gets a named UDMF property attached to this sidedef.

<!-- EOF -->


text:
# Vertex

A point in world space.

```
struct Vertex play
{
	readonly vector2 P;

	int Index();
}
```

### `P`

The point this object represents.

### `Index`

The index of this vertex in the global vertices array.

<!-- EOF -->


text:
# F3DFloor

Currently empty. Does not expose any information.

<!-- EOF -->


text:
# SecPlane

TODO

```
struct SecPlane play
{
	double  D;
	double  NegiC;
	vector3 Normal;

	void   ChangeHeight(double hdiff);
	double GetChangedHeight(double hdiff) const;
	double HeightDiff(double oldd, double newd = 0.0) const;
	bool   IsEqual(SecPlane other) const;
	bool   IsSlope() const;
	int    PointOnSide(vector3 pos) const;
	double PointToDist(vector2 xy, double z) const;
	double ZAtPointDist(vector2 v, double dist) const;

	clearscope double ZAtPoint(vector2 v) const;
}
```

### `D`

TODO

### `NegiC`

TODO

### `Normal`

TODO

### `ChangeHeight`

TODO

### `GetChangedHeight`

TODO

### `HeightDiff`

TODO

### `IsEqual`

TODO

### `IsSlope`

TODO

### `PointOnSide`

TODO

### `PointToDist`

TODO

### `ZAtPointDist`

TODO

### `ZAtPoint`

TODO

<!-- EOF -->


text:
# FColorMap

Describes the coloring of a sector.

```
struct FColorMap
{
	uint8 BlendFactor;
	uint8 Desaturation;
	color FadeColor;
	color LightColor;
}
```

### `BlendFactor`

TODO: "This is for handling Legacy-style color maps which use a different
formula to calculate how the color affects lighting."

### `Desaturation`

How much to desaturate colors in this sector. Range is 0 to 255, inclusive.

### `FadeColor`

The color of fog in this sector. None if all components are 0.

### `LightColor`

The color of the sector. Default if all components are 0.

<!-- EOF -->


text:
# Sector

TODO

```
struct Sector play
{
	readonly color[5]  AdditiveColors;
	readonly FColormap ColorMap;
	readonly color[5]  SpecialColors;

	Actor SoundTarget;

	int16 LightLevel;
	int16 SeqType;
	int16 Special;

	name SeqName;
	int  Sky;

	readonly vector2 CenterSpot;

	Actor ThingList;
	int   ValidCount;

	double Friction;
	double MoveFactor;
	int    TerrainNum[2];

	SectorEffect CeilingData;
	SectorEffect FloorData;
	SectorEffect LightingData;

	int   NextSec;
	int   PrevSec;
	uint8 SoundTraversed;
	int8  StairLock;

	readonly array<Line> Lines;

	readonly SecPlane CeilingPlane;
	readonly SecPlane FloorPlane;

	readonly Sector HeightSec;

	uint BottomMap;
	uint MidMap;
	uint TopMap;

	int    DamageAmount;
	int16  DamageInterval;
	name   DamageType;
	double Gravity;
	int16  LeakyDamage;

	readonly uint16 ZoneNumber;

	readonly int HealthCeiling;
	readonly int HealthCeilingGroup;
	readonly int HealthFloor;
	readonly int HealthFloorGroup;

	uint   Flags;
	uint16 MoreFlags;

	SectorAction SecActTarget;

	readonly int     PortalGroup;
	internal uint[2] Portals;

	readonly int SectorNum;

	int Index();

	double, Sector, F3DFloor NextHighestCeilingAt(double x, double y, double bottomz, double topz, int flags = 0);
	double, Sector, F3DFloor NextLowestFloorAt(double x, double y, double z, int flags = 0, double steph = 0);

	void RemoveForceField();

	static clearscope Sector PointInSector(vector2 pt);

	void   CheckPortalPlane(int plane);
	int    GetCeilingLight();
	int    GetFloorLight();
	Sector GetHeightSec();
	void   GetSpecial(out SecSpecial spec);
	int    GetTerrain(int pos);
	bool   PlaneMoving(int pos);
	void   SetSpecial(SecSpecial spec);
	void   TransferSpecial(Sector model);

	double, double GetFriction(int plane);
	double, Sector HighestCeilingAt(vector2 a);
	double, Sector LowestFloorAt(vector2 a);

	void   AddXOffset(int pos, double o);
	void   AddYOffset(int pos, double o);
	void   ChangeFlags(int pos, int and, int or);
	double GetAlpha(int pos);
	double GetAngle(int pos, bool addbase = true);
	int    GetFlags(int pos);
	color  GetGlowColor(int pos);
	double GetGlowHeight(int pos);
	int    GetPlaneLight(int pos);
	int    GetVisFlags(int pos);
	double GetXOffset(int pos);
	double GetXScale(int pos);
	double GetYOffset(int pos, bool addbase = true);
	double GetYScale(int pos);
	void   SetAdditiveColor(int pos, color cr);
	void   SetAlpha(int pos, double o);
	void   SetAngle(int pos, double o);
	void   SetBase(int pos, double y, double o);
	void   SetColor(color c, int desat = 0);
	void   SetFade(color c);
	void   SetFogDensity(int dens);
	void   SetGlowColor(int pos, color color);
	void   SetGlowHeight(int pos, double height);
	void   SetPlaneLight(int pos, int level);
	void   SetSpecialColor(int pos, color color);
	void   SetXOffset(int pos, double o);
	void   SetXScale(int pos, double o);
	void   SetYOffset(int pos, double o);
	void   SetYScale(int pos, double o);

	void      AdjustFloorClip();
	void      ChangeLightLevel(int newval);
	int       GetLightLevel();
	double    GetPlaneTexZ(int pos);
	textureid GetTexture(int pos);
	bool      IsLinked(Sector other, bool ceiling);
	void      SetLightLevel(int newval);
	void      SetPlaneTexZ(int pos, double val, bool dirtify = false);
	void      SetTexture(int pos, textureid tex, bool floorclip = true);

	double  CenterCeiling();
	double  CenterFloor();
	void    ClearPortal(int plane);
	int     GetOppositePortalGroup(int plane);
	vector2 GetPortalDisplacement(int plane);
	double  GetPortalPlaneZ(int plane);
	int     GetPortalType(int plane);
	bool    PortalBlocksMovement(int plane);
	bool    PortalBlocksSight(int plane);
	bool    PortalBlocksSound(int plane);
	bool    PortalBlocksView(int plane);
	bool    PortalIsLinked(int plane);
	bool    TriggerSectorActions(Actor thing, int activation);

	int MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush);
	int MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant = false);

	Sector NextSpecialSector(int type, Sector prev);

	double, Vertex FindHighestCeilingSurrounding();
	double, Vertex FindHighestFloorPoint();
	double, Vertex FindHighestFloorSurrounding();
	double, Vertex FindLowestCeilingPoint();
	double, Vertex FindLowestCeilingSurrounding();
	double, Vertex FindLowestFloorSurrounding();
	double, Vertex FindNextHighestCeiling();
	double, Vertex FindNextHighestFloor();
	double, Vertex FindNextLowestCeiling();
	double, Vertex FindNextLowestFloor();

	int    FindMinSurroundingLight(int max);
	Sector FindModelCeilingSector(double floordestheight);
	Sector FindModelFloorSector(double floordestheight);
	double FindShortestTextureAround();
	double FindShortestUpperAround();

	void SetEnvironment(string env);
	void SetEnvironmentID(int envnum);

	SeqNode CheckSoundSequence(int chan);
	bool    IsMakingLoopingSound();
	SeqNode StartSoundSequence(int chan, name seqname, int modenum);
	SeqNode StartSoundSequenceID(int chan, int sequence, int type, int modenum, bool nostop = false);
	void    StopSoundSequence(int chan);

	void ClearSecret();
	bool IsSecret();
	bool WasSecret();

	clearscope int GetHealth(SectorPart part);
	void           SetHealth(SectorPart part, int newhealth);

	double GetUdmfFloat(name nm);
	int    GetUdmfInt(name nm);
	string GetUdmfString(name nm);
}
```

TODO

<!-- EOF -->


text:
# SectorEffect

A thinker which is attached to a sector and effects it in some way.

```
class SectorEffect : Thinker
{
	protected Sector m_Sector;

	Sector GetSector();
}
```

### `m_Sector`

The sector this effect is attached to.

### `GetSector`

Returns the sector this effect is attached to.

<!-- EOF -->


text:
# LineIdIterator

Iterates over line indices with a specified tag.

```
class LineIdIterator : Object
{
	static LineIdIterator Create(int tag);

	int Next();
}
```

### `Create`

Creates a new iterator over lines with tag `tag`.

### `Next`

Returns the index of the current line and advances the iterator. Returns `-1`
when the list is exhausted.

<!-- EOF -->


text:
# SectorTagIterator

Iterates over sector indices with a specified tag.

```
class SectorTagIterator : Object
{
	static SectorTagIterator Create(int tag, Line defline = null);

	int Next();
	int NextCompat(bool compat, int secnum);
}
```

### `Create`

Creates a new iterator over sectors with tag `tag`. TODO: I can't find where
`defline` is actually used. It is a mystery.

### `Next`

Returns the index of the current sector and advances the iterator. Returns `-1`
when the list is exhausted.

### `NextCompat`

If `compat` is `false`, acts exactly as `Next`. Otherwise, returns the index of
the current sector and advances the iterator in a manner compatible with Doom's
stair builders.

<!-- EOF -->


text:
# PlayerSkin

A player skin as defined in `SKININFO` or `S_SKIN`.

```
struct PlayerSkin
{
	int     CrouchSprite;
	string  Face;
	uint8   Gender;
	int     NameSpc;
	bool    OtherGame;
	uint8   Range0End;
	uint8   Range0Start;
	vector2 Scale;
	string  SkinName;
	int     Sprite;
}
```

### `CrouchSprite`

The crouching sprite ID for this skin.

### `Face`

Prefix for statusbar face graphics.

### `Gender`

Default gender of the skin. May be one of the following:

| Name             | Value | Description                 |
| ----             | :---: | -----------                 |
| `GENDER_FEMALE`  | `1`   | Feminine.                   |
| `GENDER_MALE`    | `0`   | Masculine.                  |
| `GENDER_NEUTRAL` | `2`   | Neutral.                    |
| `GENDER_OTHER`   | `3`   | Other (robot, zombie, etc.) |

### `NameSpc`

If this skin was defined in S_SKIN, this is the lump ID of the marker itself.

### `OtherGame`

The player skin is made for another game and needs to be color remapped
differently.

### `Range0End`

The end index of the translation range to be used for changing the player
sprite's color.

### `Range0Start`

The beginning index of the translation range to be used for changing the player
sprite's color.

### `Scale`

The scaling factor used for the player sprite.

### `SkinName`

Name of the skin.

### `Sprite`

The sprite ID for this skin.

<!-- EOF -->


text:
# Team

A team as defined in `TEAMINFO`.

```
struct Team
{
	const Max;
	const NoTeam;

	string mName;
}
```

### `Max`

The maximum number of teams.

### `NoTeam`

A constant index for a player with no team.

### `mName`

The name of the team.

<!-- EOF -->


text:
# PlayerClass

A player class as defined in either `MAPINFO`/GameInfo or `KEYCONF`.

```
struct PlayerClass
{
	uint         Flags;
	array<int>   Skins;
	class<Actor> Type;

	bool CheckSkin(int skin);
	void EnumColorsets(out array<int> data);
	name GetColorsetName(int setnum);
}
```

### `Flags`

Not currently implemented correctly, `PCF_NOMENU` does not exist in ZScript,
but its value is `1` if you need to check for that.

### `Skins`

Skin indices available to this player class.

### `Type`

The class type reference for this player class.

### `CheckSkin`

Checks if `skin` is in `Skins`.

### `EnumColorsets`

TODO

### `GetColorsetName`

TODO

<!-- EOF -->


text:
# SeqNode

A sound sequence (`SNDSEQ`) node.

```
class SeqNode : Object
{
	static name GetSequenceSlot(int sequence, int type);
	static void MarkPrecacheSounds(int sequence, int type);

	void AddChoice(int seqnum, int type);
	bool AreModesSame(name n, int mode1);
	bool AreModesSameID(int sequence, int type, int mode1);
	name GetSequenceName();
}
```

### `GetSequenceSlot`

TODO

### `MarkPrecacheSounds`

TODO

### `AddChoice`

TODO

### `AreModesSame`

TODO

### `AreModesSameID`

TODO

### `GetSequenceName`

TODO

<!-- EOF -->


text:
# StaticEventHandler

Static event handlers handle events on a per-instance level. This means that
they are registered when you start GZDoom, and un-register when you exit
GZDoom. This is unlike `EventHandler`, which registers when a new game is
started, and un-registers when it ends. Care should be taken to make sure that
variables kept in a static event handler don't interact with the game directly,
or it will act **non-deterministically** and cause a desync.

All of the virtual functions on `StaticEventHandler` have empty implementations
by default, so you only need to override the events your event handler needs to
override.

Differences in virtual function behaviour are listed in the `EventHandler`
documentation.

```
class StaticEventHandler : Object play
{
	clearscope static StaticEventHandler Find(class<StaticEventHandler> type);

	virtual void OnRegister();
	virtual void OnUnregister();

	virtual void WorldLoaded(WorldEvent e);
	virtual void WorldUnloaded(WorldEvent e);
	virtual void WorldThingSpawned(WorldEvent e);
	virtual void WorldThingDied(WorldEvent e);
	virtual void WorldThingRevived(WorldEvent e);
	virtual void WorldThingDamaged(WorldEvent e);
	virtual void WorldThingDestroyed(WorldEvent e);
	virtual void WorldLinePreActivated(WorldEvent e);
	virtual void WorldLineActivated(WorldEvent e);
	virtual void WorldSectorDamaged(WorldEvent e);
	virtual void WorldLineDamaged(WorldEvent e);
	virtual void WorldLightning(WorldEvent e);
	virtual void WorldTick();

	virtual ui void RenderOverlay(RenderEvent e);

	virtual void PlayerEntered(PlayerEvent e);
	virtual void PlayerRespawned(PlayerEvent e);
	virtual void PlayerDied(PlayerEvent e);
	virtual void PlayerDisconnected(PlayerEvent e);

	virtual ui bool UiProcess(UiEvent e);
	virtual ui void UiTick();
	virtual ui void PostUiTick();

	virtual ui bool InputProcess(InputEvent e);

	virtual ui void ConsoleProcess(ConsoleEvent e);
	virtual void NetworkProcess(ConsoleEvent e);

	virtual void CheckReplacement(ReplaceEvent e);

	virtual void NewGame();

	void SetOrder(int order);

	readonly int Order;
	bool IsUiProcessor;
	bool RequireMouse;
}
```

### `Find`

Finds and returns the `StaticEventHandler` type `type` if it is registered, or
`null` if it does not exist.

### `OnRegister`

Called when this type is registered. This is where you should set `Order`,
`IsUiProcessor` and `RequireMouse`.

### `OnUnregister`

Called when this type is un-registered. With `StaticEventHandler`s this is
called when the engine shuts down, so it isn't particularly useful.

### `WorldLoaded`

Called directly after the status bar is attached to the player and after
`REOPEN` ACS scripts are called, just before the display is flushed and
auto-save is done.

### `WorldUnloaded`

Called directly after `UNLOADING` ACS scripts, just before the level is
changed.

### `WorldThingSpawned`

Called directly after an actor's `PostBeginPlay` function.

### `WorldThingDied`

Called after `MorphedDeath`, inventory items have called `OwnerDied`, and the
target is set to the damage source, just before `KILL` ACS scripts are called
and the rest of the death handling is done.

### `WorldThingRevived`

Called when an actor is revived, after everything is finished.

### `WorldThingDamaged`

Called directly before `Die`, or directly after after `DamageMobj` finishes.

### `WorldThingDestroyed`

Called at the beginning of an actor's `OnDestroy` function.

### `WorldLinePreActivated`

Called directly after a line is tested for activation, before any other
activation specials are called (such as checking for keys, executing the line
special, etc.)

### `WorldLineActivated`

Called directly after a line's special is executed, if it succeeded, before any
other handling (such as changing a switch's texture) is completed.

### `WorldSectorDamaged`

Called when a sector is damaged if it has any health groups, before any other
handling is done.

### `WorldLineDamaged`

Called when a line is damaged if it has any health groups, before any other
handling is done.

### `WorldLightning`

Called when lightning strikes, directly after the sound is played, just before
`LIGHTNING` ACS scripts are called.

### `WorldTick`

Called on every world tick, after interpolators are updated, world freeze is
updated, sight counters are reset, particles have run their thinkers, and
players have run their thinkers, just before the status bar is ticked, the
level ticks, thinkers are ticked, and the level time is updated. This is not
called when the game is paused, and its execution is entirely deterministic
regardless of how this event handler is applied.

### `RenderOverlay`

Despite the name, this is actually run on the status bar, specifically in
`BaseStatusBar::DrawTopStuff`. It is run after `HudMessage`s are drawn and
power-ups are drawn, just before ゴゴゴ「The Log」ゴゴゴ is drawn. You may use
`Screen` functions in this function.

### `PlayerEntered`

Called during level load when each player enters the game, after the camera is
set but just before `RETURN` ACS scripts are called.

### `PlayerRespawned`

Called when a player spawns, directly after the teleport fog is spanwed and
just before `RESPAWN` ACS scripts are called. Also called similarly at the end
of the `Respawn` function, for example when the `resurrect` cheat is used.

### `PlayerDied`

Called after `WorldThingDied` and `GetDeathHeight`, and after the actor's thing
special is activated, when the obituary has been displayed, just before `DEATH`
ACS scripts have been called.

### `PlayerDisconnected`

Called when a bot is removed and when a player disconnects from the game, just
before `DISCONNECT` ACS scripts are called.

### `UiProcess`

Called only if `IsUiProcessor` is `true`. Called when a GUI event is dispatched
by the engine, for example when the UI is active and the player has pressed a
key or moved the mouse. Mouse movements will only be captured if `RequireMouse`
is `true`. Because this interacts directly with the OS it is not part of the
game simulation, therefore has `ui` scope and must dispatch commands to the
game as networked events. If the return value is `true`, the function will
block any further handlers from processing this event, essentially "eating"
it. If the return value is `false`, other handlers will continue to be called
as normal.

### `UiTick`

Despite what it may seem, this function is actually called deterministically
within the game loop, just before the level is ticked and after the player's
network commands are created. Albeit this, it is `ui` scope, so it should be
used to process UI code.

### `PostUiTick`

Similar to `UiTick`, this is also deterministic, but called after all other
tickers.

### `InputProcess`

The same as `UiProcess`, but this is only called when inputs are being directed
to the game, rather than to the GUI. All of the same restrictions apply to this
as they do to `UiProcess`, and the return value acts the same.

### `ConsoleProcess`

Called when network events which have no player activator are received.

### `NetworkProcess`

Called when network events which have a player activator are received.

### `CheckReplacement`

Called during actor replacement, after skill replacement is done, but before
any other replacement (such as actor replacements done in ZScript actor
definitions.)

### `NewGame`

Called on a new game, directly after level data is reset and right before the
level is set up.

### `SetOrder`

Sets the ordering of this event handler, which can be read from `Order`.

### `Order`

The arbitrary ordering of this event handler relative to other ones. Event
handlers with lower ordering numbers have their functions executed first. You
can set this variable with `SetOrder`.

### `IsUiProcessor`

If `true`, GUI events will be sent to this event handler through `UiProcess`.
This is mainly for optimization purposes.

### `RequireMouse`

If `true`, mouse events will be sent to this event handler through
`InputProcess` and/or `UiProcess`. This is mainly for optimization purposes.

<!-- EOF -->


text:
# ReplaceEvent

The information for a `CheckReplacement` event. You can mutate the variables in
this event to change the result of replacement checking.

```
struct ReplaceEvent
{
	readonly class<Actor> Replacee;
	class<Actor>          Replacement;
	bool                  IsFinal;
}
```

### `Replacee`

The actor class which is being replaced.

### `Replacement`

What to replace it with. This class type is already effected by skill and actor
definition replacements, so it may be useful to read it. Modify this to change
what the resulting replacement class ends up being.

### `IsFinal`

If `true`, the engine will not attempt to continue going down the replacement
chain, and will directly replace the actor with `Replacement`.

<!-- EOF -->


text:
# RenderEvent

The information for a `RenderOverlay` event.

```
struct RenderEvent
{
	readonly vector3 ViewPos;
	readonly double ViewAngle;
	readonly double ViewPitch;
	readonly double ViewRoll;
	readonly double FracTic;
	readonly Actor Camera;
}
```

### `ViewPos`

The position at which the camera is at.

### `ViewAngle`

The yaw angle of the camera.

### `ViewPitch`

The pitch angle of the camera.

### `ViewRoll`

The roll angle of the camera.

### `FracTic`

A value between 0 and 1 (exclusive) representing the time between the last game
tick and the next game tick. This is most useful for interpolation, and you can
add it to the current game tick to get the real time at which this event has
been called. Precision is not specified.

### `Camera`

The actor which is acting as the camera for the player's view.

<!-- EOF -->


text:
# ConsoleEvent

The information for a `ConsoleProcess` or `NetworkProcess` event.

```
struct ConsoleEvent
{
	readonly int Player;
	readonly string Name;
	readonly int Args[3];
	readonly bool IsManual;
}
```

### `Player`

The player who created this event, or `-1` if there was no activator. This will
always be positive for `NetworkProcess` events and always `-1` for
`ConsoleProcess` events.

### `Name`

The name as provided to `SendNetworkEvent`. Use this to distinguish between
event types. It is favorable to prefix names with the name of your mod or game
so that it will not potentially conflict with other mods.

### `Args`

The arguments as provided to `SendNetworkEvent`.

### `IsManual`

`true` if this event was created manually, for instance through a console
command.

<!-- EOF -->


text:
# EventHandler

Event handlers handle events on a per-game or per-map level. This means that
they are registered when you start a new game or map, and un-register when you
finish the game or map. This is unlike `StaticEventHandler`, which registers
when the engine is started, and un-registers when it exits.

All of the virtual functions on `EventHandler` have empty implementations by
default, so you only need to override the events your event handler needs to
override.

See `StaticEventHandler` for more information on the events that can be
overridden on this type.

```
class EventHandler : StaticEventHandler
{
	clearscope static StaticEventHandler Find(class<StaticEventHandler> type);
	clearscope static void SendNetworkEvent(string name, int arg1 = 0, int arg2 = 0, int arg3 = 0);
}
```

### `Find`

Finds and returns the `StaticEventHandler` type `type` if it is registered, or
`null` if it does not exist. It should be noted that this is exactly the same
as `StaticEventHandler`'s, and does not actually check for `EventHandlers`,
although due to inheritance will return them correctly.

### `SendNetworkEvent`

Sends a network event with no activator.

<!-- EOF -->


text:
# Wads

The `Wads` group of functions allow you to access the virtual file system by
reading from loaded archives. Note that all archive operations are **not
deterministic** unless all users have the exact same files loaded. This is
generally fine even if they are not exactly the same, but be careful to not do
things which may collide with what another mod is doing.

As a summary of how the virtual file system works, files of various kinds are
loaded from *archives* into a structure of *lumps* and *namespaces*. The term
*lump* in this document refers to any file object loaded from an archive which
has its name truncated to 8 characters and its extension stripped, and the term
*file* refers to any actual file within a real folder structure. Archives which
have real folder structures are referred to in this document as *resource
archives* or *resources*. The other two types of supported archives are *Doom
Wad* (commonly just "Wad") and *Blood* `RFF` files. The latter is useless. The
former, *Doom Wads*, are most commonly used for maps, map sets, older mods and
all commercially available games including Doom, Heretic &al. The currently
supported resource archive file types include `PKZIP` (`.zip`, `.pk3`, `.pkz`),
7-Zip (`.7z`, `.pk7`), BUILD `GRP` (`.grp`), Quake `PAK` (`.pak`), and folders.
Single files can also be loaded as archives, containing only themselves.

In short:

* *Lump* refers to an object from any archive type with an 8 character filename (extension removed.)
* *File* refers to fully qualified object from a resource archive, which can also be used as a lump through its truncated name.
* *Archives* are real files or folders which hold *lumps*.
* *Resource archives* are archives with a folder structure for determining lump namespaces, and also store fully qualified paths for files.
* *Wad files* are archives which hold only lumps, and use markers for determining lump namespaces.

| Name              | Description                                             | Resource path | Wad file marker                          |
| ----              | -----------                                             | ------------- | ---------------                          |
| `NS_ACSLIBRARY`   | ACS libraries.                                          | `/acs/`       | `A_START`/`A_END`                        |
| `NS_BLOODMISC`    | Unused.                                                 | N/A           | N/A                                      |
| `NS_BLOODRAW`     | Blood `RAW` format sounds. Found only in `RFF` files.   | N/A           | N/A                                      |
| `NS_BLOODSFX`     | Blood `SFX` format sounds. Found only in `RFF` files.   | N/A           | N/A                                      |
| `NS_COLORMAPS`    | Boom color maps.                                        | `/colormaps/` | `C_START`/`C_END`                        |
| `NS_FLATS`        | Flat textures.                                          | `/flats/`     | `FF_START`/`FF_END`                      |
| `NS_GLOBAL`       | The global namespace, which is the root of any archive. | `/`           | None                                     |
| `NS_GRAPHICS`     | Miscellaneous graphics.                                 | `/graphics/`  | None                                     |
| `NS_HIDDEN`       | Used for filtered files that did not match this game.   | N/A           | N/A                                      |
| `NS_HIRES`        | Deprecated high-resolution textures.                    | `/hires/`     | `HI_START`/`HI_END`                      |
| `NS_MUSIC`        | Music files.                                            | `/music/`     | None                                     |
| `NS_NEWTEXTURES`  | Generic texture files, usable as patches or flats.      | `/textures/`  | `TX_START`/`TX_END`                      |
| `NS_PATCHES`      | Texture patches.                                        | `/patches/`   | None                                     |
| `NS_SOUNDS`       | Sound files.                                            | `/sounds/`    | None                                     |
| `NS_SPRITES`      | Sprites are all contained in this namespace.            | `/sprites/`   | `S_START`/`S_END` or `SS_START`/`SS_END` |
| `NS_STRIFEVOICES` | Strife voice files.                                     | `/voices/`    | `V_START`/`V_END`                        |
| `NS_VOXELS`       | Volumetric pixel (voxel) models.                        | `/voxels/`    | `VX_START`/`VX_END`                      |

Additionally, `NS_SPECIALZIPDIRECTORY` denotes the start of the specialized
resource archive folder namespaces, which are normally under `NS_GLOBAL`.

```
struct Wads
{
	static int    CheckNumForFullName(string name);
	static int    CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false);
	static int    FindLump(string name, int startlump = 0, FindLumpNamespace ns = Wads.GLOBALNAMESPACE);
	static string ReadLump(int lump);
}
```

### `CheckNumForFullName`

Returns the handle of the first file named `name`, matching only the full path
to it, including the extension, or `-1` if the file was not found. Only works
with files defined in resource archives.

### `CheckNumForName`

Returns the handle of the first lump named `name` within namespace `ns`. If
`wadnum` is not `-1`, then it signifies, if `exact` is false, the number of the
last archive to search in, or the only archive to search in if `exact` is
`true`.

Note there is currently no way to actually *get* the number of an archive, even
the current one. The only guarantee is that archive `0` will be the base
archive (`gzdoom.pk3`.)

### `FindLump`

Returns the handle of the first lump named `name` starting at `startlump` (zero
indicates the first lump) in either the global namespace or any namespace. `ns`
can be either `Wads.GLOBALNAMESPACE` or `Wads.ANYNAMESPACE` to specify this.
Returns `-1` if there are no lumps with that name left.

This function can be used in a loop to find all lumps with a specified name.

### `ReadLump`

Reads the whole contents of `lump` into a string and returns the result. If
`lump` is not valid, returns an empty string. Note that binary lumps can be
loaded this way and the string's length will be correct according to the lump's
size even if null characters are present in the lump.

<!-- EOF -->


text:
# PSprite

A **P**layer **Sprite**, paradoxically, is not the player themself, but the
sprite *within their view*, such as their weapon. PSprites are arbitrarily
layered by number, somewhat similar to `HUDMessage`s. They are drawn ordered
from lowest to highest.

The predefined layers are:

| Name                   | Value         | Description                                                                        |
| ----                   | :---:         | -----------                                                                        |
| `PSprite.Flash`        | `1000`        | The layer used by `A_GunFlash` for gun flashes.                                    |
| `PSprite.StrifeHands`  | `-1`          | The hands brought up by `A_ItBurnsItBurns` when the player in Strife dies of fire. |
| `PSprite.TargetCenter` | `int.Max - 2` | The middle of the targeting system view in Strife.                                 |
| `PSprite.TargetLeft`   | `int.Max - 1` | The left side of the targeting system view in Strife.                              |
| `PSprite.TargetRight`  | `int.Max`     | The right side of the targeting system view in Strife.                             |
| `PSprite.Weapon`       | `1`           | The default layer for all weapons.                                                 |

```
class PSprite : Object play
{
	readonly State      CurState;
	readonly int        ID;
	readonly PSprite    Next;
	readonly PlayerInfo Owner;

	double   Alpha;
	Actor    Caller;
	bool     FirstTic;
	int      Frame;
	double   OldX;
	double   OldY;
	bool     ProcessPending;
	spriteid Sprite;
	int      Tics;
	double   X;
	double   Y;

	bool bAddBob;
	bool bAddWeapon;
	bool bCVarFast;
	bool bFlip;
	bool bPowDouble;

	void SetState(State newstate, bool pending = false);
	void Tick();
}
```

### `CurState`

TODO

### `ID`

TODO

### `Next`

TODO

### `Owner`

TODO

### `Alpha`

The amount of translucency of the PSprite, range 0-1 inclusive.

### `Caller`

TODO

### `FirstTic`

TODO

### `Frame`

Frame number of the sprite.

### `OldX`

TODO

### `OldY`

TODO

### `ProcessPending`

TODO

### `Sprite`

The sprite to display on this layer.

### `Tics`

The number of game ticks before the next state takes over.

### `X`

The offset from the weapon's normal resting position on the horizontal axis.

### `Y`

The offset from the weapon's normal resting position on the vertical axis. Note
that `32` is the real resting position because of `A_Raise`.

### `bAddBob`

Adds the weapon's bobbing to this layer's offset.

### `bAddWeapon`

Adds the weapon layer's offsets to this layer's offset.

### `bCVarFast`

Layer will respect `sv_fastweapons`.

### `bFlip`

Flips the weapon visually horizontally.

### `bPowDouble`

Layer will respect `PowerDoubleFiringSpeed`.

### `SetState`

TODO

### `Tick`

Called by `PlayerPawn::TickPSprites` to advance the frame.

<!-- EOF -->


text:
# WBStartStruct

Information passed into the `StatusScreen` class when an intermission starts.

```
struct WBStartStruct
{
	WBPlayerStruct Plyr[MAXPLAYERS];
	int            PNum;

	int Finished_Ep;
	int Next_Ep;

	string Current;
	string Next;
	string NextName;

	textureid LName0;
	textureid LName1;

	int MaxFrags;
	int MaxItems;
	int MaxKills;
	int MaxSecret;

	int ParTime;
	int SuckTime;
	int TotalTime;
}
```

### `Plyr`

The `WBPlayerStruct` for each player.

### `PNum`

The index of the player to show stats for.

### `Finished_Ep`

The cluster of the finished map, minus one.

### `Next_Ep`

The cluster of the next map, minus one.

### `Current`

The name of the map that was finished.

### `Next`

The name of the next map.

### `NextName`

The printable name of the next map.

### `LName0`

Texture ID of the level name of the map that was finished.

### `LName1`

Texture ID of the level name of the map being entered.

### `MaxFrags`

Unknown purpose, not actually used by any part of the engine.

### `MaxItems`

The maximum number of acquired items in the map.

### `MaxKills`

The maximum number of killed monsters in the map.

### `MaxSecret`

The maximum number of found secrets in the map.

### `ParTime`

The par time of the map, in ticks.

### `SuckTime`

The suck time of the map, in minutes.

### `TotalTime`

The total time for the whole game, in ticks.

<!-- EOF -->


text:
# PatchInfo

Either a patch or string depending on external configurations.

```
struct PatchInfo play
{
	int       mColor;
	Font      mFont;
	textureid mPatch;

	void Init(GIFont gifont);
}
```

### `mColor`

The color of the font, if this is a string.

### `mFont`

The font, if this is a string, or `null`.

### `mPatch`

The patch, if this is a patch, or an invalid texture.

### `Init`

Initializes the structure. If `gifont.Color` is `'Null'`, and `gifont.FontName`
is a valid patch, `mPatch` will be set accordingly. Otherwise, if the font has
a color or the patch is invalid, `gifont.FontName` is used to set `mFont` (or
it is defaulted to `BigFont`.)

<!-- EOF -->


text:
# WBPlayerStruct

Information for each individual player for a `StatusScreen`.

```
struct WBPlayerStruct
{
	int SItems;
	int SKills;
	int SSecret;
	int STime;

	int FragCount;
	int Frags[MAXPLAYERS];
}
```

### `SItems`

The number of items this player acquired.

### `SKills`

The number of monsters this player killed.

### `SSecret`

The number of secrets this player found.

### `STime`

The time this player finished the level at, in ticks. (This is the same for all
players.)

### `FragCount`

The total amount of frags this player scored against all players.

### `Frags`

The number of frags this player scored against each other player.

<!-- EOF -->


text:
# StatusScreen

The base class for intermission status screens. Any status screen used by
`MAPINFO`/GameInfo must be derived from this class.

Status screens have four stages:

* `STATCOUNT`, where the stats are counted and displayed.
* `SHOWNEXTLOC`, where the next map is shown as "ENTERING (map name)" and in episodic maps, the world map.
* `NOSTATE`, at the very end of this process, where the last frame is drawn and the intermission is exited.
* `LEAVINGINTERMISSION`, which is used only to signify that all stages are done and the status screen has been exited.

These are provided as constants in `StatusScreen`. The starting stage is `STATCOUNT`.

```
class StatusScreen : Object abstract play
{
	const NG_STATSY;
	const SHOWNEXTLOCDELAY;
	const SP_STATSX;
	const SP_STATSY;
	const SP_TIMEX;
	const SP_TIMEY;
	const TITLEY;

	InterBackground BG;
	WBPlayerStruct  Plrs[MAXPLAYERS];
	WBStartStruct   Wbs;

	int   AccelerateStage;
	int   BCnt;
	int   Cnt;
	int   Cnt_Deaths[MAXPLAYERS];
	int   Cnt_Frags[MAXPLAYERS];
	int   Cnt_Items[MAXPLAYERS];
	int   Cnt_Kills[MAXPLAYERS];
	int   Cnt_Par;
	int   Cnt_Pause;
	int   Cnt_Secret[MAXPLAYERS];
	int   Cnt_Time;
	int   Cnt_Total_Time;
	int   CurState;
	int   DoFrags;
	int   Me;
	int   NG_State;
	bool  NoAutoStartMap;
	bool  PlayerReady[MAXPLAYERS];
	int   Player_Deaths[MAXPLAYERS];
	bool  Snl_PointerOn;
	int   SP_State;
	float ShadowAlpha;
	int   Total_Deaths;
	int   Total_Frags;

	PatchInfo Entering;
	PatchInfo Finished;
	PatchInfo MapName;

	textureid Items;
	textureid Kills;
	textureid P_Secret;
	textureid Par;
	textureid Secret;
	textureid Sucks;
	textureid Timepic;

	string LNameTexts[2];

	int  DrawCharPatch(Font fnt, int charcode, int x, int y, int translation = Font.CR_UNTRANSLATED, bool nomove = false);
	void DrawEL();
	int  DrawLF();
	int  DrawName(int y, textureid tex, string levelname);
	int  DrawNum(Font fnt, int x, int y, int n, int digits, bool leadingzeros = true, int translation = Font.CR_UNTRANSLATED);
	int  DrawPatchText(int y, PatchInfo pinfo, string stringname);
	void DrawPercent(Font fnt, int x, int y, int p, int b, bool show_total = true, int color = Font.CR_UNTRANSLATED);
	void DrawTime(int x, int y, int t, bool no_sucks = false);

	bool AutoSkip();

	virtual void Drawer();
	virtual void End();
	virtual void Start(WBStartStruct wbs_);
	virtual void StartMusic();
	virtual void Ticker();

	protected virtual void DrawNoState();
	protected virtual void DrawShowNextLoc();
	protected virtual void DrawStats();
	protected virtual void InitNoState();
	protected virtual void InitShowNextLoc();
	protected virtual void InitStats();
	protected virtual void UpdateNoState();
	protected virtual void UpdateShowNextLoc();
	protected virtual void UpdateStats();

	protected void CheckForAccelerate();
	protected int  FragSum(int playernum);

	static int, int, int GetPlayerWidths();
	static color GetRowColor(PlayerInfo player, bool highlight);
	static void  GetSortedPlayers(in out array<int> sorted, bool teamplay);
	static void  PlaySound(sound snd);
}
```

### `NG_STATSY`

TODO

### `SHOWNEXTLOCDELAY`

TODO

### `SP_STATSX`

TODO

### `SP_STATSY`

TODO

### `SP_TIMEX`

TODO

### `SP_TIMEY`

TODO

### `TITLEY`

The Y position (in 320x200 pixels) to draw the top of the "finished" and
"entering" texts. Used by `DrawEL` and `DrawLF`.

### `BG`

The `InterBackground` object for this intermission, set by `Start` with the
initial `Wbs` object.

### `Plrs`

The value of `Wbs.Plyr` when `Start` was called. Usually not changed, so
essentially equivalent to `Wbs.Plyr`.

### `Wbs`

The `WBStartStruct` passed to this class via the `Start` function.

### `AccelerateStage`

Used to signify to the current stage that it should go quicker or be skipped
entirely.

### `BCnt`

TODO

### `Cnt`

TODO

### `Cnt_Deaths`

TODO

### `Cnt_Frags`

TODO

### `Cnt_Items`

TODO

### `Cnt_Kills`

TODO

### `Cnt_Par`

TODO

### `Cnt_Pause`

TODO

### `Cnt_Secret`

TODO

### `Cnt_Time`

TODO

### `Cnt_Total_Time`

TODO

### `CurState`

The current stage the intermission is in.

### `DoFrags`

TODO

### `Me`

The value of `Wbs.PNum` when `Start` was called. Usually not changed, so
essentially equivalent to `Wbs.PNum`.

### `NG_State`

TODO

### `NoAutoStartMap`

TODO

### `PlayerReady`

Used in networked games to signify when each player is ready to continue to the
next map. Set by `CheckForAccelerate`.

### `Player_Deaths`

TODO

### `Snl_PointerOn`

TODO

### `SP_State`

Used in single-player status screens during the `STATCOUNT` stage for
indicating the current round of statistics to count up.

### `ShadowAlpha`

TODO

### `Total_Deaths`

TODO

### `Total_Frags`

TODO

### `Entering`

TODO

### `Finished`

TODO

### `MapName`

TODO

### `Items`

The "ITEMS" (default `WIOSTI`) graphic.

### `Kills`

The "KILLS" (default `WIOSTK`) graphic.

### `P_Secret`

The "SECRET" (default `WISCRT2`) graphic.

### `Par`

The "PAR" (default `WIPAR`) graphic.

### `Secret`

The "SCRT" (default `WIOSTS`) graphic.

### `Sucks`

The "SUCKS" (default `WISUCKS`) graphic.

### `Timepic`

The "TIME" (default `WITIME`) graphic.

### `LNameTexts`

TODO

### `DrawCharPatch`

TODO

### `DrawEL`

TODO

### `DrawLF`

TODO

### `DrawName`

TODO

### `DrawNum`

TODO

### `DrawPatchText`

TODO

### `DrawPercent`

TODO

### `DrawTime`

TODO

### `AutoSkip`

TODO

### `Drawer`

Called by `WI_Drawer`, which is called every frame when `GameState` is
`GS_INTERMISSION`.

### `End`

Called when the intermission should end. Default behaviour is to set `CurState`
to `LEAVINGINTERMISSION` and remove bots in death-match. Generally,
`Level.WorldDone` should be called directly after this.

### `Start`

Called by `WI_Start` after the `WBStartStruct` is populated, sounds are stopped
and the screen blend is set to black. Sets up initial values and runs
`InitStats`.

### `StartMusic`

Called in the first tick by `Ticker` to set the intermission music.

### `Ticker`

Called by `WI_Ticker`, which is called every game tick when `GameState` is
`GS_INTERMISSION`.

### `DrawNoState`

Called by `Drawer` when `CurState` is `NOSTATE` or any other non-state.

### `DrawShowNextLoc`

Called by `Drawer` when `CurState` is `SHOWNEXTLOC` and, by default,
`DrawNoState` after setting `Snl_PointerOn` to `true`.

### `DrawStats`

Called by `Drawer` directly after drawing the animated background when
`CurState` is `STATCOUNT`.

### `InitNoState`

Called by `UpdateShowNextLoc` to initiate the `NOSTATE` stage.

### `InitShowNextLoc`

Called by `UpdateStats` to initiate the `SHOWNEXTLOC` stage.

### `InitStats`

Called by `Start` to initiate the `STATCOUNT` stage.

### `UpdateNoState`

Called by `Ticker` when `CurState` is `NOSTATE` or any other non-state. Exits
the intermission by calling `End` and `Level.WorldDone` when appropriate.

### `UpdateShowNextLoc`

Called by `Ticker` when `CurState` is `SHOWNEXTLOC`. Runs `InitNoState` when
appropriate and alternates `Snl_PointerOn`.

### `UpdateStats`

Called by `Ticker` when `CurState` is `STATCOUNT`. Runs `InitShowNextLoc`
when appropriate.

### `CheckForAccelerate`

Updates the values of `AccelerateStage` and `PlayerReady` according to each
player's inputs.

### `FragSum`

Returns the number of frags player `playernum` has accumulated against all
currently in-game players. This is different from `WBPlayerStruct.FragCount`
because it is counted dynamically, i.e. if a player leaves the count will be
changed. This is only useful for game modes where frags do not count as score.

### `GetPlayerWidths`

TODO

### `GetRowColor`

TODO

### `GetSortedPlayers`

TODO

### `PlaySound`

Plays a UI sound at full volume using `S_Sound`.

<!-- EOF -->


text:
# InterBackground

A class containing an animated intermission background.

```
class InterBackground : Object play
{
	static InterBackground Create(WBStartStruct wbs);

	virtual void DrawBackground(int curstate, bool drawsplat, bool pointeron);
	virtual bool LoadBackground(bool isenterpic);
	virtual void UpdateAnimatedBack();
}
```

### `Create`

TODO

### `DrawBackground`

TODO

### `LoadBackground`

TODO

### `UpdateAnimatedBack`

TODO

<!-- EOF -->


text:
# Font

A font as defined in `FONTDEFS` or a bitmap font file. **Not serializable. Do
not use as a member unless marked as `transient`.**

```
struct Font
{
	static Font FindFont(name fontname);
	static int  FindFontColor(name color);
	static Font GetFont(name fontname);

	double GetBottomAlignOffset(int code);
	int    GetCharWidth(int code);
	string GetCursor();
	int    GetHeight();
	int    StringWidth(string code);

	BrokenLines BreakLines(string text, int maxlen);
}
```

### `FindFont`

Gets a font as defined in `FONTDEFS`.

### `FindFontColor`

Returns the color range enumeration for a named color.

### `GetFont`

Gets a font either as defined in `FONTDEFS` or a ZDoom/bitmap font.

### `GetBottomAlignOffset`

Returns the baseline for the character `code`.

### `GetCharWidth`

Returns the width in pixels of a character code.

### `GetCursor`

Returns the string used as a blinking cursor graphic for this font.

### `GetHeight`

Returns the line height of the font.

### `StringWidth`

Returns the width in pixels of the string.

### `BreakLines`

Breaks `text` up into a `BrokenLines` structure according to the screen and
clip region, as well as appropriately accounting for a maximum width in pixels
of `maxlen`.

<!-- EOF -->


text:
# TexMan

The **Tex**ture **Man**ager is used for loading, finding, replacing and getting
information on textures.

```
struct TexMan
{
	static textureid CheckForTexture(string name, int usetype, int flags = TexMan.TryAny);
	static int       CheckRealHeight(textureid tex);
	static string    GetName(textureid tex);
	static vector2   GetScaledOffset(textureid tex);
	static vector2   GetScaledSize(textureid tex);
	static int, int  GetSize(textureid tex);
	static void      SetCameraToTexture(Actor viewpoint, string texture, double fov);
	static bool      OkForLocalization(textureid patch, string textSubstitute);

	deprecated("3.8") static void ReplaceTextures(string from, string to, int flags);
}
```

### `CheckForTexture`

Returns a `textureid` for the texture named `name`. `usetype` may be one of the
following, which selects what kind of texture to find:

| Name                       | Description                                                                                |
| ----                       | -----------                                                                                |
| `TexMan.TYPE_ANY`          | Any kind of texture.                                                                              |
| `TexMan.TYPE_AUTOPAGE`     | Unused.                                                                                |
| `TexMan.TYPE_BUILD`        | Unused.                                                                                |
| `TexMan.TYPE_DECAL`        | A decal pic defined in `DECALDEF`.                                                                |
| `TexMan.TYPE_FIRSTDEFINED` | The first composite texture defined by the IWad.                                                  |
| `TexMan.TYPE_FLAT`         | A flat (ceiling/floor texture,) i.e. `FLOOR0_1`.                                                  |
| `TexMan.TYPE_FONTCHAR`     | Unused.                                                                                |
| `TexMan.TYPE_MISCPATCH`    | A loose graphic, i.e. `M_DOOM`.                                                                   |
| `TexMan.TYPE_NULL`         | Reserved for the null graphic. Ignores `name`.                                                    |
| `TexMan.TYPE_OVERRIDE`     | Overridable generalized textures, for instance textures defined in `TX_START` or BUILD ART tiles. |
| `TexMan.TYPE_SKINGRAPHIC`  | Any loose graphic defined in `S_SKIN` i.e. statusbar faces.                                       |
| `TexMan.TYPE_SKINSPRITE`   | Any sprite defined in `S_SKIN`.                                                                   |
| `TexMan.TYPE_SPRITE`       | A sprite in `S_START`, i.e. `MEDIA0`.                                                             |
| `TexMan.TYPE_WALLPATCH`    | An uncomposited patch, i.e. `DOOR2_1`.                                                            |
| `TexMan.TYPE_WALL`         | Any composited wall texture, i.e. `STARTAN2`.                                                     |

`flags` may be any of the following combined (with the bitwise OR operator
`|`:)

| Name                   | Description                                                                               |
| ----                   | -----------                                                                               |
| `TexMan.ALLOWSKINS`    | Allows `SkinGraphic`s to be returned under normal circumstances.                          |
| `TexMan.DONTCREATE`    | Will never create a new texture when searching.                                           |
| `TexMan.LOCALIZE`      | TODO                                          .                                           |
| `TexMan.OVERRIDABLE`   | Allows overriding of this texture by for instance `TEXTURES`.                             |
| `TexMan.RETURNFIRST`   | Allows returning the `FirstDefined` "null" texture under normal circumstances.            |
| `TexMan.SHORTNAMEONLY` | Will force use of a short name when searching.                                            |
| `TexMan.TRYANY`        | Returns any other type of texture if one is not found in the specified use type. Default. |

### `CheckRealHeight`

Returns the height in pixels of the texture down to the last scanline which has
actual pixel data. Note that this operation is extremely slow and should be
used sparingly.

### `GetName`

Returns the original name of a `textureid`.

### `GetScaledOffset`

Returns the offsets for this texture used to display it (rather than the
original offsets.)

### `GetScaledSize`

Returns the size used to display this texture (rather than the physical size.)

### `GetSize`

Returns the width and height of a `textureid`.

### `SetCameraToTexture`

Sets the camera texture (as defined in `ANIMDEFS`) `texture` to the viewpoint
of `viewpoint` with a fov of `fov`.

### `OkForLocalization`

TODO

### `ReplaceTextures`

Note: This function is deprecated and `LevelLocals::ReplaceTextures` should be
used instead.

Replaces textures named `from` with `to` within the map. `flags` may be used to
filter out certain textures from being replaced:

| Name                 | Description                          |
| ----                 | -----------                          |
| `TexMan.NOT_BOTTOM`  | Filters out linedef bottom textures. |
| `TexMan.NOT_CEILING` | Filters out ceiling flats.           |
| `TexMan.NOT_FLAT`    | Filters out any flat texture.        |
| `TexMan.NOT_FLOOR`   | Filters out floor flats.             |
| `TexMan.NOT_MIDDLE`  | Filters out linedef middle textures. |
| `TexMan.NOT_TOP`     | Filters out linedef upper textures.  |
| `TexMan.NOT_WALL`    | Filters out any linedef texture.     |

<!-- EOF -->


text:
# BrokenLines

A container representing an array of lines of text that have been broken up to
fit the screen and clipping region.

```
class BrokenLines : Object
{
	int    Count();
	string StringAt(int line);
	int    StringWidth(int line);
}
```

### `Count`

Returns the amount of lines in this container.

### `StringAt`

Returns the text of line `line`.

### `StringWidth`

Returns the width (in pixels) of line `line`.

<!-- EOF -->


text:
# Console

Basic access to console functionality.

```
struct Console
{
	static void HideConsole();
	static void MidPrint(Font font, string text, bool bold = false);
	static vararg void PrintF(string fmt, ...);
}
```

### `HideConsole`

Hides the console if it is open and `GameState` is not `GS_FULLCONSOLE`.

### `MidPrint`

Prints `text` (possibly a `LANGUAGE` string if prefixed with `$`) in `font` to
the middle of the screen for 1½ seconds. Will print even if the player is a
spectator if `bold` is `true`. Uses the `msgmidcolor` CVar for non-bold
messages and `msgmidcolor2` for bold messages.

This is the function used internally by ACS' `Print` and `PrintBold` functions.

### `PrintF`

Prints a formatted string to the console.

<!-- EOF -->


text:
# GIFont

A font as defined in `MAPINFO`/GameInfo.

```
struct GIFont
{
	name Color;
	name FontName;
}
```

### `Color`

The color of the font.

### `FontName`

The name of the font.

<!-- EOF -->


text:
# Screen

Functions for drawing various things to the screen.

Note: There are no longer any fully paletted renderers in GZDoom as of version
3.5. Alternate palette index parameters are generally ignored now.

```
struct Screen
{
	static vararg void DrawChar(Font font, int cr, double x, double y, int character, ...);
	static vararg void DrawShape(textureid tex, bool animate, Shape2D s, ...);
	static vararg void DrawText(Font font, int cr, double x, double y, string text, ...);
	static vararg void DrawTexture(textureid tex, bool animate, double x, double y, ...);

	static void Clear(int left, int top, int right, int bottom, color cr, int palcolor = -1);
	static void Dim(color cr, double amount, int x, int y, int w, int h);
	static void DrawFrame(int x, int y, int w, int h);
	static void DrawLine(int x0, int y0, int x1, int y1, color cr, int alpha = 255);
	static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, color cr, int alpha = 255);

	static double GetAspectRatio();
	static int GetHeight();
	static int GetWidth();
	static color PaletteColor(int index);
	static vector2, vector2 VirtualToRealCoords(vector2 pos, vector2 size, vector2 vsize, bool vbottom = false, bool handleaspect = true);

	static void ClearClipRect();
	static int, int, int, int GetClipRect();
	static int, int, int, int GetViewWindow();
	static void SetClipRect(int x, int y, int w, int h);
}
```

### `DrawChar`

The same as `DrawTexture`, but draws the texture of character code `character`
from `font`. The output color may be modified by the font color `cr`.

### `DrawShape`

TODO

### `DrawText`

TODO

### `DrawTexture`

Draws texture `tex`, possibly animated by the animation ticker if `animate` is
`true`, at horizontal position `x` and vertical position `y`.

Various properties of this drawing process can be changed by passing extra
arguments to this function. After all arguments are parsed, the "`CleanMode`"
internal variable is used along with the specified virtual width/height to
determine how to finally transform positions. `CleanMode` may be one of the
following:

| Name                | Description                                                                                |
| ----                | -----------                                                                                |
| `DTA_BASE`          | No position scaling is performed.                                                                    |
| `DTA_CLEAN`         | Scales all positions by `Clean*Fac`. See the documentation for those variables for more information. |
| `DTA_CLEANNOMOVE`   | Scales the destination width and height by `Clean*Fac`.                                              |
| `DTA_CLEANNOMOVE_1` | Scales the destination width and height by `Clean*Fac_1`.                                            |
| `DTA_FULLSCREEN`    | Sets the X and Y positions to `0`. (Yes, really, this is all it does.)                               |
| `DTA_HUDRULES`      | Scales all positions by the current status bar's scaling rules.                                      |
| `DTA_HUDRULESC`     | Scales all positions by the current status bar's scaling rules and centers the X position.           |

Here is a list of tags and their respective arguments which may be used:

| Name                                      | Arguments      | Description |
| ----                                      | ---------      | ----------- |
| `DTA_320X200`                             | `bool use`     | Sets `CleanMode` to `DTA_BASE` and the virtual width/height to `320`/`200` if `use` is `true`. Note that 320x200 does not scale properly to the screen as it must be 320x240 to do so. |
| `DTA_ALPHACHANNEL`                        | `bool use`     | Does nothing unless `DTA_FILLCOLOR` is used and the render style is unspecified, in which case it will set the render style to "shaded" if `use` is `true`. |
| `DTA_ALPHA`                               | `double alpha` | Sets the alpha of the drawn texture to `alpha`. |
| `DTA_BOTTOM320X200`                       | `bool use`     | Same as `DTA_320X200`, but also enables position transformation as if a call to `VirtualToRealCoords` with `vbottom` to `true`. Note that this is the only way to actually set this, but it may be overridden by following arguments to effectively toggle only this flag. |
| `DTA_CENTERBOTTOMOFFSET`                  | `bool use`     | Same as `DTA_CENTERBOTTOMOFFSET`, but the Y offset is aligned to the bottom instead of the center. |
| `DTA_CENTEROFFSET`                        | `bool use`     | Overrides the texture's X and Y offsets, centering them between the texture's height and width if `use` is `true`. |
| `DTA_CLEANNOMOVE1`                        | `bool use`     | Sets `CleanMode` to `DTA_CLEANNOMOVE1` if `use` is `true`. |
| `DTA_CLEANNOMOVE`                         | `bool use`     | Sets `CleanMode` to `DTA_CLEANNOMOVE` if `use` is `true`. |
| `DTA_CLEAN`                               | `bool use`     | Sets `CleanMode` to `DTA_CLEAN` if `use` is `true`. |
| `DTA_CLIPBOTTOM`, `DTA_CLIPTOP`           | `int length`   | Sets the vertical clipping for the texture. |
| `DTA_CLIPLEFT`, `DTA_CLIPRIGHT`           | `int length`   | Sets the horizontal clipping for the texture. |
| `DTA_COLOROVERLAY`                        | `color cr`     | Multiplies `cr` with the texture. Alpha determines the intensity of this overlay. Applied before render styles. |
| `DTA_COLOR`                               | `color cr`     | Multiplies `cr` with the texture. Applied after render styles change the color. |
| `DTA_DESATURATE`                          | `int amount`   | Desaturates the texture by `amount` (range 0-255.) |
| `DTA_DESTHEIGHTF`, `DTA_DESTWIDTHF`       | `double size`  | Same as `DTA_DESTHEIGHT`/`DTA_DESTWIDTH`, but with decimal arguments. |
| `DTA_DESTHEIGHT`, `DTA_DESTWIDTH`         | `int size`     | Sets the resulting width or height on screen of the texture and sets `CleanMode` to `DTA_BASE`. |
| `DTA_FILLCOLOR`                           | `color cr`     | Sets the render style to "stencil" if one is not specified and the fill color to `cr`. |
| `DTA_FLIPX`, `DTA_FLIPY`                  | `bool use`     | Flips the X or Y position if `use` is `true`.
| `DTA_FULLSCREEN`                          | `bool use`     | Sets `CleanMode` to `DTA_FULLSCREEN` and the virtual width and height to the display size of the texture. |
| `DTA_HUDRULES`                            | `int type`     | Sets `CleanMode` to `DTA_HUDRULESC` if `type` is `BaseStatusBar.HUD_HORIZCENTER`, or `DTA_HUDRULES` if it is `BaseStatusBar.HUD_NORMAL`. |
| `DTA_KEEPRATIO`                           | `bool on`      | Enables aspect ratio correction if `on` is `true`. |
| `DTA_LEFTOFFSETF`, `DTA_TOPOFFSETF`       | `double ofs`   | Same as `DTA_LEFTOFFSET`/`DTA_TOPOFFSETF`, but with decimal arguments. |
| `DTA_LEFTOFFSET`, `DTA_TOPOFFSET`         | `int ofs`      | Overrides the texture's X or Y offset. |
| `DTA_LEGACYRENDERSTYLE`                   | `int style`    | Overrides the render style. Note that there is also a `DTA_RENDERSTYLE` which cannot be used because the engine does not expose `FRenderStyle` yet. |
| `DTA_MASKED`                              | `bool on`      | Turns the texture fully opaque (no alpha mask) if `on` is `false`. Default value is on. |
| `DTA_SRCHEIGHT`, `DTA_SRCWIDTH`           | `int size`     | Sets the width or height of the source image. Will cut the texture if lower than the original size. If the size is larger than the original, it will cause UV clamping, repeating the pixels at the image borders. |
| `DTA_SRCX`, `DTA_SRCY`                    | `int pos`      | Sets the X or Y on the source image to start the texture at. Texture wrapping will cause a UV clamping effect, repeating the pixels at the image borders. |
| `DTA_TRANSLATIONINDEX`                    | `int index`    | Remaps colors in the destination texture with translation table `index`. |
| `DTA_VIRTUALHEIGHTF`, `DTA_VIRTUALWIDTHF` | `double size`  | Same as `DTA_VIRTUALHEIGHT`/`DTA_VIRTUALWIDTH`, but with decimal arguments. |
| `DTA_VIRTUALHEIGHT`, `DTA_VIRTUALWIDTH`   | `int size`     | Sets the virtual width or height to `size`. |
| `DTA_WINDOWLEFTF`, `DTA_WINDOWRIGHTF`     | `double size`  | Same as `DTA_WINDOWLEFT`/`DTA_WINDOWRIGHT`, but with decimal arguments. |
| `DTA_WINDOWLEFT`, `DTA_WINDOWRIGHT`       | `int size`     | Crops `size` pixels from the left or right. |

### `Clear`

Draws a rectangle from `top left` to `bottom right` in screen coordinates of
`cr` color. Does not support translucent colors. `palcolor` is a palette index
to use as a color in paletted renderers or `-1` for automatic conversion from
the given RGB color.

### `Dim`

Draws a rectangle at `x y` of `w h` size in screen coordinates of `cr` color.
Does not support translucent colors, but `amount` may be used to specify the
translucency in a range of 0-1 inclusive.

### `DrawFrame`

Draws a frame around a rectangle at `x y` of `w h` size in screen coordinates,
using the border graphics as defined in `MAPINFO`/GameInfo.

### `DrawLine`

Draws a one pixel wide line from `x0 y0` to `x1 y1` in screen coordinates of
color `cr` with alpha `alpha` (range 0-255.)

### `DrawThickLine`

Draws a `thickness` pixel wide line from `x0 y0` to `x1 y1` in screen
coordinates of color `cr` with alpha `alpha` (range 0-255.)

### `GetAspectRatio`

Returns the aspect ratio of the screen.

### `GetHeight`

Returns the height of the screen.

### `GetWidth`

Returns the width of the screen.

### `PaletteColor`

Returns a `color` for a given palette index.

### `VirtualToRealCoords`

Converts virtual coordinates `pos` from virtual coordinate space `vsize` to
screen coordinate space `size`, possibly accounting for aspect ratio
differences if `handleaspect` is true. If the ratio is 5:4, `vbottom` will
account for the higher-than-wide conversion by repositioning vertically.

### `ClearClipRect`

Clears the clipping rectangle if there is one.

### `GetClipRect`

Returns the clipping rectangle's `x`/`y`/`w`/`h`.

### `GetViewWindow`

Returns the 3D viewing window, which may be smaller than the screen size with
any given `screenblocks` setting.

### `SetClipRect`

Sets the clipping rectangle to restrict further drawing to the region starting
at `x y` of size `w h` in screen coordinates.

<!-- EOF -->


text:
# TextureID

Texture IDs can be explicitly converted to integers, but not the other way
around. You can add and subtract integers with a `textureid`, however. (This
only works with the integer on the right hand side.)

```
struct TextureID
{
	bool Exists() const;
	bool IsNull() const;
	bool IsValid() const;
	void SetInvalid();
	void SetNull();
}
```

### `Exists`

Checks if the texture exists within the texture manager at all.

### `IsNull`

Checks if the texture is the null index (`0`.)

### `IsValid`

Checks if the texture index is not the invalid index (`-1`.)

### `SetInvalid`

Sets the texture index to `-1`.

### `SetNull`

Sets the texture index to `0`.

The proper way to zero-initialize a `textureid` is:

```
textureid tex;
tex.SetNull();
```

<!-- EOF -->


text:
# Shape2D

Represents an arbitrary polygonal 2D shape.

```
class Shape2D : Object
{
	void Clear(int which = C_Verts | C_Coords | C_Indices);
	void PushCoord(vector2 c);
	void PushTriangle(int a, int b, int c);
	void PushVertex(vector2 v);
}
```

### `Clear`

Clears data out of a shape. Uses these as a bit flag:

| Name                | Description                 |
| ----                | -----------                 |
| `Shape2D.C_Coords`  | Clears texture coordinates. |
| `Shape2D.C_Indices` | Clears vertex indices.      |
| `Shape2D.C_Verts`   | Clears vertices.            |

### `PushCoord`

Pushes a texture coordinate into the shape buffer.

### `PushTriangle`

Pushes the indices of a triangle into the shape buffer.

### `PushVertex`

Pushes a vertex into the shape buffer.

<!-- EOF -->


text:
<!-- vim-markdown-toc GFM -->

* [Enumeration Definitions](#enumeration-definitions)
	* [Example: Enumeration definitions](#example-enumeration-definitions)

<!-- vim-markdown-toc -->

# Enumeration Definitions

An enumeration is a list of named numbers, which by default will be incremental
from 0. By default they decay to the type `int`, but the default decay type can
be set manually.

An enumeration definition takes the form:

```
enum Identifier $[ : Integer-type]$
{
	$[Enumerator $[ , Enumerator]$... $[ , ]$]$
}
```

Optionally followed by a semicolon. `Integer-type` in this context is any valid
integral type name.

Enumerators can either be incremental (from the last enumerator or 0 if there
is none) or explicitly set with the syntax `Identifier = Expression`.
Enumerators must be followed by a comma unless it is the end of the list.

Enumerator syntax is:

```
Identifier $[ = Expression]$
```

## Example: Enumeration definitions

```
// Basic enumeration.
enum MyCoolEnum
{
	A_THING, // Has value int(0) ...
	BEES, // ... 1 ...
	CALCIUM, // ... 2 ...
	DEXTROSE, // ... and 3.
}

// Less trivial example.
enum MyCoolerEnum : int16
{
	A = 500, // Has value int16(500),
	B, // 501,
	C = 200,
	D, // 201,
	E, // and 202.
}
```
<!-- EOF -->