#include "cm_local.h"
Include dependency graph for cm_load.c:

Go to the source code of this file.
|
|
Definition at line 46 of file cm_load.c. Referenced by CMod_LoadBrushes(), and CMod_LoadLeafBrushes(). |
|
|
Definition at line 48 of file cm_load.c. Referenced by CMod_LoadLeafs(). |
|
|
Definition at line 49 of file cm_load.c. Referenced by CMod_LoadPlanes(). |
|
|
Definition at line 47 of file cm_load.c. Referenced by CMod_LoadBrushSides(). |
|
|
Definition at line 51 of file cm_load.c. Referenced by R_LoadMD3(), and R_LoadMD4(). |
|
|
|
|
|
Definition at line 454 of file cm_load.c. Referenced by CMod_LoadVisibility(). |
|
|
Definition at line 215 of file cm_load.c. References b, cbrush_t::bounds, cplane_s::dist, cbrushside_t::plane, and cbrush_t::sides. Referenced by CMod_LoadBrushes(). 00215 {
00216 b->bounds[0][0] = -b->sides[0].plane->dist;
00217 b->bounds[1][0] = b->sides[1].plane->dist;
00218
00219 b->bounds[0][1] = -b->sides[2].plane->dist;
00220 b->bounds[1][1] = b->sides[3].plane->dist;
00221
00222 b->bounds[0][2] = -b->sides[4].plane->dist;
00223 b->bounds[1][2] = b->sides[5].plane->dist;
00224 }
|
|
|
Definition at line 545 of file cm_load.c. References CM_LumpChecksum(), Com_BlockChecksum(), header, LittleLong(), LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_DRAWVERTS, LUMP_LEAFBRUSHES, LUMP_LEAFS, LUMP_LEAFSURFACES, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_SHADERS, LUMP_SURFACES, and dheader_t::lumps. 00545 {
00546 unsigned checksums[16];
00547 checksums[0] = CM_LumpChecksum(&header->lumps[LUMP_SHADERS]);
00548 checksums[1] = CM_LumpChecksum(&header->lumps[LUMP_LEAFS]);
00549 checksums[2] = CM_LumpChecksum(&header->lumps[LUMP_LEAFBRUSHES]);
00550 checksums[3] = CM_LumpChecksum(&header->lumps[LUMP_LEAFSURFACES]);
00551 checksums[4] = CM_LumpChecksum(&header->lumps[LUMP_PLANES]);
00552 checksums[5] = CM_LumpChecksum(&header->lumps[LUMP_BRUSHSIDES]);
00553 checksums[6] = CM_LumpChecksum(&header->lumps[LUMP_BRUSHES]);
00554 checksums[7] = CM_LumpChecksum(&header->lumps[LUMP_MODELS]);
00555 checksums[8] = CM_LumpChecksum(&header->lumps[LUMP_NODES]);
00556 checksums[9] = CM_LumpChecksum(&header->lumps[LUMP_SURFACES]);
00557 checksums[10] = CM_LumpChecksum(&header->lumps[LUMP_DRAWVERTS]);
00558
00559 return LittleLong(Com_BlockChecksum(checksums, 11 * 4));
00560 }
|
Here is the call graph for this function:

|
|
Definition at line 665 of file cm_load.c. References cm, CM_ClearLevelPatches(), and Com_Memset(). Referenced by CL_FlushMemory(), and SV_SpawnServer(). 00665 {
00666 Com_Memset( &cm, 0, sizeof( cm ) );
00667 CM_ClearLevelPatches();
00668 }
|
Here is the call graph for this function:

|
|
Definition at line 675 of file cm_load.c. References cm, cmodel_t, clipMap_t::cmodels, Com_Error(), ERR_DROP, MAX_SUBMODELS, and clipMap_t::numSubModels. Referenced by CM_ModelBounds(), CM_PointContents(), CM_TestBoundingBoxInCapsule(), CM_Trace(), and CM_TraceBoundingBoxThroughCapsule(). 00675 {
00676 if ( handle < 0 ) {
00677 Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i", handle );
00678 }
00679 if ( handle < cm.numSubModels ) {
00680 return &cm.cmodels[handle];
00681 }
00682 if ( handle == BOX_MODEL_HANDLE ) {
00683 return &box_model;
00684 }
00685 if ( handle < MAX_SUBMODELS ) {
00686 Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i < %i < %i",
00687 cm.numSubModels, handle, MAX_SUBMODELS );
00688 }
00689 Com_Error( ERR_DROP, "CM_ClipHandleToModel: bad handle %i", handle + MAX_SUBMODELS );
00690
00691 return NULL;
00692
00693 }
|
Here is the call graph for this function:

