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

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
Online link GitHub entry
File type C header file
#include guard __R_DEFS__

Includes

  • m_fixed.h
  • d_think.h
  • p_mobj.h
  • screen.h
  • m_aatree.h (only included if HWRENDER is defined)
  • p_polyobj.h (only included if POLYOBJECTS is defined)

Macros

Macro Defined as Description
POLYOBJECTS 1 (Enabled) Enables/disables all PolyObject code.
SIL_NONE 0 The drawseg does not clip sprites vertically.
SIL_BOTTOM 1 The drawseg clips the bottom of sprites partially below bsilheight.
SIL_TOP 2 The drawseg clips the top of sprites partially above tsilheight.
SIL_BOTH 3 The drawseg can clip both top and bottom of sprites, combines the effects of SIL_BOTTOM and SIL_TOP.
MAXFFLOORS 40 Defined here only if MAXFFLOORS is not already defined
HORIZONSPECIAL 41

Typedefs

Name Type Attributes Description
cliprange_t struct The structure of a wall clip range. Used to store a range of columns taken up by a solid wall segment being rendered, so that any wall segments rendered afterwards are clipped to prevent them being drawn in the same columns.

(See R_ClipSolidWallSegment and R_ClipPassWallSegment in r_bsp.c, or their OpenGL equivalents in hardware/hw_main.c)

lighttable_t UINT8 The type of an element in a "light table", also sometimes known as a colormap.
extracolormap_t
struct extracolormap_s
struct The structure of a colormap created by R_CreateColormap.
vertex_t struct The structure of a map vertex.
degenmobj_t struct A "degenerate" version of mobj_t, storing only a location. Used for sound origins in sectors and similar purposes.
ffloortype_e enum FOF flags.
ffloor_t
struct ffloor_s
struct The structure of an FOF. (Also known as a fake floor, or a 3D block)
lightlist_t
struct lightlist_s
struct The structure of a shadow cast by an FOF. Stored in a sector's lightlist.
r_lightlist_t
struct r_lightlist_s
struct The structure of a shadow cast on a wall by an FOF. Used for rendering walls, and is stored in a seg's rlights.
linechain_t
struct linechain_s
struct A structure of an element in a line chain. Used for OpenGL's "Software tricks".

(See hardware/hw_trick.c)

slopeflags_t enum This type is declared only if ESLOPE is defined

Slope flags.

pslope_t
struct pslope_s
struct This type is declared only if ESLOPE is defined

The structure of a slope.

sectorflags_t enum Sector flags.
sector_t
struct sector_s
struct The structure of a sector.
slopetype_t enum Linedef gradient or slope types. (Related to linedef direction, not slopes for planes)
line_t
struct line_s
struct The structure of a linedef.
side_t struct The structure of a sidedef.
subsector_t
struct subsector_s
struct The structure of a subsector.
msecnode_t
struct msecnode_s
struct The structure of a sector list node. Used for storing all objects touching a sector, or vice versa.
mprecipsecnode_t
struct mprecipsecnode_s
struct The structure of a sector list node, for precipitation. Used for storing all precipitation objects touching a sector, or vice versa.
light_t
struct light_s
struct
lightmap_t
struct lightmap_s
struct
seg_t
struct seg_s
struct The structure of a line segment, or seg.
node_t struct The structure of a BSP node.
post_t struct ATTRPACK The structure of a post in a patch column.
column_t post_t The structure of a column in a patch.
drawseg_t
struct drawseg_s
struct The structure of a drawn wall segment.
pic_mode_t enum
patch_t struct ATTRPACK The structure of a patch.
pic_t struct ATTRPACK
rotsprite_t struct This type is declared only if ROTSPRITE is defined
spriterotateflags_t enum
spriteframe_t struct The structure of a sprite frame.
spritedef_t struct The structure of a sprite definition.

Structs

cliprange_t

Data name Data type Description
first INT32
last INT32

extracolormap_t

