Skip to content

Commit

Permalink
Client: HUD: Crosshair: Check if m_pWeapon is null (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Dec 18, 2023
1 parent 6750a4c commit e00a6fe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/game/client/hud/crosshair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ void CHudCrosshair::Draw(float flTime)
if (!(m_iFlags & HUD_ACTIVE))
return;

if (gEngfuncs.GetMaxClients() == 1)
{
// These checks are limited to singleplayer since HL servers
// reset the HUD incorrectly on full update (e.g. when starting a demo recording).
// This causes ammo count and crosshair to disappear.
if ((gHUD.m_iHideHUDDisplay & HIDEHUD_WEAPONS) || !CHudAmmo::Get()->m_pWeapon)
return;
}
if (!CHudAmmo::Get()->m_pWeapon)
return;

// These checks are limited to singleplayer since HL servers
// reset the HUD incorrectly on full update (e.g. when starting a demo recording).
// This causes ammo count and crosshair to disappear.
if (gEngfuncs.GetMaxClients() == 1 && gHUD.m_iHideHUDDisplay & HIDEHUD_WEAPONS)
return;

bool isZoomed = gHUD.m_iFOV < 90;
bool shouldDrawZoomed = cl_cross_zoom.GetInt() == 1 || cl_cross_zoom.GetInt() == 2;
Expand Down

0 comments on commit e00a6fe

Please sign in to comment.