wrap to 80 columns and fix minor errata

pull/1/head
an 2019-02-02 21:06:35 -05:00
parent 9ac3796341
commit 8ffeb2acfc
45 changed files with 811 additions and 285 deletions

View File

@ -79,18 +79,40 @@ Language
<!-- vim-markdown-toc -->
ZScript is a new (circa 2017) scripting language that has sprung from the ceasing of ZDoom and the subsequent reprisal of GZDoom as mainline. It is similar to Java, though it has many deficiencies, oddities and other such issues. Despite this, it is still the most powerful Doom modding tool since straight up source editing, and will likely stay that way for a while until Eternity Engine inevitably becomes competition-worthy with scripting additions.
ZScript is a new (circa 2017) scripting language that has sprung from the
ceasing of ZDoom and the subsequent reprisal of GZDoom as mainline. It is
similar to Java, though it has many deficiencies, oddities and other such
issues. Despite this, it is still the most powerful Doom modding tool since
straight up source editing, and will likely stay that way for a while until
Eternity Engine inevitably becomes competition-worthy with scripting additions.
This documentation serves as an introduction to and informal specification of the ZScript language from a programmer's viewpoint. It should also be useful for non-programmers looking for specifics on the inner workings of the language and more information on the functions and properties provided to it.
This documentation serves as an introduction to and informal specification of
the ZScript language from a programmer's viewpoint. It should also be useful
for non-programmers looking for specifics on the inner workings of the language
and more information on the functions and properties provided to it.
ZScript runs in a virtual machine much like ACS, although because it is *not* compiled to bytecode and uses an object-oriented structure, the virtual machine is far more complex, and also therefore quite a bit slower. ZScript may only be read from source files by the engine, which has several benefits as well as detriments. It is the opinion of the author that this is a bad solution, but the author will refrain from going on a several-paragraph tirade about why bytecode is always better than source, even if it is an optional component.
ZScript runs in a virtual machine much like ACS, although because it is *not*
compiled to bytecode and uses an object-oriented structure, the virtual machine
is far more complex, and also therefore quite a bit slower. ZScript may only be
read from source files by the engine, which has several benefits as well as
detriments. It is the opinion of the author that this is a bad solution, but
the author will refrain from going on a several-paragraph tirade about why
bytecode is always better than source, even if it is an optional component.
In any case, here we are. This documentation will detail all aspects of ZScript, from the language and type system to the API and finer details. This document is distributed under the [CC0 public domain license](LICENSE.txt) in the hope that it is useful reference and serves as a solid basis for further writings. This document was originally written by Alison Sanderson (Marrub.) Attribution is encouraged but not required.
In any case, here we are. This documentation will detail all aspects of
ZScript, from the language and type system to the API and finer details. This
document is distributed under the [CC0 public domain license](LICENSE.txt) in
the hope that it is useful reference and serves as a solid basis for further
writings. This document was originally written by Alison Sanderson (Marrub.)
Attribution is encouraged but not required.
Reading This Document
=====================
This document's syntaxes are written in a specific way to be easy to read but still close enough to a formal syntax that, for instance, someone writing a parser could do so off of this document. Here is a legend describing all syntax element spellings:
This document's syntaxes are written in a specific way to be easy to read but
still close enough to a formal syntax that, for instance, someone writing a
parser could do so off of this document. Here is a legend describing all syntax
element spellings:
| Spelling | Meaning |
| -------- | ------- |
@ -105,27 +127,38 @@ This document's syntaxes are written in a specific way to be easy to read but st
Translation Unit
================
Full ZScript files are referred to as "translation units." This terminology comes from the C standard, and refers simply to the entirety of a ZScript source file. ZScript files are looked for in lumps named `zscript` with any extension. The standard extension is `.txt`, but `.zsc` and `.zs` are common as well. The author of this documentation prefers `.zsc`.
Full ZScript files are referred to as "translation units." This terminology
comes from the C standard, and refers simply to the entirety of a ZScript
source file. ZScript files are looked for in lumps named `zscript` with any
extension. The standard extension is `.txt`, but `.zsc` and `.zs` are common as
well. The author of this documentation prefers `.zsc`.
The base translation unit `zscript` may start with a version directive, then followed by any number of top-level definitions and `#include` directives. Included translation units may not have version directives.
The base translation unit `zscript` may start with a version directive, then
followed by any number of top-level definitions and `#include` directives.
Included translation units may not have version directives.
All keywords and identifiers in ZScript are case insensitive.
Versions
========
A version directive may be placed at the very beginning of a ZScript file, the syntax being:
A version directive may be placed at the very beginning of a ZScript file, the
syntax being:
```
version "num"
```
Where `num` is the ZScript version to use. By default ZScript is `version "2.3"`, the original ZScript specification. This old version is not supported by this documentation and it is highly encouraged to always use the latest version of ZScript. The minimum version supported by this documentation is 3.0.
Where `num` is the ZScript version to use. By default ZScript is version
2.3, the original ZScript specification. This old version is not supported
by this documentation and it is highly encouraged to always use the latest
version of ZScript. The minimum version supported by this documentation is 3.0.
Top-level
=========
A ZScript file can have one of several things at the top level of the file, following a version directive:
A ZScript file can have one of several things at the top level of the file,
following a version directive:
- Class definitions
- Structure definitions
@ -136,13 +169,20 @@ A ZScript file can have one of several things at the top level of the file, foll
Class definitions
=================
A class defines an object type within ZScript, and is most of what you'll be creating within the language.
A class defines an object type within ZScript, and is most of what you'll be
creating within the language.
All classes inherit from other classes. The base class can be set within the class header, but if it is not the class will automatically inherit from Object.
All classes inherit from other classes. The base class can be set within the
class header, but if it is not the class will automatically inherit from
Object.
Classes are subject to Scoping. They are also implicitly reference values, and therefore can be null. Use `new` to instantiate a new class object.
Classes are subject to Scoping. They are also implicitly reference values, and
therefore can be null. Use `new` to instantiate a new class object.
Classes that inherit from Actor can replace other actors when spawned in maps, and can also be used freely in `DECORATE`. Actors have states, which will not be explained in this document as they are already well-documented on the ZDoom wiki.
Classes that inherit from Actor can replace other actors when spawned in maps,
and can also be used freely in `DECORATE`. Actors have states, which will not
be explained in this document as they are already well-documented on the ZDoom
wiki.
A class is formed with the syntax:
@ -155,7 +195,8 @@ class Identifier $[ : Base-class]$ $[Class-flags...]$
`Base-class` in this context is an `Identifier`.
Alternatively, the rest of the file can be used as class content. Note that with this syntax you cannot use include directives afterward:
Alternatively, the rest of the file can be used as class content. Note that
with this syntax you cannot use include directives afterward:
```
class Identifier $[ : Base-class]$ $[Class-flags...]$ ;
@ -163,7 +204,8 @@ class Identifier $[ : Base-class]$ $[Class-flags...]$ ;
$[Class-content...]$
```
If the class is defined within the same archive as the current file, then one can continue a class definition with the syntax:
If the class is defined within the same archive as the current file, then one
can continue a class definition with the syntax:
```
extend class Identifier
@ -182,11 +224,13 @@ In place of the class header.
| `ui` | Class has UI scope. |
| `version ( "ver" )` | Restricted to ZScript version `ver` or higher. |
`Replace-class` in this context is an `Identifier` denoting a class which inherits `Actor`.
`Replace-class` in this context is an `Identifier` denoting a class which
inherits `Actor`.
## Class content
Class contents are an optional list of various things logically contained within the class, including:
Class contents are an optional list of various things logically contained
within the class, including:
- Member declarations
- Method definitions
@ -201,11 +245,20 @@ Class contents are an optional list of various things logically contained within
## Property definitions
Property definitions are used within classes to define defaultable attributes on actors. They are not valid on classes not derived from Actor.
Property definitions are used within classes to define defaultable attributes
on actors. They are not valid on classes not derived from Actor.
When registered, a property will be available in the `default` block as `ClassName.PropertyName`. Properties can be given multiple members to initialize.
When registered, a property will be available in the `default` block as
`ClassName.PropertyName`. Properties can be given multiple members to
initialize.
Property definitions take the form `property Identifier : Member $[ , Member]$... ;` (where `Member` is an identifier naming any member in the current class.)
Property definitions take the form:
```
property Identifier : Member $[ , Member]$... ;
```
Where `Member` is an identifier naming any member in the current class.
Properties defined in ZScript are usable from `DECORATE`.
@ -213,23 +266,42 @@ Properties defined in ZScript are usable from `DECORATE`.
*Version 3.7.0 and newer.*
Flag definitions are used within classes to define defaultable boolean flags on actors. They are not valid on classes not derived from Actor.
Flag definitions are used within classes to define defaultable boolean flags on
actors. They are not valid on classes not derived from Actor.
When registered, a flag will be available in the `default` block as `CLASSNAME.FLAGNAME`, as well as a member as `bFLAGNAME`.
When registered, a flag will be available in the `default` block as
`CLASSNAME.FLAGNAME`, as well as a member as `bFLAGNAME`.
Each flag operates on a singular bit of any integer member of the class. The integer must be exactly 32 bits, though if it is signed or not does not matter. This means each backing integer can hold exactly 32 flags each (assuming no duplicated flags,) and more will require another one to be added. (Internally, the `Actor` flags are currently up to over 8 backing integers.)
Each flag operates on a singular bit of any integer member of the class. The
integer must be exactly 32 bits, though if it is signed or not does not matter.
This means each backing integer can hold exactly 32 flags each (assuming no
duplicated flags,) and more will require another one to be added. (Internally,
the `Actor` flags are currently up to over 8 backing integers.)
A flag's backing integer may not be `meta`, although it may be `readonly`, `private`, or any other access modifier. The generated flag member will be publicly visible regardless of the backing integer's visibility.
A flag's backing integer may not be `meta`, although it may be `readonly`,
`private`, or any other access modifier. The generated flag member will be
publicly visible regardless of the backing integer's visibility.
Flag definitions take the form `flagdef Identifier : Member , Number ;` where `Number` is the bit in `Member` to use, starting from `0` and ending at `31`.
Flag definitions take the form:
```
flagdef Identifier : Member , Number ;
```
Where `Number` is the bit in `Member` to use, starting from `0` and ending at
`31`.
Flags defined in ZScript are usable from `DECORATE`.
## Default blocks
Default blocks are used on classes derived from Actor to create an overridable list of defaults to properties, allowing for swift creation of flexible actor types.
Default blocks are used on classes derived from Actor to create an overridable
list of defaults to properties, allowing for swift creation of flexible actor
types.
In `DECORATE`, this is everything that isn't in the `states` block, but in ZScript, for syntax flexibility purposes, it must be enclosed in a block with `default` at the beginning, formed:
In `DECORATE`, this is everything that isn't in the `states` block, but in
ZScript, for syntax flexibility purposes, it must be enclosed in a block with
`default` at the beginning, formed:
```
default
@ -259,11 +331,15 @@ Default properties are formed as:
Identifier $[ . Identifier]$... Expression ;
```
Note that all properties *except for* `DamageFunction` require `Expression` to be a constant expression.
Note that all properties *except for* `DamageFunction` require `Expression` to
be a constant expression.
## State definitions
These are the same as `DECORATE`, but states that do not have function blocks require terminating semicolons. Double quotes around `#` and `-` are no longer required. State blocks can be subject to Action Scoping with the syntax `states(Scope)`.
These are the same as `DECORATE`, but states that do not have function blocks
require terminating semicolons. Double quotes around `#` and `-` are no longer
required. State blocks can be subject to Action Scoping with the syntax
`states(Scope)`.
A state definition block has the syntax:
@ -274,7 +350,7 @@ states $[ ( Scope $[ , Scope]$... ) ]$
}
```
State-or-label either defines a state label or a state itself, with the syntax of:
State-or-label either defines a state label or a state itself, with the syntax:
```
Identifier :
@ -308,14 +384,23 @@ Identifier ( Argument-list ) ;
{ $[Statement...]$ }
```
The first will attach no action function to the state. The second will attach the specified action function with the specified arguments, and the third will create an anonymous action function and attach it.
The first will attach no action function to the state. The second will attach
the specified action function with the specified arguments, and the third will
create an anonymous action function and attach it.
Structure definitions
=====================
A structure is an object type that does not inherit from Object and is not always (though occasionally is) a reference type, unlike classes. Structures marked as `native` are passed by-reference to and from the engine in an implicit pseudo-type `Pointer<T>`, and `null` can be passed in their place. Also note that this means the engine can return `null` structures. Non-native structures cannot be passed as arguments or returned normally.
A structure is an object type that does not inherit from Object and is not
always (though occasionally is) a reference type, unlike classes. Structures
marked as `native` are passed by-reference to and from the engine in an
implicit pseudo-type `Pointer<T>`, and `null` can be passed in their place.
Also note that this means the engine can return `null` structures. Non-native
structures cannot be passed as arguments or returned normally.
Structures are preferred for basic compound data types that do not need to be instanced and are often used as a way of generalizing code. They cannot be returned from functions.
Structures are preferred for basic compound data types that do not need to be
instanced and are often used as a way of generalizing code. They cannot be
returned from functions.
Structures are subject to Scoping.
@ -342,7 +427,8 @@ Optionally followed by a semicolon.
## Structure content
Structure contents are an optional list of various things logically contained within the structure, including:
Structure contents are an optional list of various things logically contained
within the structure, including:
- Member declarations
- Method definitions
@ -352,7 +438,9 @@ Structure contents are an optional list of various things logically contained wi
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 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:
@ -363,9 +451,12 @@ enum Identifier $[ : Integer-type]$
}
```
Optionally followed by a semicolon. `Integer-type` in this context is any valid integral type name.
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.
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:
@ -382,12 +473,15 @@ Constants are simple named values. They are created with the syntax:
const Identifier = Expression ;
```
Constants are not assignable. Their type is inferred from their value, so if you wish for them to have a specific type, you must cast the value to that type.
Constants are not assignable. Their type is inferred from their value, so if
you wish for them to have a specific type, you must cast the value to that
type.
Static array definitions
=========================
Similar to constants, static arrays are named values, but for an array. They are created with the syntax:
Similar to constants, static arrays are named values, but for an array. They
are created with the syntax:
```
static const Type Variable-name = { $[Expression $[ , Expression]$...]$ } ;
@ -398,24 +492,36 @@ Static arrays cannot be multi-dimensional, unlike normal fixed-size arrays.
Include directives
==================
Include directives include other files to be processed by the ZScript compiler, allowing you to organize and separate code into different files. Their syntax is simple:
Include directives include other files to be processed by the ZScript compiler,
allowing you to organize and separate code into different files. Their syntax
is simple:
```
#include "filename"
```
Note that included filenames will conflict with other mods. If two mods have a file named `zscript/MyCoolClasses.zsc` and both include it, expecting to get different files, the engine will fail to load with a script error.
Note that included filenames will conflict with other mods. If two mods have a
file named `zscript/MyCoolClasses.zsc` and both include it, expecting to get
different files, the engine will fail to load with a script error.
To avoid this, it is suggested to place your ZScript code under a uniquely named sub-folder.
To avoid this, it is suggested to place your ZScript code under a uniquely
named sub-folder.
Types
=====
ZScript has several categories of types: Integer types, floating-point (decimal) types, strings, vectors, names, classes, et al. There are a wide variety of ways to use these types, as well as a wide variety of places they are used.
ZScript has several categories of types: Integer types, floating-point
(decimal) types, strings, vectors, names, classes, et al. There are a wide
variety of ways to use these types, as well as a wide variety of places they
are used.
Types determine what kind of value an object stores, how it acts within an expression, etc. All objects, constants and enumerations have a type. Argument lists use types to ensure a function is used properly.
Types determine what kind of value an object stores, how it acts within an
expression, etc. All objects, constants and enumerations have a type. Argument
lists use types to ensure a function is used properly.
Most basic types have methods attached to them, and both integer and floating-point type names have symbols accessible from them. See the API section for more information.
Most basic types have methods attached to them, and both integer and
floating-point type names have symbols accessible from them. See the API
section for more information.
## Integers
@ -441,7 +547,8 @@ Some types have aliases as well:
### Symbols
Integer types have symbols attached which can be accessed by `typename.name`, for instance `int.Max`.
Integer types have symbols attached which can be accessed by `typename.name`,
for instance `int.Max`.
- `Max`
@ -453,7 +560,8 @@ Integer types have symbols attached which can be accessed by `typename.name`, fo
## Floating-point types
Floating-point types hold exponents, generally represented as regular decimal numbers. There are two such types available to ZScript:
Floating-point types hold exponents, generally represented as regular decimal
numbers. There are two such types available to ZScript:
| Name | Usable as argument | Notes |
| ---- | :----------------: | ----- |
@ -464,7 +572,8 @@ Floating-point types hold exponents, generally represented as regular decimal nu
### Symbols
Floating-point types have symbols attached which can be accessed by `typename.name`, for instance `double.Infinity`.
Floating-point types have symbols attached which can be accessed by
`typename.name`, for instance `double.Infinity`.
- `Dig`
@ -520,7 +629,9 @@ Floating-point types have symbols attached which can be accessed by `typename.na
| ---- | :----------------: |
| `string` | Yes |
The `string` type is a mutable, garbage-collected string reference type. Strings are not structures or classes, however there are methods attached to the type, detailed in the API section.
The `string` type is a mutable, garbage-collected string reference type.
Strings are not structures or classes, however there are methods attached to
the type, detailed in the API section.
## Names
@ -528,9 +639,14 @@ The `string` type is a mutable, garbage-collected string reference type. Strings
| ---- | :----------------: |
| `name` | Yes |
The `name` type is an indexed string. While their contents are the same as a string, their actual value is merely an integer which can be compared far quicker than a string. Names are used for many internal purposes such as damage type names. Strings are implicitly cast to names.
The `name` type is an indexed string. While their contents are the same as a
string, their actual value is merely an integer which can be compared far
quicker than a string. Names are used for many internal purposes such as damage
type names. Strings are implicitly cast to names.
Names can be converted to `int` with an explicit cast, and the negative of `int(name())` may be used to create an integer representation of a string usable by action specials, most prominently `ACS_NamedExecute`.
Names can be converted to `int` with an explicit cast, and the negative of
`int(name())` may be used to create an integer representation of a string
usable by action specials, most prominently `ACS_NamedExecute`.
## Color
@ -538,7 +654,13 @@ Names can be converted to `int` with an explicit cast, and the negative of `int(
| ---- | :----------------: |
| `color` | Yes |
The `color` type can be converted from a string using the `X11RGB` lump or a hex color in the format `#RRGGBB`, or with either `color(R, G, B)` or `color(A, R, G, B)`.
The `color` type can be converted from a string using the `X11RGB` lump or a
hex color in the format `#RRGGBB`, or with either of:
```
color(R, G, B)
color(A, R, G, B)
```
## Vectors
@ -547,9 +669,13 @@ The `color` type can be converted from a string using the `X11RGB` lump or a hex
| `vector2` | Yes |
| `vector3` | Yes |
There are two vector types in ZScript, `vector2` and `vector3`, which hold two and three members, respectively. Their members can be accessed through `x`, `y` and (for `vector3`,) `z`. `vector3` can additionally get the X and Y components as a `vector2` with `xy`.
There are two vector types in ZScript, `vector2` and `vector3`, which hold two
and three members, respectively. Their members can be accessed through `x`, `y`
and (for `vector3`,) `z`. `vector3` can additionally get the X and Y components
as a `vector2` with `xy`.
Vectors can use many operators and even have special ones to themselves. See the Expressions and Operators section for more information.
Vectors can use many operators and even have special ones to themselves. See
the Expressions and Operators section for more information.
## Fixed-size arrays
@ -557,7 +683,14 @@ Vectors can use many operators and even have special ones to themselves. See the
| ---- | :----------------: |
| `Type Array-size` | No |
Fixed-size arrays take the form `Type[size]`. They hold `size` number of `Type` elements, which can be accessed with the array access operator. Multi-dimensional arrays are also supported. Note that this kind of type can also be declared in variable names themselves.
Fixed-size arrays take the form `Type[size]`. They hold `size` number of `Type`
elements, which can be accessed with the array access operator.
Multi-dimensional arrays are also supported, although the dimensions will be
backwards (right to left instead of left to right) unless `version` is `3.7.2`
or greater.
Note that this kind of type can also be declared in variable names themselves.
## Dynamic-size arrays
@ -565,9 +698,12 @@ Fixed-size arrays take the form `Type[size]`. They hold `size` number of `Type`
| ---- | :----------------: |
| `array < Type >` | Yes |
Dynamically sized arrays take the form `array<Type>`, and hold an arbitrary number of `Type` elements, which can be accessed with the array access operator.
Dynamically sized arrays take the form `array<Type>`, and hold an arbitrary
number of `Type` elements, which can be accessed with the array access
operator.
Dynamic-sized arrays do not have their lifetime scoped to their current block, so:
Dynamic-sized arrays do not have their lifetime scoped to their current block,
so the following:
```
for(int i = 0; i < 5; i++)
@ -579,7 +715,8 @@ for(int i = 0; i < 5; i++)
Will result in an array with 5 elements.
Dynamically sized arrays also cannot store other dynamically sized arrays, or user-defined `struct` objects.
Dynamically sized arrays also cannot store other dynamically sized arrays, or
user-defined `struct` objects.
## Maps
@ -596,7 +733,10 @@ Map types take the form `map<Type, Type>`. They are not yet implemented.
| `class < Type >` | Yes |
| `class` | Yes |
Class type references are used to describe a concrete *type* rather than an object. They simply take the form `class`, and can be restrained to descendants of a type with the syntax `class<Type>`. Strings are implicitly cast to class type references.
Class type references are used to describe a concrete *type* rather than an
object. They simply take the form `class`, and can be restrained to descendants
of a type with the syntax `class<Type>`. Strings are implicitly cast to class
type references.
## User types
@ -607,11 +747,15 @@ Class type references are used to describe a concrete *type* rather than an obje
| User-defined `struct` object | No |
| `@ Type` | Yes |
Any other identifier used as a type will resolve to a user class, structure or enumeration type.
Any other identifier used as a type will resolve to a user class, structure or
enumeration type.
Types prefixed with `@` are native pointers to objects (as opposed to objects placed directly in the structure's data.) This is not usable in user code.
Types prefixed with `@` are native pointers to objects (as opposed to objects
placed directly in the structure's data.) This is not usable in user code.
A type name that is within a specific scope can be accessed by prefixing it with a `.`. The type `.MyClass.MySubStructure` will resolve to the type `MySubStructure` contained within `MyClass`.
A type name that is within a specific scope can be accessed by prefixing it
with a `.`. The type `.MyClass.MySubStructure` will resolve to the type
`MySubStructure` contained within `MyClass`.
## Read-only types
@ -619,7 +763,9 @@ A type name that is within a specific scope can be accessed by prefixing it with
| ---- | :----------------: |
| `readonly < Type >` | Yes |
A read-only type, as its name implies, may only be read from, and is effectively immutable. They take the form `readonly<Type>`. Do note that this is separate from the member declaration flag.
A read-only type, as its name implies, may only be read from, and is
effectively immutable. They take the form `readonly<Type>`. Do note that this
is separate from the member declaration flag.
## Other types
@ -638,7 +784,8 @@ Strings will implicitly convert to `sound` and `statelabel`.
## Variable name
Variable names can have an array's size on them, instead of on the type, or none. Variable names are formed as either:
Variable names can have an array's size on them, instead of on the type, or
none. Variable names are formed as either:
```
Identifier
@ -647,7 +794,8 @@ Identifier Array-size
## Array size
Array sizes can be multi-dimensional or automatically sized, so all of the following syntaxes are available:
Array sizes can be multi-dimensional or automatically sized, so all of the
following syntaxes are available:
```
[ ]
@ -659,7 +807,9 @@ Expressions and Operators
## Literals
Much like C or most other programming languages, ZScript has object literals, including string literals, integer literals, float literals, name literals, boolean literals, and the null pointer.
Much like C or most other programming languages, ZScript has object literals,
including string literals, integer literals, float literals, name literals,
boolean literals, and the null pointer.
### String literals
@ -669,7 +819,8 @@ String literals take the same form as in C:
"text here"
```
String literals have character escapes, which are formed with a backslash and a character. Character escapes include:
String literals have character escapes, which are formed with a backslash and a
character. Character escapes include:
| Spelling | Output |
| -------- | ------ |
@ -688,9 +839,12 @@ String literals have character escapes, which are formed with a backslash and a
| `\xnn` or `\Xnn` | Byte `0xnn`. |
| `\nnn` | Byte `0nnn` (octal.) |
To quote [cppreference](https://en.cppreference.com/w/cpp/language/escape), "of the octal escape sequences, `\0` is the most useful because it represents the terminating null character in null-terminated strings."
To quote [cppreference](https://en.cppreference.com/w/cpp/language/escape), "of
the octal escape sequences, `\0` is the most useful because it represents the
terminating null character in null-terminated strings."
String literals, also like C and C++, will be concatenated when put directly next to each other. For example, this:
String literals, also like C and C++, will be concatenated when put directly
next to each other. For example, this:
```
"text 1" "text 2"
@ -700,23 +854,30 @@ Will be parsed as a single string literal with the text `"text 1text 2"`.
### Class type literals
Class type literals take the same form as string literals, but do note that they are not the same.
Class type literals take the same form as string literals, but do note that
they are not the same.
### Name literals
Name literals are similar to string literals, though they use apostrophes instead of quote marks:
Name literals are similar to string literals, though they use apostrophes
instead of quote marks:
```
'text here'
```
They do not concatenate like string literals, and do not have character escapes.
They do not concatenate like string literals, and do not have character
escapes.
### Integer literals
Integer literals are formed similarly to C. They may take one of three forms, and be typed `uint` or `int` based on whether there is a `u` or `U` at the end or not.
Integer literals are formed similarly to C. They may take one of three forms,
and be typed `uint` or `int` based on whether there is a `u` or `U` at the end
or not.
The parser also supports an optional `l`/`L` suffix as in C, though it does not actually do anything, and it is advised you do not use it for potential forward compatibility purposes.
The parser also supports an optional `l`/`L` suffix as in C, though it does not
actually do anything, and it is advised you do not use it for potential forward
compatibility purposes.
Integer literals can be in the basic base-10/decimal form:
@ -725,7 +886,8 @@ Integer literals can be in the basic base-10/decimal form:
500u // uint
```
Base-16/hexadecimal form, which may use upper- or lower-case decimals and `0x` prefix, depending on user preference:
Base-16/hexadecimal form, which may use upper- or lower-case decimals and `0x`
prefix, depending on user preference:
```
0x123456789ABCDEF0
@ -743,9 +905,12 @@ And, base-8/octal form, prefixed with a `0`:
### Float literals
Float literals, much like integer literals, are formed similarly to C, but they do not support hex-float notation. Float literals support exponent notation.
Float literals, much like integer literals, are formed similarly to C, but they
do not support hex-float notation. Float literals support exponent notation.
The parser supports an optional `f`/`F` suffix as in C, though it does not actually do anything, and it is advised you do not use it for potential forward compatibility purposes.
The parser supports an optional `f`/`F` suffix as in C, though it does not
actually do anything, and it is advised you do not use it for potential forward
compatibility purposes.
Float literals can be formed in a few ways:
@ -764,15 +929,19 @@ And with exponents:
### Boolean literals
The two boolean literals are spelled `false` and `true`, and much like C, can decay to the integer literals `0` and `1`.
The two boolean literals are spelled `false` and `true`, and much like C, can
decay to the integer literals `0` and `1`.
### Null pointer
The null pointer literal is spelled `null` and represents an object that does not exist in memory. Like C, it is not equivalent to the integer literal `0`, and is more similar to C++'s `nullptr`.
The null pointer literal is spelled `null` and represents an object that does
not exist in memory. Like C, it is not equivalent to the integer literal `0`,
and is more similar to C++'s `nullptr`.
## Expressions
Expressions contain literals or other such *expressions* of objects, including arithmetic and various conditions.
Expressions contain literals or other such *expressions* of objects, including
arithmetic and various conditions.
### Primary expressions
@ -784,11 +953,15 @@ Basic expressions, also known as primary expressions, can be one of:
- A vector literal.
- An expression in parentheses.
Identifiers work as you expect, they reference a variable or constant. The `Super` keyword references the parent type or any member within it.
Identifiers work as you expect, they reference a variable or constant. The
`Super` keyword references the parent type or any member within it.
#### Vector literals
Vector literals are not under object literals as they are not constants in the same manner as other literals, since they contain expressions within them. As such, they are expressions, not proper value-based literals. They can be formed with:
Vector literals are not under object literals as they are not constants in the
same manner as other literals, since they contain expressions within them. As
such, they are expressions, not proper value-based literals. They can be formed
with:
```
( X , Y ) //=> vector2, where X is not a vector2
@ -796,11 +969,14 @@ Vector literals are not under object literals as they are not constants in the s
( X , Y , Z ) //=> vector3
```
All components must have type `double`, except in the second grammar where `X` is `vector2`.
All components must have type `double`, except in the second grammar where `X`
is `vector2`.
### Postfix expressions
Postfix expressions are affixed at the end of an expression, and are used for a large variety of things, although the actual amount of postfix expressions is small:
Postfix expressions are affixed at the end of an expression, and are used for a
large variety of things, although the actual amount of postfix expressions is
small:
| Form | Description |
| ---- | ----------- |
@ -820,11 +996,16 @@ The syntax for an argument list is:
Expression $[ , Expression]$...
```
Function calls may name arguments which have defaults with the syntax `Identifier : Expression`, possibly skipping over other defaulted arguments. After the first named defaultable argument, all other arguments must be named as well.
Function calls may name arguments which have defaults with the syntax
`Identifier : Expression`, possibly skipping over other defaulted arguments.
After the first named defaultable argument, all other arguments must be named
as well.
### Unary expressions
Unary expressions are affixed at the beginning of an expression. The simplest example of a unary expression is the negation operator, `-`, as in `-500`. Unary expressions include:
Unary expressions are affixed at the beginning of an expression. The simplest
example of a unary expression is the negation operator, `-`, as in `-500`.
Unary expressions include:
| Form | Description |
| ---- | ----------- |
@ -839,7 +1020,9 @@ Unary expressions are affixed at the beginning of an expression. The simplest ex
### Binary expressions
Binary expressions operate on two expressions, and are the most common kind of expression. They are used inline like regular math syntax, i.e. `1 + 1`. Binary expressions include:
Binary expressions operate on two expressions, and are the most common kind of
expression. They are used inline like regular math syntax, i.e. `1 + 1`. Binary
expressions include:
| Form | Description |
| ---- | ----------- |
@ -873,7 +1056,9 @@ Binary expressions operate on two expressions, and are the most common kind of e
#### Assignment expressions
Assignment expressions are a subset of binary expressions which *are never constant expressions*. They assign a value to another value, as one might guess.
Assignment expressions are a subset of binary expressions which *are never
constant expressions*. They assign a value to another value, as one might
guess.
| Form | Description |
| ---- | ----------- |
@ -892,12 +1077,15 @@ Assignment expressions are a subset of binary expressions which *are never const
### Ternary expression
The ternary expression is formed `A ? B : C`, and will evaluate to `B` if `A` is `true`, or `C` if it is `false`.
The ternary expression is formed `A ? B : C`, and will evaluate to `B` if `A`
is `true`, or `C` if it is `false`.
Statements
==========
All functions are made up of a list of *statements* enclosed with left and right braces, which in and of itself is a statement called a *compound statement*, or *block*.
All functions are made up of a list of *statements* enclosed with left and
right braces, which in and of itself is a statement called a *compound
statement*, or *block*.
## Compound statements
@ -909,11 +1097,16 @@ A compound statement is formed as:
}
```
Note that the statement list is optional, so an empty compound statement `{}` is entirely valid.
Note that the statement list is optional, so an empty compound statement `{}`
is entirely valid.
## Expression statements
An expression statement is the single most common type of statement in just about any programming language. In ZScript, exactly like C and C++, an expression statement is simply formed with any expression followed by a semicolon. Function calls and variable assignments are expressions, for instance, so it is quite clear why they are common.
An expression statement is the single most common type of statement in just
about any programming language. In ZScript, exactly like C and C++, an
expression statement is simply formed with any expression followed by a
semicolon. Function calls and variable assignments are expressions, for
instance, so it is quite clear why they are common.
Their syntax is:
@ -923,7 +1116,8 @@ Expression ;
## Conditional statements
A conditional statement will, conditionally, choose a statement (or none) to execute. They work the same as in C and ACS:
A conditional statement will, conditionally, choose a statement (or none) to
execute. They work the same as in C and ACS:
```
if ( Expression ) Statement $[ else Statement]$
@ -931,7 +1125,8 @@ if ( Expression ) Statement $[ else Statement]$
## Switch statements
A switch statement takes an expression of integer or name type and selects a labeled statement to run. They work the same as in C and ACS:
A switch statement takes an expression of integer or name type and selects a
labeled statement to run. They work the same as in C and ACS:
```
switch ( Expression ) Statement
@ -939,15 +1134,21 @@ switch ( Expression ) Statement
## Loop statements
ZScript has five loop statements, `for`, `while`, `until`, `do while` and `do until`. `for`, `while` and `do while` work the same as in C, C++ and ACS, while `until` and `do until` do the inverse of `while` and `do while`.
ZScript has five loop statements, `for`, `while`, `until`, `do while` and `do
until`. `for`, `while` and `do while` work the same as in C, C++ and ACS, while
`until` and `do until` do the inverse of `while` and `do while`.
The `for` loop takes a limited statement and two optional expressions: The statement for when the loop begins (which is scoped to the loop,) one expression for checking if the loop should break, and one which is executed every time the loop iterates. Its syntax is:
The `for` loop takes a limited statement and two optional expressions: The
statement for when the loop begins (which is scoped to the loop,) one
expression for checking if the loop should break, and one which is executed
every time the loop iterates. Its syntax is:
```
for ( $[Expression-or-Local-variable-statement]$ ; $[Expression]$ ; $[Expression]$ ) Statement
```
The `while` loop simply takes one expression for checking if the loop should break, equivalent to `for(; a;)`.
The `while` loop simply takes one expression for checking if the loop should
break, equivalent to `for(; a;)`.
The `until` loop is equivalent to `while(!a)`. Their syntax are:
@ -956,7 +1157,8 @@ while ( Expression ) Statement
until ( Expression ) Statement
```
`do while` and `do until` will only check the expression after the first iteration is complete. The `do while` and `do until` loops are formed as such:
`do while` and `do until` will only check the expression after the first
iteration is complete. The `do while` and `do until` loops are formed as such:
```
do
@ -970,21 +1172,28 @@ until ( Expression )
## Control flow statements
As in C, there are three control flow statements that manipulate where the program will execute statements next, which are available contextually. They are `continue`, `break` and `return`.
As in C, there are three control flow statements that manipulate where the
program will execute statements next, which are available contextually. They
are `continue`, `break` and `return`.
`continue` is available in loop statements and will continue to the next iteration immediately:
`continue` is available in loop statements and will continue to the next
iteration immediately:
```
continue ;
```
`break` is available in loop statements and switch statements, and will break out of the containing statement early:
`break` is available in loop statements and switch statements, and will break
out of the containing statement early:
```
break ;
```
`return` is available in functions. If the function does not return any values, it may only be spelled `return;` and will simply exit the function early. If the function does return values, it takes a comma-separated list for each value returned:
`return` is available in functions. If the function does not return any values,
it may only be spelled `return;` and will simply exit the function early. If
the function does return values, it takes a comma-separated list for each value
returned:
```
return $[Expression $[ , Expression]$...]$ ;
@ -992,7 +1201,9 @@ return $[Expression $[ , Expression]$...]$ ;
## Local variable statements
Local variable statements are formed in one of 2 ways. The `let` keyword can be used to automatically determine the type of the variable from the initializer, while the regular syntax uses an explicit type, and initialization is optional.
Local variable statements are formed in one of 2 ways. The `let` keyword can be
used to automatically determine the type of the variable from the initializer,
while the regular syntax uses an explicit type, and initialization is optional.
Variables' syntax are one of:
@ -1010,7 +1221,8 @@ Type Variable $[ , Variable]$... ;
## Multi-assignment statements
Expressions or functions that return multiple values can be assigned into multiple variables with the syntax:
Expressions or functions that return multiple values can be assigned into
multiple variables with the syntax:
```
[ Expression $[ , Expression]$... ] = Expression ;
@ -1024,12 +1236,15 @@ Static arrays can be defined normally as a statement.
## Null statements
A null statement does nothing, and is formed `;`. It is similar to an empty compound statement.
A null statement does nothing, and is formed `;`. It is similar to an empty
compound statement.
Member declarations
===================
Member declarations define data within a structure or class that can be accessed directly within methods of the object (or its derived classes,) or indirectly from instances of it with the member access operator.
Member declarations define data within a structure or class that can be
accessed directly within methods of the object (or its derived classes,) or
indirectly from instances of it with the member access operator.
A member declaration is formed as so:
@ -1057,9 +1272,13 @@ $[Member-declaration-flags...]$ Type Variable-name $[ , Variable-name]$... ;
Method definitions
==================
Method definitions define functions within a structure or class that can be accessed directly within other methods of the object (or its derived classes,) or indirectly from instances of it with the member access operator.
Method definitions define functions within a structure or class that can be
accessed directly within other methods of the object (or its derived classes,)
or indirectly from instances of it with the member access operator.
Methods marked as `virtual` may have their functionality overridden by derived classes, and in those overrides one can use the `Super` keyword to call the parent function.
Methods marked as `virtual` may have their functionality overridden by derived
classes, and in those overrides one can use the `Super` keyword to call the
parent function.
Methods are formed as so:
@ -1070,17 +1289,27 @@ $[Method-definition-flags...]$ Type $[ , Type]$... Identifier ( $[Method-argumen
}
```
If `const` is placed after the function signature and before the function body, the method will not be allowed to modify any members in the object instance it's being called on.
If `const` is placed after the function signature and before the function body,
the method will not be allowed to modify any members in the object instance
it's being called on.
The keyword `void` can be used in place of the return type (or type list) to have a method which does not have any return value. Similarly, one can place `void` where the argument list might be, although this is redundant as having no argument list at all is allowed.
The keyword `void` can be used in place of the return type (or type list) to
have a method which does not have any return value. Similarly, one can place
`void` where the argument list might be, although this is redundant as having
no argument list at all is allowed.
Arguments of methods may only be of certain types due to technical limitations. See the type table for a list of which are usable and which are not.
Arguments of methods may only be of certain types due to technical limitations.
See the type table for a list of which are usable and which are not.
All methods which are not `static` have an implicit `self` parameter which refers to this object, although if you wish to refer to a member of `self`, you do not need to reference it directly, as it is already implicitly in scope.
All methods which are not `static` have an implicit `self` parameter which
refers to this object, although if you wish to refer to a member of `self`, you
do not need to reference it directly, as it is already implicitly in scope.
## Method argument list
Method arguments must all have a name and type, and optionally the last arguments in the list may have a default value, (*Version 3.3.0 and newer*) except in functions marked `override`. The syntax is:
Method arguments must all have a name and type, and optionally the last
arguments in the list may have a default value, (*Version 3.3.0 and newer*)
except in functions marked `override`. The syntax is:
```
Type Variable-name $[ , Method-argument-list]$
@ -1112,7 +1341,12 @@ Or, the entire list may simply be `void` or empty.
### Action functions
ZScript includes an extra method type for descendents of `Actor` called *actions*, which are intended to be run from actor states and give extra information to the function. Action functions change the meaning of the `self` parameter and pass in `invoker` and `stateinfo` parameters as well. `stateinfo` refers to the `State` which this action was called from. Here is a chart for the meanings of the `self` and `invoker` variables under each scope:
ZScript includes an extra method type for descendents of `Actor` called
*actions*, which are intended to be run from actor states and give extra
information to the function. Action functions change the meaning of the `self`
parameter and pass in `invoker` and `stateinfo` parameters as well. `stateinfo`
refers to the `State` which this action was called from. Here is a chart for
the meanings of the `self` and `invoker` variables under each scope:
| Scope | `self` meaning | `invoker` meaning |
| ----- | -------------- | ----------------- |

View File

@ -11,9 +11,17 @@
* [Weapons](#weapons)
* [Global Objects](#global-objects)
The ZScript API (Advanced Programming Interface) is vast and has some holes which are hard to explain. Some parts are implemented in ways that don't make sense to user code, but are fine to the engine. Because of this, the API shall be documented in pseudo-ZScript which gives an idea of how it works for the modder rather than for the engine.
The ZScript API (Advanced Programming Interface) is vast and has some holes
which are hard to explain. Some parts are implemented in ways that don't make
sense to user code, but are fine to the engine. Because of this, the API shall
be documented in pseudo-ZScript which gives an idea of how it works for the
modder rather than for the engine.
Note to authors: Capitalization is normalized within this documentation to encourage consistent code, and does not follow ZScript's original capitalization exactly. Similarly, argument names in methods are sometimes renamed. Note well that *arguments with defaults MAY NOT be renamed* as they are part of the API.
Note to authors: Capitalization is normalized within this documentation to
encourage consistent code, and does not follow ZScript's original
capitalization exactly. Similarly, argument names in methods are sometimes
renamed. Note well that *arguments with defaults MAY NOT be renamed* as they
are part of the API.
# Actors
@ -82,7 +90,11 @@ TODO
<!-- toc end -->
For legacy reasons, many intermission-related things may be prefixed with `WI` or `WB`. The abbreviation `WI` means *World Intermission* (the intermission screen was originally called "World Map" by Tom Hall) and `WB` meaning *World Buffer*, as this data was originally buffered into a specific memory address for [statistics drivers](https://doomwiki.org/wiki/Statistics_driver). Author's Note: I am not actually sure if this naming scheme is documented anywhere else, as even source port developers I asked didn't know about it. Feel free to disseminate this information, it was an original research.
For legacy reasons, many intermission-related things may be prefixed with `WI`
or `WB`. The abbreviation `WI` means *World Intermission* (the intermission
screen was originally called "World Map" by Tom Hall) and `WB` meaning *World
Buffer*, as this data was originally buffered into a specific memory address
for [statistics drivers](https://doomwiki.org/wiki/Statistics_driver).
# Level Data
@ -158,7 +170,8 @@ These types are used by global variables.
<!-- toc end -->
These variables are accessible in any context and are not bound by any specific object.
These variables are accessible in any context and are not bound by any specific
object.
<!-- toc global-func -->
@ -171,6 +184,7 @@ These variables are accessible in any context and are not bound by any specific
<!-- toc end -->
These functions are accessible in any context and are not bound by any specific object.
These functions are accessible in any context and are not bound by any specific
object.
<!-- EOF -->

View File

@ -21,27 +21,53 @@ Table of Contents
Entry Points
============
For backwards compatibility reasons and so as to not bloat the ZScript language itself, many interactions with the engine are not defined in ZScript. This section describes all ZScript interactions with the engine, both inside and outside of ZScript itself.
For backwards compatibility reasons and so as to not bloat the ZScript language
itself, many interactions with the engine are not defined in ZScript. This
section describes all ZScript interactions with the engine, both inside and
outside of ZScript itself.
ACS
===
ACS has several functions for interfacing with ZScript: `SetUserVariable` (callfunc `24`,) `GetUserVariable` (callfunc `25`,) `SetUserArray` (callfunc `28`,) `GetUserArray` (callfunc `29`) and `ScriptCall` (callfunc `210`.)
ACS has several functions for interfacing with ZScript: `SetUserVariable`
(callfunc `24`,) `GetUserVariable` (callfunc `25`,) `SetUserArray` (callfunc
`28`,) `GetUserArray` (callfunc `29`) and `ScriptCall` (callfunc `210`.)
`GetUserVariable` may be used to get any `float` or `double` (converted to fixed-point,) `name` or `string` (converted to ACS string,) `bool` (converted to integer,) or integer (of any type including `enum`, converted to a 32-bit signed integer) member of an `Actor`, by TID or by the script activator. The member may be `native`, though it may not be `meta`. If the type is an `array` or fixed-size array, the first element is used.
`GetUserVariable` may be used to get any `float` or `double` (converted to
fixed-point,) `name` or `string` (converted to ACS string,) `bool` (converted
to integer,) or integer (of any type including `enum`, converted to a 32-bit
signed integer) member of an `Actor`, by TID or by the script activator. The
member may be `native`, though it may not be `meta`. If the type is an `array`
or fixed-size array, the first element is used.
`SetUserVariable` follows the same rules as `GetUserVariable`, although `native` variables may not be set. `name` is not handled.
`SetUserVariable` follows the same rules as `GetUserVariable`, although
`native` variables may not be set. `name` is not handled.
`SetUserArray` and `GetUserArray` follow the same rules as `SetUserVariable` and `GetUserVariable`, but the index of an array may be used. The variable does not have to be an array if the index is `0`.
`SetUserArray` and `GetUserArray` follow the same rules as `SetUserVariable`
and `GetUserVariable`, but the index of an array may be used. The variable does
not have to be an array if the index is `0`.
`ScriptCall` may be used to call any `static` function on any class. It cannot call functions on `struct`s. If the first argument of the function is type `Actor`, the activator is passed to this argument (or `null` if there is no activator.) Each argument may be of type `int` (or its aliases,) `color` or `bool` (converted from integer,) `double` (converted from fixed-point,) `name`, `string` or `sound` (converted from ACS string.)
`ScriptCall` may be used to call any `static` function on any class. It cannot
call functions on `struct`s. If the first argument of the function is type
`Actor`, the activator is passed to this argument (or `null` if there is no
activator.) Each argument may be of type `int` (or its aliases,) `color` or
`bool` (converted from integer,) `double` (converted from fixed-point,) `name`,
`string` or `sound` (converted from ACS string.)
The function may have default arguments. The function may return zero or more values, although more than one value will be ignored. The returned value may be `int` (or one of its aliases,) `bool` or `color` (converted to integer,) `double` (converted to fixed-point,) `name`, `sound` or `string` (converted to ACS string.) If it is not one of these types, it will be ignored.
The function may have default arguments. The function may return zero or more
values, although more than one value will be ignored. The returned value may be
`int` (or one of its aliases,) `bool` or `color` (converted to integer,)
`double` (converted to fixed-point,) `name`, `sound` or `string` (converted to
ACS string.) If it is not one of these types, it will be ignored.
Actors
======
Actor classes can be replaced by the `replaces` class flag, which during dynamic actor replacement will choose to spawn this class over its replaced actor, unless the replaced actor is later replaced again by another class. Dynamic actor replacement can also be overridden with an event handler's `CheckReplacement` virtual function.
Actor classes can be replaced by the `replaces` class flag, which during
dynamic actor replacement will choose to spawn this class over its replaced
actor, unless the replaced actor is later replaced again by another class.
Dynamic actor replacement can also be overridden with an event handler's
`CheckReplacement` virtual function.
For example:
@ -53,12 +79,17 @@ class MyOtherActor : Actor replaces OtherActor {} // OtherActor will now be repl
CVARINFO
========
Any CVars declared as a server CVar in `CVARINFO` or by the engine will be accessible as a global variable in ZScript, which has a special type that can be implicitly cast to the type of the CVar. They cannot be set this way, only accessed.
Any CVars declared as a server CVar in `CVARINFO` or by the engine will be
accessible as a global variable in ZScript, which has a special type that can
be implicitly cast to the type of the CVar. They cannot be set this way, only
accessed.
DECALDEF
========
`DECALDEF` can set the decal generator for a specific `Actor` class with the `generator` keyword. An actor can also define its generator and inherited classes' generators with the `Decal` property.
`DECALDEF` can set the decal generator for a specific `Actor` class with the
`generator` keyword. An actor can also define its generator and inherited
classes' generators with the `Decal` property.
DECORATE
========
@ -68,7 +99,8 @@ TODO: lots of things to note here
LOCKDEFS
========
Key and lock groups in `LOCKDEFS` are defined as groups of `Inventory` or `Key` descendants.
Key and lock groups in `LOCKDEFS` are defined as groups of `Inventory` or `Key`
descendants.
GLDEFS
======
@ -83,7 +115,8 @@ TODO: this can be used for custom buttons
MAPINFO
=======
In `MAPINFO`, the `GameInfo` block (referred to as `MAPINFO`/GameInfo in this document) the following properties interact directly with ZScript:
In `MAPINFO`, the `GameInfo` block (referred to as `MAPINFO`/GameInfo in this
document) the following properties interact directly with ZScript:
- `EventHandlers` and `AddEventHandlers` override or add to the list of `StaticEventHandler` or `EventHandler` classes registered by the game (as opposed to event handlers registered per-map.)
- `MessageBoxClass` sets the `MessageBoxMenu` class to use for message boxes used by the engine's GUI.
@ -105,6 +138,7 @@ TODO: this directly uses ZScript classes
TERRAIN
=======
The `SmallSplash`, `SplashBase` and `SplashChunk` properties of `Splash` blocks use `Actor`s.
The `SmallSplash`, `SplashBase` and `SplashChunk` properties of `Splash` blocks
use `Actor`s.
<!-- EOF -->

View File

@ -10,6 +10,7 @@
<!-- toc end -->
Miscallaneous information about ZScript, including code examples and version differences.
Miscallaneous information about ZScript, including code examples and version
differences.
<!-- EOF -->

View File

@ -1,4 +1,5 @@
zscript-doc
===========
This is documentation for the ZScript language. See `zscript-doc-1-language.md` for license information.
This is documentation for the ZScript language. See `zscript-doc-1-language.md`
for license information.

View File

@ -1,6 +1,8 @@
# State
Represents a state on an `Actor` or `StateProvider`. Data in `State` is read-only and is copied as needed to its respective locations for modification, as it is merely a look into the global constant state table.
Represents a state on an `Actor` or `StateProvider`. Data in `State` is
read-only and is copied as needed to its respective locations for modification,
as it is merely a look into the global constant state table.
```
struct State
@ -54,15 +56,19 @@ struct State
- `TicRange`
The maximum amount of tics to add for random tic durations, or `0` if the duration is not random. For example, `TNT1 A random(5, 7)` would have a `Tics` value of `5` and a `TicRange` of `2`.
The maximum amount of tics to add for random tic durations, or `0` if the
duration is not random. For example, `TNT1 A random(5, 7)` would have a
`Tics` value of `5` and a `TicRange` of `2`.
- `UseFlags`
The scope of this state. See *Action Scoping*. Can have any of the `DefaultStateUsage` flags.
The scope of this state. See *Action Scoping*. Can have any of the
`DefaultStateUsage` flags.
- `bCANRAISE`
State has the `CANRAISE` flag, allowing `A_VileChase` to target this actor for healing without entering an infinitely long state.
State has the `CANRAISE` flag, allowing `A_VileChase` to target this actor
for healing without entering an infinitely long state.
- `bDEHACKED`
@ -70,31 +76,38 @@ struct State
- `bFAST`
State has the `FAST` flag, halving the duration when fast monsters is enabled.
State has the `FAST` flag, halving the duration when fast monsters is
enabled.
- `bFULLBRIGHT`
State has the `BRIGHT` flag, making it fully bright regardless of other lighting conditions.
State has the `BRIGHT` flag, making it fully bright regardless of other
lighting conditions.
- `bNODELAY`
State has the `NODELAY` flag, forcing the associated action function to be run if the actor is in its first tic.
State has the `NODELAY` flag, forcing the associated action function to be
run if the actor is in its first tic.
- `bSAMEFRAME`
`true` if the state's frame is to be kept from the last frame used, i.e., is `#`.
`true` if the state's frame is to be kept from the last frame used, i.e., is
`#`.
- `bSLOW`
State has the `SLOW` flag, doubling the duration when slow monsters is enabled.
State has the `SLOW` flag, doubling the duration when slow monsters is
enabled.
- `DistanceTo`
Returns the offset between this state and `other` in the global frame table. Only works if both states are owned by the same actor.
Returns the offset between this state and `other` in the global frame table.
Only works if both states are owned by the same actor.
- `InStateSequence`
Returns `true` if this state is within a contiguous state sequence beginning with `base`.
Returns `true` if this state is within a contiguous state sequence beginning
with `base`.
- `ValidateSpriteFrame`
@ -102,6 +115,8 @@ struct State
- `GetSpriteTexture`
Returns the texture, if the texture should be flipped horizontally, and scaling of this state's sprite. Scaling will return `scale` unless `skin` is nonzero. `skin` determines the player skin used.
Returns the texture, if the texture should be flipped horizontally, and
scaling of this state's sprite. Scaling will return `scale` unless `skin` is
nonzero. `skin` determines the player skin used.
<!-- EOF -->

View File

@ -1,6 +1,7 @@
# Array
While ZScript does not have proper user-facing generics, `Array` is one such type that does have a type parameter. It mirrors the internal `TArray` type.
While ZScript does not have proper user-facing generics, `Array` is one such
type that does have a type parameter. It mirrors the internal `TArray` type.
```
struct Array<Type>
@ -32,7 +33,8 @@ struct Array<Type>
- `Delete`
Deletes `count` object(s) at `index`. Moves objects after them into their place.
Deletes `count` object(s) at `index`. Moves objects after them into their
place.
- `Find`
@ -56,7 +58,8 @@ struct Array<Type>
- `Pop`
Deletes the last item in the array. Returns `false` if there are no items in the array.
Deletes the last item in the array. Returns `false` if there are no items in
the array.
- `Push`
@ -64,11 +67,13 @@ struct Array<Type>
- `Reserve`
Adds `amount` new entries at the end of the array, increasing `Size`. Calls `Grow` if necessary.
Adds `amount` new entries at the end of the array, increasing `Size`. Calls
`Grow` if necessary.
- `Resize`
Changes the allocated array size to `amount`. Deletes members if `amount` is smaller than `Size`.
Changes the allocated array size to `amount`. Deletes members if `amount` is
smaller than `Size`.
- `ShrinkToFit`

View File

@ -1,8 +1,10 @@
# 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`.**
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.
All Get and Set operations will work regardless of the real type of the CVar,
as they aren't "strongly" typed.
```
struct CVar
@ -31,34 +33,41 @@ struct CVar
- `GetCVar`
Returns a user or server CVar by name, with `player` as the user if applicable, or `null` if none is found.
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.
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.
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.
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.
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.
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:
Returns the type of the CVar as it was defined, which may be one of the
following:
| Name |
| ---- |
@ -70,6 +79,7 @@ struct CVar
- `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.
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 -->

View File

@ -1,6 +1,7 @@
# Color
Colors simply store red, green, blue and alpha components. Each component has a range 0 to 255, inclusive.
Colors simply store red, green, blue and alpha components. Each component has a
range 0 to 255, inclusive.
```
struct Color

View File

@ -35,10 +35,15 @@ class Object
- `Destroy`
Destroys this object. Do not use the object after calling this. References to it will be invalidated.
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.
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 -->

View File

@ -48,7 +48,8 @@ struct String
- `Filter`
Replaces escape sequences in a string with escaped characters as a new string.
Replaces escape sequences in a string with escaped characters as a new
string.
- `IndexOf`
@ -80,7 +81,9 @@ struct String
- `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.
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`
@ -88,7 +91,8 @@ struct String
- `ToInt`
Interprets the string as a base `base` integer, guessing the base if it is `0`.
Interprets the string as a base `base` integer, guessing the base if it is
`0`.
- `ToLower`

View File

@ -11,6 +11,10 @@ struct StringTable
- `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.
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 -->

View File

@ -1,12 +1,19 @@
# 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.
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.
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.
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 to authors: These tables are not alphabetically organized as their ordering is meaningful.)
(Note to authors: These tables are not alphabetically organized as their
ordering is meaningful.)
Thinkers which do not think and are elided from many checks:
@ -68,10 +75,12 @@ class Thinker play
- `Tick`
Called every game tick. The order between this thinker's `Tick` and every other thinker in the same statnum is unspecified.
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`.
Roughly converts a number of tics to an integral amount of seconds.
Equivalent to `tics / TICRATE`.
<!-- EOF -->

View File

@ -1,6 +1,7 @@
# Vector2/Vector3
Vectors have builtin methods and `Vector3` in particular has a swizzle operator.
Vectors have builtin methods and `Vector3` in particular has a swizzle
operator.
```
struct Vector2

View File

@ -1,6 +1,7 @@
# BrokenLines
A container representing an array of lines of text that have been broken up to fit the screen and clipping region.
A container representing an array of lines of text that have been broken up to
fit the screen and clipping region.
```
class BrokenLines

View File

@ -17,9 +17,13 @@ struct Console
- `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.
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.
This is the function used internally by ACS' `Print` and `PrintBold`
functions.
- `Printf`

View File

@ -1,6 +1,7 @@
# Font
A font as defined in `FONTDEFS` or a bitmap font file. **Not serializable. Do not use as a member unless marked as `transient`.**
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
@ -53,6 +54,8 @@ struct Font
- `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`.
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 -->

View File

@ -2,7 +2,8 @@
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.
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
@ -33,7 +34,9 @@ struct Screen
- `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`.
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`
@ -45,9 +48,14 @@ struct Screen
- `DrawTexture`
Draws texture `tex`, possibly animated by the animation ticker if `animate` is `true`, at horizontal position `x` and vertical position `y`.
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:
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 |
| ---- | ----------- |
@ -97,23 +105,31 @@ struct Screen
- `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.
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.
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.
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.)
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.)
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`
@ -133,7 +149,10 @@ struct Screen
- `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.
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`
@ -145,10 +164,12 @@ struct Screen
- `GetViewWindow`
Returns the 3D viewing window, which may be smaller than the screen size with any given `screenblocks` setting.
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.
Sets the clipping rectangle to restrict further drawing to the region
starting at `x y` of size `w h` in screen coordinates.
<!-- EOF -->

View File

@ -1,6 +1,7 @@
# TexMan
The **Tex**ture **Man**ager is used for loading, finding, replacing and getting information on textures.
The **Tex**ture **Man**ager is used for loading, finding, replacing and getting
information on textures.
```
struct TexMan
@ -18,7 +19,8 @@ struct TexMan
- `CheckForTexture`
Returns a `textureid` for the texture named `name`. `usetype` may be one of the following, which selects what kind of texture to find:
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 |
| ---- | ----------- |
@ -38,7 +40,8 @@ struct TexMan
| `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 `|`:)
`flags` may be any of the following combined (with the bitwise OR operator
`|`:)
| Name | Description |
| ---- | ----------- |
@ -51,7 +54,9 @@ struct TexMan
- `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.
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`
@ -59,11 +64,13 @@ struct TexMan
- `GetScaledOffset`
Returns the offsets for this texture used to display it (rather than the original offsets.)
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.)
Returns the size used to display this texture (rather than the physical
size.)
- `GetSize`
@ -71,7 +78,8 @@ struct TexMan
- `ReplaceTextures`
Replaces textures named `from` with `to` within the map. `flags` may be used to filter out certain textures from being replaced:
Replaces textures named `from` with `to` within the map. `flags` may be used
to filter out certain textures from being replaced:
| Name | Description |
| ---- | ----------- |
@ -85,6 +93,7 @@ struct TexMan
- `SetCameraToTexture`
Sets the camera texture (as defined in `ANIMDEFS`) `texture` to the viewpoint of `viewpoint` with a fov of `fov`.
Sets the camera texture (as defined in `ANIMDEFS`) `texture` to the
viewpoint of `viewpoint` with a fov of `fov`.
<!-- EOF -->

View File

@ -1,6 +1,8 @@
# 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.)
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

View File

@ -1,8 +1,24 @@
# 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.
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.
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:
@ -32,7 +48,8 @@ In short:
| `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`.
Additionally, `ns_specialzipdirectory` denotes the start of the specialized
resource archive folder namespaces, which are normally under `ns_global`.
```
struct Wads
@ -46,22 +63,35 @@ struct Wads
- `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.
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`.
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`.)
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.
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.
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 -->

View File

@ -20,15 +20,18 @@ struct DEHInfo
- `BlueAC`
Multiple of 100 for `BlueArmor`'s `Armor.SaveAmount`. Default is 2 for 200 armor.
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.
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.
For actors with the `DEHEXPLOSION` flag, the render style to be applied on
explosion.
- `MaxSoulsphere`
@ -36,6 +39,7 @@ struct DEHInfo
- `NoAutofreeze`
Overrides generic freezing deaths if not zero, making all actors act as if they had the `NOICEDEATH` flag.
Overrides generic freezing deaths if not zero, making all actors act as if
they had the `NOICEDEATH` flag.
<!-- EOF -->

View File

@ -1,6 +1,7 @@
# FOptionMenuSettings
Defaults for `OptionMenu`s as defined in `MENUDEF`'s `OptionMenuSettings` block and `MAPINFO`/GameInfo.
Defaults for `OptionMenu`s as defined in `MENUDEF`'s `OptionMenuSettings` block
and `MAPINFO`/GameInfo.
```
struct FOptionMenuSettings

