2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-25 19:30:08 +01:00

engine: common: use Mod_PointInLeaf in Mod_GetPVSForPoint instead of traversing nodes manually

This commit is contained in:
Alibek Omarov 2024-05-27 13:21:04 +03:00
parent 6cbac51731
commit 3ca15250e8

View File

@ -684,22 +684,11 @@ NOTE: can return NULL
*/
byte *Mod_GetPVSForPoint( const vec3_t p )
{
mnode_t *node;
mleaf_t *leaf = NULL;
mleaf_t *leaf;
ASSERT( worldmodel != NULL );
node = worldmodel->nodes;
while( 1 )
{
if( node->contents < 0 )
{
leaf = (mleaf_t *)node;
break; // we found a leaf
}
node = node->children[PlaneDiff( p, node->plane ) <= 0];
}
leaf = Mod_PointInLeaf( p, worldmodel->nodes );
if( leaf && leaf->cluster >= 0 )
return Mod_DecompressPVS( leaf->compressed_vis, world.visbytes );