From a2e4a7ec03d987c0645742fde30a591452689245 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Wed, 19 Jul 2017 04:11:08 +0500 Subject: [PATCH] Fix crosshair. --- cl_dll/ammo.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/cl_dll/ammo.cpp b/cl_dll/ammo.cpp index f439520e..edc21652 100644 --- a/cl_dll/ammo.cpp +++ b/cl_dll/ammo.cpp @@ -305,6 +305,9 @@ void CHudAmmo::Reset( void ) gHR.Reset(); //VidInit(); + wrect_t nullrc = {}; + SetCrosshair( 0, nullrc, 0, 0, 0 ); // reset crosshair + m_pWeapon = NULL; // reset last weapon } int CHudAmmo::VidInit( void ) @@ -606,22 +609,24 @@ int CHudAmmo::MsgFunc_CurWeapon( const char *pszName, int iSize, void *pbuf ) m_pWeapon = pWeapon; - if( gHUD.m_iFOV >= 90 ) + if( !( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) ) ) { - // normal crosshairs - if( fOnTarget && m_pWeapon->hAutoaim ) - SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 ); + if( gHUD.m_iFOV >= 90 ) + { + // normal crosshairs + if( fOnTarget && m_pWeapon->hAutoaim ) + SetCrosshair( m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255 ); + else + SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 ); + } else - SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 ); - } - else - { - // zoomed crosshairs - if( fOnTarget && m_pWeapon->hZoomedAutoaim ) - SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 ); - else - SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 ); - + { + // zoomed crosshairs + if( fOnTarget && m_pWeapon->hZoomedAutoaim ) + SetCrosshair( m_pWeapon->hZoomedAutoaim, m_pWeapon->rcZoomedAutoaim, 255, 255, 255 ); + else + SetCrosshair( m_pWeapon->hZoomedCrosshair, m_pWeapon->rcZoomedCrosshair, 255, 255, 255 ); + } } m_fFade = 200.0f; //!!!