View File

@ -60,19 +60,25 @@ int LocalViewPitch;
- `CleanXFac`
Integral scaling factor for horizontal positions to scale from 320x200 to the current virtual resolution. **Not deterministic.**
Integral scaling factor for horizontal positions to scale from 320x200 to
the current virtual resolution. **Not deterministic.**
- `CleanXFac_1`
Integral scaling factor for horizontal positions to scale from 320x200 to the current virtual resolution, accounting for aspect ratio differences. **Not deterministic.**
Integral scaling factor for horizontal positions to scale from 320x200 to
the current virtual resolution, accounting for aspect ratio differences.
**Not deterministic.**
- `CleanYFac`
Integral scaling factor for vertical positions to scale from 320x200 to the current virtual resolution. **Not deterministic.**
Integral scaling factor for vertical positions to scale from 320x200 to the
current virtual resolution. **Not deterministic.**
- `CleanYFac_1`
Integral scaling factor for vertical positions to scale from 320x200 to the current virtual resolution, accounting for aspect ratio differences. **Not deterministic.**
Integral scaling factor for vertical positions to scale from 320x200 to the
current virtual resolution, accounting for aspect ratio differences. **Not
deterministic.**
- `ConFont`

View File

@ -22,7 +22,8 @@ const SAWRANGE;
- `DEFMELEERANGE`
The range where melee will be used for monsters, and the range for the player's melee attacks.
The range where melee will be used for monsters, and the range for the
player's melee attacks.
- `MISSILERANGE`

