//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time // Input : // Output : //----------------------------------------------------------------------------- bool CWeaponShotgun::Reload( void ) { // Check that StartReload was called first if (!m_bInReload) { Warning("ERROR: Shotgun Reload called incorrectly!\n"); } CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; FillClip(); // Play reload on different channel as otherwise steals channel away from fire sound WeaponSound(RELOAD); SendWeaponAnim( ACT_VM_RELOAD ); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); return true; }
bool CWeaponShotgun::Reload( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if ( pOwner->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 ) return false; if ( m_iClip1 >= GetMaxClip1() ) return false; // don't reload until recoil is done if ( m_flNextPrimaryAttack > gpGlobals->curtime ) return false; // check to see if we're ready to reload if ( m_fInSpecialReload == 0 ) { SendWeaponAnim( ACT_SHOTGUN_RELOAD_START ); m_fInSpecialReload = 1; pOwner->m_flNextAttack = gpGlobals->curtime + 0.6; SetWeaponIdleTime( gpGlobals->curtime + 0.6 ); m_flNextPrimaryAttack = gpGlobals->curtime + 1.0; m_flNextSecondaryAttack = gpGlobals->curtime + 1.0; return true; } else if ( m_fInSpecialReload == 1 ) { if ( !HasWeaponIdleTimeElapsed() ) return false; // was waiting for gun to move to side m_fInSpecialReload = 2; // Play reload on different channel as otherwise steals channel away from fire sound WeaponSound( RELOAD ); SendWeaponAnim( ACT_VM_RELOAD ); SetWeaponIdleTime( gpGlobals->curtime + 0.5 ); } else { FillClip(); m_fInSpecialReload = 1; } return true; }
//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time //----------------------------------------------------------------------------- bool CWeaponRemington::Reload( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = min(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; FillClip(); // Play reload on different channel as otherwise steals channel away from fire sound WeaponSound(RELOAD); SendWeaponAnim( ACT_VM_RELOAD ); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + 0.5f; return true; }