/* ============= 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); }
//=========================================================================== // 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
/* ============= 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++; }
//=========================================================================== // Mark each leaf with an area, bounded by CONTENTS_AREAPORTAL // // Parameter: - // Returns: - // Changes Globals: - //=========================================================================== void FloodAreas(tree_t *tree) { Log_Print("--- FloodAreas ---\n"); FindAreas_r(tree->headnode); SetAreaPortalAreas_r(tree->headnode); Log_Print("%5i areas\n", c_areas); } //end of the function FloodAreas
/* ============= FloodAreas Mark each leaf with an area, bounded by CONTENTS_AREAPORTAL ============= */ void FloodAreas (tree_t *tree) { qprintf ("--- FloodAreas ---\n"); FindAreas_r (tree->headnode); SetAreaPortalAreas_r (tree->headnode); qprintf ("%5i areas\n", 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++; }
/* * @brief Mark each leaf with an area, bounded by CONTENTS_AREA_PORTAL */ void FloodAreas(tree_t *tree) { Com_Verbose("--- FloodAreas ---\n"); FindAreas_r(tree->head_node); SetAreaPortalAreas_r(tree->head_node); Com_Verbose("%5i areas\n", c_areas); }
/* ============= FloodAreas Mark each leaf with an area, bounded by CONTENTS_AREAPORTAL ============= */ void FloodAreas (tree_t *tree) { int start = Plat_FloatTime(); qprintf ("--- FloodAreas ---\n"); Msg("Processing areas..."); FindAreas_r (tree->headnode); SetAreaPortalAreas_r (tree, tree->headnode); qprintf ("%5i areas\n", c_areas); Msg("done (%d)\n", (int)(Plat_FloatTime() - start) ); }
void FloodAreas( tree_t *tree ) { Sys_FPrintf( SYS_VRB,"--- FloodAreas ---\n" ); FindAreas_r( tree->headnode ); /* ydnar: flood all skybox nodes */ FloodSkyboxArea_r( tree->headnode ); /* check for areaportal brushes that don't touch two areas */ /* ydnar: fix this rather than just silence the warnings */ //% CheckAreas_r( tree->headnode ); Sys_FPrintf( SYS_VRB, "%9d areas\n", c_areas ); }
/* ============= 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 ); } }