UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
check.h File Reference

Performs check on a loaded mapfile, and makes changes that can be saved back to the source map. More...

#include "../map.h"

Go to the source code of this file.

Data Structures

struct  compositeSide_s
 

Typedefs

typedef struct compositeSide_s compositeSide_t
 

Functions

void CheckTexturesBasedOnFlags (void)
 check that sides have textures and that where content/surface flags are set the texture is correct. More...
 
void CheckFlagsBasedOnTextures (void)
 sets content flags based on textures More...
 
void CheckLevelFlags (void)
 sets all levelflags, if none are set. More...
 
void CheckFillLevelFlags (void)
 ensures set levelflags are in one contiguous block More...
 
void CheckBrushes (void)
 
void CheckNodraws (void)
 check for faces which can safely be set to SURF_NODRAW because they are pressed against the faces of other brushes. Also set faces pointing near straight down nodraw. More...
 
void CheckMixedFaceContents (void)
 contentflags should be the same on each face of a brush. print warnings if they are not. remove contentflags that are set on less than half of the faces. some content flags are transferred to all faces on parsing, ParseBrush(). More...
 
void CheckMapMicro (void)
 report brushes from the map below 1 unit^3 More...
 
void Check_BrushIntersection (void)
 reports intersection between optimisable map brushes More...
 
void FixErrors (void)
 
void DisplayContentFlags (const int flags)
 prints a list of the names of the set content flags or "no contentflags" if all bits are 0 More...
 
void SetImpliedFlags (side_t *side, brush_texture_t *tex, const mapbrush_t *brush)
 Sets surface flags dependent on assigned texture. More...
 
void CheckPropagateParserContentFlags (mapbrush_t *b)
 some contentlflags are set as a result of some surface flag. For example, if one face is TRANS* then the brush is TRANSLUCENT. this is required by the .map parser as well as th check/fix code. More...
 
void Check_ContainedBrushes (void)
 find duplicated brushes and brushes contained inside brushes More...
 
void CheckZFighting (void)
 check all brushes for overlapping shared faces More...
 

Variables

compositeSide_t compositeSides [MAX_MAP_SIDES/2]
 
int numCompositeSides
 

Detailed Description

Performs check on a loaded mapfile, and makes changes that can be saved back to the source map.

Definition in file check.h.

Typedef Documentation

Function Documentation

void CheckFillLevelFlags ( void  )
void CheckFlagsBasedOnTextures ( void  )

sets content flags based on textures

Definition at line 1532 of file check.cpp.

References brushsides, i, index, mapbrushes, nummapbrushes, mapbrush_s::numsides, mapbrush_s::original_sides, SetImpliedFlags(), and side_brushtextures.

Referenced by main().

void CheckMapMicro ( void  )

report brushes from the map below 1 unit^3

Definition at line 1293 of file check.cpp.

References mapbrush_s::brushnum, Check_MapBrushVolume(), Check_Printf(), config, mapbrush_s::entitynum, i, mapbrushes, nummapbrushes, mapbrush_s::skipWriteBack, and VERB_CHECK.

Referenced by main().

void CheckMixedFaceContents ( void  )

contentflags should be the same on each face of a brush. print warnings if they are not. remove contentflags that are set on less than half of the faces. some content flags are transferred to all faces on parsing, ParseBrush().

Todo:
at the moment only actorclip is removed if only set on less than half of the faces. there may be other contentflags that would benefit from this treatment
See also
ParseBrush

Definition at line 1647 of file check.cpp.

References mapbrush_s::brushnum, brushsides, Check_Printf(), CheckPropagateParserContentFlags(), side_s::contentFlags, mapbrush_s::contentFlags, CONTENTS_ACTORCLIP, CONTENTS_ORIGIN, DisplayContentFlags(), mapbrush_s::entitynum, i, index, mapbrushes, brush_texture_s::name, NUM_SAME, nummapbrushes, mapbrush_s::numsides, mapbrush_s::original_sides, Q_streq, Q_strncpyz(), side_brushtextures, and VERB_CHECK.

Referenced by main().

void CheckNodraws ( void  )

check for faces which can safely be set to SURF_NODRAW because they are pressed against the faces of other brushes. Also set faces pointing near straight down nodraw.

