Beispiel #1
0
/*
=============
CheckAreas_r
=============
*/
void CheckAreas_r (node_t *node)
{
    brush_t	*b;

    if (node->planenum != PLANENUM_LEAF)
    {
        CheckAreas_r (node->children[0]);
        CheckAreas_r (node->children[1]);
        return;
    }

    if (node->opaque)
        return;

    if (node->cluster != -1)
        if (node->area == -1)
            Sys_Printf("WARNING: cluster %d has area set to -1\n", node->cluster);
    if (node->areaportal)
    {
        b = node->brushlist->original;

        // check if the areaportal touches two areas
        if (b->portalareas[0] == -1 || b->portalareas[1] == -1)
            Sys_Printf ("WARNING: areaportal brush %i doesn't touch two areas\n", b->brushNum);
    }
}
/*
============
CheckAreas_r
============
*/
void CheckAreas_r( node_t *node ) {
	if( node->planenum != PLANENUM_LEAF ) {
		CheckAreas_r( node->children[0] );
		CheckAreas_r( node->children[1] );
		return;
	}
	if( !node->opaque && node->area < 0 ) {
		common->Error( "CheckAreas_r: area = %i", node->area );
	}
}
/*
=============
FloodAreas

Mark each leaf with an area, bounded by CONTENTS_AREAPORTAL
Sets e->areas.numAreas
=============
*/
void FloodAreas( uEntity_t *e ) {
	common->Printf( "--- FloodAreas ---\n" );
	// set all areas to -1
	ClearAreas_r( e->tree->headnode );
	// flood fill from non-opaque areas
	c_areas = 0;
	FindAreas_r( e->tree->headnode );
	common->Printf( "%5i areas\n", c_areas );
	e->numAreas = c_areas;
	// make sure we got all of them
	CheckAreas_r( e->tree->headnode );
	// identify all portals between areas if this is the world
	if( e == &dmapGlobals.uEntities[0] ) {
		numInterAreaPortals = 0;
		FindInterAreaPortals_r( e->tree->headnode );
	}
}