User:Monster Iestyn/Source Code Documentation/doomdata.h

From SRB2 Wiki
Jump to navigation Jump to search
Online link GitHub entry
File type C header file
#include guard __DOOMDATA__

This header declares structures and macros for handling data from map lumps. At level load, most of the data is then loaded into different structures for run-time usage (see r_defs.h). Also included are externs of arrays relating to skin colors.

Includes

Externs

Data name Data type Non-extern location(s) Description
*Color_Names[MAXSKINCOLORS] const char r_draw.c The array containing all skin color name strings.
Color_Opposite[MAXSKINCOLORS*2] const UINT8 r_draw.c The array containing all "opposite" colors for each skin color and the corresponding frame increments for the Level End Sign's background.

Enumerations

Map lump types

See also: Map#Data structure

These integer constants determine the order in which the lumps that make up a single map are assumed to be placed within a WAD. When the map is being loaded in-game, these macros can then act as offsets from the map's label lump number, allowing the lump numbers for the rest of the map's lumps to be obtained.

Value Name Description
0 ML_LABEL The MAPxx lump.
1 ML_THINGS The THINGS lump.
2 ML_LINEDEFS The LINEDEFS lump.
3 ML_SIDEDEFS The SIDEDEFS lump.
4 ML_VERTEXES The VERTEXES lump.
5 ML_SEGS The SEGS lump.
6 ML_SSECTORS The SSECTORS lump.
7 ML_NODES The NODES lump.
8 ML_SECTORS The SECTORS lump.
9 ML_REJECT The REJECT lump.
10 ML_BLOCKMAP The BLOCKMAP lump.

Macros

Map thing flags

See also: Thing#Flags

Note: the Extra flag does not have a corresponding macro.

Macro Defined as Description
MTF_OBJECTFLIP 2 Flip
MTF_OBJECTSPECIAL 4 Special
MTF_AMBUSH 8 Ambush

Linedef flags

See also: Linedef#Flags
Macro Defined as Description
ML_IMPASSIBLE 1 Impassable
ML_BLOCKMONSTERS 2 Block Enemies
ML_TWOSIDED 4 Double-Sided
ML_DONTPEGTOP 8 Upper Unpegged
ML_DONTPEGBOTTOM 16 Lower Unpegged
ML_EFFECT1 32 Slope Skew
ML_NOCLIMB 64 Not Climbable
ML_EFFECT2 128 No Midtexture Skew
ML_EFFECT3 256 Peg Midtexture
ML_EFFECT4 512 Solid Midtexture
ML_EFFECT5 1024 Repeat Midtexture
ML_NOSONIC 2048 No Sonic
ML_NOTAILS 4096 No Tails
ML_NOKNUX 8192 No Knuckles
ML_NETONLY 14336 No Sonic + No Tails + No Knuckles
ML_BOUNCY 16384 Bouncy Wall
ML_TFERLINE 32768 Transfer Line

Node flags

Macro Defined as Description
NF_SUBSECTOR 0x8000 (32768) This node is a subsector (or leaf).

Miscellaneous

Macro Defined as Description
ZSHIFT 4 Bits to shift a Thing's z-offsets up by.
NUMMAPS 1035 Number of map slots available in SRB2.

Typedefs

Name Type Unpadded size (bytes) Attributes Description
mapvertex_t struct 4 ATTRPACK The data structure for a single vertex as obtained from the VERTEXES lump. Not to be confused with vertex_t, which is defined in r_defs.h
mapsidedef_t struct 30 ATTRPACK The data structure for a single sidedef as obtained from the SIDEDEFS lump. Not to be confused with side_t, which is defined in r_defs.h
maplinedef_t struct 14 ATTRPACK The data structure for a single linedef as obtained from the LINEDEFS lump. Not to be confused with line_t, which is defined in r_defs.h
mapsector_t struct 26 ATTRPACK The data structure for a single sector as obtained from the SECTORS lump. Not to be confused with sector_t, which is defined in r_defs.h
mapsubsector_t struct 4 ATTRPACK The data structure for a single subsector as obtained from the SSECTORS lump. Not to be confused with subsector_t, which is defined in r_defs.h
mapseg_t struct 12 ATTRPACK The data structure for a single seg as obtained from the SEGS lump. Not to be confused with seg_t, which is defined in r_defs.h
mapnode_t struct 24 ATTRPACK The data structure for a single node as obtained from the NODES lump. Not to be confused with node_t, which is defined in r_defs.h
mapthing_t struct 17 The data structure for a Thing. Unlike the other structs for map data in this file, this one is not directly the structure of a Thing entry as found in the THINGS lump (which have a size of 10 bytes each).

