コード例 #1
0
//-----------------------------------------------------------------------------
// Sends a mesage from the tool to the client
//-----------------------------------------------------------------------------
void CClientTools::PostToolMessage( KeyValues *pKeyValues )
{
	if ( !Q_stricmp( pKeyValues->GetName(), "QueryParticleManifest" ) )
	{
		// NOTE: This cannot be done during particle system init because tools aren't set up at that point
		CUtlVector<CUtlString> files;
		GetParticleManifest( files );
		int nCount = files.Count();
		for ( int i = 0; i < nCount; ++i )
		{
			char pTemp[256];
			Q_snprintf( pTemp, sizeof(pTemp), "%d", i );
			KeyValues *pSubKey = pKeyValues->FindKey( pTemp, true );
			pSubKey->SetString( "file", files[i] );
		}
		return;
	}

	if ( !Q_stricmp( pKeyValues->GetName(), "QueryMonitorTexture" ) )
	{
		pKeyValues->SetPtr( "texture", GetCameraTexture() );
		return;
	}


}
コード例 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void ReloadParticleEffectsInList( IFileList *pFilesToReload )
{
	MEM_ALLOC_CREDIT();

	CUtlVector<CUtlString> files;
	GetParticleManifest( files );

	// CAB 2/17/11 Reload all the particles regardless (Fixes filename change exploits).
	bool bReloadAll = true;

	//int nCount = files.Count();
	//for ( int i = 0; i < nCount; ++i )
	//{
	//	// Skip the precache marker
	//	const char *pFile = files[i];
 //		if ( pFile[0] == '!' )
 //		{
 //			pFile++;
 //		}

	//	char szDX80Filename[MAX_PATH];
	//	V_strncpy( szDX80Filename, pFile, sizeof( szDX80Filename ) );
	//	V_StripExtension( pFile, szDX80Filename, sizeof( szDX80Filename ) );
	//	V_strncat( szDX80Filename, "_dx80.", sizeof( szDX80Filename ) );
	//	V_strncat( szDX80Filename, V_GetFileExtension( pFile ), sizeof( szDX80Filename ) );

	//	if ( pFilesToReload->IsFileInList( pFile ) || pFilesToReload->IsFileInList( szDX80Filename ) )
	//	{
	//		Msg( "Reloading all particle files due to pure settings.\n" );
	//		bReloadAll = true;
	//		break;
	//	}
	//}

	// Then check to see if we need to reload the map's particles
	const char *pszMapName = NULL;
#ifdef CLIENT_DLL
	pszMapName = engine->GetLevelName();	
#else
	pszMapName = STRING( gpGlobals->mapname );
#endif
	if ( pszMapName && pszMapName[0] )
	{
		char mapname[MAX_MAP_NAME];
		Q_FileBase( pszMapName, mapname, sizeof( mapname ) );
		Q_strlower( mapname );
		ParseParticleEffectsMap( mapname, true, pFilesToReload );
	}

	if ( bReloadAll )
	{
		ParseParticleEffects( true, true );
	}
	
	g_pParticleSystemMgr->DecommitTempMemory();
}
コード例 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void ParseParticleEffects( bool bLoadSheets, bool bPrecache )
{
	MEM_ALLOC_CREDIT();

	g_pParticleSystemMgr->ShouldLoadSheets( bLoadSheets );

	CUtlVector<CUtlString> files;
	GetParticleManifest( files );

	int nCount = files.Count();
	for ( int i = 0; i < nCount; ++i )
	{
		g_pParticleSystemMgr->ReadParticleConfigFile( files[i], bPrecache, false );
	}

	g_pParticleSystemMgr->DecommitTempMemory();
}
コード例 #4
0
//-----------------------------------------------------------------------------
// Sends a mesage from the tool to the client
//-----------------------------------------------------------------------------
void CClientTools::PostToolMessage( KeyValues *pKeyValues )
{
	if ( !Q_stricmp( pKeyValues->GetName(), "QueryParticleManifest" ) )
	{
		// NOTE: This cannot be done during particle system init because tools aren't set up at that point
		CUtlVector<CUtlString> files;
		GetParticleManifest( files );
		int nCount = files.Count();
		for ( int i = 0; i < nCount; ++i )
		{
			char pTemp[256];
			Q_snprintf( pTemp, sizeof(pTemp), "%d", i );
			KeyValues *pSubKey = pKeyValues->FindKey( pTemp, true );
			pSubKey->SetString( "file", files[i] );
		}
		return;
	}

	if ( !Q_stricmp( pKeyValues->GetName(), "QueryMonitorTexture" ) )
	{
		pKeyValues->SetPtr( "texture", GetCameraTexture() );
		return;
	}

#ifdef PORTAL
	if ( !Q_stricmp( pKeyValues->GetName(), "portals" ) )
	{
		g_pPortalRender->HandlePortalPlaybackMessage( pKeyValues );
		return;
	}
	
	if ( !Q_stricmp( pKeyValues->GetName(), "query CPortalRenderer" ) )
	{
		pKeyValues->SetInt( "IsRenderingPortal", g_pPortalRender->IsRenderingPortal() ? 1 : 0 );
		return;
	}
#endif
}