replace drawSurfRef_t

This commit is contained in:
Garux
2025-11-30 20:08:52 +05:00
parent 0c557f7dff
commit 37c0494725
3 changed files with 8 additions and 26 deletions
+1 -8
View File
@@ -971,13 +971,6 @@ struct mapDrawSurface_t : public mapDrawSurface_t_params
};
struct drawSurfRef_t
{
drawSurfRef_t *nextRef;
int outputNum;
};
struct epair_t
{
CopiedString key, value;
@@ -1072,7 +1065,7 @@ struct node_t
int cluster; /* for portalfile writing */
int area; /* for areaportals */
brushlist_t brushlist; /* fragments of all brushes in this leaf */
drawSurfRef_t *drawSurfReferences;
std::vector<int> drawSurfReferences; /* int outputNum of bspDrawSurface_t*/
int occupied; /* 1 or greater can reach entity */
const entity_t *occupant; /* for leak file testing */
+5 -14
View File
@@ -1455,28 +1455,19 @@ void ClipSidesIntoTree( entity_t& e, const tree_t& tree ){
*/
static int AddReferenceToLeaf( mapDrawSurface_t& ds, node_t *node ){
drawSurfRef_t *dsr;
const int numBSPDrawSurfaces = bspDrawSurfaces.size();
/* dummy check */
if ( node->planenum != PLANENUM_LEAF || node->opaque ) {
return 0;
}
const int numBSPDrawSurfaces = bspDrawSurfaces.size();
/* try to find an existing reference */
for ( dsr = node->drawSurfReferences; dsr; dsr = dsr->nextRef )
{
if ( dsr->outputNum == numBSPDrawSurfaces ) {
return 0;
}
}
if( std::ranges::find( node->drawSurfReferences, numBSPDrawSurfaces ) != node->drawSurfReferences.cend() )
return 0;
/* add a new reference */
dsr = safe_malloc( sizeof( *dsr ) );
dsr->outputNum = numBSPDrawSurfaces;
dsr->nextRef = node->drawSurfReferences;
node->drawSurfReferences = dsr;
node->drawSurfReferences.push_back( numBSPDrawSurfaces );
/* ydnar: sky/skybox surfaces */
if ( node->skybox ) {
+2 -4
View File
@@ -142,10 +142,8 @@ static void EmitLeaf( node_t *node ){
/* add the drawSurfRef_t drawsurfs */
leaf.firstBSPLeafSurface = bspLeafSurfaces.size();
for ( const drawSurfRef_t *dsr = node->drawSurfReferences; dsr; dsr = dsr->nextRef )
{
bspLeafSurfaces.push_back( dsr->outputNum );
}
bspLeafSurfaces.insert( bspLeafSurfaces.cend(), node->drawSurfReferences.cbegin(), node->drawSurfReferences.cend() );
leaf.numBSPLeafSurfaces = bspLeafSurfaces.size() - leaf.firstBSPLeafSurface;
}