Thing

From SRB2 Wiki
Jump to: navigation, search
For Objects, which are sometimes mislabeled as Things, see Object.
A section of a map with a Thing highlighted.

A Thing is a map component that is used to spawn an Object when the map is loaded. Examples include spawn points for players, enemies, rings, monitors and scenery items.

Things are closely related to Objects, but they are not the same. Most Thing types correspond directly to an Object type. For example, a Thing of the type "Crawla" will spawn an Object of the type "Crawla". However, some types of Objects cannot be placed directly on a map via a Thing, such as missiles or shields. Similarly, some Thing types are not directly linked to an Object type. For example, special placement patterns such as the Circle of Rings spawn a group of Objects in a predetermined arrangement rather than just a single Object.

Specification

The Things of a map are stored in the THINGS lump as a list. Each Thing has a 10-byte entry consisting of the following:

Bytes Data type Description
0–1 Signed 16-bit integer X position
2–3 Signed 16-bit integer Y position
4–5 Signed 16-bit integer Angle
6–7 Unsigned 16-bit integer Lower 12 bits: Type
Upper 4 bits: Parameter
8–9 Signed 16-bit integer Lower 4 bits: Flags
Upper 12 bits: Z position

Thing properties

Thing type

For a list of Thing types, see Thing types.
Zone Builder's Thing properties window. Click to enlarge.

This determines the Thing's type, ranging from 0 to 4095. In map editors such as Zone Builder, SRB2 Doom Builder and SRB2 Workbench, the Thing types are separated into different categories by a drop-down list, which makes the Thing placement process easier.

In Zone Builder and SRB2 Doom Builder, additional properties for a Thing type will be displayed when selected in the Thing properties window. These are determined by the configuration file loaded for the editor.

X/Y position

These are the absolute X and Y map coordinates the Thing is located at, measured in fracunits. These can be any value from -32768 to 32767. These properties are normally set when a Thing is first placed in the map or dragged around after being placed; however, in Zone Builder and SRB2 Workbench, they can also be changed manually through the Thing properties window.

Z position

For most Thing types, this property is the Z-offset that determines how far up from the floor – or how far down from the ceiling – the Thing is placed, measured in fracunits. For most Thing types, the Z-offset is measured from the floor up by default, but for Thing types that hang from the ceiling by default, such as the Chain, it is measured from the ceiling down. If the Thing's Flip flag is checked, this behavior is inverted – if the offset is usually measured from the floor up, it is now measured from the ceiling down, and vice versa. The Z position can be any value from 0 to 4095. Thing types that do not use this property directly for determining the Thing's Z-offset (or at all) include the Axis, Axis Transfer, Axis Transfer Line, and the non-customizable Hoop.

Map editors such as Zone Builder, SRB2 Doom Builder and SRB2 Workbench also provide an Absolute option – when the box for this is checked, the Thing's absolute Z position from 0 is determined instead. The map editor will then calculate the required relative Z position automatically, which will be displayed when the Thing properties window is next opened.

Because Doom did not originally support Z-offsets for Things, there is no dedicated Z position field in the map format. SRB2 works around this by assigning the lower 12 bits of the 16-bit Flags value to the Z position. As a result, only 4 bits are left for the actual flags, so SRB2 only allows for 4 Thing flags. Map editors that are not specifically adapted for SRB2 will not display a field for the Z position. In these editors, the Z position must be set via the Flags value instead; see below for details.

Angle

For most Thing types, this property controls the direction the Thing is facing. This is measured relative to the east in a counterclockwise fashion, so 0º is north, 90º is east, 180º is south, and 270º is west. Some Thing types (e.g., the Star Post) use this property for additional effects; in these cases it can have any value and might even exceed 360º. Any value within a range of -32768 to 32767 can be used here.

Parameter

This is a special value ranging from 0 to 15 that can determine extra properties for a Thing. Notable Thing types that use this property include various NiGHTS items as well as the Fan Particle Generator and Flame Jets.

The Parameter value is not part of Doom's original map format and was added specifically for SRB2. Internally, it is stored in the upper 4 bits of the Thing's Type value. As a result, the actual Thing type is restricted to 12 bits in SRB2 and may therefore only range from 0 and 4095 – unlike Doom where it could range from 0 to 65535. Because the Parameter value is SRB2-specific, only map editors that are adapted specifically for SRB2, such as Zone Builder and SRB2 Workbench, provide a field for it. In other map editors, such as the original Doom Builder and SRB2 Doom Builder, it must be set via the Type field – the Parameter value must be multiplied by 4096 and then added to the Thing type number, e.g. ,the Blue Crawla (Thing type 100) with a parameter value of 2 would have a Thing type number of 100 + 2×4096, or 8292.

Flags

These are a series of toggles that may be applied to a Thing to change how the Object spawned behaves in-game – outside the context of level editing, these are referred to as Thing flags to differentiate them from Object flags. Some Thing types (e.g., the NiGHTS Bumper) do not consider the flags individually and instead require combinations of these flags for certain effects; in these cases, the individual effects of these flags may or may not apply.

In map editors such as Zone Builder, SRB2 Doom Builder and SRB2 Workbench, the flags are displayed as a list of checkboxes that can be checked. The mathematical total of the corresponding values for the selected flags is given in the Flags value box below the flags list. Note that this value also contains the Thing's Z position, multiplied by 16 – the resulting Flags value is calculated as: Thing flags + Z position×16. This is because SRB2 uses the upper 12 bits of the Flags field to store the Z position.

The flags and their purposes are given below:

Value Editor name Internal name Description
1 Extra none This flag is currently unused except by Thing types that use the flags value as a whole.
2 Flip MTF_OBJECTFLIP This flag inverts the Thing's gravity direction, and also inverts whether the Thing's Z position is measured from the floor or ceiling. For instance, power-up monitors will be flipped upside-down and laid on the ceiling instead of the floor, while Things that hang from the ceiling by default (e.g., chains) will be flipped upside-down but laid on the floor instead of the ceiling.

In most cases, this flag will also give the corresponding Object(s) the secondary Object flag MF2_OBJECTFLIP when checked. Exceptions to this include the following Thing types:

4 Special MTF_OBJECTSPECIAL This is a special flag that has no general effect but is rather used by certain Thing types for turning on extra features or alternative behavior.
8 Ambush MTF_AMBUSH This is a special flag that has no general effect but is rather used by certain Thing types for turning on extra features or alternative behavior.

In most cases, this flag will also give the corresponding Object(s) the Object flag MF_AMBUSH when checked. Exceptions to this include the following Thing types:

A flag named (Used for Z offsets) may also be displayed in some map editors below the flags listed above – this flag is reserved for calculating the Thing's Z-offset and should never be checked manually.

In some editors, the names of certain flags may change depending on the current Thing type. For example, the Ambush flag is renamed to Float for rings because it makes them hover 24 fracunits above the ground. For most power-up monitors, it is renamed to Random (Weak) because it makes them respawn randomly in a WRM fashion in multiplayer. Zone Builder supports renaming for all flags, SRB2 Workbench for the Special flag and the Ambush flag, and SRB2 Doom Builder only for the Ambush flag.

See also

  Map components [view]

ThingLinedefSidedefVertexNodeSectorRejectBlockmap