Exemplo n.º 1
0
CPSSpawnEffect::CPSSpawnEffect(int maxParticles, const Vector &origin, float scale, float scaledelta, float radius, float radiusdelta, float velocity, int sprindex, int r_mode, byte r, byte g, byte b, float a, float adelta, float timetolive)
{
	index = 0;// the only good place for this
	removenow = false;
	ResetParameters();
	if (!InitTexture(sprindex))
	{
		removenow = true;
		return;
	}
	m_iMaxParticles = maxParticles;
	VectorCopy(origin, m_vecOrigin);
	m_fScale = scale;
	m_fScaleDelta = scaledelta;
	m_fRadius = radius;
	m_fRadiusDelta = radiusdelta;
	m_color.r = r;
	m_color.g = g;
	m_color.b = b;
	m_fBrightness = a;
	m_fBrightnessDelta = adelta;
	m_iRenderMode = r_mode;

	if (timetolive <= 0.0f)
		m_fDieTime = -1.0f;
	else
		m_fDieTime = gEngfuncs.GetClientTime() + timetolive;

	InitializeSystem();
	m_iNumParticles = m_iMaxParticles;// all particles are present at start

	for (int i = 0; i < m_iNumParticles; ++i)
		InitializeParticle(i);
}
Exemplo n.º 2
0
/*****************************************************************************
 CParticleSystem::Emit()
 
 Creates the number of new particles specified by the parameter, using
 the general particle system values with some random element. Note that
 only initial values will be randomized. Final values will not. This may
 be changed in the future.
*****************************************************************************/
int CParticleSystem::Emit(int numParticles)
{
  // create numParticles new particles (if there's room)
  while (numParticles && (m_numParticles < m_maxParticles))
  {
    // initialize the current particle and increase the count
    InitializeParticle(m_numParticles++);
    --numParticles;
  }
  return numParticles;
} // end CParticleSystem::Emit