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
This commit is contained in:
TimeServ 2006-04-14 05:23:11 +00:00
parent 363223186e
commit 68a5e9d3b3
4 changed files with 19 additions and 28 deletions

View File

@ -25,6 +25,10 @@ unsigned int *d_8to32table = d_8to24bgrtable; //palette lookups while rendering
extern int gl_anisotropy_factor; 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_refreshrate = SCVARF("vid_displayfrequency", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH);
static cvar_t vid_multisample = SCVARF("vid_multisample", "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_motionblur = SCVARF("gl_motionblur", "0", CVAR_ARCHIVE);
cvar_t gl_motionblurscale = SCVAR("gl_motionblurscale", "1"); 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 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 prefabmode;
int prefab2dmode; int prefab2dmode;
int currentbpp; int currentbpp;
int currenttexturefilter;
#ifdef RGLQUAKE #ifdef RGLQUAKE
int currenttexturefilter;
int currentanisotropy; int currentanisotropy;
#endif #endif
@ -1294,14 +1300,15 @@ void M_Menu_Video_f (void)
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (gl_anisotropy_factor >= 2) if (gl_anisotropy_factor >= 2)
currenttexturefilter = 2; currenttexturefilter = 2;
else
#endif if (strcmp(gl_texturemode.string,trilinear))
if (strcmp(gl_texturemode.string,trilinear))
currenttexturefilter = 0; currenttexturefilter = 0;
else if (strcmp(gl_texturemode.string,bilinear)) else if (strcmp(gl_texturemode.string,bilinear))
currenttexturefilter = 1; currenttexturefilter = 1;
else else
currenttexturefilter = 1; currenttexturefilter = 1;
#endif
#ifdef RGLQUAKE #ifdef RGLQUAKE
if (gl_anisotropy_factor == 1) if (gl_anisotropy_factor == 1)
currentanisotropy = 0; currentanisotropy = 0;

View File

@ -643,18 +643,19 @@ void GLDraw_Anisotropy_f (void)
Draw_TextureMode_f Draw_TextureMode_f
=============== ===============
*/ */
void GLDraw_TextureMode_Changed (void) void GL_Texturemode_Callback (struct cvar_s *var, char *oldvalue)
{ {
int i; int i;
gltexture_t *glt; gltexture_t *glt;
gl_texturemode.modified = false; if (qrenderer != QR_OPENGL)
return;
for (i=0 ; i< sizeof(modes)/sizeof(modes[0]) ; i++) 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; break;
if (!Q_strcasecmp (modes[i].altname, gl_texturemode.string ) ) if (!Q_strcasecmp (modes[i].altname, var->string ) )
break; break;
} }
if (i == 6) if (i == 6)
@ -994,8 +995,6 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
} }
cs_texture = texture_extension_number++; 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); missing_texture = GL_LoadTexture("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], true, false);

View File

@ -1185,27 +1185,15 @@ static void PPL_BaseChain_Flat(msurface_t *first)
{ {
if (r_wallcolour.modified) if (r_wallcolour.modified)
{ {
char *s;
r_wallcolour.modified = false; r_wallcolour.modified = false;
s = COM_Parse(r_wallcolour.string); SCR_StringToRGB(r_wallcolour.string, wallcolour, 1);
wallcolour[0] = atof(com_token);
s = COM_Parse(s);
wallcolour[1] = atof(com_token);
s = COM_Parse(s);
wallcolour[2] = atof(com_token);
} }
if (r_floorcolour.modified) if (r_floorcolour.modified)
{ {
char *s;
r_floorcolour.modified = false; r_floorcolour.modified = false;
s = COM_Parse(r_floorcolour.string); SCR_StringToRGB(r_floorcolour.string, floorcolour, 1);
floorcolour[0] = atof(com_token);
s = COM_Parse(s);
floorcolour[1] = atof(com_token);
s = COM_Parse(s);
floorcolour[2] = atof(com_token);
} }
} }

View File

@ -27,7 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <time.h> #include <time.h>
void GLSCR_UpdateScreen (void); void GLSCR_UpdateScreen (void);
void GLDraw_TextureMode_Changed (void);
extern qboolean scr_drawdialog; extern qboolean scr_drawdialog;
@ -239,8 +238,6 @@ void GLSCR_UpdateScreen (void)
oldsbar = cl_sbar.value; oldsbar = cl_sbar.value;
vid.recalc_refdef = true; vid.recalc_refdef = true;
} }
if (gl_texturemode.modified)
GLDraw_TextureMode_Changed();
GL_BeginRendering (&glx, &gly, &glwidth, &glheight); GL_BeginRendering (&glx, &gly, &glwidth, &glheight);