Note
probably cannot warn about faces which are nodraw, but might be visible, as there will always be planty of optimisations beyond faces being hidden by one brush, or composite faces.

Definition at line 984 of file check.cpp.

References side_s::brush, mapbrush_s::brushnum, CH_COMP_NDR_EDGE_INTSCT_BUF, CH_DIST_EPSILON_SQR, Check_EdgeEdgeIntersection(), Check_FindCompositeSides(), Check_IsOptimisable(), Check_IsPointInsideBrush(), Check_LevelForNodraws(), Check_Printf(), Check_SetNodraw(), Check_SideIsInBrush(), Check_SidePointsDown(), Check_SurfProp(), Com_Printf(), mapbrush_s::entitynum, FacingAndCoincidentTo(), i, m, mapbrushes, compositeSide_s::memberSides, mapbrush_s::nearBrushes, numCompositeSides, nummapbrushes, compositeSide_s::numMembers, mapbrush_s::numNear, winding_s::numpoints, mapbrush_s::numsides, OBJZERO, mapbrush_s::original_sides, winding_s::p, PIB_INCL_SURF, side_s::planenum, SURF_LIGHT, SURF_NODRAW, side_s::surfaceFlags, VectorCopy, VectorDistSqr, VERB_CHECK, VERB_EXTRA, VERB_LESS, and side_s::winding.

Referenced by main().

void CheckPropagateParserContentFlags ( mapbrush_t b)

some contentlflags are set as a result of some surface flag. For example, if one face is TRANS* then the brush is TRANSLUCENT. this is required by the .map parser as well as th check/fix code.

See also
ParseBrush

Definition at line 1619 of file check.cpp.

References mapbrush_s::brushnum, Check_Printf(), side_s::contentFlags, mapbrush_s::contentFlags, CONTENTS_DETAIL, CONTENTS_TRANSLUCENT, DisplayContentFlags(), mapbrush_s::entitynum, m, mapbrush_s::numsides, mapbrush_s::original_sides, and VERB_CHECK.

Referenced by CheckMixedFaceContents(), and ParseBrush().

void DisplayContentFlags ( const int  flags)

prints a list of the names of the set content flags or "no contentflags" if all bits are 0

See also
defines.h

Definition at line 1309 of file check.cpp.

References Check_Printf(), M, NUM_SAME, and VERB_CHECK.

Referenced by CheckFillLevelFlags(), CheckMixedFaceContents(), and CheckPropagateParserContentFlags().

void FixErrors ( void  )
void SetImpliedFlags ( side_t side,
brush_texture_t tex,
const mapbrush_t brush 
)

Sets surface flags dependent on assigned texture.

See also
ParseBrush
CheckFlags
Note
surfaceFlags are set in side_t for map compiling and in brush_texture_t because this is saved back on -fix.
also removes phongs from nodraws. also removes legacy flags.

Definition at line 1448 of file check.cpp.

References mapbrush_s::brushnum, Check_Printf(), Check_SurfProp(), config, side_s::contentFlags, CONTENTS_ACTORCLIP, CONTENTS_LADDER, CONTENTS_LIGHTCLIP, CONTENTS_ORIGIN, CONTENTS_PASSABLE, CONTENTS_WATER, CONTENTS_WEAPONCLIP, mapbrush_s::entitynum, brush_texture_s::name, Q_streq, SURF_HINT, SURF_NODRAW, SURF_PHONG, SURF_SKIP, SURF_SLICK, SURF_WARP, brush_texture_s::surfaceFlags, side_s::surfaceFlags, and VERB_CHECK.

Referenced by CheckFlagsBasedOnTextures(), and ParseBrush().

Variable Documentation

compositeSide_t compositeSides[MAX_MAP_SIDES/2]

an array of composite mapbrush sides.

See also
Check_FindCompositeSides ensures the array is populated
Note
a composite must have at least 2 members. composites should not be duplicated, hence the largest possible number is the number of sides divided by two.

Definition at line 37 of file check.cpp.

Referenced by Check_Free().

int numCompositeSides

Definition at line 38 of file check.cpp.

Referenced by Check_FindCompositeSides(), Check_Free(), and CheckNodraws().