Example #1
0
void CWeaponG3SG1::G3SG1Fire(float flSpread)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    // If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
    if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
        flSpread += 0.025;

    // Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
    m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);

    if (m_flAccuracy > 0.98)
        m_flAccuracy = 0.98;

    m_flLastFire = gpGlobals->curtime;

    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    // Adjust the punch angle.
    QAngle angle = pPlayer->GetPunchAngle();
    angle.x -= SharedRandomFloat("G3SG1PunchAngleX", 0.75, 1.75) + (angle.x / 4);
    angle.y += SharedRandomFloat("G3SG1PunchAngleY", -0.75, 0.75);
    pPlayer->SetPunchAngle(angle);
}
void CWeaponScout::SCOUTFire( float flSpread )
{
    CCSPlayer *pPlayer = GetPlayerOwner();
    if (pPlayer == NULL)
    {
        Assert(pPlayer != NULL);
        return;
    }

    // If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
    if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
    {
        flSpread += 0.025;
    }

    if (pPlayer->GetFOV() != pPlayer->GetDefaultFOV())
    {
        pPlayer->m_bResumeZoom = true;
        pPlayer->m_iLastZoom = pPlayer->GetFOV();

#ifndef CLIENT_DLL
        pPlayer->SetFOV( pPlayer, pPlayer->GetDefaultFOV(), 0.05f );
#endif
    }

    if ( !CSBaseGunFire( flSpread, GetCSWpnData().m_flCycleTime, true ) )
        return;

    QAngle angle = pPlayer->GetPunchAngle();
    angle.x -= 2;
    pPlayer->SetPunchAngle( angle );
}
void CWeaponG3SG1::G3SG1Fire( float flSpread, float flCycleTime, bool fUseAutoAim )
{
	CCSPlayer *pPlayer = GetPlayerOwner();

	if ( pPlayer->GetFOV() == 90 )
		flSpread += 0.025;

	// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
	if (m_flLastFire == 0)
	{
		m_flLastFire = gpGlobals->curtime;
	}
	else 
	{
		m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);	

		if (m_flAccuracy > 0.98)
			m_flAccuracy = 0.98;

		m_flLastFire = gpGlobals->curtime;
	}

	if ( !CSBaseGunFire( flSpread, flCycleTime ) )
		return;

	// Adjust the punch angle.
	QAngle angle = pPlayer->GetPunchAngle();
	angle.x -= SHARED_RANDOMFLOAT( 2.75, 3.25) + ( angle.x / 4 );
	angle.y += SHARED_RANDOMFLOAT( -1.25, 1.5);
	pPlayer->SetPunchAngle( angle );
}
Example #4
0
void CWeaponAug::AUGFire(float flSpread, bool bZoomed)
{
    float flCycleTime = GetCSWpnData().m_flCycleTime;

    if (bZoomed)
        flCycleTime = 0.135f;

    if (!CSBaseGunFire(flSpread, flCycleTime, true))
        return;

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(1, 0.45, 0.275, 0.05, 4, 2.5, 7);

    else if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4, 5);

    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2, 8);

    else
        pPlayer->KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);
}
void CWeaponM4A1::M4A1Fire( float flSpread, float flCycleTime )
{
	if ( !CSBaseGunFire( flSpread, flCycleTime ) )
		return;

	CCSPlayer *pPlayer = GetPlayerOwner();
	if (pPlayer->GetAbsVelocity().Length2D() > 0)
		KickBack (1.0, 0.45, 0.28, 0.045, 3.75, 3, 7);
	else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
		KickBack (1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);
	else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
		KickBack (0.6, 0.3, 0.2, 0.0125, 3.25, 2, 7);
	else
		KickBack (0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);
}
void CWeaponSG552::SG552Fire( float flSpread, float flCycleTime )
{
	if ( !CSBaseGunFire( flSpread, flCycleTime ) )
		return;

	CCSPlayer *pPlayer = GetPlayerOwner();
	if (pPlayer->GetAbsVelocity().Length2D() > 0)
		KickBack (1, 0.45, 0.28, 0.04, 4.25, 2.5, 7);
	else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
		KickBack (1.25, 0.45, 0.22, 0.18, 6, 4, 5);
	else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
		KickBack (0.6, 0.35, 0.2, 0.0125, 3.7, 2, 10);
	else
		KickBack (0.625, 0.375, 0.25, 0.0125, 4, 2.25, 9);
}
Example #7
0
void CAK47::AK47Fire( float flSpread, float flCycleTime )
{
    if ( !CSBaseGunFire( flSpread, flCycleTime ) )
        return;

    CCSPlayer *pPlayer = GetPlayerOwner();

    if (pPlayer->GetAbsVelocity().Length2D() > 0 )
        KickBack ( 1.5, 0.45, 0.225, 0.05, 6.5, 2.5, 7 );
    else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
        KickBack ( 2, 1.0, 0.5, 0.35, 9, 6, 5 );
    else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
        KickBack ( 0.9, 0.35, 0.15, 0.025, 5.5, 1.5, 9 );
    else
        KickBack ( 1, 0.375, 0.175, 0.0375, 5.75, 1.75, 8 );
}
Example #8
0
void CWeaponP90::P90Fire(float flSpread)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    // Kick the gun based on the state of the player.
    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(0.9, 0.45, 0.35, 0.04, 5.25, 3.5, 4);
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(0.45, 0.3, 0.2, 0.0275, 4, 2.25, 7);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.275, 0.2, 0.125, 0.02, 3, 1, 9);
    else
        pPlayer->KickBack(0.3, 0.225, 0.125, 0.02, 3.25, 1.25, 8);
}
Example #9
0
void CWeaponFamas::FamasFire(float flSpread, bool bFireBurst)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    float flCycleTime = GetCSWpnData().m_flCycleTime;

    // change a few things if we're in burst mode
    if (bFireBurst)
    {
        m_iFamasShotsFired = 0;
        flCycleTime = 0.55f;
    }
    else
    {
        flSpread += 0.01;
    }

    if (!CSBaseGunFire(flSpread, flCycleTime, true))
        return;

    if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(1, 0.45, 0.275, 0.05, 4, 2.5, 7);

    else if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4, 5);

    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2, 8);

    else
        pPlayer->KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);

    if (bFireBurst)
    {
        // Fire off the next two rounds
        m_flFamasShoot = gpGlobals->curtime + 0.05;	// 0.1
        m_fBurstSpread = flSpread;
        m_iFamasShotsFired++;
    }
}
void CAK47::AK47Fire( float flSpread )
{
	if ( !CSBaseGunFire( flSpread, GetCSWpnData().m_flCycleTime, true ) )
		return;

	CCSPlayer *pPlayer = GetPlayerOwner();

	// CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
	if ( !pPlayer )
		return;

	if (pPlayer->GetAbsVelocity().Length2D() > 5 )
		pPlayer->KickBack ( 1.5, 0.45, 0.225, 0.05, 6.5, 2.5, 7 );
	else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
		pPlayer->KickBack ( 2, 1.0, 0.5, 0.35, 9, 6, 5 );
	else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
		pPlayer->KickBack ( 0.9, 0.35, 0.15, 0.025, 5.5, 1.5, 9 );
	else
		pPlayer->KickBack ( 1, 0.375, 0.175, 0.0375, 5.75, 1.75, 8 );
}
void CWeaponGalil::GalilFire( float flSpread )
{
	if ( !CSBaseGunFire( flSpread, GetCSWpnData().m_flCycleTime, true ) )
		return;

	CCSPlayer *pPlayer = GetPlayerOwner();

	// CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
	if ( !pPlayer )
		return;

	if (pPlayer->GetAbsVelocity().Length2D() > 5)
		pPlayer->KickBack (1.0, 0.45, 0.28, 0.045, 3.75, 3, 7);
	else if ( !FBitSet( pPlayer->GetFlags(), FL_ONGROUND ) )
		pPlayer->KickBack (1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);
	else if ( FBitSet( pPlayer->GetFlags(), FL_DUCKING ) )
		pPlayer->KickBack (0.6, 0.3, 0.2, 0.0125, 3.25, 2, 7);
	else
		pPlayer->KickBack (0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);
}
Example #12
0
void CWeaponMAC10::MAC10Fire(float flSpread)
{
    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))	// jumping
        pPlayer->KickBack(1.3, 0.55, 0.4, 0.05, 4.75, 3.75, 5);
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)				// running
        pPlayer->KickBack(0.9, 0.45, 0.25, 0.035, 3.5, 2.75, 7);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))	// ducking
        pPlayer->KickBack(0.75, 0.4, 0.175, 0.03, 2.75, 2.5, 10);
    else														// standing
        pPlayer->KickBack(0.775, 0.425, 0.2, 0.03, 3, 2.75, 9);
}
Example #13
0
void CWeaponTMP::TMPFire(float flSpread)
{
    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(1.1, 0.5, 0.35, 0.045, 4.5, 3.5, 6);
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(0.8, 0.4, 0.2, 0.03, 3, 2.5, 7);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.7, 0.35, 0.125, 0.025, 2.5, 2, 10);
    else
        pPlayer->KickBack(0.725, 0.375, 0.15, 0.025, 2.75, 2.25, 9);
}
Example #14
0
void CWeaponUMP45::UMP45Fire(float flSpread)
{
    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    // Kick the gun based on the state of the player.
    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(0.125, 0.65, 0.55, 0.0475, 5.5, 4, 10);
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(0.55, 0.3, 0.225, 0.03, 3.5, 2.5, 10);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.25, 0.175, 0.125, 0.02, 2.25, 1.25, 10);
    else
        pPlayer->KickBack(0.275, 0.2, 0.15, 0.0225, 2.5, 1.5, 10);
}
Example #15
0
void CWeaponM4A1::M4A1Fire(float flSpread)
{
    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, !m_bSilencerOn))
        return;

    if (m_bSilencerOn)
        SendWeaponAnim(ACT_VM_PRIMARYATTACK_SILENCED);

    CMomentumPlayer *pPlayer = GetPlayerOwner();

    // CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
    if (!pPlayer)
        return;

    if (pPlayer->GetAbsVelocity().Length2D() > 5)
        pPlayer->KickBack(1.0, 0.45, 0.28, 0.045, 3.75, 3, 7);
    else if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        pPlayer->KickBack(1.2, 0.5, 0.23, 0.15, 5.5, 3.5, 6);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        pPlayer->KickBack(0.6, 0.3, 0.2, 0.0125, 3.25, 2, 7);
    else
        pPlayer->KickBack(0.65, 0.35, 0.25, 0.015, 3.5, 2.25, 7);
}
Example #16
0
void CWeaponAWP::AWPFire(float flSpread)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();

    if (pPlayer == nullptr)
    {
        Assert(pPlayer != nullptr);
        return;
    }

    // If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
    if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
    {
        flSpread += 0.08;
    }

    if (pPlayer->GetFOV() != pPlayer->GetDefaultFOV())
    {
        pPlayer->m_iLastZoom = pPlayer->GetFOV();

#ifndef CLIENT_DLL
#ifdef AWP_UNZOOM
        SetContextThink(&CWeaponAWP::UnzoomThink, gpGlobals->curtime + sv_awpunzoomdelay.GetFloat(), SNIPER_ZOOM_CONTEXT);
#else
        pPlayer->m_bResumeZoom = true;
        pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV(), 0.1f);
#endif
#endif
    }

    if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
        return;

    QAngle angle = pPlayer->GetPunchAngle();
    angle.x -= 2;
    pPlayer->SetPunchAngle(angle);
}