View File

@ -26,7 +26,8 @@ readonly Weapon WP_NOCHANGE;
- `PlayerClasses`
An array of all player classes as defined in `MAPINFO`/GameInfo and `KEYCONF`.
An array of all player classes as defined in `MAPINFO`/GameInfo and
`KEYCONF`.
- `PlayerSkins`
@ -46,7 +47,8 @@ readonly Weapon WP_NOCHANGE;
- `OptionMenuSettings`
Defaults for `OptionMenu`s as defined in `MENUDEF`'s `OptionMenuSettings` block and `MAPINFO`/GameInfo.
Defaults for `OptionMenu`s as defined in `MENUDEF`'s `OptionMenuSettings`
block and `MAPINFO`/GameInfo.
- `SkyFlatNum`
@ -54,6 +56,7 @@ readonly Weapon WP_NOCHANGE;
- `WP_NOCHANGE`
A constant denoting that the weapon the player is currently holding shouldn't be switched from.
A constant denoting that the weapon the player is currently holding
shouldn't be switched from.
<!-- EOF -->

View File

@ -9,10 +9,15 @@ Type New(class typename = ThisClass);
- `GetDefaultByType`
Returns an object containing the default values for each member of the `Actor` type provided as they would be set in `BeginPlay`. **Note that the return value cannot be serialized and if stored must be marked as `transient`.** The returned object is a pseudo-object which is stored only in-memory.
Returns an object containing the default values for each member of the
`Actor` type provided as they would be set in `BeginPlay`. **Note that the
return value cannot be serialized and if stored must be marked as
`transient`.** The returned object is a pseudo-object which is stored only
in-memory.
- `New`
Typically spelled lowercase (`new`), creates an object with type `typename`. Defaults to using the class of the calling object.
Typically spelled lowercase (`new`), creates an object with type `typename`.
Defaults to using the class of the calling object.
<!-- EOF -->

