Example #1
0
//-----------------------------------------------------------------------------
// Purpose: Dissolve all weapons within our volume
//-----------------------------------------------------------------------------
void CTriggerWeaponDissolve::DissolveThink( void )
{
	int	numWeapons = m_pWeapons.Count();

	// Dissolve all the items within the volume
	for ( int i = 0; i < numWeapons; i++ )
	{
		CBaseCombatWeapon *pWeapon = m_pWeapons[i];
		Vector vecConduit = GetConduitPoint( pWeapon );
		
		// The physcannon upgrades when this happens
		if ( FClassnameIs( pWeapon, "weapon_physcannon" ) )
		{
			// This must be the last weapon for us to care
			if ( numWeapons > 1 )
				continue;

			//FIXME: Make them do this on a stagger!

			// All conduits send power to the weapon
			for ( int i = 0; i < m_pConduitPoints.Count(); i++ )
			{
				CreateBeam( m_pConduitPoints[i]->GetAbsOrigin(), pWeapon, 4.0f );
			}

			PhysCannonBeginUpgrade( pWeapon );
			m_OnChargingPhyscannon.FireOutput( this, this );

			EmitSound( "WeaponDissolve.Beam" );

			// We're done
			m_pWeapons.Purge();
			m_pConduitPoints.Purge();
			SetContextThink( NULL, 0, s_pDissolveThinkContext );
			return;
		}

		// Randomly dissolve them all
		float flLifetime = random->RandomFloat( 2.5f, 4.0f );
		CreateBeam( vecConduit, pWeapon, flLifetime );
		pWeapon->Dissolve( NULL, gpGlobals->curtime + ( 3.0f - flLifetime ), false );

		m_OnDissolveWeapon.FireOutput( this, this );

		CPASAttenuationFilter filter( pWeapon );
		EmitSound( filter, pWeapon->entindex(), "WeaponDissolve.Dissolve" );
		
		// Beam looping sound
		EmitSound( "WeaponDissolve.Beam" );

		m_pWeapons.Remove( i );
		SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + random->RandomFloat( 0.5f, 1.5f ), s_pDissolveThinkContext );
		return;
	}

	SetContextThink( &CTriggerWeaponDissolve::DissolveThink, gpGlobals->curtime + 0.1f, s_pDissolveThinkContext );
}
Example #2
0
void CPhazonBeam::Update(float dt, CStateManager& mgr) {
  CGunWeapon::Update(dt, mgr);
  x278_fireTime += dt;
  TAreaId aid = mgr.GetPlayer().GetAreaIdAlways();
  if (aid != kInvalidAreaId) {
    CGameArea* area = mgr.WorldNC()->GetArea(aid);
    if (x278_fireTime > 1.f / 6.f)
      area->SetWeaponWorldLighting(4.f, 1.f);
    else
      area->SetWeaponWorldLighting(4.f, 0.9f);
  }

  if (!IsLoaded()) {
    if (CGunWeapon::IsLoaded() && !x274_24_loaded) {
      x274_24_loaded = x228_phazon2nd1.IsLoaded() && x21c_phazonVeins.IsLoaded();
      if (x274_24_loaded) {
        CreateBeam(mgr);
        x224_phazonVeinsData = std::make_unique<CModelData>(CStaticRes(
            NWeaponTypes::get_asset_id_from_name(x274_27_phazonVeinsIdx ? "PhazonVeins_2" : "PhazonVeins"), x4_scale));
        x21c_phazonVeins.Unlock();
        x274_25_clipWipeActive = true;
      }
    }
  }

  if (x274_25_clipWipeActive) {
    x268_clipWipeScale += 0.75f * dt;
    if (x268_clipWipeScale > 1.f)
      x268_clipWipeScale = 1.f;
    if (x268_clipWipeScale > 0.4f) {
      if (x26c_clipWipeTranslate < 0.5f)
        x26c_clipWipeTranslate += 0.75f * dt;
      else
        x274_25_clipWipeActive = false;
    }
  } else if (x274_26_veinsAlphaActive) {
    x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y();
  }
}