|
|
Definition at line 715 of file cm_load.c. References cm, and clipMap_t::entityString. Referenced by BotImport_BSPEntityData(), and SV_InitGameVM(). 00715 {
00716 return cm.entityString;
00717 }
|
|
|
Definition at line 359 of file cm_test.c. References clipMap_t::areas, cm, CM_FloodArea_r(), clipMap_t::floodvalid, cArea_t::floodvalid, i, and clipMap_t::numAreas. Referenced by CM_AdjustAreaPortalState(), and CM_LoadMap(). 00359 {
00360 int i;
00361 cArea_t *area;
00362 int floodnum;
00363
00364 // all current floods are now invalid
00365 cm.floodvalid++;
00366 floodnum = 0;
00367
00368 for (i = 0 ; i < cm.numAreas ; i++) {
00369 area = &cm.areas[i];
00370 if (area->floodvalid == cm.floodvalid) {
00371 continue; // already flooded into
00372 }
00373 floodnum++;
00374 CM_FloodArea_r (i, floodnum);
00375 }
00376
00377 }
|
Here is the call graph for this function:

|
Here is the call graph for this function:

|
|
Definition at line 700 of file cm_load.c. References clipHandle_t, cm, Com_Error(), ERR_DROP, and clipMap_t::numSubModels. Referenced by AAS_CalcReachAndClusters(), BotImport_BSPModelMinsMaxsOrigin(), CL_CgameSystemCalls(), SV_ClearWorld(), SV_ClipHandleForEntity(), and SV_SetBrushModel(). 00700 {
00701 if ( index < 0 || index >= cm.numSubModels ) {
00702 Com_Error (ERR_DROP, "CM_InlineModel: bad number");
00703 }
00704 return index;
00705 }
|
Here is the call graph for this function:

|
|
Definition at line 726 of file cm_load.c. References cLeaf_t::area, cm, Com_Error(), ERR_DROP, clipMap_t::leafs, and clipMap_t::numLeafs. Referenced by SV_AddEntitiesVisibleFromPoint(), SV_inPVS(), SV_inPVSIgnorePortals(), and SV_LinkEntity(). 00726 {
00727 if ( leafnum < 0 || leafnum >= cm.numLeafs ) {
00728 Com_Error (ERR_DROP, "CM_LeafArea: bad number");
00729 }
00730 return cm.leafs[leafnum].area;
00731 }
|
Here is the call graph for this function:

