bool CWeaponBaseGun::Reload() { CMomentumPlayer *pPlayer = GetPlayerOwner(); if (!pPlayer) return false; if (pPlayer->GetAmmoCount(GetPrimaryAmmoType()) <= 0) return false; int iResult = DefaultReload(GetMaxClip1(), GetMaxClip2(), ACT_VM_RELOAD); if (!iResult) return false; pPlayer->SetAnimation(PLAYER_RELOAD); #ifndef CLIENT_DLL if ((iResult) && (pPlayer->GetFOV() != pPlayer->GetDefaultFOV())) { pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV()); } #endif m_flAccuracy = 0.2; pPlayer->m_iShotsFired = 0; m_bDelayFire = false; return true; }
void CWeaponBaseGun::ItemPostFrame() { CMomentumPlayer *pPlayer = GetPlayerOwner(); if (!pPlayer) return; if ((m_flNextPrimaryAttack <= gpGlobals->curtime) && (pPlayer->m_bResumeZoom)) { #ifndef CLIENT_DLL pPlayer->SetFOV(pPlayer, pPlayer->m_iLastZoomFOV, 0.05f); // Make sure we think that we are zooming on the server so we don't get instant acc bonus m_zoomFullyActiveTime = gpGlobals->curtime + 0.05f; if (pPlayer->GetFOV() == pPlayer->m_iLastZoomFOV) { // return the fade level in zoom. pPlayer->m_bResumeZoom = false; } #endif } ProcessAnimationEvents(); BaseClass::ItemPostFrame(); }
void CWeaponScout::SCOUTFire(float flSpread) { CMomentumPlayer *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 CWeaponAWP::SecondaryAttack() { #ifndef CLIENT_DLL CMomentumPlayer *pPlayer = GetPlayerOwner(); if (pPlayer == nullptr) { Assert(pPlayer != nullptr); return; } if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV()) { pPlayer->SetFOV(pPlayer, 40, 0.15f); } else if (pPlayer->GetFOV() == 40) { pPlayer->SetFOV(pPlayer, 10, 0.08f); } else { pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV(), 0.1f); } //pPlayer->ResetMaxSpeed(); #endif #ifndef CLIENT_DLL // If this isn't guarded, the sound will be emitted twice, once by the server and once by the client. // Let the server play it since if only the client plays it, it's liable to get played twice cause of // a prediction error. joy. EmitSound("Default.Zoom"); // let the bots hear the rifle zoom IGameEvent * event = gameeventmanager->CreateEvent("weapon_zoom"); if (event) { event->SetInt("userid", pPlayer->GetUserID()); gameeventmanager->FireEvent(event); } #endif m_flNextSecondaryAttack = gpGlobals->curtime + 0.3; m_zoomFullyActiveTime = gpGlobals->curtime + 0.15; // The worst zoom time from above. }
void CWeaponAWP::UnzoomThink(void) { CMomentumPlayer *pPlayer = GetPlayerOwner(); if (pPlayer == nullptr) { Assert(pPlayer != nullptr); return; } pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV(), 0.1f); }
void CWeaponAug::SecondaryAttack() { #ifndef CLIENT_DLL CMomentumPlayer *pPlayer = GetPlayerOwner(); if (!pPlayer) return; if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV()) { pPlayer->SetFOV(pPlayer, 55, 0.2f); } else if (pPlayer->GetFOV() == 55) { pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV(), 0.15f); } else { pPlayer->SetFOV(pPlayer, pPlayer->GetDefaultFOV()); } #endif m_flNextSecondaryAttack = gpGlobals->curtime + 0.3; }
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); }