Esempio n. 1
0
CBaseFX* CClientFXMgr::CreateFX(const char *sName, FX_BASEDATA *pBaseData, CBaseFXProps* pProps)
{
	//track our performance
	CTimedSystemBlock TimingBlock(g_tsClientFXUpdateCreate);

	CBaseFX *pNewFX = NULL;

	// Locate the named FX

	const FX_REF *pFxRef = CClientFXDB::GetSingleton().FindFX(sName);
	if( pFxRef ) 
	{
		pNewFX = pFxRef->m_pfnCreate();
	}

	// If we have a new fx, go ahead and add it onto the active list

	if( pNewFX ) 
	{
		//initialize the effect
		if( !pNewFX->Init(pBaseData, pProps) )
		{
			//if this failed to initialize, then destroy the effect
			pNewFX->Term();
			CClientFXDB::GetSingleton().DeleteEffect(pNewFX);

			pNewFX = NULL;
		}
	}

	// All done....
	return pNewFX;
}
Esempio n. 2
0
CBaseFX* CClientFXMgr::CreateFX(const char *sName, FX_BASEDATA *pBaseData, CBaseFXProps* pProps, HOBJECT hInstParent)
{
	CBaseFX *pNewFX = NULL;

	// Locate the named FX

	FX_REF *pFxRef = CClientFXDB::GetSingleton().FindFX(sName);

	if( pFxRef ) 
	{
		pNewFX = pFxRef->m_pfnCreate();
	}

	// If we have a new fx, go ahead and add it onto the active list

	if( pNewFX ) 
	{
		// Assign a unique ID for this FX

		pBaseData->m_dwID = GetUniqueID();
		
		if( !pNewFX->Init(m_pClientDE, pBaseData, pProps) )
		{
			// See if the FX->Init() filled out data to create a new instance...
			if( pBaseData->m_sNode[0] )
			{
				CLIENTFX_CREATESTRUCT	fxCS( pBaseData->m_sNode, pBaseData->m_dwFlags, pBaseData->m_vPos, pBaseData->m_rRot );
				fxCS.m_vTargetNorm		= pBaseData->m_vTargetNorm;
				fxCS.m_hParent			= hInstParent;
				
				CreateClientFX( fxCS, LTTRUE );
			}

			pNewFX->Term();
			CClientFXDB::GetSingleton().DeleteEffect(pNewFX);

			pNewFX = NULL;
		}
	}

	// All done....
	
	return pNewFX;
}