Data name Data type Description
fadestart
fadeend
UINT16 The Software light levels at which the colormap's fade to the fade color starts and ends, used for Software rendering. These should always have values between 0 and 33.
fog UINT8 If non-zero, this enables fog block-like lighting for planes of a translucent FOF with this colormap; this enables the ability to have their light levels controlled by their FOF's control sector. If zero, the default value, the planes of such an FOF will always be rendered at full brightness.
rgba INT32 The combined RGBA value of the colormap's main color and alpha.
fadergba INT32 The combined RGBA value of the colormap's fade color and alpha.
*colormap lighttable_t The colormap's light table, for Software rendering.
lump lumpnum_t This member is declared only if EXTRACOLORMAPLUMP is defined
lumpname[9] char This member is declared only if EXTRACOLORMAPLUMP is defined
*next struct extracolormap_s
*prev struct extracolormap_s

vertex_t

Data name Data type Description
x
y
z
fixed_t

degenmobj_t

Data name Data type Description
thinker thinker_t
x fixed_t
y fixed_t
z fixed_t

ffloor_t

Data name Data type Description
*topheight fixed_t
*toppic INT32
*toplightlevel INT16
*topxoffs fixed_t
*topyoffs fixed_t
*topangle angle_t
*bottomheight fixed_t
*bottompic INT32
*bottomxoffs fixed_t
*bottomyoffs fixed_t
*bottomangle angle_t
**t_slope struct pslope_s This member is declared only if ESLOPE is defined
**b_slope struct pslope_s This member is declared only if ESLOPE is defined
secnum size_t
flags ffloortype_e
*master struct line_s
*target struct sector_s
*next struct ffloor_s
*prev struct ffloor_s
lastlight INT32
alpha INT32
norender tic_t
spawnflags ffloortype_e
spawnalpha INT32
*fadingdata void

lightlist_t

Data name Data type Description
height fixed_t
*lightlevel INT16
**extra_colormap extracolormap_t
flags INT32
*caster ffloor_t
*slope struct pslope_s This member is declared only if ESLOPE is defined

r_lightlist_t

Data name Data type Description
height fixed_t
heightstep fixed_t
botheight fixed_t
botheightstep fixed_t
startheight fixed_t
lightlevel INT16
*extra_colormap extracolormap_t
*rcolormap lighttable_t
flags ffloortype_e
lightnum INT32

linechain_t

Data name Data type Description
*line struct line_s
*next struct linechain_s

pslope_t

Data name Data type Description
id UINT16 The slope's ID, for netgame synchronisation.
*next struct pslope_s The next slope in the linked list of dynamic slopes.
o vector3_t The slope's origin vector.

For sector-based slopes, the origin's X/Y position is set to a horizontal distance of extent away from the middle point of the linedef that defines the slope, at an angle of xydistance. The Z position is set as the un-sloped height of the floor or ceiling plane the slope is created for.

If the slope is marked as dynamic, the origin's Z position may be updated automatically.

normal vector3_t The normal vector of the slope's plane. It is probably intended to point upward out of the plane, but it instead follows the direction of it. Currently unused.

If the slope is marked as dynamic, this value may be updated automatically.

d vector2_t The slope's 2D (X,Y) direction vector. Used to determine distance from the origin in 2D mapspace. The values are normalised, i.e.: they are equivalent to a thrust of FRACUNIT, though in the opposite direction to the angle xydirection.
zdelta fixed_t The rate at which Z changes based on distance from the origin. For sector-based slopes, this is calculated as the un-sloped height of the sector plane on the other side of the linedef that defines the slope's plane, minus the un-sloped height of the slope's own plane, and divided by extent. (i.e.: zdelta = (plane2-plane1)/ extent)

If the slope is marked as dynamic, this value may be updated automatically.

zangle angle_t The vertical angle of the slope's plane, going up from the ground (i.e. a "flat" slope plane would have a zangle of 0°).

If the slope is marked as dynamic, this value may be updated automatically.

xydirection angle_t The horizontal angle of the slope's plane.
flags UINT8 Slope flags.

sector_t

