//----------------------------------------------------------------------------- // Purpose: Starts the effect // Input : *pParticleMgr - // *pArgs - //----------------------------------------------------------------------------- void C_SmokeStack::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs) { pParticleMgr->AddEffect( &m_ParticleEffect, this ); // Figure out the material name. char str[512] = "unset_material"; const model_t *pModel = modelinfo->GetModel( m_iMaterialModel ); if ( pModel ) { Q_strncpy( str, modelinfo->GetModelName( pModel ), sizeof( str ) ); // Get rid of the extension because the material system doesn't want it. char *pExt = Q_stristr( str, ".vmt" ); if ( pExt ) pExt[0] = 0; } m_MaterialHandle[0] = m_ParticleEffect.FindOrAddMaterial( str ); int iCount = 1; char szNames[512]; int iLength = Q_strlen( str ); str[iLength-1] = '\0'; Q_snprintf( szNames, sizeof( szNames ), "%s%d.vmt", str, iCount ); while ( filesystem->FileExists( VarArgs( "materials/%s", szNames ) ) && iCount < SMOKESTACK_MAX_MATERIALS ) { char *pExt = Q_stristr( szNames, ".vmt" ); if ( pExt ) pExt[0] = 0; m_MaterialHandle[iCount] = m_ParticleEffect.FindOrAddMaterial( szNames ); iCount++; } m_iMaxFrames = iCount-1; m_ParticleSpawn.Init( mat_reduceparticles.GetBool() ? m_Rate / 4 : m_Rate ); // Obey mat_reduceparticles in episodic m_InvLifetime = m_Speed / m_JetLength; m_pParticleMgr = pParticleMgr; // Figure out how we need to draw. IMaterial *pMaterial = pParticleMgr->PMaterialToIMaterial( m_MaterialHandle[0] ); if( pMaterial ) { m_Renderer.Init( pParticleMgr, pMaterial ); } QueueLightParametersInRenderer(); // For the first N seconds, always simulate so it can build up the smokestack. // Afterwards, we set it to freeze when it's not being rendered. m_ParticleEffect.SetAlwaysSimulate( true ); SetNextClientThink( gpGlobals->curtime + 5 ); }
//----------------------------------------------------------------------------- // Purpose: Starts the effect // Input : *pParticleMgr - // *pArgs - //----------------------------------------------------------------------------- void C_SmokeStack::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs) { pParticleMgr->AddEffect(&m_ParticleEffect, this); // Figure out the material name. char str[512] = "unset_material"; const model_t *pModel = modelinfo->GetModel(m_iMaterialModel); if (pModel) { Q_strncpy(str, modelinfo->GetModelName(pModel), sizeof(str)); // Get rid of the extension because the material system doesn't want it. char *pExt = Q_stristr(str, ".vmt"); if (pExt) pExt[0] = 0; } m_MaterialHandle[0] = m_ParticleEffect.FindOrAddMaterial(str); m_ParticleSpawn.Init( m_Rate ); m_InvLifetime = m_Speed / m_JetLength; m_pParticleMgr = pParticleMgr; // Figure out how we need to draw. IMaterial *pMaterial = pParticleMgr->PMaterialToIMaterial( m_MaterialHandle[0] ); if( pMaterial ) { m_Renderer.Init( pParticleMgr, pMaterial ); } QueueLightParametersInRenderer(); // For the first N seconds, always simulate so it can build up the smokestack. // Afterwards, we set it to freeze when it's not being rendered. m_ParticleEffect.SetAlwaysSimulate( true ); SetNextClientThink( gpGlobals->curtime + 5 ); }