void BuildMiniPrt( list<Str>* exclusionList ) { // yes, we could just use -fulldetail option, but, as SPOG said // it'd be faster without all the hint, donotenter etc textures and // doors, etc DEntity world; char buffer[128]; const char *pn = g_FuncTable.m_pfnReadProjectKey( "mapspath" ); strcpy( buffer, pn ); strcat( buffer, "/ac_prt.map" ); FILE* pFile = fopen( buffer, "w" ); // ahem, thx rr2 if ( !pFile ) { return; } int count = g_FuncTable.m_pfnGetEntityCount(); for ( int i = 0; i < count; i++ ) { entity_t* ent = (entity_t*)g_FuncTable.m_pfnGetEntityHandle( i ); epair_t* epl = *g_EntityTable.m_pfnGetEntityKeyValList( ent ); epair_t* ep = epl; while ( ep ) { if ( !strcmp( ep->key, "classname" ) ) { if ( !strcmp( ep->value, "worldspawn" ) ) { world.LoadFromEntity( i, FALSE ); world.RemoveNonCheckBrushes( exclusionList, TRUE ); world.SaveToFile( pFile ); } else if ( strstr( ep->value, "info_" ) ) { world.ClearBrushes(); world.ClearEPairs(); world.LoadEPairList( epl ); world.SaveToFile( pFile ); } break; } ep = ep->next; } } fclose( pFile ); StartBSP(); }
void operator()(scene::Instance& instance) const { const char* classname = Node_getEntity(instance.path().top())->getKeyValue("classname"); if(!strcmp(classname, "worldspawn")) { world.LoadFromEntity(instance.path().top(), false); world.RemoveNonCheckBrushes(exclusionList, true); world.SaveToFile(pFile); } else if(strstr(classname, "info_")) { world.ClearBrushes(); world.ClearEPairs(); world.LoadEPairList(Node_getEntity(instance.path().top())); world.SaveToFile(pFile); } }
void DoIntersect(){ IntersectRS rs; if ( DoIntersectBox( &rs ) == IDCANCEL ) { return; } if ( rs.nBrushOptions == BRUSH_OPT_SELECTED ) { if ( g_FuncTable.m_pfnSelectedBrushCount() < 2 ) { DoMessageBox( "Invalid number of brushes selected, choose at least 2", "Error", MB_OK ); return; } } DEntity world; switch ( rs.nBrushOptions ) { case BRUSH_OPT_SELECTED: { world.LoadSelectedBrushes(); break; } case BRUSH_OPT_WHOLE_MAP: { world.LoadFromEntity( 0, FALSE ); break; } } world.RemoveNonCheckBrushes( &exclusionList, rs.bUseDetail ); bool* pbSelectList; if ( rs.bDuplicateOnly ) { pbSelectList = world.BuildDuplicateList(); } else{ pbSelectList = world.BuildIntersectList(); } world.SelectBrushes( pbSelectList ); delete[] pbSelectList; }