View File

@ -57,7 +57,8 @@ vector3, int G_PickPlayerStart(int pnum, int flags = 0);
- `G_PickPlayerStart`
Returns the position and angle of a player start for player `pnum`. `flags` may be:
Returns the position and angle of a player start for player `pnum`. `flags`
may be:
| Name | Description |
| ---- | ----------- |

View File

@ -18,7 +18,8 @@ double VectorAngle(double x, double y);
- `ATan2`
Computes the arctangent of `y / x` using the arguments' signs to determine the correct quadrant.
Computes the arctangent of `y / x` using the arguments' signs to determine
the correct quadrant.
- `BAM`
@ -26,7 +27,8 @@ double VectorAngle(double x, double y);
- `Clamp`
Returns `n` if `n` is more than `minimum` and less than `maximum`, or either of those values if it is not.
Returns `n` if `n` is more than `minimum` and less than `maximum`, or either
of those values if it is not.
- `Max`

View File

@ -1,6 +1,8 @@
# Random Number Generation
All of these functions may have `[identifier]` between the function name and the argument list to specify a named RNG table to use. This special syntax applies only to these functions.
All of these functions may have `[identifier]` between the function name and
the argument list to specify a named RNG table to use. This special syntax
applies only to these functions.
```
double FRandom(double min, double max);
@ -25,7 +27,9 @@ void SetRandomSeed(uint num);
- `Random2`
Returns a random integer value between `-mask` and `mask`. `mask` is used as a bit mask, so it is recommended to use a value of one less than a power of two (i.e. 3, 7, 15, 31, 63, 127, 255...)
Returns a random integer value between `-mask` and `mask`. `mask` is used as
a bit mask, so it is recommended to use a value of one less than a power of
two (i.e. 3, 7, 15, 31, 63, 127, 255...)
- `RandomPick`

View File

@ -18,11 +18,15 @@ void S_Sound(sound id, int channel, float volume = 1, float attenuation = ATTN_
- `SetMusicVolume`
Sets the volume of the music relative to the user's volume. Range is 0-1, inclusive.
Sets the volume of the music relative to the user's volume. Range is 0-1,
inclusive.
- `S_ChangeMusic`
Changes the music to `name`. If `name` is `"*"`, the music will be set to the default music for this level. Will loop if `looping` is `true`. `force` will force the music to play even if a playlist (from the `playlist` console command) is playing.
Changes the music to `name`. If `name` is `"*"`, the music will be set to
the default music for this level. Will loop if `looping` is `true`. `force`
will force the music to play even if a playlist (from the `playlist` console
command) is playing.
`order` may mean something different based on the music format:
@ -34,11 +38,13 @@ void S_Sound(sound id, int channel, float volume = 1, float attenuation = ATTN_
- `S_GetLength`
Returns the length of a sound in seconds. **Potentially non-deterministic if all users in a networked game are not using the same sounds.**
Returns the length of a sound in seconds. **Potentially non-deterministic if
all users in a networked game are not using the same sounds.**
- `S_PauseSound`
Pauses music if `notmusic` is `false` and all game sounds if `notsfx` is `false`. Used for instance in the time stop power-up.
Pauses music if `notmusic` is `false` and all game sounds if `notsfx` is
`false`. Used for instance in the time stop power-up.
- `S_ResumeSound`
@ -46,7 +52,8 @@ void S_Sound(sound id, int channel, float volume = 1, float attenuation = ATTN_
- `S_Sound`
Plays a sound (as defined in `SNDINFO`) from the calling object if it has world presence (is an actor or sector etc.)
Plays a sound (as defined in `SNDINFO`) from the calling object if it has
world presence (is an actor or sector etc.)
`channel` may be:
@ -61,7 +68,8 @@ void S_Sound(sound id, int channel, float volume = 1, float attenuation = ATTN_
| `CHAN_6` | Extra sound channel. |
| `CHAN_7` | Extra sound channel. |
`channel` may also have the following flags applied with the binary OR operator `|`:
`channel` may also have the following flags applied with the binary OR
operator `|`:
| Name | Description |
| ---- | ----------- |
@ -74,7 +82,8 @@ void S_Sound(sound id, int channel, float volume = 1, float attenuation = ATTN_
Additionally, `CHAN_PICKUP` is equivalent to `CHAN_ITEM | CHAN_MAYBE_LOCAL`.
`attenuation` determines the drop-off distance of the sound. The higher the value, the quicker it fades. Constants include:
`attenuation` determines the drop-off distance of the sound. The higher the
value, the quicker it fades. Constants include:
| Name | Value | Description |
| ---- | ----- | ----------- |

View File

@ -27,6 +27,9 @@ struct PatchInfo play
- `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`.)
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 -->

View File

@ -1,6 +1,7 @@
# StatusScreen
The base class for intermission status screens. Any status screen used by `MAPINFO`/GameInfo must be derived from this class.
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:
@ -128,15 +129,18 @@ class StatusScreen abstract play
- `TITLEY`
The Y position (in 320x200 pixels) to draw the top of the "finished" and "entering" texts. Used by `DrawEL` and `DrawLF`.
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.
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`.
The value of `WBS.Plyr` when `Start` was called. Usually not changed, so
essentially equivalent to `WBS.Plyr`.
- `WBS`
@ -144,7 +148,8 @@ class StatusScreen abstract play
- `AccelerateStage`
Used to signify to the current stage that it should go quicker or be skipped entirely.
Used to signify to the current stage that it should go quicker or be skipped
entirely.
- `BCnt`
@ -200,7 +205,8 @@ class StatusScreen abstract play
- `Me`
The value of `WBS.PNum` when `Start` was called. Usually not changed, so essentially equivalent to `WBS.PNum`.
The value of `WBS.PNum` when `Start` was called. Usually not changed, so
essentially equivalent to `WBS.PNum`.
- `NG_State`
@ -212,7 +218,8 @@ class StatusScreen abstract play
- `PlayerReady`
Used in networked games to signify when each player is ready to continue to the next map. Set by `CheckForAccelerate`.
Used in networked games to signify when each player is ready to continue to
the next map. Set by `CheckForAccelerate`.
- `Player_Deaths`
@ -224,7 +231,8 @@ class StatusScreen abstract play
- `SP_State`
Used in single-player status screens during the `StatCount` stage for indicating the current round of statistics to count up.
Used in single-player status screens during the `StatCount` stage for
indicating the current round of statistics to count up.
- `ShadowAlpha`
@ -320,15 +328,20 @@ class StatusScreen abstract play
- `Drawer`
Called by `WI_Drawer`, which is called every frame when `GameState` is `GS_INTERMISSION`.
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.
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`.
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`
@ -336,7 +349,8 @@ class StatusScreen abstract play
- `Ticker`
Called by `WI_Ticker`, which is called every game tick when `GameState` is `GS_INTERMISSION`.
Called by `WI_Ticker`, which is called every game tick when `GameState` is
`GS_INTERMISSION`.
- `DrawNoState`
@ -344,11 +358,13 @@ class StatusScreen abstract play
- `DrawShowNextLoc`
Called by `Drawer` when `CurState` is `ShowNextLoc` and, by default, `DrawNoState` after setting `SNL_PointerOn` to `true`.
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`.
Called by `Drawer` directly after drawing the animated background when
`CurState` is `StatCount`.
- `InitNoState`
@ -364,23 +380,32 @@ class StatusScreen abstract play
- `UpdateNoState`
Called by `Ticker` when `CurState` is `NoState` or any other non-state. Exits the intermission by calling `End` and `Level.WorldDone` when appropriate.
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`.
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.
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.
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.
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`

View File

@ -29,7 +29,8 @@ struct WBPlayerStruct
- `STime`
The time this player finished the level at, in ticks. (This is the same for all players.)
The time this player finished the level at, in ticks. (This is the same for
all players.)
- `FragCount`

View File

@ -14,7 +14,8 @@ struct FColorMap
- `BlendFactor`
TODO: "This is for handling Legacy-style color maps which use a different formula to calculate how the color affects lighting."
TODO: "This is for handling Legacy-style color maps which use a different
formula to calculate how the color affects lighting."
- `Desaturation`

View File

@ -62,7 +62,8 @@ struct Line play
- `Sidedef`
The front and back sides of this line, 0 and 1 respectively. The aliases `Line.Front` and `Line.Back` are provided as well.
The front and back sides of this line, 0 and 1 respectively. The aliases
`Line.Front` and `Line.Back` are provided as well.
- `PortalIndex`

View File

@ -17,6 +17,7 @@ class LineIdIterator
- `Next`
Returns the index of the current line and advances the iterator. Returns -1 when the list is exhausted.
Returns the index of the current line and advances the iterator. Returns
`-1` when the list is exhausted.
<!-- EOF -->

View File

@ -1,6 +1,8 @@
# 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.
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:
@ -84,7 +86,8 @@ struct Side play
- `Light`
The light level of this side. Relative to the sector lighting unless `WALLF_ABSLIGHTING`.
The light level of this side. Relative to the sector lighting unless
`WALLF_ABSLIGHTING`.
- `Index`

View File

@ -17,7 +17,8 @@ struct PlayerClass
- `Flags`
Not currently implemented correctly, `PCF_NOMENU` does not exist in ZScript, but its value is `1` if you need to check for that.
Not currently implemented correctly, `PCF_NOMENU` does not exist in ZScript,
but its value is `1` if you need to check for that.
- `Skins`

View File

@ -43,15 +43,18 @@ struct PlayerSkin
- `OtherGame`
The player skin is made for another game and needs to be color remapped differently.
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.
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.
The beginning index of the translation range to be used for changing the
player sprite's color.
- `Scale`

View File

@ -1,6 +1,9 @@
# 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.
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:
@ -102,7 +105,8 @@ class PSprite play
- `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`.
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`

