Beispiel #1
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();
}
Beispiel #2
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);
		}
  }
Beispiel #3
0
entity_s* FindEntityFromTargetname( const char* targetname, int* entNum ) {
    DEntity world;

    int count = g_FuncTable.m_pfnGetEntityCount();
    for ( int i = 0; i < count; i++ )
    {
        world.ClearEPairs();

        entity_s* ent = (entity_s*)g_FuncTable.m_pfnGetEntityHandle( i );

        world.LoadEPairList( *g_EntityTable.m_pfnGetEntityKeyValList( ent ) );

        DEPair* tn = world.FindEPairByKey( "targetname" );
        if ( tn ) {
            if ( !stricmp( tn->value, targetname ) ) {
                if ( entNum ) {
                    *entNum = i;
                }
                return ent;
            }
        }
    }
    return NULL;
}