void CWeaponFamas::ItemPostFrame() { if (m_flFamasShoot != 0.0 && m_flFamasShoot < gpGlobals->curtime) FireRemaining(m_iFamasShotsFired, m_flFamasShoot); BaseClass::ItemPostFrame(); }
/* ===================== CBasePlayerWeapon::ItemPostFrame Handles weapon firing, reloading, etc. ===================== */ void CBasePlayerWeapon::ItemPostFrame( void ) { int button = m_pPlayer->pev->button; if (!HasSecondaryAttack()) button &= ~IN_ATTACK2; if (m_flGlock18Shoot != 0) { m_iClip--; if( m_iClip < 0 ) { m_iClip = m_iGlock18ShotsFired = 0; } FireRemaining(m_iGlock18ShotsFired, m_flGlock18Shoot, TRUE); } else if (gpGlobals->time > m_flFamasShoot && m_flFamasShoot != 0) { m_iClip--; if( m_iClip < 0 ) { m_iClip = m_iFamasShotsFired = 0; } FireRemaining(m_iFamasShotsFired, m_flFamasShoot, FALSE); } if (m_flNextPrimaryAttack <= 0.0f) { if (m_pPlayer->m_bResumeZoom) { m_pPlayer->pev->fov = m_pPlayer->m_iFOV = m_pPlayer->m_iLastZoom; if (m_pPlayer->m_iFOV == m_pPlayer->m_iLastZoom) m_pPlayer->m_bResumeZoom = false; } } if (!g_bHoldingShield) { if (m_fInReload && m_pPlayer->pev->button & IN_ATTACK2) { SecondaryAttack(); m_pPlayer->pev->button &= ~IN_ATTACK2; m_fInReload = FALSE; m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase(); } } if ((m_fInReload) && m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase()) { int j = min(iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]); m_iClip += j; m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= j; m_fInReload = FALSE; } if ((button & IN_ATTACK2) && m_flNextSecondaryAttack <= UTIL_WeaponTimeBase()) { if (pszAmmo2() && !m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()]) m_fFireOnEmpty = TRUE; SecondaryAttack(); m_pPlayer->pev->button &= ~IN_ATTACK2; } else if ((m_pPlayer->pev->button & IN_ATTACK) && m_flNextPrimaryAttack <= UTIL_WeaponTimeBase()) { if ((!m_iClip && pszAmmo1()) || (iMaxClip() == WEAPON_NOCLIP && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()])) m_fFireOnEmpty = TRUE; if (m_pPlayer->m_bCanShoot == true) PrimaryAttack(); } else if (m_pPlayer->pev->button & IN_RELOAD && iMaxClip() != WEAPON_NOCLIP && !m_fInReload) { if (m_flNextPrimaryAttack < UTIL_WeaponTimeBase()) { if (m_flFamasShoot == 0 && m_flGlock18Shoot == 0) { if (!(m_iWeaponState & WPNSTATE_SHIELD_DRAWN)) Reload(); } } } else if (!(button & (IN_ATTACK | IN_ATTACK2))) { if (m_bDelayFire == true) { m_bDelayFire = false; if (m_iShotsFired > 15) m_iShotsFired = 15; m_flDecreaseShotsFired = gpGlobals->time + 0.4; } m_fFireOnEmpty = FALSE; if (m_iId != WEAPON_USP && m_iId != WEAPON_GLOCK18 && m_iId != WEAPON_P228 && m_iId != WEAPON_DEAGLE && m_iId != WEAPON_ELITE && m_iId != WEAPON_FIVESEVEN) { if (m_iShotsFired > 0) { if (gpGlobals->time > m_flDecreaseShotsFired) { m_iShotsFired--; m_flDecreaseShotsFired = gpGlobals->time + 0.0225; } } } else m_iShotsFired = 0; if (!(m_iWeaponState & WPNSTATE_SHIELD_DRAWN)) { if (m_iClip == 0 && !(iFlags() & ITEM_FLAG_NOAUTORELOAD) && m_flNextPrimaryAttack < UTIL_WeaponTimeBase()) { if (m_flFamasShoot == 0 && m_flGlock18Shoot == 0) { Reload(); return; } } } WeaponIdle(); return; } }