コード例 #1
0
ファイル: DMap.cpp プロジェクト: Triang3l/netradiant
	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
ファイル: misc.cpp プロジェクト: ensiform/GtkRadiant
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
ファイル: misc.cpp プロジェクト: clbr/netradiant
  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
ファイル: funchandlers-GTK.cpp プロジェクト: TTimo/GtkRadiant
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
ファイル: DTreePlanter.cpp プロジェクト: raynorpat/cake
  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
ファイル: DMap.cpp プロジェクト: 0bsidian/GtkRadiant
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();
		}
	}
}