Data name Data type Description
floorheight fixed_t
ceilingheight fixed_t
floorpic INT32
ceilingpic INT32
lightlevel INT16
special INT16
tag UINT16
nexttag
firsttag
INT32
soundorg degenmobj_t
validcount size_t
*thinglist mobj_t
*floordata void
*ceilingdata void
*lightingdata void
*fadecolormapdata void
floor_xoffs
floor_yoffs
fixed_t
ceiling_xoffs
ceiling_yoffs
fixed_t
floorpic_angle angle_t
ceilingpic_angle angle_t
heightsec INT32
camsec INT32
floorlightsec
ceilinglightsec
INT32
crumblestate INT32
*touching_thinglist struct msecnode_s
linecount size_t
**lines struct line_s
*tagline struct line_s
*ffloors ffloor_t
*attached size_t
*attachedsolid boolean
numattached size_t
maxattached size_t
*lightlist lightlist_t
numlights INT32
moved boolean
*extra_colormap extracolormap_t
pseudoSector boolean This member is declared only if HWRENDER is defined
virtualFloor boolean This member is declared only if HWRENDER is defined
virtualFloorheight fixed_t This member is declared only if HWRENDER is defined
virtualCeiling boolean This member is declared only if HWRENDER is defined
virtualCeilingheight fixed_t This member is declared only if HWRENDER is defined
*sectorLines linechain_t This member is declared only if HWRENDER is defined
**stackList struct sector_s This member is declared only if HWRENDER is defined
lineoutLength double This member is declared only if HWRENDER is defined
*gravity fixed_t
verticalflip boolean
flags sectorflags_t
*cullheight struct line_s
floorspeed
ceilspeed
fixed_t
*preciplist precipmobj_t
*touching_preciplist struct mprecipsecnode_s
*f_slope pslope_t This member is declared only if ESLOPE is defined
*b_slope pslope_t This member is declared only if ESLOPE is defined
hasslope boolean This member is declared only if ESLOPE is defined
spawn_lightlevel INT16
spawn_nexttag
spawn_firsttag
INT32
spawn_flr_xoffs
spawn_flr_yoffs
fixed_t
spawn_ceil_xoffs
spawn_ceil_yoffs
fixed_t
spawn_flrpic_angle angle_t
spawn_ceilpic_angle angle_t
*spawn_extra_colormap extracolormap_t

line_t

Data name Data type Description
*v1 vertex_t
*v2 vertex_t
dx
dy
fixed_t
flags INT16
special INT16
tag INT16
sidenum[2] UINT16
bbox[4] fixed_t
slopetype slopetype_t
*frontsector sector_t
*backsector sector_t
validcount size_t
*splats void
firsttag
nexttag
INT32
*polyobj polyobj_t This member is declared only if POLYOBJECTS is defined
*text char
callcount INT16

side_t

Data name Data type Description
textureoffset fixed_t
rowoffset fixed_t
toptexture
midtexture
toptexture
INT32
*sector sector_t
special INT16
repeatcnt INT16
*text char
*colormap_data extracolormap_t

subsector_t

Data name Data type Description
*sector sector_t
numlines INT16
firstline UINT16
*polyList struct polyobj_s This member is declared only if POLYOBJECTS is defined
*splats void
validcount size_t

msecnode_t

Data name Data type Description
*m_sector sector_t
*m_thing struct mobj_s
*m_sectorlist_prev struct msecnode_s
*m_sectorlist_next struct msecnode_s
*m_thinglist_prev struct msecnode_s
*m_thinglist_next struct msecnode_s
visited boolean

mprecipsecnode_t

Data name Data type Description
*m_sector sector_t
*m_thing struct precipmobj_s
*m_sectorlist_prev struct mprecipsecnode_s
*m_sectorlist_next struct mprecipsecnode_s
*m_thinglist_prev struct mprecipsecnode_s
*m_thinglist_next struct mprecipsecnode_s
visited boolean

light_t

Data name Data type Description
type UINT16
light_xoffset float
light_yoffset float
corona_color UINT32
corona_radius float
dynamic_color UINT32
dynamic_radius float
dynamic_sqrradius float

lightmap_t

Data name Data type Description
s[2]
t[2]
float
*light light_t
*next struct lightmap_s

seg_t

