Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 37 additions & 8 deletions cl_dll/ammo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
if (gEngfuncs.IsSpectateOnly())
return 1;

if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_FLASHLIGHT | HIDEHUD_ALL ) )
if ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_FLASHLIGHT | HIDEHUD_ALL | HIDEHUD_CROSSHAIR ) )
{
gpActiveSel = NULL;
HideCrosshair();
Expand All @@ -581,12 +581,20 @@ int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
//
int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
{
int fOnTarget = FALSE;

BufferReader reader( pszName, pbuf, iSize );

int iState = reader.ReadByte();
int iId = reader.ReadChar();
int iClip = reader.ReadChar();

// detect if we're also on target
if( iState > 1 )
{
fOnTarget = TRUE;
}

if ( iId < 1 )
{
HideCrosshair();
Expand Down Expand Up @@ -621,6 +629,23 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )

m_pWeapon = pWeapon;

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 );

HideCrosshair(); // hide static
}
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 );
}

m_fFade = 200.0f; //!!!

return 1;
Expand Down Expand Up @@ -1024,16 +1049,14 @@ int CHudAmmo::Draw(float flTime)
int a, x, y, r, g, b;
int AmmoWidth;

if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;

// place it here, so pretty dynamic crosshair will work even in spectator!
if( gHUD.m_iFOV > 40 )
{
HideCrosshair(); // hide static

// draw a dynamic crosshair
DrawCrosshair();
if( !( gHUD.m_iHideHUDDisplay & HIDEHUD_CROSSHAIR ) )
DrawCrosshair();

DrawSpriteCrosshair();
}
else
{
Expand All @@ -1045,7 +1068,10 @@ int CHudAmmo::Draw(float flTime)
}
}

if ( (gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
if (!(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)) ))
return 1;

if( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL ) )
return 1;

// Draw Weapon Menu
Expand Down Expand Up @@ -1576,6 +1602,9 @@ void CHudAmmo::DrawCrosshair( int weaponId )

void CHudAmmo::DrawCrosshair()
{
if( g_iUser1 && g_iUser1 != OBS_IN_EYE )
return;

int flags, iDeltaDistance, iDistance, iLength, weaponid;
float flCrosshairDistance;

Expand Down
Loading