//=========================================================================== // 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 SetAreaPortalAreas_r(node_t *node) { bspbrush_t *b; entity_t *e; if(node->planenum != PLANENUM_LEAF) { SetAreaPortalAreas_r(node->children[0]); SetAreaPortalAreas_r(node->children[1]); return; } //end if if(node->contents == CONTENTS_AREAPORTAL) { if(node->area) { return; // allready set } b = node->brushlist; e = &entities[b->original->entitynum]; node->area = e->portalareas[0]; if(!e->portalareas[1]) { Log_Print("WARNING: areaportal entity %i doesn't touch two areas\n", b->original->entitynum); return; } //end if } //end if } //end of the function SetAreaPortalAreas_r
/* ============= SetAreaPortalAreas_r Just decend the tree, and for each node that hasn't had an area set, flood fill out from there ============= */ void SetAreaPortalAreas_r (tree_t *tree, node_t *node) { bspbrush_t *b; entity_t *e; if (node->planenum != PLANENUM_LEAF) { SetAreaPortalAreas_r (tree, node->children[0]); SetAreaPortalAreas_r (tree, node->children[1]); return; } if (IsAreaportalNode(node)) { if (node->area) return; // already set b = AreaportalBrushForNode( node ); e = &entities[b->original->entitynum]; node->area = e->portalareas[0]; if (!e->portalareas[1]) { ReportAreaportalLeak( tree, node ); Warning("\nBrush %i: areaportal brush doesn't touch two areas\n", b->original->id); return; } } }
//=========================================================================== // 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); }
/* * @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) ); }
/* * ============= * SetAreaPortalAreas_r * * Just decend the tree, and for each node that hasn't had an * area set, flood fill out from there * ============= */ static void SetAreaPortalAreas_r(node_t *node) { bsp_brush_t *b; entity_t *e; if (node->plane_num != PLANENUM_LEAF) { SetAreaPortalAreas_r(node->children[0]); SetAreaPortalAreas_r(node->children[1]); return; } if (node->contents == CONTENTS_AREA_PORTAL) { if (node->area) return; // already set b = node->brushes; e = &entities[b->original->entity_num]; node->area = e->portal_areas[0]; if (!e->portal_areas[1]) { Com_Verbose("WARNING: areaportal entity %i doesn't touch two areas\n", b->original->entity_num); return; } } }