/*
=============
FloodAreas_r
=============
*/
void FloodAreas_r( node_t *node ) {
	uPortal_t	*p;
	int			s;
	if( node->area != -1 ) {
		return;		// allready got it
	}
	if( node->opaque ) {
		return;
	}
	c_areaFloods++;
	node->area = c_areas;
	for( p = node->portals ; p ; p = p->next[s] ) {
		node_t	*other;
		s = ( p->nodes[1] == node );
		other = p->nodes[!s];
		if( !Portal_Passable( p ) ) {
			continue;
		}
		// can't flood through an area portal
		if( FindSideForPortal( p ) ) {
			continue;
		}
		FloodAreas_r( other );
	}
}
Example #2
0
/*
=============
FindAreas_r

Just decend the tree, and for each node that hasn't had an
area set, flood fill out from there
=============
*/
void FindAreas_r (node_t *node)
{
	if (node->planenum != PLANENUM_LEAF)
	{
		FindAreas_r (node->children[0]);
		FindAreas_r (node->children[1]);
		return;
	}

	if (node->area)
		return;		// allready got it

	if (node->contents & CONTENTS_SOLID)
		return;

	if (!node->occupied)
		return;			// not reachable by entities

	// area portals are allways only flooded into, never
	// out of
	if (IsAreaportalNode(node))
		return;

	c_areas++;
	FloodAreas_r (node, NULL);
}
Example #3
0
//===========================================================================
// Just decend the tree, and for each node that hasn't had an
// area set, flood fill out from there
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void FindAreas_r( node_t *node ) {
	if ( node->planenum != PLANENUM_LEAF ) {
		FindAreas_r( node->children[0] );
		FindAreas_r( node->children[1] );
		return;
	}

	if ( node->area ) {
		return;     // allready got it

	}
	if ( node->contents & CONTENTS_SOLID ) {
		return;
	}

	if ( !node->occupied ) {
		return;         // not reachable by entities

	}
	// area portals are allways only flooded into, never
	// out of
	if ( node->contents == CONTENTS_AREAPORTAL ) {
		return;
	}

	c_areas++;
	FloodAreas_r( node );
} //end of the function FindAreas_r
Example #4
0
void FloodAreas_r( node_t *node )
{
    int			s;
    portal_t	*p;
    brush_t		*b;


    if( node->areaportal )
    {
        if( node->area == -1 )
            node->area = c_areas;

        /* this node is part of an area portal brush */
        b = node->brushlist->original;

        /* if the current area has already touched this portal, we are done */
        if( b->portalareas[ 0 ] == c_areas || b->portalareas[ 1 ] == c_areas )
            return;

        // note the current area as bounding the portal
        if( b->portalareas[ 1 ] != -1 )
        {
            Sys_Printf( "WARNING: areaportal brush %i touches > 2 areas\n", b->brushNum );
            return;
        }
        if( b->portalareas[ 0 ] != -1 )
            b->portalareas[ 1 ] = c_areas;
        else
            b->portalareas[ 0 ] = c_areas;

        return;
    }

    if( node->area != -1 )
        return;
    if( node->cluster == -1 )
        return;

    node->area = c_areas;

    /* ydnar: skybox nodes set the skybox area */
    if( node->skybox )
        skyboxArea = c_areas;

    for( p = node->portals; p; p = p->next[ s ] )
    {
        s = (p->nodes[1] == node);

        /* ydnar: allow areaportal portals to block area flow */
        if( p->compileFlags & C_AREAPORTAL )
            continue;

        if( !PortalPassable( p ) )
            continue;

        FloodAreas_r( p->nodes[ !s ] );
    }
}
Example #5
0
void FloodAreas_r (node_t *node, portal_t *pSeeThrough)
{
	portal_t	*p;
	int			s;
	bspbrush_t	*b;
	entity_t	*e;

	if ( IsAreaportalNode(node) )
	{
		// this node is part of an area portal
		b = AreaportalBrushForNode( node );
		e = &entities[b->original->entitynum];

		// if the current area has allready touched this
		// portal, we are done
		if (e->portalareas[0] == c_areas || e->portalareas[1] == c_areas)
			return;

		// note the current area as bounding the portal
		if (e->portalareas[1])
		{
			Warning("WARNING: areaportal entity %i (brush %i) touches > 2 areas\n", b->original->entitynum, b->original->id );
			return;
		}
		
		if (e->portalareas[0])
		{
			e->portalareas[1] = c_areas;
			e->m_pPortalsLeadingIntoAreas[1] = pSeeThrough;
		}
		else
		{
			e->portalareas[0] = c_areas;
			e->m_pPortalsLeadingIntoAreas[0] = pSeeThrough;
		}

		return;
	}

	if (node->area)
		return;		// allready got it
	node->area = c_areas;

	for (p=node->portals ; p ; p = p->next[s])
	{
		s = (p->nodes[1] == node);
#if 0
		if (p->nodes[!s]->occupied)
			continue;
#endif
		if (!Portal_EntityFlood (p, s))
			continue;

		FloodAreas_r (p->nodes[!s], p);
	}
}
Example #6
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
void FloodAreas_r( node_t *node ) {
	portal_t    *p;
	int s;
	bspbrush_t  *b;
	entity_t    *e;

	if ( node->contents == CONTENTS_AREAPORTAL ) {
		// this node is part of an area portal
		b = node->brushlist;
		e = &entities[b->original->entitynum];

		// if the current area has allready touched this
		// portal, we are done
		if ( e->portalareas[0] == c_areas || e->portalareas[1] == c_areas ) {
			return;
		}

		// note the current area as bounding the portal
		if ( e->portalareas[1] ) {
			Log_Print( "WARNING: areaportal entity %i touches > 2 areas\n", b->original->entitynum );
			return;
		}
		if ( e->portalareas[0] ) {
			e->portalareas[1] = c_areas;
		} else {
			e->portalareas[0] = c_areas;
		}

		return;
	} //end if

	if ( node->area ) {
		return;     // allready got it
	}
	node->area = c_areas;

	for ( p = node->portals ; p ; p = p->next[s] )
	{
		s = ( p->nodes[1] == node );
#if 0
		if ( p->nodes[!s]->occupied ) {
			continue;
		}
#endif
		if ( !Portal_EntityFlood( p, s ) ) {
			continue;
		}

		FloodAreas_r( p->nodes[!s] );
	} //end for
} //end of the function FloodAreas_r
Example #7
0
/*
=============
FindAreas_r

Just decend the tree, and for each node that hasn't had an
area set, flood fill out from there
=============
*/
void FindAreas_r( node_t *node )
{
    if( node->planenum != PLANENUM_LEAF )
    {
        FindAreas_r( node->children[ 0 ] );
        FindAreas_r( node->children[ 1 ] );
        return;
    }

    if( node->opaque || node->areaportal || node->area != -1 )
        return;

    FloodAreas_r( node );
    c_areas++;
}
/*
=============
FindAreas_r

Just decend the tree, and for each node that hasn't had an
area set, flood fill out from there
=============
*/
void FindAreas_r( node_t *node ) {
	if( node->planenum != PLANENUM_LEAF ) {
		FindAreas_r( node->children[0] );
		FindAreas_r( node->children[1] );
		return;
	}
	if( node->opaque ) {
		return;
	}
	if( node->area != -1 ) {
		return;		// allready got it
	}
	c_areaFloods = 0;
	FloodAreas_r( node );
	common->Printf( "area %i has %i leafs\n", c_areas, c_areaFloods );
	c_areas++;
}
Example #9
0
/*
 * @brief
 */
static void FloodAreas_r(node_t * node) {
    portal_t *p;
    int32_t s;

    if (node->contents == CONTENTS_AREA_PORTAL) {
        // this node is part of an area portal
        const bsp_brush_t *b = node->brushes;
        entity_t *e = &entities[b->original->entity_num];

        // if the current area has already touched this
        // portal, we are done
        if (e->portal_areas[0] == c_areas || e->portal_areas[1] == c_areas)
            return;

        // note the current area as bounding the portal
        if (e->portal_areas[1]) {
            Com_Verbose("WARNING: areaportal entity %i touches > 2 areas\n",
                        b->original->entity_num);
            return;
        }
        if (e->portal_areas[0])
            e->portal_areas[1] = c_areas;
        else
            e->portal_areas[0] = c_areas;

        return;
    }

    if (node->area)
        return; // already got it
    node->area = c_areas;

    for (p = node->portals; p; p = p->next[s]) {
        s = (p->nodes[1] == node);
        // TODO: why is this commented out?
#if 0
        if(points->nodes[!s]->occupied)
            continue;
#endif
        if (!Portal_EntityFlood(p))
            continue;

        FloodAreas_r(p->nodes[!s]);
    }
}