From 68a5e9d3b366971528becfb87ec2c4130e9b02ac Mon Sep 17 00:00:00 2001 From: TimeServ Date: Fri, 14 Apr 2006 05:23:11 +0000 Subject: [PATCH] simplified r_floorcolour/r_wallcolour, switched gl_texturemode to callback, some cleanup git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2207 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/renderer.c | 17 ++++++++++++----- engine/gl/gl_draw.c | 11 +++++------ engine/gl/gl_ppl.c | 16 ++-------------- engine/gl/gl_screen.c | 3 --- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 75c9be0ea..7bd7c2837 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -25,6 +25,10 @@ unsigned int *d_8to32table = d_8to24bgrtable; //palette lookups while rendering extern int gl_anisotropy_factor; +// callbacks used for cvars +#if defined(RGLQUAKE) +void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue); +#endif // @@ -96,7 +100,9 @@ static cvar_t vid_height = SCVARF("vid_height", "480", CVAR_ARCHIVE|CVAR_RENDERE static cvar_t vid_refreshrate = SCVARF("vid_displayfrequency", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); static cvar_t vid_multisample = SCVARF("vid_multisample", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); -cvar_t gl_texturemode = SCVAR("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST"); +#if defined(RGLQUAKE) +cvar_t gl_texturemode = SCVARFC("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE|CVAR_RENDERERCALLBACK, GL_Texturemode_Callback); +#endif cvar_t gl_motionblur = SCVARF("gl_motionblur", "0", CVAR_ARCHIVE); cvar_t gl_motionblurscale = SCVAR("gl_motionblurscale", "1"); cvar_t gl_fontedgeclamp = SCVAR("gl_fontedgeclamp", "0"); //gl blends. Set this to 1 to stop the outside of your conchars from being visible @@ -1239,8 +1245,8 @@ void M_Menu_Video_f (void) int prefabmode; int prefab2dmode; int currentbpp; - int currenttexturefilter; #ifdef RGLQUAKE + int currenttexturefilter; int currentanisotropy; #endif @@ -1294,14 +1300,15 @@ void M_Menu_Video_f (void) #ifdef RGLQUAKE if (gl_anisotropy_factor >= 2) currenttexturefilter = 2; - else -#endif - if (strcmp(gl_texturemode.string,trilinear)) + + if (strcmp(gl_texturemode.string,trilinear)) currenttexturefilter = 0; else if (strcmp(gl_texturemode.string,bilinear)) currenttexturefilter = 1; else currenttexturefilter = 1; +#endif + #ifdef RGLQUAKE if (gl_anisotropy_factor == 1) currentanisotropy = 0; diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index e5580bb40..eeb700a04 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -643,18 +643,19 @@ void GLDraw_Anisotropy_f (void) Draw_TextureMode_f =============== */ -void GLDraw_TextureMode_Changed (void) +void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue) { int i; gltexture_t *glt; - gl_texturemode.modified = false; + if (qrenderer != QR_OPENGL) + return; for (i=0 ; i< sizeof(modes)/sizeof(modes[0]) ; i++) { - if (!Q_strcasecmp (modes[i].name, gl_texturemode.string ) ) + if (!Q_strcasecmp (modes[i].name, var->string ) ) break; - if (!Q_strcasecmp (modes[i].altname, gl_texturemode.string ) ) + if (!Q_strcasecmp (modes[i].altname, var->string ) ) break; } if (i == 6) @@ -994,8 +995,6 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); } cs_texture = texture_extension_number++; - crosshair.modified=true; - crosshairimage.modified = true; missing_texture = GL_LoadTexture("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], true, false); diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index eb105efa1..0c53ad080 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -1185,27 +1185,15 @@ static void PPL_BaseChain_Flat(msurface_t *first) { if (r_wallcolour.modified) { - char *s; r_wallcolour.modified = false; - s = COM_Parse(r_wallcolour.string); - wallcolour[0] = atof(com_token); - s = COM_Parse(s); - wallcolour[1] = atof(com_token); - s = COM_Parse(s); - wallcolour[2] = atof(com_token); + SCR_StringToRGB(r_wallcolour.string, wallcolour, 1); } if (r_floorcolour.modified) { - char *s; r_floorcolour.modified = false; - s = COM_Parse(r_floorcolour.string); - floorcolour[0] = atof(com_token); - s = COM_Parse(s); - floorcolour[1] = atof(com_token); - s = COM_Parse(s); - floorcolour[2] = atof(com_token); + SCR_StringToRGB(r_floorcolour.string, floorcolour, 1); } } diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index 082dc102b..bfa307879 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include void GLSCR_UpdateScreen (void); -void GLDraw_TextureMode_Changed (void); extern qboolean scr_drawdialog; @@ -239,8 +238,6 @@ void GLSCR_UpdateScreen (void) oldsbar = cl_sbar.value; vid.recalc_refdef = true; } - if (gl_texturemode.modified) - GLDraw_TextureMode_Changed(); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);