|
|
Definition at line 719 of file cm_load.c. References cLeaf_t::cluster, cm, Com_Error(), ERR_DROP, clipMap_t::leafs, and clipMap_t::numLeafs. Referenced by SV_AddEntitiesVisibleFromPoint(), SV_inPVS(), SV_inPVSIgnorePortals(), and SV_LinkEntity(). 00719 {
00720 if (leafnum < 0 || leafnum >= cm.numLeafs) {
00721 Com_Error (ERR_DROP, "CM_LeafCluster: bad number");
00722 }
00723 return cm.leafs[leafnum].cluster;
00724 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 569 of file cm_load.c. References BSP_VERSION, byte, cm, CM_ClearLevelPatches(), CM_FloodAreaConnections(), CM_InitBoxHull(), cm_noAreas, cm_noCurves, cm_playerCurveClip, cmod_base, CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadEntityString(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadLeafSurfaces(), CMod_LoadNodes(), CMod_LoadPatches(), CMod_LoadPlanes(), CMod_LoadShaders(), CMod_LoadSubmodels(), CMod_LoadVisibility(), clipMap_t::cmodels, Com_BlockChecksum(), Com_DPrintf(), Com_Error(), Com_Memset(), CVAR_ARCHIVE, CVAR_CHEAT, Cvar_Get(), ERR_DROP, FS_FreeFile(), FS_ReadFile(), h_high, header, Hunk_Alloc(), i, length(), LittleLong(), LoadQuakeFile(), LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_DRAWVERTS, LUMP_ENTITIES, LUMP_LEAFBRUSHES, LUMP_LEAFS, LUMP_LEAFSURFACES, LUMP_MODELS, LUMP_NODES, LUMP_PLANES, LUMP_SHADERS, LUMP_SURFACES, LUMP_VISIBILITY, dheader_t::lumps, name, clipMap_t::name, clipMap_t::numAreas, clipMap_t::numClusters, clipMap_t::numLeafs, Q_strncpyz(), quakefile_t, strcmp(), and dheader_t::version. Referenced by AAS_CalcReachAndClusters(), CL_CM_LoadMap(), and SV_SpawnServer(). 00569 {
00570 int *buf;
00571 int i;
00572 dheader_t header;
00573 int length;
00574 static unsigned last_checksum;
00575
00576 if ( !name || !name[0] ) {
00577 Com_Error( ERR_DROP, "CM_LoadMap: NULL name" );
00578 }
00579
00580 #ifndef BSPC
00581 cm_noAreas = Cvar_Get ("cm_noAreas", "0", CVAR_CHEAT);
00582 cm_noCurves = Cvar_Get ("cm_noCurves", "0", CVAR_CHEAT);
00583 cm_playerCurveClip = Cvar_Get ("cm_playerCurveClip", "1", CVAR_ARCHIVE|CVAR_CHEAT );
00584 #endif
00585 Com_DPrintf( "CM_LoadMap( %s, %i )\n", name, clientload );
00586
00587 if ( !strcmp( cm.name, name ) && clientload ) {
00588 *checksum = last_checksum;
00589 return;
00590 }
00591
00592 // free old stuff
00593 Com_Memset( &cm, 0, sizeof( cm ) );
00594 CM_ClearLevelPatches();
00595
00596 if ( !name[0] ) {
00597 cm.numLeafs = 1;
00598 cm.numClusters = 1;
00599 cm.numAreas = 1;
00600 cm.cmodels = Hunk_Alloc( sizeof( *cm.cmodels ), h_high );
00601 *checksum = 0;
00602 return;
00603 }
00604
00605 //
00606 // load the file
00607 //
00608 #ifndef BSPC
00609 length = FS_ReadFile( name, (void **)&buf );
00610 #else
00611 length = LoadQuakeFile((quakefile_t *) name, (void **)&buf);
00612 #endif
00613
00614 if ( !buf ) {
00615 Com_Error (ERR_DROP, "Couldn't load %s", name);
00616 }
00617
00618 last_checksum = LittleLong (Com_BlockChecksum (buf, length));
00619 *checksum = last_checksum;
00620
00621 header = *(dheader_t *)buf;
00622 for (i=0 ; i<sizeof(dheader_t)/4 ; i++) {
00623 ((int *)&header)[i] = LittleLong ( ((int *)&header)[i]);
00624 }
00625
00626 if ( header.version != BSP_VERSION ) {
00627 Com_Error (ERR_DROP, "CM_LoadMap: %s has wrong version number (%i should be %i)"
00628 , name, header.version, BSP_VERSION );
00629 }
00630
00631 cmod_base = (byte *)buf;
00632
00633 // load into heap
00634 CMod_LoadShaders( &header.lumps[LUMP_SHADERS] );
00635 CMod_LoadLeafs (&header.lumps[LUMP_LEAFS]);
00636 CMod_LoadLeafBrushes (&header.lumps[LUMP_LEAFBRUSHES]);
00637 CMod_LoadLeafSurfaces (&header.lumps[LUMP_LEAFSURFACES]);
00638 CMod_LoadPlanes (&header.lumps[LUMP_PLANES]);
00639 CMod_LoadBrushSides (&header.lumps[LUMP_BRUSHSIDES]);
00640 CMod_LoadBrushes (&header.lumps[LUMP_BRUSHES]);
00641 CMod_LoadSubmodels (&header.lumps[LUMP_MODELS]);
00642 CMod_LoadNodes (&header.lumps[LUMP_NODES]);
00643 CMod_LoadEntityString (&header.lumps[LUMP_ENTITIES]);
00644 CMod_LoadVisibility( &header.lumps[LUMP_VISIBILITY] );
00645 CMod_LoadPatches( &header.lumps[LUMP_SURFACES], &header.lumps[LUMP_DRAWVERTS] );
00646
00647 // we are NOT freeing the file, because it is cached for the ref
00648 FS_FreeFile (buf);
00649
00650 CM_InitBoxHull ();
00651
00652 CM_FloodAreaConnections ();
00653
00654 // allow this to be cached if it is loaded by the server
00655 if ( !clientload ) {
00656 Q_strncpyz( cm.name, name, sizeof( cm.name ) );
00657 }
00658 }
|
Here is the call graph for this function:

|
|
Definition at line 541 of file cm_load.c. References cmod_base, Com_BlockChecksum(), lump_t::filelen, lump_t::fileofs, and LittleLong(). Referenced by CM_Checksum(). 00541 {
00542 return LittleLong (Com_BlockChecksum (cmod_base + lump->fileofs, lump->filelen));
00543 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 831 of file cm_load.c. References CM_ClipHandleToModel(), cmodel_t, cmodel_s::maxs, cmodel_s::mins, and VectorCopy. Referenced by BotImport_BSPModelMinsMaxsOrigin(), CM_TestBoundingBoxInCapsule(), CM_TestCapsuleInCapsule(), CM_TraceBoundingBoxThroughCapsule(), CM_TraceCapsuleThroughCapsule(), SV_ClearWorld(), and SV_SetBrushModel(). 00831 {
00832 cmodel_t *cmod;
00833
00834 cmod = CM_ClipHandleToModel( model );
00835 VectorCopy( cmod->mins, mins );
00836 VectorCopy( cmod->maxs, maxs );
00837 }
|
Here is the call graph for this function:

|
|
Definition at line 707 of file cm_load.c. References cm, and clipMap_t::numClusters. 00707 {
00708 return cm.numClusters;
00709 }
|
|
|
Definition at line 711 of file cm_load.c. References cm, and clipMap_t::numSubModels. Referenced by CL_CgameSystemCalls(). 00711 {
00712 return cm.numSubModels;
00713 }
|
|
||||||||||||||||
|
Definition at line 798 of file cm_load.c. References cbrush_t::bounds, box_brush, box_model, box_planes, clipHandle_t, cplane_s::dist, cmodel_s::maxs, cmodel_s::mins, and VectorCopy. Referenced by CL_CgameSystemCalls(), CM_TestBoundingBoxInCapsule(), CM_TraceBoundingBoxThroughCapsule(), and SV_ClipHandleForEntity(). 00798 {
00799
00800 VectorCopy( mins, box_model.mins );
00801 VectorCopy( maxs, box_model.maxs );
00802
00803 if ( capsule ) {
00804 return CAPSULE_MODEL_HANDLE;
00805 }
00806
00807 box_planes[0].dist = maxs[0];
00808 box_planes[1].dist = -maxs[0];
00809 box_planes[2].dist = mins[0];
00810 box_planes[3].dist = -mins[0];
00811 box_planes[4].dist = maxs[1];
00812 box_planes[5].dist = -maxs[1];
00813 box_planes[6].dist = mins[1];
00814 box_planes[7].dist = -mins[1];
00815 box_planes[8].dist = maxs[2];
00816 box_planes[9].dist = -maxs[2];
00817 box_planes[10].dist = mins[2];
00818 box_planes[11].dist = -mins[2];
00819
00820 VectorCopy( mins, box_brush->bounds[0] );
00821 VectorCopy( maxs, box_brush->bounds[1] );
00822
00823 return BOX_MODEL_HANDLE;
00824 }
|
|
|
Definition at line 233 of file cm_load.c. References BOX_BRUSHES, clipMap_t::brushes, clipMap_t::brushsides, cm, CM_BoundBrush(), cmod_base, Com_Error(), dshader_t::contentFlags, count, ERR_DROP, lump_t::filelen, lump_t::fileofs, dbrush_t::firstSide, h_high, Hunk_Alloc(), i, in, l, LittleLong(), clipMap_t::numBrushes, clipMap_t::numShaders, dbrush_t::numSides, dbrush_t::shaderNum, cbrushside_t::shaderNum, clipMap_t::shaders, and cbrush_t::sides. Referenced by CM_LoadMap(). 00233 {
00234 dbrush_t *in;
00235 cbrush_t *out;
00236 int i, count;
00237
00238 in = (void *)(cmod_base + l->fileofs);
00239 if (l->filelen % sizeof(*in)) {
00240 Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
00241 }
00242 count = l->filelen / sizeof(*in);
00243
00244 cm.brushes = Hunk_Alloc( ( BOX_BRUSHES + count ) * sizeof( *cm.brushes ), h_high );
00245 cm.numBrushes = count;
00246
00247 out = cm.brushes;
00248
00249 for ( i=0 ; i<count ; i++, out++, in++ ) {
00250 out->sides = cm.brushsides + LittleLong(in->firstSide);
00251 out->numsides = LittleLong(in->numSides);
00252
00253 out->shaderNum = LittleLong( in->shaderNum );
00254 if ( out->shaderNum < 0 || out->shaderNum >= cm.numShaders ) {
00255 Com_Error( ERR_DROP, "CMod_LoadBrushes: bad shaderNum: %i", out->shaderNum );
00256 }
00257 out->contents = cm.shaders[out->shaderNum].contentFlags;
00258
00259 CM_BoundBrush( out );
00260 }
00261
00262 }
|
Here is the call graph for this function:

|
|
Definition at line 407 of file cm_load.c. References BOX_SIDES, clipMap_t::brushsides, cm, cmod_base, Com_Error(), count, ERR_DROP, lump_t::filelen, lump_t::fileofs, h_high, Hunk_Alloc(), i, in, l, LittleLong(), clipMap_t::numBrushSides, clipMap_t::numShaders, cbrushside_t::plane, clipMap_t::planes, cbrushside_t::shaderNum, clipMap_t::shaders, dshader_t::surfaceFlags, and cbrushside_t::surfaceFlags. Referenced by CM_LoadMap(). 00408 {
00409 int i;
00410 cbrushside_t *out;
00411 dbrushside_t *in;
00412 int count;
00413 int num;
00414
00415 in = (void *)(cmod_base + l->fileofs);
00416 if ( l->filelen % sizeof(*in) ) {
00417 Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
00418 }
00419 count = l->filelen / sizeof(*in);
00420
00421 cm.brushsides = Hunk_Alloc( ( BOX_SIDES + count ) * sizeof( *cm.brushsides ), h_high );
00422 cm.numBrushSides = count;
00423
00424 out = cm.brushsides;
00425
00426 for ( i=0 ; i<count ; i++, in++, out++) {
00427 num = LittleLong( in->planeNum );
00428 out->plane = &cm.planes[num];
00429 out->shaderNum = LittleLong( in->shaderNum );
00430 if ( out->shaderNum < 0 || out->shaderNum >= cm.numShaders ) {
00431 Com_Error( ERR_DROP, "CMod_LoadBrushSides: bad shaderNum: %i", out->shaderNum );
00432 }
00433 out->surfaceFlags = cm.shaders[out->shaderNum].surfaceFlags;
00434 }
00435 }
|
Here is the call graph for this function:

|
|
Definition at line 443 of file cm_load.c. References cm, cmod_base, Com_Memcpy(), clipMap_t::entityString, lump_t::filelen, lump_t::fileofs, h_high, Hunk_Alloc(), l, and clipMap_t::numEntityChars. Referenced by CM_LoadMap(). 00443 {
00444 cm.entityString = Hunk_Alloc( l->filelen, h_high );
00445 cm.numEntityChars = l->filelen;
00446 Com_Memcpy (cm.entityString, cmod_base + l->fileofs, l->filelen);
00447 }
|
Here is the call graph for this function:

|
|
Definition at line 353 of file cm_load.c. References BOX_BRUSHES, cm, cmod_base, Com_Error(), count, ERR_DROP, lump_t::filelen, lump_t::fileofs, h_high, Hunk_Alloc(), i, in, l, clipMap_t::leafbrushes, LittleLong(), and clipMap_t::numLeafBrushes. Referenced by CM_LoadMap(). 00354 {
00355 int i;
00356 int *out;
00357 int *in;
00358 int count;
00359
00360 in = (void *)(cmod_base + l->fileofs);
00361 if (l->filelen % sizeof(*in))
00362 Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
00363 count = l->filelen / sizeof(*in);
00364
00365 cm.leafbrushes = Hunk_Alloc( (count + BOX_BRUSHES) * sizeof( *cm.leafbrushes ), h_high );
00366 cm.numLeafBrushes = count;
00367
00368 out = cm.leafbrushes;
00369
00370 for ( i=0 ; i<count ; i++, in++, out++) {
00371 *out = LittleLong (*in);
00372 }
00373 }
|
Here is the call graph for this function:

|
|
Definition at line 269 of file cm_load.c. References cLeaf_t::area, clipMap_t::areaPortals, clipMap_t::areas, BOX_LEAFS, cLeaf_t::cluster, cm, cmod_base, Com_Error(), count, ERR_DROP, lump_t::filelen, lump_t::fileofs, cLeaf_t::firstLeafBrush, cLeaf_t::firstLeafSurface, h_high, Hunk_Alloc(), i, in, l, clipMap_t::leafs, LittleLong(), clipMap_t::numAreas, clipMap_t::numClusters, cLeaf_t::numLeafBrushes, clipMap_t::numLeafs, and cLeaf_t::numLeafSurfaces. Referenced by CM_LoadMap(). 00270 {
00271 int i;
00272 cLeaf_t *out;
00273 dleaf_t *in;
00274 int count;
00275
00276 in = (void *)(cmod_base + l->fileofs);
00277 if (l->filelen % sizeof(*in))
00278 Com_Error (ERR_DROP, "MOD_LoadBmodel: funny lump size");
00279 count = l->filelen / sizeof(*in);
00280
00281 if (count < 1)
00282 Com_Error (ERR_DROP, "Map with no leafs");
00283
00284 cm.leafs = Hunk_Alloc( ( BOX_LEAFS + count ) * sizeof( * |