Common model code header (for bsp and others). More...
#include "../common/qfiles.h"
#include "pqueue.h"
#include "../common/qfiles.h"
Go to the source code of this file.
Defines | |
#define | CM_TransformedBoxTrace(tile, start, end, mins, maxs, headnode, brushmask, brushreject, origin, angles) CM_HintedTransformedBoxTrace(tile, start, end, mins, maxs, headnode, brushmask, brushreject, origin, angles, vec3_origin, 1.0f); |
Functions | |
void | CM_LoadMap (const char *tiles, qboolean day, const char *pos, mapData_t *mapData, mapTiles_t *mapTiles) |
Loads in the map and all submodels. | |
cBspModel_t * | CM_InlineModel (mapTiles_t *mapTiles, const char *name) |
Searches all inline models and return the cBspModel_t pointer for the given modelnumber or -name. | |
void | CM_SetInlineModelOrientation (mapTiles_t *mapTiles, const char *name, const vec3_t origin, const vec3_t angles) |
This function updates a model's orientation. | |
int32_t | CM_HeadnodeForBox (mapTile_t *tile, const vec3_t mins, const vec3_t maxs) |
To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. | |
trace_t | CM_HintedTransformedBoxTrace (mapTile_t *tile, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, 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. | |
trace_t | CM_EntCompleteBoxTrace (mapTiles_t *mapTiles, const vec3_t start, const vec3_t end, const box_t *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. | |
qboolean | CM_EntTestLineDM (mapTiles_t *mapTiles, const vec3_t start, const vec3_t stop, vec3_t end, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models, gives the hit position back. | |
qboolean | CM_EntTestLine (mapTiles_t *mapTiles, const const vec3_t start, const vec3_t stop, const int levelmask, const char **entlist) |
Checks traces against the world and all inline models. | |
trace_t | CM_CompleteBoxTrace (mapTiles_t *mapTiles, const vec3_t start, const vec3_t end, const vec3_t mins, const vec3_t maxs, int levelmask, int brushmask, int brushreject) |
Traces all submodels in all tiles. Used by ufo and ufo_ded. |
Common model code header (for bsp and others).
Definition in file cmodel.h.
#define CM_TransformedBoxTrace | ( | tile, | |||
start, | |||||
end, | |||||
mins, | |||||
maxs, | |||||
headnode, | |||||
brushmask, | |||||
brushreject, | |||||
origin, | |||||
angles | ) | CM_HintedTransformedBoxTrace(tile, start, end, mins, maxs, headnode, brushmask, brushreject, origin, angles, vec3_origin, 1.0f); |
trace_t CM_CompleteBoxTrace | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
int | levelmask, | |||
int | brushmask, | |||
int | brushreject | |||
) |
Traces all submodels in all tiles. Used by ufo and ufo_ded.
[in] | start | trace start vector |
[in] | end | trace end vector |
[in] | mins | box mins |
[in] | maxs | box maxs |
[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 304 of file cmodel.c.
References trace_s::fraction, i, trace_s::mapTile, mapTiles_t::mapTiles, mapTiles_t::numTiles, PosToVec, TR_TileBoxTrace(), UNIT_HEIGHT, UNIT_SIZE, VectorAdd, VectorSubtract, mapTile_t::wpMaxs, and mapTile_t::wpMins.
Referenced by CL_Trace(), CM_EntCompleteBoxTrace(), R_Trace(), SV_PointContents(), and SV_Trace().
trace_t CM_EntCompleteBoxTrace | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const box_t * | 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] | start | The position to start the trace. |
[in] | end | The position where the trace ends. |
[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 368 of file cmodel.c.
References cBspModel_s::angles, CM_CalculateBoundingBox(), CM_CompleteBoxTrace(), CM_HintedTransformedBoxTrace(), CM_InlineModel(), Com_Error(), ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, box_s::maxs, box_s::mins, name, cBspModel_s::origin, cBspModel_s::shift, cBspModel_s::tile, VectorAdd, and VectorSet.
qboolean CM_EntTestLine | ( | mapTiles_t * | mapTiles, | |
const const vec3_t | start, | |||
const vec3_t | stop, | |||
const int | levelmask, | |||
const char ** | entlist | |||
) |
Checks traces against the world and all inline models.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[in] | levelmask |
Definition at line 197 of file cmodel.c.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, MASK_VISIBILILITY, name, cBspModel_s::origin, qfalse, qtrue, cBspModel_s::shift, trace_s::startsolid, cBspModel_s::tile, TR_TestLine(), and vec3_origin.
Referenced by SV_TestLineWithEnt().
qboolean CM_EntTestLineDM | ( | mapTiles_t * | mapTiles, | |
const vec3_t | start, | |||
const vec3_t | stop, | |||
vec3_t | end, | |||
const int | levelmask, | |||
const char ** | entlist | |||
) |
Checks traces against the world and all inline models, gives the hit position back.
[in] | start | The position to start the trace. |
[in] | stop | The position where the trace ends. |
[out] | end | The position where the line hits a object or the stop position if nothing is in the line |
[in] | levelmask |
Definition at line 246 of file cmodel.c.
References cBspModel_s::angles, CM_HintedTransformedBoxTrace(), CM_InlineModel(), CM_LineMissesModel(), Com_Error(), trace_s::endpos, ERR_DROP, trace_s::fraction, cBspModel_s::headnode, mapTiles_t::mapTiles, MASK_ALL, name, cBspModel_s::origin, qtrue, trace_s::startsolid, cBspModel_s::tile, TR_TestLineDM(), vec3_origin, and VectorCopy.
Referenced by CL_ActorMouseTrace().
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 165 of file cmodel.c.
References mapTile_t::box_headnode, mapTile_t::box_planes, cBspPlane_s::dist, and MAX_MAP_NODES.
Referenced by CL_HullForEntity(), and SV_HullForEntity().
trace_t CM_HintedTransformedBoxTrace | ( | mapTile_t * | tile, | |
const vec3_t | start, | |||
const vec3_t | end, | |||
const vec3_t | mins, | |||
const vec3_t | maxs, | |||
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.
[in] | start | trace start vector |
[in] | end | trace end vector |
[in] | mins | box mins |
[in] | maxs | box maxs |
[in] | tile | Tile to check (normally 0 - except in assembled maps) |
[in] | headnode | if < 0 we are in a leaf node |
[in] | brushmask | brushes the trace should stop at (see MASK_*) |
[in] | brushreject | 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 100 of file cmodel.c.
References AngleVectors(), mapTile_t::box_headnode, DotProduct, trace_s::endpos, trace_s::fraction, mapTile_t::idx, trace_s::mapTile, trace_s::plane, qfalse, qtrue, right, 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 | ( | mapTiles_t * | mapTiles, | |
const char * | name | |||
) |
Searches all inline models and return the cBspModel_t pointer for the given modelnumber or -name.
[in] | name | The modelnumber (e.g. "*2") for inline brush models [bmodels] |
Definition at line 1001 of file bsp.c.
References Com_Error(), ERR_DROP, i, mapTiles_t::mapTiles, MAX_MODELS, uiNode_s::num, NUM_REGULAR_MODELS, and mapTiles_t::numTiles.
Referenced by CL_ParseConfigString(), CL_ViewLoadMedia(), CM_EntCompleteBoxTrace(), CM_EntTestLine(), CM_EntTestLineDM(), CM_SetInlineModelOrientation(), Grid_RecalcRouting(), SV_Map(), and SV_SetModel().
void CM_LoadMap | ( | const char * | tiles, | |
qboolean | day, | |||
const char * | pos, | |||
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. |
Definition at line 928 of file bsp.c.
References CM_AddMapTile(), CMod_RerouteMap(), com_cmodelSysPool, Com_DPrintf(), Com_Error(), Com_Parse(), Com_Printf(), Com_sprintf(), DEBUG_ENGINE, ERR_DROP, i, MAX_QPATH, MAX_VAR, Mem_FreePool, name, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, and Q_strncpyz().
Referenced by CL_CanMultiplayerStart(), SV_Map(), and testConnection().
void CM_SetInlineModelOrientation | ( | mapTiles_t * | mapTiles, | |
const char * | name, | |||
const vec3_t | origin, | |||
const vec3_t | angles | |||
) |
This function updates a model's orientation.
[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 1036 of file bsp.c.
References cBspModel_s::angles, CM_InlineModel(), cBspModel_s::origin, and VectorCopy.
Referenced by CL_AddBrushModel(), CL_DoorClose(), CL_DoorOpen(), SV_SetInlineModelOrientation(), and SV_SetModel().