Esempio n. 1
0
//------------------------------------------------------------------------
void CRapid::Accelerate(float acc)
{
	m_acceleration = acc;

	if (acc > 0.0f)
	{
    if (!IsFiring())
      SpinUpEffect(true);

		m_accelerating = true;
		m_decelerating = false;
		m_spinUpSoundId = m_pWeapon->PlayAction(m_pShared->actions.spin_up, 0, false, CItem::eIPAF_Default|CItem::eIPAF_CleanBlending);
	}
	else
	{
		m_accelerating = false;
		m_decelerating = true;
		if(m_speed>0.0f)
		{
			m_pWeapon->PlayAction(m_pShared->actions.spin_down, 0, false, CItem::eIPAF_Default|CItem::eIPAF_CleanBlending);
			if(m_firing)
				m_pWeapon->PlayAction(m_pShared->actions.spin_down_tail);
		}

		if (m_spinUpSoundId != INVALID_SOUNDID)
		{
			m_pWeapon->StopSound(m_spinUpSoundId);
			m_spinUpSoundId = INVALID_SOUNDID;
		}
		
    if (IsFiring())
		  SpinUpEffect(false);
	}
}
Esempio n. 2
0
float CASW_Weapon::GetTurnRateModifier()
{
	if (IsFiring())
		return 0.5f;

	return 1.0f;
}
Esempio n. 3
0
//------------------------------------------------------------------------
void CRapid::StartReload(int zoomed)
{
	if (IsFiring())
		Accelerate(m_pShared->rapidparams.deceleration);
	Firing(false);

	CSingle::StartReload(zoomed);
}
//------------------------------------------------------------------------
void CRapid::StartReload(int zoomed)
{
	if (IsFiring())
		Accelerate(m_fireParams->rapidparams.deceleration);
	Firing(false);
	PlayStopRapidFireIfNeeded();

	BaseClass::StartReload(zoomed);
}
Esempio n. 5
0
void CPhazonBeam::PreRenderGunFx(const CStateManager& mgr, const zeus::CTransform& xf) {
  if (IsFiring()) {
    zeus::CTransform backupView = CGraphics::g_ViewMatrix;
    CGraphics::SetViewPointMatrix(xf.inverse() * backupView);
    CGraphics::SetModelMatrix(zeus::CTransform());
    CGunWeapon::DrawMuzzleFx(mgr);
    CGraphics::SetViewPointMatrix(backupView);
  }
}
void CASW_Sentry_Top_Flamer::CheckFiring()
{
	bool bShouldFire = false;

	if ( HasAmmo() && m_hEnemy.IsValid() && m_hEnemy.Get())
	{
		float flDist = fabs(m_fGoalYaw - m_fCurrentYaw);
		if (flDist > 180)
			flDist = 360 - flDist;	
		// use some hysteresis
		if (flDist < (IsFiring() ? ASW_SENTRY_FIRE_ANGLE_THRESHOLD * 1.1f : ASW_SENTRY_FIRE_ANGLE_THRESHOLD) )
		{
			bShouldFire = true;
		}
	}

	if ( bShouldFire )
	{
		m_flFireHysteresisTime = gpGlobals->curtime + 0.5f;
	}
	else
	{
		bShouldFire = gpGlobals->curtime < m_flFireHysteresisTime ;
	}
	
	// turn firing on or off as appropriate
	if ( IsFiring() != bShouldFire )
	{
		if ( bShouldFire )
			StartFiring();
		else
			StopFiring();
	}
	Assert( IsFiring() == bShouldFire );

	if ( bShouldFire )
	{
		Fire();
	}
}
//------------------------------------------------------------------------
void CRapid::Accelerate(float acc)
{
	m_acceleration = acc;

	if (acc > 0.0f)
	{
		if (!IsFiring())
		{
			SpinUpEffect(true);
		}

		m_rapidFlags |= eRapidFlag_accelerating;
		m_rapidFlags &= ~eRapidFlag_decelerating;

		int flags = CItem::eIPAF_Default;
		m_pWeapon->PlayAction(GetFragmentIds().spin_up, 0, false, flags);
	}
	else
	{
		m_rapidFlags |= eRapidFlag_decelerating;
		m_rapidFlags &= ~eRapidFlag_accelerating;

		if(m_speed>0.0f)
		{
			m_pWeapon->PlayAction(GetFragmentIds().spin_down);

			if(m_firing)
			{
				m_pWeapon->PlayAction(GetFragmentIds().spin_down_tail);
			}
		}
		
		if (IsFiring())
		{
		  SpinUpEffect(false);
		}
	}
}
Esempio n. 8
0
void UBurstFiremode::HandleFire()
{
	if (!IsFiring()) return; //If we aren't firing anymore, don't fire a shot

	BurstsRemaining--;

	GetWeapon()->FireShot();
	
	if (BurstsRemaining > 0)
	{
		//get the time until the next shot
		float FireTime = (1.0f / GetWeapon()->GetActiveFiremodeData().RoundsPerMinute) * 60.0f;

		FTimerHandle handle;

		GetWorld()->GetTimerManager().SetTimer(handle, this, &UBurstFiremode::HandleFire, FireTime, false);
	}
	
}
Esempio n. 9
0
void CLaser::SetFiring(bool isFiring)
{
	if (isFiring != IsFiring())
	{
		//State has changed

		if (isFiring)
		{
			//Now firing, so add laser beam
			mpLaserModel = gEngine->GetModel(mpBeamMesh, LASER_BEAM_TEX);
			mpLaserModel->SetPosition(0.5f, 0.0f, 50.0f);
			mpLaserModel->AttachToParent(GetParent()->GetModel());

			//Attaching to parent can screw over the scaling, so reset scale
			mpLaserModel->ResetScale();
			mpLaserModel->ScaleZ(100.0f);
			mpLaserModel->ScaleX(3.0f);
		}
		else if(mpLaserModel)
		{
			//No longer firing, remove laser beam
			mpLaserModel->DetachFromParent();
			gEngine->CacheModel(mpLaserModel, LASER_BEAM_TEX);
			mpLaserModel = 0;
		}
	}
	else if (isFiring) //Still firing, ensure laser is attached to parent's current model
	{
		mpLaserModel->DetachFromParent();
		mpLaserModel->AttachToParent(GetParent()->GetModel());

		//Attaching to parent can screw over the scaling, so reset scale
		mpLaserModel->ResetScale();
		mpLaserModel->ScaleZ(100.0f);
		mpLaserModel->ScaleX(3.0f);
	}

	CWeapon::SetFiring(isFiring);
}
Esempio n. 10
0
bool CASW_Weapon::ShouldMarineMoveSlow()
{
	return (IsReloading() || IsFiring());
}
Esempio n. 11
0
void CPhazonBeam::UpdateBeam(float dt, const zeus::CTransform& targetXf, const zeus::CVector3f& localBeamPos,
                             CStateManager& mgr) {
  if (x234_chargeFxGen)
    x234_chargeFxGen->SetParticleEmission(IsFiring());
  CGunWeapon::UpdateMuzzleFx(dt, x4_scale, localBeamPos, IsFiring());
}
Esempio n. 12
0
void CPhazonBeam::DrawMuzzleFx(const CStateManager& mgr) const {
  if (IsFiring())
    CGunWeapon::DrawMuzzleFx(mgr);
}
Esempio n. 13
0
void HelicopterClass::DoWeapons (void)
{
int fireFlag;
// MissileClass* theMissile;
Tpoint pos, vec;

   // Guns
   fireFlag = fireGun;
   if (Guns)
   {
      Guns->Exec(&fireFlag, gunDmx, &platformAngles, targetPtr, FALSE);

      if (fireFlag)
      {
#ifdef MLR_NEWSNDCODE	     
		  SoundPos.Sfx( SFX_MCGUN );
#else
		 F4SoundFXSetPos( SFX_MCGUN, 0, XPos(), YPos(), ZPos(), 1.0f , 0 , XDelta(),YDelta(),ZDelta());
#endif

		pos.x = XPos();
		pos.y = YPos();
		// RV - Biker - Adjust gun smoke position
		//pos.z = ZPos() - 5.0f;
		pos.z = ZPos() + 1.0f + offsetZ;

		vec.x = PRANDFloat() * 30.0f;
		vec.y = PRANDFloat() * 30.0f;
		vec.z = -PRANDFloatPos() * 30.0f;

		//RV - I-Hawk - changing all LIGHT_CLOUD weapons effects calls
		// to more appropriate GUN_SMOKE effect here
		/*
		OTWDriver.AddSfxRequest(
			new SfxClass ( SFX_GUN_SMOKE,		// type
			SFX_MOVES,
			&pos,					// world pos
			&vec,					// vel vector
			2.3f,					// time to live
			2.0f ) );				// scale
			*/
		DrawableParticleSys::PS_AddParticleEx((SFX_GUN_SMOKE + 1),
												&pos,
												&vec);

         if (!IsFiring())
         {
            // KCK: This has been moved to GunClass::Exec, since that's where we generate
            // new bullets
//            SendFireMessage ((SimWeaponClass*)Guns, FalconWeaponsFire::GUN, TRUE, targetPtr);

			#ifdef _DEBUG
			SimVehicleClass *theObject;
			if ( targetPtr )
			{
				theObject = (SimVehicleClass *)targetPtr->BaseData();
/*				if ( theObject->IsAirplane() )
					MonoPrint( "HELO BRAIN Firing Guns at Air Unit\n" );
				else if ( theObject->IsHelicopter() )
					MonoPrint( "HELO BRAIN Firing Guns at Helo Unit\n" );
				else if ( theObject->IsGroundVehicle() )
					MonoPrint( "HELO BRAIN Firing Guns at Ground Unit\n" );
*/			}
			#endif
         }
         SetFiring(TRUE);
      }
      else
      {
         if (IsFiring())
         {
            SendFireMessage ((SimWeaponClass*)Guns, FalconWeaponsFire::GUN, FALSE, targetPtr);
         }
         SetFiring(FALSE);
      }
   }

   /*
   ** edg: no more FCC stuff here.  All done in hdigi now
   if ( FCC->releaseConsent && Sms->curWeapon )
   {
	   if (FCC->GetMasterMode() == FireControlComputer::Missile ||
		   FCC->GetMasterMode() == FireControlComputer::Dogfight ||
		   FCC->GetMasterMode() == FireControlComputer::MissileOverride)
	   {
			 theMissile = (MissileClass *)Sms->curWeapon;
			 if (Sms->LaunchMissile())
			 {
				SendFireMessage ((SimWeaponClass*)theMissile, FalconWeaponsFire::SRM, TRUE, targetPtr);
	
			   	fireMissile = FALSE;
			   	F4SoundFXSetPos( SFX_MISSILE1, 0, XPos(), YPos(), ZPos(), 1.0f );
			 }
	
	   } 
	   else if (FCC->GetMasterMode() == FireControlComputer::AirGroundMissile)
	   {
			 theMissile = (MissileClass *)Sms->curWeapon;
			 if (Sms->LaunchMissile())
			 {
				SendFireMessage ((SimWeaponClass*)theMissile, FalconWeaponsFire::AGM, TRUE, targetPtr);
	
				fireMissile = FALSE;
				F4SoundFXSetPos( SFX_MISSILE2, 0, XPos(), YPos(), ZPos(), 1.0f );
			 }
	
	   } 
      else if (FCC->GetMasterMode() == FireControlComputer::AirGroundBomb &&
         FCC->GetSubMode() == FireControlComputer::RCKT)
      {
         if (FCC->bombPickle && Sms->curWeapon && !OnGround())
         {
            // Play the sound
            F4SoundFXSetPos( SFX_RCKTLOOP, TRUE, XPos(), YPos(), ZPos(), 1.0f );

			theMissile = (MissileClass *)Sms->curWeapon;

            if (Sms->LaunchRocket())
            {

               // Stop firing
               FCC->bombPickle = FALSE;
               FCC->postDrop = TRUE;

               // Play the sound
               F4SoundFXSetPos( SFX_MISSILE3, TRUE, XPos(), YPos(), ZPos(), 1.0f );

               // Drop a message
               SendFireMessage (theMissile, FalconWeaponsFire::Rocket, TRUE, targetPtr);
            }
         }
      }
   }
   */

   /*
   else if (FCC->GetMasterMode() == FireControlComputer::AirGroundBomb)
   {
      curWeapon = Sms->curWeapon;
      if (FCC->bombPickle)
      {
         SendFireMessage ((SimWeaponClass*)curWeapon, FalconWeaponsFire::BMB, TRUE, targetPtr);
         if (Sms->DropBomb())
         {
            FCC->bombPickle = FALSE;
            FCC->postDrop = TRUE;
         }
      }
   }
   */

   // Handle missiles launched but still on the rail
	Sms->Exec();
}