Data name Data type Description
*v1 vertex_t
*v2 vertex_t
side INT32
offset fixed_t
angle angle_t
*sidedef side_t
*linedef line_t
*frontsector sector_t
*backsector sector_t
length fixed_t
*pv1 void This member is declared only if HWRENDER is defined
*pv2 void This member is declared only if HWRENDER is defined
flength float This member is declared only if HWRENDER is defined
*lightmaps lightmap_t This member is declared only if HWRENDER is defined
numlights size_t
rlights r_lightlist_t
*polyseg polyobj_t This member is declared only if POLYOBJECTS is defined
dontrenderme boolean This member is declared only if POLYOBJECTS is defined

node_t

Data name Data type Description
x
y
fixed_t
dx
dy
fixed_t
bbox[2][4] fixed_t
children[2] UINT16

post_t

Data name Data type Description
topdelta UINT8
length UINT8

drawseg_t

Data name Data type Description
*curline seg_t
x1 INT32
x2 INT32
scale1 fixed_t
scale2 fixed_t
scalestep fixed_t
silhouette INT32
bsilheight fixed_t
tsilheight fixed_t
*sprtopclip INT16
*sprbottomclip INT16
*maskedtexturecol INT16
*ffloorplanes[MAXFFLOORS] struct visplane_s
numffloorplanes INT32
*thicksides[MAXFFLOORS] struct ffloor_s
*thicksidecol INT16
numthicksides INT32
frontscale[MAXVIDWIDTH] fixed_t
portalpass UINT8
maskedtextureheight[MAXVIDWIDTH] fixed_t This member is declared only if ESLOPE is defined
leftpos
rightpos
vertex_t These members are declared only if ESLOPE is defined

patch_t

Data name Data type Description
width INT16
height INT16
leftoffset INT16
topoffset INT16
columnofs[8] INT32

pic_t

Data name Data type Description
width INT16
zero UINT8
mode UINT8
height INT16
reserved1 INT16
data[0] UINT8

rotsprite_t

spriteframe_t

Data name Data type Description
rotate UINT8
lumppat[8] lumpnum_t
lumpid[8] size_t
flip UINT8
rotsprite rotsprite_t This member is declared only if ROTSPRITE is defined

spritedef_t

Data name Data type Description
numframes size_t
*spriteframes spriteframe_t

Enumerations

ffloortype_e

Main article: Linedef type 259

slopeflags_t

Value Name Description
1 SL_NOPHYSICS
2 SL_DYNAMIC

sectorflags_t

Value Name Description
1 SF_FLIPSPECIAL_FLOOR "Floor touch" sector special effects can be triggered when the player touches the sector's floor. By default all sectors in a level have only this flag set.
2 SF_FLIPSPECIAL_CEILING "Floor touch" sector special effects can be triggered when the player touches the sector's ceiling.
3 SF_FLIPSPECIAL_BOTH "Floor touch" sector special effects can be triggered when the player touches either the sector's floor or ceiling. This flag has the same value as SF_FLIPSPECIAL_FLOOR|SF_FLIPSPECIAL_CEILING.
4 SF_TRIGGERSPECIAL_TOUCH Sector special effects can be triggered by touching the edge of the sector, rather than requiring the player's center be inside the sector.

By default players can only trigger the special effects of their main sector player->mo->subsector->sector; if any sectors within the player Object's touching_sectorlist (the linked list of sectors touched) have this flag, the effects of those sectors can also be triggered.

8 SF_TRIGGERSPECIAL_HEADBUMP
16 SF_INVERTPRECIP

slopetype_t

Value Name Description
0 ST_HORIZONTAL The linedef is directly horizontal in the map. (dx = 0)
1 ST_VERTICAL The linedef is directly vertical in the map. (dy = 0)
2 ST_POSITIVE The linedef's gradient in the map is positive. (dy/dx > 0)
3 ST_NEGATIVE The linedef's gradient in the map is negative. (dy/dx < 0)

pic_mode_t

Value Name Description
0 PALETTE
1 INTENSITY
2 INTENSITY_ALPHA
3 RGB24
4 RGBA32

spriterotateflags_t