diff --git a/main/source/cl_dll/hud_crosshairs.cpp b/main/source/cl_dll/hud_crosshairs.cpp index adcfd396..9ed791c4 100644 --- a/main/source/cl_dll/hud_crosshairs.cpp +++ b/main/source/cl_dll/hud_crosshairs.cpp @@ -20,6 +20,7 @@ int CHudCrosshairs::Init() cl_cross_outline_alpha = CVAR_CREATE("cl_cross_outline_alpha", "255", FCVAR_ARCHIVE); cl_cross_outline_inner = CVAR_CREATE("cl_cross_outline_inner", "0", FCVAR_ARCHIVE); cl_cross_circle_radius = CVAR_CREATE("cl_cross_circle_radius", "0", FCVAR_ARCHIVE); + cl_cross_circle_thickness = CVAR_CREATE("cl_cross_circle_thickness", "1", FCVAR_ARCHIVE); cl_cross_dot_size = CVAR_CREATE("cl_cross_dot_size", "0", FCVAR_ARCHIVE); cl_cross_dot_color = CVAR_CREATE("cl_cross_dot_color", "", FCVAR_ARCHIVE); cl_cross_dot_outline = CVAR_CREATE("cl_cross_dot_outline", "0", FCVAR_ARCHIVE); @@ -164,6 +165,29 @@ int CHudCrosshairs::Draw(float time) gl.line(Vector2D(center.x - offset.x, center.y - offset.y + dot_half_width), Vector2D(center.x - offset.x, center.y + offset.y - dot_half_width)); gl.line(Vector2D(center.x - offset.x - dot_half_width, center.y + offset.y), Vector2D(center.x + offset.x + dot_half_width, center.y + offset.y)); } + + // Circle + if (cl_cross_circle_radius->value > 0.0f && cl_cross_circle_thickness->value > 0.0f) { + + auto radius = cl_cross_circle_radius->value; + + if (cl_cross_outline_inner->value == 0.0f) + { + radius += (cl_cross_circle_thickness->value * 0.5f) + (cl_cross_outline->value * 0.5f); + gl.line_width(cl_cross_outline->value); + } + else + { + gl.line_width(cl_cross_circle_thickness->value + cl_cross_outline->value); + } + + if (old_circle_radius != radius) { + // Recompute the circle points. + circle_points = HudGL::compute_circle(radius); + old_circle_radius = radius; + } + gl.circle(center, circle_points); + } } gl.color(r, g, b, alpha); diff --git a/main/source/cl_dll/hud_crosshairs.h b/main/source/cl_dll/hud_crosshairs.h index a313ddb4..4934b23e 100644 --- a/main/source/cl_dll/hud_crosshairs.h +++ b/main/source/cl_dll/hud_crosshairs.h @@ -16,6 +16,7 @@ class CHudCrosshairs : public CHudBase cvar_t* cl_cross_outline_alpha; cvar_t* cl_cross_outline_inner; cvar_t* cl_cross_circle_radius; + cvar_t* cl_cross_circle_thickness; cvar_t* cl_cross_dot_size; cvar_t* cl_cross_dot_color; cvar_t* cl_cross_dot_outline; diff --git a/main/source/cl_dll/hudgl.cpp b/main/source/cl_dll/hudgl.cpp index 2b43e27e..60d99da7 100644 --- a/main/source/cl_dll/hudgl.cpp +++ b/main/source/cl_dll/hudgl.cpp @@ -52,9 +52,9 @@ void HudGL::line(const Vector2D& start, const Vector2D& end) const { glEnd(); } -#ifdef __APPLE__ -//Remove when OSX builds with c++11 -#else +//#ifdef __APPLE__ +////Remove when OSX builds with c++11 +//#else void HudGL::circle(const Vector2D& center, const std::vector& points) const { glBegin(GL_LINE_STRIP); @@ -64,7 +64,7 @@ void HudGL::circle(const Vector2D& center, const std::vector& points) glVertex2f(center.x + points[0].x, center.y + points[0].y); glEnd(); } -#endif +//#endif void HudGL::rectangle(const Vector2D& corner_a, const Vector2D& corner_b) const { glBegin(GL_QUADS);