|
UFO: Alien Invasion
|
bsp model loading More...
#include "common.h"#include "qfiles.h"#include "tracing.h"#include "routing.h"#include "../shared/parse.h"
Go to the source code of this file.
Functions | |
| static int | CMod_ValidateLump (const lump_t *lump, const char *functionName, size_t elementSize, const char *elementName, int elementMaxCount) |
| static void | CMod_LoadSubmodels (MapTile &tile, const byte *base, const lump_t *lump, const vec3_t shift) |
| Loads brush entities like func_door and func_breakable. | |
| static void | CMod_LoadSurfaces (MapTile &tile, const byte *base, const lump_t *lump) |
| static void | CMod_LoadNodes (MapTile &tile, const byte *base, const lump_t *lump, const vec3_t shift) |
| static void | CMod_LoadBrushes (MapTile &tile, const byte *base, const lump_t *lump) |
| static void | CMod_LoadLeafs (MapTile &tile, const byte *base, const lump_t *lump) |
| static void | CMod_LoadPlanes (MapTile &tile, const byte *base, const lump_t *lump, const vec3_t shift) |
| static void | CMod_LoadLeafBrushes (MapTile &tile, const byte *base, const lump_t *lump) |
| static void | CMod_LoadBrushSides (MapTile &tile, const byte *base, const lump_t *lump) |
| static int | CMod_DeCompressRouting (const byte **source, byte *dataStart) |
| static void | CM_MakeTracingNodes (MapTile &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 &tile, mapData_t *mapData, const byte *base, const char *name, const lump_t *lump, const int sX, const int sY, const int sZ) |
| static void | CMod_LoadEntityString (MapTile &tile, const char *entityString, mapData_t *mapData, const byte *base, const lump_t *l, const vec3_t shift) |
| static void | CMod_LoadLighting (MapTile &tile, const byte *base, const lump_t *lump) |
| Loads the lightmap for server side visibility lookup. | |
| static void | CM_InitBoxHull (MapTile &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. | |
| void | CM_LoadBsp (MapTile &tile, const dBspHeader_t &header, const vec3_t shift, const byte *base) |
| static void | CM_AddMapTile (const char *name, const char *entityString, const bool day, const int sX, const int sY, const byte sZ, mapData_t *mapData, mapTiles_t *mapTiles) |
| Adds in a single map tile. | |
| static void | CMod_RerouteMap (mapTiles_t *mapTiles, mapData_t *mapData) |
| Recalculate the seams of the tiles after an RMA. | |
| 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. | |
| 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. | |
| 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. | |
| void | CM_GetInlineModelAABB (mapTiles_t *mapTiles, const char *name, AABB &aabb) |
| This function calculates a model's aabb in world coordinates. | |
| float | CM_GetVisibility (const mapTiles_t *mapTiles, const pos3_t position) |
| Checks how well a position is visible. | |
Variables | |
| static cBspSurface_t | nullSurface |
bsp model loading
Definition in file bsp.cpp.
|
static |
Adds in a single map tile.
| [in] | name | The (file-)name of the tile to add. |
| [in] | entityString | If not empty, this is added to mapEntityString by CMod_LoadEntityString |
| [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 |
| [in] | mapData | The loaded data is stored here. |
| [in] | mapTiles | List of tiles the current (RMA-)map is composed of |
Definition at line 674 of file bsp.cpp.
References BSP_SwapHeader, BSPVERSION, CM_InitBoxHull(), CM_LoadBsp(), CM_MakeTracingNodes(), CMod_LoadEntityString(), CMod_LoadLighting(), CMod_LoadRouting(), Com_BlockChecksum(), Com_DPrintf(), Com_Error(), Com_sprintf(), DEBUG_ENGINE, ERR_DROP, ERR_FATAL, FS_FreeFile(), FS_LoadFile(), MapTile::idx, length, LittleLong, LUMP_ENTITIES, LUMP_LIGHTING_DAY, LUMP_LIGHTING_NIGHT, LUMP_ROUTING, dBspHeader_t::lumps, mapData, mapTiles, MAX_QPATH, MapTile::name, name, NUM_REGULAR_MODELS, MapTile::nummodels, OBJZERO, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, Q_strncpyz(), RT_GetMapSize(), shift, UNIT_HEIGHT, UNIT_SIZE, VectorSet, and dBspHeader_t::version.
Referenced by CM_LoadMap().
| 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_t::angles, CalculateMinsMaxs(), cBspModel_t::cbmBox, CM_InlineModel(), mapTiles, name, and cBspModel_t::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, VectorInside, MapTile::wpMaxs, and MapTile::wpMins.
Referenced by SV_GetVisibility().
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 589 of file bsp.cpp.
References MapTile::box_brush, MapTile::box_headnode, MapTile::box_leaf, MapTile::box_planes, cBspBrush_t::brushContentFlags, MapTile::brushes, MapTile::brushsides, cBspNode_t::children, Com_Error(), cBspLeaf_t::contentFlags, CONTENTS_WEAPONCLIP, MapTile::emptyleaf, ERR_DROP, cBspBrush_t::firstbrushside, cBspLeaf_t::firstleafbrush, i, MapTile::idx, MapTile::leafbrushes, LEAFNODE, MapTile::leafs, MAX_MAP_BRUSHES, MAX_MAP_BRUSHSIDES, MAX_MAP_LEAFBRUSHES, MAX_MAP_NODES, MAX_MAP_PLANES, MapTile::nodes, cBspPlane_t::normal, nullSurface, MapTile::numbrushes, MapTile::numbrushsides, cBspLeaf_t::numleafbrushes, MapTile::numleafbrushes, MapTile::numleafs, MapTile::numnodes, MapTile::numplanes, cBspBrush_t::numsides, cBspBrushSide_t::plane, cBspNode_t::plane, PLANE_ANYX, MapTile::planes, cBspBrushSide_t::surface, cBspPlane_t::type, and VectorClear.
Referenced by CM_AddMapTile().
| 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, MAX_MODELS, name, and NUM_REGULAR_MODELS.
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, dBspHeader_t::lumps, and shift.
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, mapData, mapTiles, MAX_QPATH, MAX_VAR, Mem_FreePool, name, OBJZERO, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, and Q_strncpyz().
Referenced by CL_CanMultiplayerStart(), SV_Map(), TEST_F(), and TEST_F().
Use the bsp node structure to reconstruct efficient tracing structures that are used for fast visibility and pathfinding checks.
Definition at line 345 of file bsp.cpp.
References com_cmodelSysPool, cBspModel_t::headnode, i, LEAFNODE, LEVEL_MAX, Mem_PoolAllocTypeN, MapTile::models, NUM_REGULAR_MODELS, MapTile::numcheads, MapTile::nummodels, MapTile::numnodes, MapTile::numtheads, MapTile::thead, MapTile::theadlevel, MapTile::tnodes, and TR_BuildTracingNode_r().
Referenced by CM_AddMapTile().
| 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_t::angles, CM_InlineModel(), mapTiles, name, cBspModel_t::origin, and VectorCopy.
Referenced by CL_AddBrushModel(), LET_RotateDoor(), 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 304 of file bsp.cpp.
References i.
Referenced by CMod_LoadRouting().
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
Definition at line 160 of file bsp.cpp.
References cBspBrush_t::brushContentFlags, dBspBrush_t::brushContentFlags, MapTile::brushes, CMod_ValidateLump(), com_cmodelSysPool, count, lump_t::fileofs, cBspBrush_t::firstbrushside, dBspBrush_t::firstbrushside, i, LittleLong, MAX_MAP_BRUSHES, Mem_PoolAllocTypeN, MapTile::numbrushes, cBspBrush_t::numsides, and dBspBrush_t::numsides.
Referenced by CM_LoadBsp().
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
Definition at line 276 of file bsp.cpp.
References MapTile::brushsides, CMod_ValidateLump(), com_cmodelSysPool, Com_Error(), count, ERR_DROP, lump_t::fileofs, i, LittleShort, MAX_MAP_BRUSHSIDES, Mem_PoolAllocTypeN, MapTile::numbrushsides, MapTile::numtexinfo, cBspBrushSide_t::plane, dBspBrushSide_t::planenum, MapTile::planes, cBspBrushSide_t::surface, MapTile::surfaces, and dBspBrushSide_t::texinfo.
Referenced by CM_LoadBsp().
|
static |
| [in] | mapData | The loaded data is stored here. |
| [in] | tile | Stores the data of the map tile |
| [in] | entityString | If not empty, this is added to mapEntityString |
| [in] | base | The start of the data loaded from the file. |
| [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 488 of file bsp.cpp.
References cBspModel_t::cbmBox, Com_Error(), Com_Parse(), ERR_DROP, lump_t::filelen, lump_t::fileofs, MapTile::idx, mapData, MAX_MAP_ENTSTRING, AABB::maxs, AABB::mins, MapTile::models, NUM_REGULAR_MODELS, Q_strcat(), Q_streq, Q_strncpyz(), Q_strvalid, shift, v, VectorAdd, and VectorSubtract.
Referenced by CM_AddMapTile().
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
Definition at line 254 of file bsp.cpp.
References CMod_ValidateLump(), com_cmodelSysPool, count, lump_t::fileofs, i, MapTile::leafbrushes, LittleShort, MAX_MAP_LEAFBRUSHES, Mem_PoolAllocTypeN, and MapTile::numleafbrushes.
Referenced by CM_LoadBsp().
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
Definition at line 185 of file bsp.cpp.
References CMod_ValidateLump(), com_cmodelSysPool, Com_Error(), cBspLeaf_t::contentFlags, dBspLeaf_t::contentFlags, CONTENTS_SOLID, count, MapTile::emptyleaf, ERR_DROP, lump_t::fileofs, cBspLeaf_t::firstleafbrush, dBspLeaf_t::firstleafbrush, i, MapTile::leafs, LittleLong, LittleShort, MAX_MAP_LEAFS, Mem_PoolAllocTypeN, cBspLeaf_t::numleafbrushes, dBspLeaf_t::numleafbrushes, and MapTile::numleafs.
Referenced by CM_LoadBsp().
Loads the lightmap for server side visibility lookup.
Definition at line 576 of file bsp.cpp.
References com_cmodelSysPool, lump_t::filelen, lump_t::fileofs, MapTile::lightdata, and Mem_PoolAllocTypeN.
Referenced by CM_AddMapTile().
|
static |
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
| [in] | shift | The shifting vector in case this is a map assemble |
Definition at line 123 of file bsp.cpp.
References cBspNode_t::children, dBspNode_t::children, CMod_ValidateLump(), com_cmodelSysPool, count, lump_t::fileofs, i, LittleLong, LittleShort, MAX_MAP_NODES, cBspNode_t::maxs, dBspNode_t::maxs, Mem_PoolAllocTypeN, cBspNode_t::mins, dBspNode_t::mins, MapTile::nodes, MapTile::numnodes, cBspNode_t::plane, dBspNode_t::planenum, PLANENUM_LEAF, MapTile::planes, and shift.
Referenced by CM_LoadBsp().
|
static |
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
| [in] | shift | The shifting vector in case this is a map assemble |
Definition at line 224 of file bsp.cpp.
References CMod_ValidateLump(), com_cmodelSysPool, count, cBspPlane_t::dist, dBspPlane_t::dist, lump_t::fileofs, i, LittleFloat, LittleLong, MAX_MAP_PLANES, Mem_PoolAllocTypeN, cBspPlane_t::normal, dBspPlane_t::normal, MapTile::numplanes, MapTile::planes, shift, cBspPlane_t::type, and dBspPlane_t::type.
Referenced by CM_LoadBsp().
|
static |
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | mapData | The loaded data is stored here. |
| [in] | name | The name of the maptile |
| [in] | lump | 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 380 of file bsp.cpp.
References ACTOR_MAX_SIZE, CMod_DeCompressRouting(), Com_DPrintf(), Com_Error(), DEBUG_ROUTING, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, MapTile::idx, length, LittleLong, mapData, Mem_Alloc, Mem_Free, name, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, ROUTING_NOT_REACHABLE, MapTile::wpMaxs, and MapTile::wpMins.
Referenced by CM_AddMapTile().
|
static |
Loads brush entities like func_door and func_breakable.
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | The lump to load the data from |
| [in] | shift | The shifting vector in case this is a map assemble |
Definition at line 68 of file bsp.cpp.
References cBspModel_t::cbmBox, CMod_ValidateLump(), com_cmodelSysPool, count, dBspModel_t::dbmBox, AABB::expand(), lump_t::fileofs, cBspModel_t::headnode, dBspModel_t::headnode, i, MapTile::idx, LittleLong, MAX_MAP_MODELS, Mem_PoolAllocTypeN, MapTile::models, MapTile::nummodels, AABB::setFromLittleFloat(), AABB::shift(), cBspModel_t::shift, shift, cBspModel_t::tile, and VectorCopy.
Referenced by CM_LoadBsp().
| [in] | tile | Stores the data of the map tile |
| [in] | base | The start of the data loaded from the file. |
| [in] | lump | descriptor of the data block we are working on |
Definition at line 97 of file bsp.cpp.
References CMod_ValidateLump(), com_cmodelSysPool, count, lump_t::fileofs, i, LittleLong, MAX_MAP_TEXINFO, Mem_PoolAllocTypeN, cBspSurface_t::name, MapTile::numtexinfo, Q_strncpyz(), cBspSurface_t::surfaceFlags, dBspTexinfo_t::surfaceFlags, MapTile::surfaces, and dBspTexinfo_t::texture.
Referenced by CM_LoadBsp().
|
static |
Recalculate the seams of the tiles after an RMA.
Definition at line 745 of file bsp.cpp.
References ACTOR_MAX_SIZE, ACTOR_SIZE_INVALID, GridBox::clipToMaxBoundaries(), Com_Printf(), CORE_DIRECTIONS, dvecs, GridBox::getMaxX(), GridBox::getMaxY(), GridBox::getMaxZ(), GridBox::getMinX(), GridBox::getMinY(), GridBox::getMinZ(), mapData, mapTiles, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, ROUTING_NOT_REACHABLE, RT_CheckCell(), and RT_UpdateConnectionColumn().
Referenced by CM_LoadMap().
|
static |
Definition at line 41 of file bsp.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_ENGINE, ERR_DROP, lump_t::filelen, S_COLOR_GREEN, and UFO_SIZE_T.
Referenced by CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadSubmodels(), and CMod_LoadSurfaces().
|
static |
Definition at line 33 of file bsp.cpp.
Referenced by CM_InitBoxHull().