//----------------------------------------------------------------------------- // Purpose: Draw the weapon's crosshair //----------------------------------------------------------------------------- void CWeaponCombatLaserRifle::DrawCrosshair( void ) { BaseClass::DrawCrosshair(); // Draw the targeting zone around the crosshair int r, g, b, a; gHUD.m_clrYellowish.GetColor( r, g, b, a ); // Check to see if we are in vgui mode C_BaseTFPlayer *pPlayer = static_cast<C_BaseTFPlayer*>( GetOwner() ); if ( !pPlayer || pPlayer->IsInVGuiInputMode() ) return; // Draw a crosshair & accuracy hoodad int iBarWidth = XRES(10); int iBarHeight = YRES(10); int iTotalWidth = (iBarWidth * 2) + (40 * m_flInaccuracy) + XRES(10); int iTotalHeight = (iBarHeight * 2) + (40 * m_flInaccuracy) + YRES(10); // Horizontal bars int iLeft = (ScreenWidth() - iTotalWidth) / 2; int iMidHeight = (ScreenHeight() / 2); Color dark( r, g, b, 32 ); Color light( r, g, b, 160 ); vgui::surface()->DrawSetColor( dark ); vgui::surface()->DrawFilledRect( iLeft, iMidHeight-1, iLeft+ iBarWidth, iMidHeight + 2 ); vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight-1, iLeft + iTotalWidth, iMidHeight + 2 ); vgui::surface()->DrawSetColor( light ); vgui::surface()->DrawFilledRect( iLeft, iMidHeight, iLeft + iBarWidth, iMidHeight + 1 ); vgui::surface()->DrawFilledRect( iLeft + iTotalWidth - iBarWidth, iMidHeight, iLeft + iTotalWidth, iMidHeight + 1 ); // Vertical bars int iTop = (ScreenHeight() - iTotalHeight) / 2; int iMidWidth = (ScreenWidth() / 2); vgui::surface()->DrawSetColor( dark ); vgui::surface()->DrawFilledRect( iMidWidth-1, iTop, iMidWidth + 2, iTop + iBarHeight ); vgui::surface()->DrawFilledRect( iMidWidth-1, iTop + iTotalHeight - iBarHeight, iMidWidth + 2, iTop + iTotalHeight ); vgui::surface()->DrawSetColor( light ); vgui::surface()->DrawFilledRect( iMidWidth, iTop, iMidWidth + 1, iTop + iBarHeight ); vgui::surface()->DrawFilledRect( iMidWidth, iTop + iTotalHeight - iBarHeight, iMidWidth + 1, iTop + iTotalHeight ); }