#include "common.h"
#include "tracing.h"
#include "routing.h"
#include "../shared/parse.h"
Go to the source code of this file.
Functions | |
static void | CMod_LoadSubmodels (mapTile_t *tile, const byte *base, const lump_t *l, const vec3_t shift) |
Loads brush entities like func_door and func_breakable. | |
static void | CMod_LoadSurfaces (mapTile_t *tile, const byte *base, const lump_t *l) |
static void | CMod_LoadNodes (mapTile_t *tile, const byte *base, const lump_t *l, const vec3_t shift) |
static void | CMod_LoadBrushes (mapTile_t *tile, const byte *base, const lump_t *l) |
static void | CMod_LoadLeafs (mapTile_t *tile, const byte *base, const lump_t *l) |
static void | CMod_LoadPlanes (mapTile_t *tile, const byte *base, const lump_t *l, const vec3_t shift) |
static void | CMod_LoadLeafBrushes (mapTile_t *tile, const byte *base, const lump_t *l) |
static void | CMod_LoadBrushSides (mapTile_t *tile, const byte *base, const lump_t *l) |
static int | CMod_DeCompressRouting (const byte **source, byte *dataStart) |
static void | CM_MakeTracingNodes (mapTile_t *tile) |
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibility and pathfinding checks. | |
static void | CMod_LoadRouting (mapTile_t *tile, mapData_t *mapData, const byte *base, const char *name, const lump_t *l, int sX, int sY, int sZ) |
static void | CMod_LoadEntityString (mapTile_t *tile, mapData_t *mapData, const byte *base, const lump_t *l, const vec3_t shift) |
static void | CMod_LoadLighting (mapTile_t *tile, const byte *base, const lump_t *l) |
Loads the lightmap for server side visibility lookup. | |
static void | CM_InitBoxHull (mapTile_t *tile) |
Set up the planes and nodes so that the six floats of a bounding box can just be stored out and get a proper clipping hull structure. | |
static void | CM_AddMapTile (const char *name, qboolean day, int sX, int sY, byte sZ, mapData_t *mapData, mapTiles_t *mapTiles) |
Adds in a single map tile. | |
static void | CMod_RerouteMap (mapTiles_t *mapTiles, mapData_t *mapData) |
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. | |
Variables | |
static cBspSurface_t | nullSurface |
static void CM_AddMapTile | ( | const char * | name, | |
qboolean | day, | |||
int | sX, | |||
int | sY, | |||
byte | sZ, | |||
mapData_t * | mapData, | |||
mapTiles_t * | mapTiles | |||
) | [static] |
Adds in a single map tile.
[in] | name | The (file-)name of the tile to add. |
[in] | day | whether the lighting for day or night should be loaded. |
[in] | sX | The x position on the world plane (grid position) - values from -(PATHFINDING_WIDTH / 2) up to PATHFINDING_WIDTH / 2 are allowed |
[in] | sY | The y position on the world plane (grid position) - values from -(PATHFINDING_WIDTH / 2) up to PATHFINDING_WIDTH / 2 are allowed |
[in] | sZ | The height level on the world plane (grid position) - values from 0 up to PATHFINDING_HEIGHT are allowed |
Definition at line 758 of file bsp.c.
References BSPVERSION, byte, CM_InitBoxHull(), CM_MakeTracingNodes(), CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadEntityString(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadLighting(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadRouting(), CMod_LoadSubmodels(), CMod_LoadSurfaces(), Com_BlockChecksum(), Com_DPrintf(), Com_Error(), Com_sprintf(), DEBUG_ENGINE, ERR_DROP, ERR_FATAL, FS_FreeFile(), FS_LoadFile(), header, i, mapTile_t::idx, LittleLong(), LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_ENTITIES, LUMP_LEAFBRUSHES, LUMP_LEAFS, LUMP_LIGHTING_DAY, LUMP_LIGHTING_NIGHT, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_ROUTING, LUMP_TEXINFO, dBspHeader_t::lumps, mapData_s::mapChecksum, mapData_s::mapMax, mapData_s::mapMin, mapTiles_t::mapTiles, MAX_QPATH, mapTile_t::name, NUM_REGULAR_MODELS, mapData_s::numInline, mapTile_t::nummodels, mapTiles_t::numTiles, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, Q_strncpyz(), RT_GetMapSize(), shift, UNIT_HEIGHT, UNIT_SIZE, VectorSet, and dBspHeader_t::version.
Referenced by CM_LoadMap().
static void CM_InitBoxHull | ( | mapTile_t * | tile | ) | [static] |
Set up the planes and nodes so that the six floats of a bounding box can just be stored out and get a proper clipping hull structure.
Definition at line 684 of file bsp.c.
References mapTile_t::box_brush, mapTile_t::box_headnode, mapTile_t::box_leaf, mapTile_t::box_planes, mapTile_t::brushes, mapTile_t::brushsides, cBspNode_s::children, Com_Error(), cBspLeaf_s::contentFlags, cBspBrush_s::contentFlags, CONTENTS_WEAPONCLIP, mapTile_t::emptyleaf, ERR_DROP, cBspBrush_s::firstbrushside, cBspLeaf_s::firstleafbrush, i, mapTile_t::idx, mapTile_t::leafbrushes, LEAFNODE, mapTile_t::leafs, MAX_MAP_BRUSHES, MAX_MAP_BRUSHSIDES, MAX_MAP_LEAFBRUSHES, MAX_MAP_NODES, MAX_MAP_PLANES, mapTile_t::nodes, cBspPlane_s::normal, mapTile_t::numbrushes, mapTile_t::numbrushsides, cBspLeaf_s::numleafbrushes, mapTile_t::numleafbrushes, mapTile_t::numleafs, mapTile_t::numnodes, mapTile_t::numplanes, cBspBrush_s::numsides, cBspNode_s::plane, cBspBrushSide_s::plane, PLANE_ANYX, mapTile_t::planes, cBspBrushSide_s::surface, cBspPlane_s::type, and VectorClear.
Referenced by CM_AddMapTile().
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().
static void CM_MakeTracingNodes | ( | mapTile_t * | tile | ) | [static] |
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibility and pathfinding checks.
Definition at line 434 of file bsp.c.
References com_cmodelSysPool, cBspModel_s::headnode, i, LEAFNODE, LEVEL_MAX, Mem_PoolAlloc, mapTile_t::models, NUM_REGULAR_MODELS, mapTile_t::numcheads, mapTile_t::nummodels, mapTile_t::numnodes, mapTile_t::numtheads, mapTile_t::thead, mapTile_t::theadlevel, mapTile_t::tnodes, and TR_BuildTracingNode_r().
Referenced by CM_AddMapTile().
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().
[in] | source | Source will be set to the end of the compressed data block! |
[in] | dataStart | where to place the uncompressed data |
Definition at line 391 of file bsp.c.
Referenced by CMod_LoadRouting().
[in] | l | descriptor of the data block we are working on |
Definition at line 181 of file bsp.c.
References mapTile_t::brushes, COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), dBspBrush_t::contentFlags, count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, dBspBrush_t::firstbrushside, cBspBrush_s::firstbrushside, i, LittleLong(), MAX_MAP_BRUSHES, Mem_PoolAlloc, mapTile_t::numbrushes, and dBspBrush_t::numsides.
Referenced by CM_AddMapTile().
[in] | l | descriptor of the data block we are working on |
Definition at line 349 of file bsp.c.
References mapTile_t::brushsides, COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleShort(), MAX_MAP_BRUSHSIDES, Mem_PoolAlloc, uiNode_s::num, mapTile_t::numbrushsides, mapTile_t::numtexinfo, cBspBrushSide_s::plane, mapTile_t::planes, cBspBrushSide_s::surface, and mapTile_t::surfaces.
Referenced by CM_AddMapTile().
static void CMod_LoadEntityString | ( | mapTile_t * | tile, | |
mapData_t * | mapData, | |||
const byte * | base, | |||
const lump_t * | l, | |||
const vec3_t | shift | |||
) | [static] |
[in] | l | descriptor of the data block we are working on |
[in] | shift | The shifting vector in case this is a map assemble loaded map tiles. |
Definition at line 586 of file bsp.c.
References Com_Error(), Com_Parse(), ERR_DROP, lump_t::filelen, lump_t::fileofs, mapTile_t::idx, mapData_s::mapEntityString, MAX_MAP_ENTSTRING, cBspModel_s::maxs, cBspModel_s::mins, mapTile_t::models, uiNode_s::num, NUM_REGULAR_MODELS, mapData_s::numInline, Q_strcat(), Q_strncpyz(), va(), VectorAdd, and VectorSubtract.
Referenced by CM_AddMapTile().
[in] | l | descriptor of the data block we are working on |
Definition at line 313 of file bsp.c.
References COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, mapTile_t::leafbrushes, LittleShort(), MAX_MAP_LEAFBRUSHES, Mem_PoolAlloc, and mapTile_t::numleafbrushes.
Referenced by CM_AddMapTile().
[in] | l | descriptor of the data block we are working on |
Definition at line 216 of file bsp.c.
References COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), cBspLeaf_s::contentFlags, CONTENTS_SOLID, count, DEBUG_ENGINE, mapTile_t::emptyleaf, ERR_DROP, lump_t::filelen, lump_t::fileofs, cBspLeaf_s::firstleafbrush, i, mapTile_t::leafs, LittleLong(), LittleShort(), MAX_MAP_LEAFS, Mem_PoolAlloc, cBspLeaf_s::numleafbrushes, and mapTile_t::numleafs.
Referenced by CM_AddMapTile().
Loads the lightmap for server side visibility lookup.
Definition at line 672 of file bsp.c.
References com_cmodelSysPool, lump_t::filelen, lump_t::fileofs, and Mem_PoolAlloc.
Referenced by CM_AddMapTile().
static void CMod_LoadNodes | ( | mapTile_t * | tile, | |
const byte * | base, | |||
const lump_t * | l, | |||
const vec3_t | shift | |||
) | [static] |
[in] | l | descriptor of the data block we are working on |
[in] | shift | The shifting vector in case this is a map assemble |
Definition at line 131 of file bsp.c.
References dBspNode_t::children, COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleLong(), LittleShort(), MAX_MAP_NODES, dBspNode_t::maxs, Mem_PoolAlloc, dBspNode_t::mins, mapTile_t::nodes, mapTile_t::numnodes, cBspNode_s::plane, dBspNode_t::planenum, PLANENUM_LEAF, and mapTile_t::planes.
Referenced by CM_AddMapTile().
static void CMod_LoadPlanes | ( | mapTile_t * | tile, | |
const byte * | base, | |||
const lump_t * | l, | |||
const vec3_t | shift | |||
) | [static] |
[in] | l | descriptor of the data block we are working on |
[in] | shift | The shifting vector in case this is a map assemble |
Definition at line 269 of file bsp.c.
References COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, cBspPlane_s::dist, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat(), LittleLong(), MAX_MAP_PLANES, Mem_PoolAlloc, cBspPlane_s::normal, mapTile_t::numplanes, mapTile_t::planes, and cBspPlane_s::type.
Referenced by CM_AddMapTile().
static void CMod_LoadRouting | ( | mapTile_t * | tile, | |
mapData_t * | mapData, | |||
const byte * | base, | |||
const char * | name, | |||
const lump_t * | l, | |||
int | sX, | |||
int | sY, | |||
int | sZ | |||
) | [static] |
[in] | name | The name of the maptile |
[in] | l | Routing lump ... (routing data lump from bsp file) |
[in] | sX | The x position on the world plane (grid position) - values from -(PATHFINDING_WIDTH/2) up to PATHFINDING_WIDTH/2 are allowed |
[in] | sY | The y position on the world plane (grid position) - values from -(PATHFINDING_WIDTH/2) up to PATHFINDING_WIDTH/2 are allowed |
[in] | sZ | The height level on the world plane (grid position) - values from 0 - PATHFINDING_HEIGHT are allowed |
Definition at line 469 of file bsp.c.
References ACTOR_MAX_SIZE, byte, routing_s::ceil, CMod_DeCompressRouting(), Com_DPrintf(), Com_Error(), CORE_DIRECTIONS, DEBUG_ROUTING, ERR_DROP, lump_t::filelen, lump_t::fileofs, routing_s::floor, i, mapTile_t::idx, LittleLong(), mapData_s::map, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, mapData_s::reroute, routing_s::route, ROUTING_NOT_REACHABLE, routing_s::stepup, mapTile_t::wpMaxs, and mapTile_t::wpMins.
Referenced by CM_AddMapTile().
static void CMod_LoadSubmodels | ( | mapTile_t * | tile, | |
const byte * | base, | |||
const lump_t * | l, | |||
const vec3_t | shift | |||
) | [static] |
Loads brush entities like func_door and func_breakable.
[in] | l | The lump to load the data from |
[in] | shift | The shifting vector in case this is a map assemble |
Definition at line 48 of file bsp.c.
References COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, cBspModel_s::headnode, i, mapTile_t::idx, LittleFloat(), LittleLong(), MAX_MAP_MODELS, cBspModel_s::maxs, Mem_PoolAlloc, cBspModel_s::mins, mapTile_t::models, mapTile_t::nummodels, cBspModel_s::shift, cBspModel_s::tile, UFO_SIZE_T, and VectorCopy.
Referenced by CM_AddMapTile().
[in] | l | descriptor of the data block we are working on |
Definition at line 92 of file bsp.c.
References COLORED_GREEN, com_cmodelSysPool, Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleLong(), MAX_MAP_TEXINFO, Mem_PoolAlloc, cBspSurface_s::name, mapTile_t::numtexinfo, Q_strncpyz(), cBspSurface_s::surfaceFlags, mapTile_t::surfaces, and cBspSurface_s::value.
Referenced by CM_AddMapTile().
static void CMod_RerouteMap | ( | mapTiles_t * | mapTiles, | |
mapData_t * | mapData | |||
) | [static] |
< Can't const: need to check bounds first.
Definition at line 842 of file bsp.c.
References ACTOR_MAX_SIZE, ACTOR_SIZE_INVALID, byte, Com_DPrintf(), Com_Printf(), CORE_DIRECTIONS, DEBUG_PATHING, dvecs, i, mapData_s::map, mapData_s::mapMax, mapData_s::mapMin, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, mapData_s::reroute, ROUTING_NOT_REACHABLE, RT_CheckCell(), RT_UpdateConnectionColumn(), and VecToPos.
Referenced by CM_LoadMap().
cBspSurface_t nullSurface [static] |