game/server/hl2/weapon_sniperrifle.cpp
void CWeaponSniperRifle::Zoom( void )
{
	CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
	if (!pPlayer)
	{
		return;
	}

	if (m_nZoomLevel >= sizeof(g_nZoomFOV) / sizeof(g_nZoomFOV[0]))
	{
		if ( pPlayer->SetFOV( this, 0 ) )
		{
			pPlayer->ShowViewModel(true);
			
			// Zoom out to the default zoom level
			WeaponSound(SPECIAL2);	
			m_nZoomLevel = 0;
		}
	}
	else
	{
		if ( pPlayer->SetFOV( this, g_nZoomFOV[m_nZoomLevel] ) )
		{
			if (m_nZoomLevel == 0)
			{
				pPlayer->ShowViewModel(false);
			}

			WeaponSound(SPECIAL1);
			
			m_nZoomLevel++;
		}
	}

	m_fNextZoom = gpGlobals->curtime + SNIPER_ZOOM_RATE;
}
//-----------------------------------------------------------------------------
// Purpose: Zooms in using the sniper rifle scope.
//-----------------------------------------------------------------------------
Zooms in using the sniper rifle scope.
Zooms in using the sniper rifle scope .
void CWeaponSniperRifle::Zoom( void )
{
	CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
	if (!pPlayer)
	{
		return;
	}
	if (m_nZoomLevel >= sizeof(g_nZoomFOV) / sizeof(g_nZoomFOV[0]))
	{
		if ( pPlayer->SetFOV( this, 0 ) )
		{
			pPlayer->ShowViewModel(true);
			WeaponSound(SPECIAL2);	
			m_nZoomLevel = 0;
		}
	}
	else
	{
		if ( pPlayer->SetFOV( this, g_nZoomFOV[m_nZoomLevel] ) )
		{
			if (m_nZoomLevel == 0)
			{
				pPlayer->ShowViewModel(false);
			}
			WeaponSound(SPECIAL1);
			m_nZoomLevel++;
		}
	}
	m_fNextZoom = gpGlobals->curtime + SNIPER_ZOOM_RATE;
}
void CWeaponSniperRifle :: Zoom ( void ) { CBasePlayer * pPlayer = ToBasePlayer ( GetOwner ( ) ) ; if ( ! pPlayer ) { return ; } if ( m_nZoomLevel >= sizeof ( g_nZoomFOV ) / sizeof ( g_nZoomFOV [ 0 ] ) ) { if ( pPlayer -> SetFOV ( this , 0 ) ) { pPlayer -> ShowViewModel ( true ) ; WeaponSound ( SPECIAL2 ) ; m_nZoomLevel = 0 ; } } else { if ( pPlayer -> SetFOV ( this , g_nZoomFOV [ m_nZoomLevel ] ) ) { if ( m_nZoomLevel == 0 ) { pPlayer -> ShowViewModel ( false ) ; } WeaponSound ( SPECIAL1 ) ; m_nZoomLevel ++ ; } } m_fNextZoom = gpGlobals -> curtime + SNIPER_ZOOM_RATE ; }
Purpose: Zooms in using the sniper rifle scope.
Purpose : Zooms in using the sniper rifle scope .
// Zoom out to the default zoom level