Пример #1
0
	bool pre( scene::Node& node ) const {
		if ( Node_isEntity( node ) ) {
			DEntity* loadEntity = m_map->AddEntity( "", 0 );
			loadEntity->LoadFromEntity( node, m_bLoadPatches );
		}
		return false;
	}
Пример #2
0
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();
}
Пример #3
0
  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);
		}
  }
Пример #4
0
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;
}
Пример #5
0
  void operator()(scene::Instance& instance) const
  {
    if(!instance.isSelected())
    {
      return;
    }
		ent.LoadFromEntity(instance.path().top());

		DEPair* pEpair = ent.FindEPairByKey("origin");
		if(!pEpair) {
			return;
		}

		vec3_t vec, out;
		sscanf( pEpair->value.GetBuffer(), "%f %f %f", &vec[0], &vec[1], &vec[2]);

		planter.FindDropPoint( vec, out );

		char buffer[256];
		sprintf( buffer, "%f %f %f", out[0], out[1], out[2] );
		ent.AddEPair( "origin", buffer );
		ent.RemoveFromRadiant();
		ent.BuildInRadiant(false);
  }
Пример #6
0
void DMap::LoadAll( bool bLoadPatches ){
	ClearEntities();

	g_FuncTable.m_pfnDeselectAllBrushes();

	int count = g_FuncTable.m_pfnGetEntityCount();

	for ( int i = 0; i < count; i++ )
	{
		DEntity* loadEntity;

		if ( i == 0 ) {
			loadEntity = GetWorldSpawn();
		}
		else{
			loadEntity = AddEntity( "", m_nNextEntity++ );
		}

		if ( !loadEntity->LoadFromEntity( i, bLoadPatches ) ) {
			delete loadEntity;
			entityList.pop_back();
		}
	}
}