UFO: Alien Invasion
|
Common model code header (for bsp and others) More...
Go to the source code of this file.
Macros | |
#define | CM_TransformedBoxTrace(tile, line, box, headnode, brushmask, brushreject, origin, angles) CM_HintedTransformedBoxTrace(tile, line, box, headnode, brushmask, brushreject, origin, angles, vec3_origin, 1.0f); |
Functions | |
void | CM_LoadMap (const char *tiles, bool day, const char *pos, const char *entityString, mapData_t *mapData, mapTiles_t *mapTiles) |
Loads in the map and all submodels. More... | |
cBspModel_t * | CM_InlineModel (const mapTiles_t *mapTiles, const char *name) |
Searches all inline models and return the cBspModel_t pointer for the given modelnumber or -name. More... | |
cBspModel_t * | CM_SetInlineModelOrientation (mapTiles_t *mapTiles, const char *name, const vec3_t origin, const vec3_t angles) |
This function updates a model's orientation. More... | |
void | CM_GetInlineModelAABB (mapTiles_t *mapTiles, const char *name, AABB &aabb) |
This function calculates a model's aabb in world coordinates. More... | |
float | CM_GetVisibility (const mapTiles_t *mapTiles, const pos3_t position) |
Checks how well a position is visible. More... | |
void | CM_LoadBsp (MapTile &tile, const dBspHeader_t &header, const vec3_t shift, const byte *base) |
int32_t | CM_HeadnodeForBox (MapTile &tile, const AABB &box) |
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. More... | |
trace_t | CM_HintedTransformedBoxTrace (MapTile &tile, const Line &traceLine, const AABB &traceBox, const int headnode, const int brushmask, const int brushrejects, const vec3_t origin, const vec3_t angles, const vec3_t rmaShift, const float fraction) |
Handles offseting and rotation of the end points for moving and rotating entities. More... | |
trace_t | CM_EntCompleteBoxTrace (mapTiles_t *mapTiles, const Line &traceLine, const AABB *traceBox, int levelmask, int brushmask, int brushreject, const char **list) |
Performs box traces against the world and all inline models, gives the hit position back. More... | |
bool | CM_EntTestLineDM (mapTiles_t *mapTiles, const Line &trLine, vec3_t hit, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models, gives the hit position back. More... | |
bool | CM_EntTestLine (mapTiles_t *mapTiles, const Line &traceLine, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models. More... | |
trace_t | CM_CompleteBoxTrace (mapTiles_t *mapTiles, const Line &trLine, const AABB &box, int levelmask, int brushmask, int brushreject) |
Traces all submodels in all tiles. Used by ufo and ufo_ded. More... | |
Common model code header (for bsp and others)
Definition in file cmodel.h.
#define CM_TransformedBoxTrace | ( | tile, | |
line, | |||
box, | |||
headnode, | |||
brushmask, | |||
brushreject, | |||
origin, | |||
angles | |||
) | CM_HintedTransformedBoxTrace(tile, line, box, headnode, brushmask, brushreject, origin, angles, vec3_origin, 1.0f); |
trace_t CM_CompleteBoxTrace | ( | mapTiles_t * | mapTiles, |
const Line & | trLine, | ||
const AABB & | box, | ||
int | levelmask, | ||
int | brushmask, | ||
int | brushreject | ||
) |
Traces all submodels in all tiles. Used by ufo and ufo_ded.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | trLine | The line to trace |
[in] | box | The box we move through the world |
[in] | levelmask | Selects which submodels get scanned. |
[in] | brushmask | brushes the trace should stop at (see MASK_*) |
[in] | brushreject | brushes the trace should ignore (see MASK_*) |
Definition at line 283 of file cmodel.cpp.
References AABB::doesIntersect(), trace_s::endpos, trace_s::fraction, MapTile::getTileBox(), trace_s::mapTile, mapTiles_s::mapTiles, mapTiles_s::numTiles, AABB::set(), Line::stop, tr, TR_TileBoxTrace(), and VectorCopy.
Referenced by CL_Trace(), CM_EntCompleteBoxTrace(), R_Trace(), SV_PointContents(), and SV_Trace().
trace_t CM_EntCompleteBoxTrace | ( | mapTiles_t * | mapTiles, |
const Line & | traceLine, | ||
const AABB * | traceBox, | ||
int | levelmask, | ||
int | brushmask, | ||
int | brushreject, | ||
const char ** | list | ||
) |
Performs box traces against the world and all inline models, gives the hit position back.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | traceLine | The start/stop position of the trace. |
[in] | traceBox | The minimum/maximum extents of the collision box that is projected. |
[in] | levelmask | A mask of the game levels to trace against. Mask 0x100 filters clips. |
[in] | brushmask | Any brush detected must at least have one of these contents. |
[in] | brushreject | Any brush detected with any of these contents will be ignored. |
[in] | list | The local models list (a local model has a name starting with * followed by the model number) |
Definition at line 327 of file cmodel.cpp.
References cBspModel_s::angles, CM_CalculateWidestBoundingBox(), CM_CompleteBoxTrace(), CM_HintedTransformedBoxTrace(), CM_InlineModel(), Com_Error(), AABB::doesIntersect(), ERR_DROP, trace_s::fraction, AABB::getMaxZ(), AABB::getMinZ(), cBspModel_s::headnode, i, mapTiles_s::mapTiles, name, cBspModel_s::origin, PATHFINDING_HEIGHT, AABB::set(), cBspModel_s::shift, cBspModel_s::tile, TL_FLAG_ACTORCLIP, tr, and UNIT_HEIGHT.
bool CM_EntTestLine | ( | mapTiles_t * | mapTiles, |
const Line & | traceLine, | ||
const int | levelmask, | ||
const char ** | entlist | ||
) |
Checks traces against the world and all inline models.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | traceLine | The start/stop positions of the trace. |
[in] | levelmask | |
[in] | entlist | The local models list |
Definition at line 184 of file cmodel.cpp.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_s::mapTiles, MASK_VISIBILILITY, name, cBspModel_s::origin, cBspModel_s::shift, Line::start, trace_s::startsolid, Line::stop, cBspModel_s::tile, and TR_TestLine().
Referenced by SV_TestLineWithEnt().
bool CM_EntTestLineDM | ( | mapTiles_t * | mapTiles, |
const Line & | trLine, | ||
vec3_t | hit, | ||
const int | levelmask, | ||
const char ** | entlist | ||
) |
Checks traces against the world and all inline models, gives the hit position back.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | trLine | The start/stop positions of the trace. |
[out] | hit | The position where the line hits a object or the stop position if nothing is in the line |
[in] | levelmask | |
[in] | entlist | The local models list |
Definition at line 230 of file cmodel.cpp.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), trace_s::endpos, ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_s::mapTiles, MASK_ALL, name, cBspModel_s::origin, Line::start, trace_s::startsolid, Line::stop, cBspModel_s::tile, TR_TestLineDM(), vec3_origin, and VectorCopy.
Referenced by CL_ActorMouseTrace(), and CL_GetWorldCoordsUnderMouse().
void CM_GetInlineModelAABB | ( | mapTiles_t * | mapTiles, |
const char * | name, | ||
AABB & | aabb | ||
) |
This function calculates a model's aabb in world coordinates.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | name | The name of the model, must include the '*' |
[out] | aabb | The aabb to be filled |
Definition at line 979 of file bsp.cpp.
References cBspModel_s::angles, CalculateMinsMaxs(), cBspModel_s::cbmBox, CM_InlineModel(), and cBspModel_s::origin.
Referenced by SV_GetInlineModelAABB().
float CM_GetVisibility | ( | const mapTiles_t * | mapTiles, |
const pos3_t | position | ||
) |
Checks how well a position is visible.
1.0
means fully visible, 0.0
means hardly visible because the given position is in the darkness Definition at line 991 of file bsp.cpp.
References Com_Printf(), i, MapTile::lightdata, mapTiles_s::mapTiles, mapTiles_s::numTiles, VectorInside, MapTile::wpMaxs, and MapTile::wpMins.
Referenced by SV_GetVisibility().
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly.
creates a clipping hull for an arbitrary box
Definition at line 151 of file cmodel.cpp.
References MapTile::box_headnode, MapTile::box_planes, cBspPlane_s::dist, MAX_MAP_NODES, AABB::maxs, and AABB::mins.
Referenced by CL_HullForEntity(), and SV_HullForEntity().
trace_t CM_HintedTransformedBoxTrace | ( | MapTile & | tile, |
const Line & | traceLine, | ||
const AABB & | traceBox, | ||
const int | headnode, | ||
const int | contentmask, | ||
const int | brushrejects, | ||
const vec3_t | origin, | ||
const vec3_t | angles, | ||
const vec3_t | rmaShift, | ||
const float | fraction | ||
) |
Handles offseting and rotation of the end points for moving and rotating entities.
[in] | tile | Tile to check (normally 0 - except in assembled maps) |
[in] | traceLine | The start and stop vectors of the trace |
[in] | traceBox | The box we shove through the world |
[in] | headnode | if < 0 we are in a leaf node |
[in] | contentmask | content flags the trace should stop at (see MASK_*) |
[in] | brushrejects | brushes the trace should ignore (see MASK_*) |
[in] | origin | center for rotating objects |
[in] | angles | current rotation status (in degrees) for rotating objects |
[in] | rmaShift | how much the object was shifted by the RMA process (needed for doors) |
[in] | fraction | The furthest distance needed to trace before we stop. |
Definition at line 84 of file cmodel.cpp.
References AngleVectors(), MapTile::box_headnode, DotProduct, trace_s::endpos, trace_s::fraction, MapTile::idx, boxtrace_s::init(), trace_s::mapTile, trace_s::plane, boxtrace_s::setLineAndBox(), Line::start, Line::stop, TR_BoxTrace(), VectorAdd, VectorCopy, VectorInterpolation, VectorNegate, VectorNotEmpty, and VectorSubtract.
Referenced by CL_ClipMoveToLEs(), CM_EntCompleteBoxTrace(), CM_EntTestLine(), CM_EntTestLineDM(), and SV_ClipMoveToEntities().
cBspModel_t* CM_InlineModel | ( | const mapTiles_t * | mapTiles, |
const char * | name | ||
) |
Searches all inline models and return the cBspModel_t pointer for the given modelnumber or -name.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | name | The modelnumber (e.g. "*2") for inline brush models [bmodels] |
Definition at line 929 of file bsp.cpp.
References Com_Error(), ERR_DROP, i, mapTiles_s::mapTiles, MAX_MODELS, NUM_REGULAR_MODELS, and mapTiles_s::numTiles.
Referenced by CL_GridRecalcRouting(), CL_ParseConfigString(), CL_ViewLoadMedia(), CM_EntCompleteBoxTrace(), CM_EntTestLine(), CM_EntTestLineDM(), CM_GetInlineModelAABB(), CM_SetInlineModelOrientation(), Grid_RecalcRouting(), LET_SlideDoor(), SV_Map(), and SV_SetModel().
void CM_LoadBsp | ( | MapTile & | tile, |
const dBspHeader_t & | header, | ||
const vec3_t | shift, | ||
const byte * | base | ||
) |
Definition at line 644 of file bsp.cpp.
References CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadSubmodels(), CMod_LoadSurfaces(), LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_LEAFBRUSHES, LUMP_LEAFS, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_TEXINFO, and dBspHeader_t::lumps.
Referenced by CM_AddMapTile().
void CM_LoadMap | ( | const char * | tiles, |
bool | day, | ||
const char * | pos, | ||
const char * | entityString, | ||
mapData_t * | mapData, | ||
mapTiles_t * | mapTiles | ||
) |
Loads in the map and all submodels.
R_ModBeginLoading
is used. [in] | tiles | Map name(s) relative to base/maps or random map assembly string |
[in] | day | Use the day (true ) or the night (false ) version of the map |
[in] | pos | In case you gave more than one tile (Random map assembly [rma]) you also have to provide the positions where those tiles should be placed at. |
[out] | mapData | The loaded data is stored here. |
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | entityString | An entity string that is used for all map tiles. Might be nullptr . |
Definition at line 860 of file bsp.cpp.
References CM_AddMapTile(), CMod_RerouteMap(), com_cmodelSysPool, Com_DPrintf(), Com_Error(), Com_Parse(), Com_sprintf(), DEBUG_ENGINE, ERR_DROP, i, MAX_QPATH, MAX_VAR, Mem_FreePool, name, OBJZERO, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, and Q_strncpyz().
Referenced by CL_CanMultiplayerStart(), SV_Map(), and TEST_F().
cBspModel_t* CM_SetInlineModelOrientation | ( | mapTiles_t * | mapTiles, |
const char * | name, | ||
const vec3_t | origin, | ||
const vec3_t | angles | ||
) |
This function updates a model's orientation.
[in] | mapTiles | List of tiles the current (RMA-)map is composed of |
[in] | name | The name of the model, must include the '*' |
[in] | origin | The new origin for the model |
[in] | angles | The new facing angles for the model |
Definition at line 963 of file bsp.cpp.
References cBspModel_s::angles, CM_InlineModel(), cBspModel_s::origin, and VectorCopy.
Referenced by CL_AddBrushModel(), LET_RotateDoor(), SV_SetInlineModelOrientation(), and SV_SetModel().