From 70d31d2617dbaecd253dc16bc4f03b8a334d6158 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sat, 15 Apr 2006 07:10:49 +0000 Subject: [PATCH] added gl_smoothcrosshair, defaults to 1, 0 = don't smooth, 1 = old behavior (smooth on crosshairsize > 16 or using image) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2212 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/renderer.c | 2 ++ engine/gl/gl_draw.c | 30 +++++++++++++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 63141899f..bc1bd5132 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -110,6 +110,7 @@ cvar_t gl_font = SCVARF("gl_font", "", CVAR_RENDERERCALLBACK); //gl blends. Set this to 1 to stop the outside of your conchars from being visible cvar_t gl_fontedgeclamp = SCVAR("gl_fontedgeclamp", "0"); cvar_t gl_smoothfont = SCVAR("gl_smoothfont", "1"); +cvar_t gl_smoothcrosshair = SCVAR("gl_smoothcrosshair", "1"); #endif cvar_t gl_motionblur = SCVARF("gl_motionblur", "0", CVAR_ARCHIVE); cvar_t gl_motionblurscale = SCVAR("gl_motionblurscale", "1"); @@ -318,6 +319,7 @@ void GLRenderer_Init(void) Cvar_Register (&gl_font, GRAPHICALNICETIES); Cvar_Register (&gl_conback, GRAPHICALNICETIES); Cvar_Register (&gl_smoothfont, GRAPHICALNICETIES); + Cvar_Register (&gl_smoothcrosshair, GRAPHICALNICETIES); Cvar_Register (&gl_bump, GRAPHICALNICETIES); Cvar_Register (&r_shadow_glsl_offsetmapping, GRAPHICALNICETIES); diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index 14815afbf..2a980c87f 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -61,7 +61,7 @@ extern cvar_t gl_lerpimages; extern cvar_t gl_picmip2d; extern cvar_t r_drawdisk; extern cvar_t gl_compress; -extern cvar_t gl_smoothfont, gl_fontedgeclamp; +extern cvar_t gl_smoothfont, gl_smoothcrosshair, gl_fontedgeclamp; extern cvar_t gl_texturemode; extern cvar_t cl_noblink; @@ -1399,7 +1399,7 @@ void GLDraw_Crosshair(void) float x1, x2, y1, y2; float size, chc; - int usecolor = 0; + qboolean usingimage = false; if (crosshair.value == 1 && !*crosshairimage.string) { @@ -1414,7 +1414,7 @@ void GLDraw_Crosshair(void) if (*crosshairimage.string) { - usecolor = 1; + usingimage = true; GL_Bind (externalhair); chc = 0; @@ -1430,17 +1430,6 @@ void GLDraw_Crosshair(void) if (crosshair.value >= FIRSTANIMATEDCROSHAIR) GLCrosshair_Callback(&crosshair, ""); - if (crosshairsize.value <= 16) - { - qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } - else - { - qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - if (crosshairalpha.value<1) { qglEnable (GL_BLEND); @@ -1455,7 +1444,7 @@ void GLDraw_Crosshair(void) else return; - if (usecolor) + if (usingimage) qglColor4f(chcolor[0], chcolor[1], chcolor[2], crosshairalpha.value); else qglColor4f(1, 1, 1, crosshairalpha.value); @@ -1463,6 +1452,17 @@ void GLDraw_Crosshair(void) size = crosshairsize.value; chc = size * chc; + if (gl_smoothcrosshair.value && (size > 16 || usingimage)) + { + qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } + for (sc = 0; sc < cl.splitclients; sc++) { SCR_CrosshairPosition(sc, &x, &y);