View File

@ -1,6 +1,7 @@
# Classes
Here is a full tree of all classes in ZScript as of GZDoom 3.7.0. There are 1456 classes total.
Here is a full tree of all classes in ZScript as of GZDoom 3.7.0. There are
1456 classes total.
```
Object

View File

@ -11,7 +11,10 @@ TODO
## Action Scoping
On classes derived from Actor, states and methods can be scoped to a certain subset of uses. This is mainly to differentiate actions which take place in inventory items and weapons, and actions which take place in the actual game map, for disambiguating the `self` pointer usage. The available scopes are:
On classes derived from Actor, states and methods can be scoped to a certain
subset of uses. This is mainly to differentiate actions which take place in
inventory items and weapons, and actions which take place in the actual game
map, for disambiguating the `self` pointer usage. The available scopes are:
| Name | Description |
| ---- | ----------- |
@ -20,7 +23,8 @@ On classes derived from Actor, states and methods can be scoped to a certain sub
| `overlay` | Actions are called from a weapon overlay. |
| `weapon` | Actions are called from a weapon. |
These can be defined either in the `states` block header as-is, or in `Actor`'s `DefaultStateUsage` property with the following bit flags:
These can be defined either in the `states` block header as-is, or in `Actor`'s
`DefaultStateUsage` property with the following bit flags:
| Name | Scope |
| ---- | ----- |
@ -31,9 +35,19 @@ These can be defined either in the `states` block header as-is, or in `Actor`'s
## Object Scoping
Most objects are subject to object scoping, which restricts the way data can be used in certain contexts. This is to ensure that the game simulation does not get changed by the UI, for instance, or that the game simulation doesn't read from the UI and break network synchronization. In other words, it is to prevent a multitude of errors that arise when data is modified or read from the wrong places.
Most objects are subject to object scoping, which restricts the way data can be
used in certain contexts. This is to ensure that the game simulation does not
get changed by the UI, for instance, or that the game simulation doesn't read
from the UI and break network synchronization. In other words, it is to prevent
a multitude of errors that arise when data is modified or read from the wrong
places.
There are three scopes in ZScript: Play, UI, and Data (also known as "`clearscope`.") The Play scope is used for objects that are part of the game simulation and interact with the world in some way or another, while the UI scope is for objects that have no correlation with the world besides perhaps reading information from it. The Data scope is shared between the two, and must be used carefully.
There are three scopes in ZScript: Play, UI, and Data (also known as
"`clearscope`.") The Play scope is used for objects that are part of the game
simulation and interact with the world in some way or another, while the UI
scope is for objects that have no correlation with the world besides perhaps
reading information from it. The Data scope is shared between the two, and must
be used carefully.
Here is a chart of data access possibilities for each scope:
@ -45,7 +59,11 @@ Here is a chart of data access possibilities for each scope:
## Format String
A format string is a string that specifies the format of a conversion from arbitrary data to a contiguous character string. A format string contains normal characters and *conversion specifiers*. See [this page](https://en.cppreference.com/w/c/io/fprintf) for more information. Differences between C's `printf` and ZScript formats include:
A format string is a string that specifies the format of a conversion from
arbitrary data to a contiguous character string. A format string contains
normal characters and *conversion specifiers*. See [this
page](https://en.cppreference.com/w/c/io/fprintf) for more information.
Differences between C's `printf` and ZScript formats include:
- Since there's no `char` type, `int` is used for `%c`.
- `%s` also works for `name`.
@ -55,27 +73,42 @@ A format string is a string that specifies the format of a conversion from arbit
## Sprite
A sprite is stored in two numbers: the *sprite ID* (represented by the `spriteid` type or sometimes `int`) and the *sprite frame* (represented by an `int` or `uint8` usually.) The rotation is generally irrelevant as only the `0` (front rotation) frame is used in most contexts. The sprite frame is, unlike the file and state block representations, not a character, but an integer. The number `0` for instance represents the letter `A`, `1` to `B`, etc.
A sprite is stored in two numbers: the *sprite ID* (represented by the
`spriteid` type or sometimes `int`) and the *sprite frame* (represented by an
`int` or `uint8` usually.) The rotation is generally irrelevant as only the `0`
(front rotation) frame is used in most contexts. The sprite frame is, unlike
the file and state block representations, not a character, but an integer. The
number `0` for instance represents the letter `A`, `1` to `B`, etc.
For more information on sprites and rotations, please refer to [the relevant Doom Wiki article](https://doomwiki.org/wiki/Sprite).
For more information on sprites and rotations, please refer to [the relevant
Doom Wiki article](https://doomwiki.org/wiki/Sprite).
## Game Tick
The Doom engine, as long as it has existed and into every faithful-enough port of it, no matter how different from the source material, runs the game simulation in the same way:
The Doom engine, as long as it has existed and into every faithful-enough port
of it, no matter how different from the source material, runs the game
simulation in the same way:
- Input events are processed.
Keyboard, mouse, gamepad, etc. if a local player, the demo file if watching a demo, packets over the internet in networked games.
Keyboard, mouse, gamepad, etc. if a local player, the demo file if watching
a demo, packets over the internet in networked games.
- The game is *ticked*.
Every 1/35th of a second that passes, a new "game tick" takes place, also referred to as *gametic*, *tick* or simply *tic*.
Every 1/35th of a second that passes, a new "game tick" takes place, also
referred to as *gametic*, *tick* or simply *tic*.
- The game is rendered.
All information from the *current* game tick is rendered. This usually happens more often than the game is actually ticked. In ZDoom, Eternity Engine, and some other ports, the information is interpolated between the last and current game tick when there is extra time available to give smoother rendering.
All information from the *current* game tick is rendered. This usually
happens more often than the game is actually ticked. In ZDoom, Eternity
Engine, and some other ports, the information is interpolated between the
last and current game tick when there is extra time available to give
smoother rendering.
For more information on ticks, please refer to [the relevant Doom Wiki article](https://doomwiki.org/wiki/Tic).
For more information on ticks, please refer to [the relevant Doom Wiki
article](https://doomwiki.org/wiki/Tic).
## Interpolation

View File

@ -1,6 +1,8 @@
# Structures
Here is a full list of all structures in ZScript as of GZDoom 3.7.0. There are 74 structures total. Note that some of these are merely implementation details and should not be used in code.
Here is a full list of all structures in ZScript as of GZDoom 3.7.0. There are
74 structures total. Note that some of these are merely implementation details
and should not be used in code.
```
Struct

View File

@ -15,7 +15,8 @@ f = open "glossary-classes.md", "wb"
f.puts <<_end_
# Classes
Here is a full tree of all classes in ZScript as of GZDoom #{VER}. There are #{si.classes.count + 1} classes total.
Here is a full tree of all classes in ZScript as of GZDoom #{VER}. There are
#{si.classes.count + 1} classes total.
```
Object
@ -33,7 +34,9 @@ f = open "glossary-structures.md", "wb"
f.puts <<_end_
# Structures
Here is a full list of all structures in ZScript as of GZDoom #{VER}. There are #{si.structs.count} structures total. Note that some of these are merely implementation details and should not be used in code.
Here is a full list of all structures in ZScript as of GZDoom #{VER}. There are
#{si.structs.count} structures total. Note that some of these are merely
implementation details and should not be used in code.
```
Struct