Structs

mapvertex_t

Data name Data type Description
x
y
INT16 The vertex's X and Y coordinates.

mapsidedef_t

Data name Data type Description
textureoffset
rowoffset
INT16 The sidedef's X and Y texture offsets.
toptexture[8]
bottomtexture[8]
midtexture[8]
char The sidedef's top, bottom and middle texture names as 8-character strings.
sector INT16 The sector number of the sidedef's sector.

maplinedef_t

Data name Data type Description
v1
v2
INT16 The vertex numbers of the linedef's vertexes.
flags INT16 The linedef's flags.
special INT16 The linedef's linedef type number.
tag INT16 The linedef's tag number.
sidenum[2] UINT16 An array containing the sidedef numbers for the linedef's sidedefs. sidenum[0] is the front sidedef number, sidenum[1] is the back sidedef number; if sidenum[1] has a value of 0xFFFF, this means the linedef does not have a back sidedef (i.e. the linedef is one-sided).

mapsector_t

Data name Data type Description
floorheight INT16 The sector's floor height.
ceilingheight INT16 The sector's ceiling height.
floorpic[8] char The name of the sector's floor flat as an 8-character string.
ceilingpic[8] char The name of the sector's ceiling flat as an 8-character string.
lightlevel INT16 The sector's light level (a value between 0 and 255)
special INT16 The sector's sector type number.
tag INT16 The sector's tag number.

mapsubsector_t

Data name Data type Description
numsegs UINT16 The number of segs attached to the subsector.
firstseg UINT16 The seg number of the first seg attached to the subsector.

mapseg_t

Data name Data type Description
v1
v2
INT16 The vertex numbers of the seg's vertexes.
angle INT16 The seg's angle, as a value between 0 and 65535.
linedef INT16 The linedef number of the seg's linedef.
side INT16 The side of the seg's linedef the seg runs along; can be 0 (the front) or 1 (the back).
offset INT16 The offset distance along the seg's linedef to the start of the seg.

mapnode_t

Data name Data type Description
x
y
INT16 Partition line X and Y coordinates.
dx
dy
INT16 Change in X and Y to end of partition line.
bbox[2][4] INT16 The node's bounding boxes array: bbox[0] is the right bounding box, bbox[1] is the left bounding box.

Each bounding box consists of four UINT8 values marking the bounds of the X and Y coordinates; in order, these are: top, bottom, left and right.

children[2] UINT16 The node's child nodes array: children[0] is the right child node, children[1] is the left child node.

The type of each child is determined by the NF_SUBSECTOR flag (or bit 15). If this flag/bit is set, bits 0-14 of the entry give the number of a subsector; otherwise, they give the node number of a subnode.

mapthing_t

Data name Data type Description
x
y
INT16 The X and Y coordinates of the Thing.
angle INT16 The angle of the Thing, meaured in degrees (0 is East, 90 is North, 180 is West, 270 is South). This is normally expected to be a value between 0 and 359, but can be set to any value in practice (including negative values) for extra behaviour.
type UINT16 The Thing's Thing type number (a value between 1 and 4095).
options UINT16 The Thing's flags and Z position combined; bits 0-3 are the Thing's flags, bits 4-15 are the Thing's Z position shifted up by ZSHIFT (4 bits).
z INT16 An extra value reserved for storing the Thing's actual Z position; used by some, but not all, Thing types.
extrainfo UINT8 The Thing's extra parameter, stored in the map editor as the upper 4 bits of the Thing type number.
*mobj mobj_t The Thing's mobj; this is set only after the mobj itself has been spawned in-game while the map is being loaded. For Special placement pattern Thing types, or Thing types that are not meant to spawn anything in the current gametype or game mode, this will remain NULL.