Example #1
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);
}
Example #2
0
void CWeaponAWP::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        AWPFire(0.85);

    else if (pPlayer->GetAbsVelocity().Length2D() > 140)
        AWPFire(0.25);

    else if (pPlayer->GetAbsVelocity().Length2D() > 10)
        AWPFire(0.10);

    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        AWPFire(0.0);

    else
        AWPFire(0.001);
}
Example #3
0
void CWeaponP90::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        P90Fire(0.3f * m_flAccuracy);
    else if (pPlayer->GetAbsVelocity().Length2D() > 170)
        P90Fire(0.115f * m_flAccuracy);
    else
        P90Fire(0.045f * m_flAccuracy);
}
Example #4
0
void CAK47::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        AK47Fire(0.04f + 0.4f * m_flAccuracy);
    else if (pPlayer->GetAbsVelocity().Length2D() > 140)
        AK47Fire(0.04f + 0.07f * m_flAccuracy);
    else
        AK47Fire(0.0275f * m_flAccuracy);
}
Example #5
0
void CWeaponG3SG1::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        G3SG1Fire(0.45 * (1 - m_flAccuracy));
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)
        G3SG1Fire(0.15);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        G3SG1Fire(0.035 * (1 - m_flAccuracy));
    else
        G3SG1Fire(0.055 * (1 - m_flAccuracy));
}
Example #6
0
void CWeaponSG552::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    bool bZoomed = pPlayer->GetFOV() < pPlayer->GetDefaultFOV();

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        SG552Fire(0.035f + 0.45f * m_flAccuracy, bZoomed);
    else if (pPlayer->GetAbsVelocity().Length2D() > 140)
        SG552Fire(0.035f + 0.075f * m_flAccuracy, bZoomed);
    else
        SG552Fire(0.02f * m_flAccuracy, bZoomed);
}
Example #7
0
void CWeaponSG550::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        SG550Fire(0.45f * (1 - m_flAccuracy));
    else if (pPlayer->GetAbsVelocity().Length2D() > 5)
        SG550Fire(0.15f);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        SG550Fire(0.04f * (1 - m_flAccuracy));
    else
        SG550Fire(0.05f * (1 - m_flAccuracy));
}
Example #8
0
void CWeaponScout::PrimaryAttack(void)
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (pPlayer == NULL)
    {
        Assert(pPlayer != NULL);
        return;
    }

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        SCOUTFire(0.2);
    else if (pPlayer->GetAbsVelocity().Length2D() > 170)
        SCOUTFire(0.075);
    else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
        SCOUTFire(0.0);
    else
        SCOUTFire(0.007);
}
Example #9
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 #10
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++;
    }
}
Example #11
0
void CWeaponGalil::GalilFire(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 (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 CAK47::AK47Fire(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 (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);
}
Example #13
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 #14
0
void CWeaponGalil::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    // don't fire underwater
    if (pPlayer->GetWaterLevel() == 3)
    {
        PlayEmptySound();
        m_flNextPrimaryAttack = gpGlobals->curtime + 0.15;
        return;
    }

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
        GalilFire(0.04f + 0.3f * m_flAccuracy);
    else if (pPlayer->GetAbsVelocity().Length2D() > 140)
        GalilFire(0.04f + 0.07f * m_flAccuracy);
    else
        GalilFire(0.0375f * m_flAccuracy);
}
Example #15
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 #16
0
void CWeaponM4A1::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
    {
        M4A1Fire(0.035f + 0.4f * m_flAccuracy);
    }
    else if (pPlayer->GetAbsVelocity().Length2D() > 140)
    {
        M4A1Fire(0.035f + 0.07f * m_flAccuracy);
    }
    else
    {
        if (m_bSilencerOn)
            M4A1Fire(0.025f * m_flAccuracy);
        else
            M4A1Fire(0.02f * m_flAccuracy);
    }
}
Example #17
0
void CWeaponFamas::PrimaryAttack()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();
    if (!pPlayer)
        return;

    // don't fire underwater
    if (pPlayer->GetWaterLevel() == 3)
    {
        PlayEmptySound();
        m_flNextPrimaryAttack = gpGlobals->curtime + 0.15;
        return;
    }

    if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))	// if player is in air
        FamasFire(0.03f + 0.3f * m_flAccuracy, m_bBurstMode);

    else if (pPlayer->GetAbsVelocity().Length2D() > 140)	// if player is moving
        FamasFire(0.03f + 0.07f * m_flAccuracy, m_bBurstMode);
    /* new code */
    else
        FamasFire(0.02f * m_flAccuracy, m_bBurstMode);
}
Example #18
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);
}