/* =================== R_FreeDerivedData ReloadModels and RegenerateWorld call this =================== */ void R_FreeDerivedData() { for( int j = 0; j < tr.worlds.Num(); j++ ) { idRenderWorldLocal* rw = tr.worlds[j]; for( int i = 0; i < rw->entityDefs.Num(); i++ ) { idRenderEntityLocal* def = rw->entityDefs[i]; if( def == NULL ) { continue; } R_FreeEntityDefDerivedData( def, false, false ); } for( int i = 0; i < rw->lightDefs.Num(); i++ ) { idRenderLightLocal* light = rw->lightDefs[i]; if( light == NULL ) { continue; } R_FreeLightDefDerivedData( light ); } } }
/* ================ FreeDMapFile ================ */ void FreeDMapFile( void ) { int i, j; FreeBrush( buildBrush ); buildBrush = NULL; // free the entities and brushes for( i = 0; i < dmapGlobals.num_entities; i++ ) { uEntity_t *ent; primitive_t *prim, *nextPrim; ent = &dmapGlobals.uEntities[i]; FreeTree( ent->tree ); // free primitives for( prim = ent->primitives; prim; prim = nextPrim ) { nextPrim = prim->next; if( prim->brush ) { FreeBrush( prim->brush ); } if( prim->tris ) { FreeTriList( prim->tris ); } Mem_Free( prim ); } // free area surfaces if( ent->areas ) { for( j = 0; j < ent->numAreas; j++ ) { uArea_t *area; area = &ent->areas[j]; FreeOptimizeGroupList( area->groups ); } Mem_Free( ent->areas ); } } Mem_Free( dmapGlobals.uEntities ); dmapGlobals.num_entities = 0; // free the map lights for( i = 0; i < dmapGlobals.mapLights.Num(); i++ ) { R_FreeLightDefDerivedData( &dmapGlobals.mapLights[i]->def ); } dmapGlobals.mapLights.DeleteContents( true ); }