From 3ca15250e86645e1f3560f8eeac2be02f2bb5b7b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 27 May 2024 13:21:04 +0300 Subject: [PATCH] engine: common: use Mod_PointInLeaf in Mod_GetPVSForPoint instead of traversing nodes manually --- engine/common/mod_bmodel.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 33e9e2ac..3f818692 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -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 );