r_fastskycolour accepts rgb format

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2857 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2008-01-13 05:05:30 +00:00
parent ec41df875c
commit 9f09a30019
5 changed files with 27 additions and 16 deletions

View file

@ -86,7 +86,8 @@ cvar_t r_drawviewmodelinvis = SCVAR ("r_drawviewmodelinvis", "0");
cvar_t r_dynamic = SCVARF ("r_dynamic", "1",
CVAR_ARCHIVE);
cvar_t r_fastsky = SCVAR ("r_fastsky", "0");
cvar_t r_fastskycolour = SCVAR ("r_fastskycolour", "0");
cvar_t r_fastskycolour = SCVARF ("r_fastskycolour", "0",
CVAR_RENDERERCALLBACK);
cvar_t r_fb_bmodels = SCVARF("gl_fb_bmodels", "1",
CVAR_SEMICHEAT|CVAR_RENDERERLATCH);
cvar_t r_fb_models = FCVAR ("r_fb_models", "gl_fb_models", "1",

View file

@ -662,6 +662,7 @@ extern cvar_t gl_conback, gl_font, gl_smoothfont, gl_fontinwardstep, r_menutint;
extern cvar_t vid_conautoscale, vid_conheight, vid_conwidth;
extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname;
extern cvar_t r_floorcolour, r_wallcolour, r_floortexture, r_walltexture;
extern cvar_t r_fastskycolour;
void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue);
void GLCrosshair_Callback(struct cvar_s *var, char *oldvalue);
void GLCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue);
@ -680,6 +681,7 @@ void GLR_Walltexture_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Floortexture_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Drawflat_Callback(struct cvar_s *var, char *oldvalue);
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Fastskycolour_Callback(struct cvar_s *var, char *oldvalue);
void GLR_DeInit (void)
{
@ -705,6 +707,7 @@ void GLR_DeInit (void)
Cvar_Unhook(&r_floorcolour);
Cvar_Unhook(&r_walltexture);
Cvar_Unhook(&r_floortexture);
Cvar_Unhook(&r_fastskycolour);
Cvar_Unhook(&r_drawflat);
Cvar_Unhook(&v_gamma);
Cvar_Unhook(&v_contrast);
@ -734,6 +737,7 @@ void GLR_Init (void)
Cvar_Hook(&vid_conheight, GLVID_Conheight_Callback);
Cvar_Hook(&vid_conwidth, GLVID_Conwidth_Callback);
Cvar_Hook(&r_floorcolour, GLR_Floorcolour_Callback);
Cvar_Hook(&r_fastskycolour, GLR_Fastskycolour_Callback);
Cvar_Hook(&r_wallcolour, GLR_Wallcolour_Callback);
Cvar_Hook(&r_floortexture, GLR_Floortexture_Callback);
Cvar_Hook(&r_walltexture, GLR_Walltexture_Callback);

View file

@ -59,6 +59,12 @@ extern cvar_t r_fastskycolour;
char defaultskybox[MAX_QPATH];
int skyboxtex[6];
vec3_t glskycolor;
void GLR_Fastskycolour_Callback(struct cvar_s *var, char *oldvalue)
{
SCR_StringToRGB(var->string, glskycolor, 255);
}
void GL_DrawSkyBox (msurface_t *s);
void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
@ -224,16 +230,8 @@ void GL_DrawSkyChain (msurface_t *s)
if (r_fastsky.value||(!solidskytexture&&!usingskybox)) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
{
int fc;
qbyte *pal;
fc = r_fastskycolour.value;
if (fc > 255)
fc = 255;
if (fc < 0)
fc = 0;
pal = host_basepal+fc*3;
qglDisable(GL_TEXTURE_2D);
qglColor3f(pal[0]/255.0f, pal[1]/255.0f, pal[2]/255.0f);
qglColor3f(glskycolor[0], glskycolor[1], glskycolor[2]);
qglDisableClientState( GL_COLOR_ARRAY );
for (fa=s ; fa ; fa=fa->texturechain)
{
@ -1348,7 +1346,7 @@ void R_InitSky (texture_t *mt)
((qbyte *)&transpix)[2] = b/(128*128);
((qbyte *)&transpix)[3] = 0;
sprintf(name, "%s_solid", mt->name);
Q_snprintfz(name, sizeof(name), "%s_solid", mt->name);
Q_strlwr(name);
solidskytexture = Mod_LoadReplacementTexture(name, NULL, true, false, true);
if (!solidskytexture)
@ -1373,7 +1371,7 @@ void R_InitSky (texture_t *mt)
trans[(i*128) + j] = d_8to24rgbtable[p] & alphamask;
}
sprintf(name, "%s_trans", mt->name);
Q_snprintfz(name, sizeof(name), "%s_trans", mt->name);
Q_strlwr(name);
alphaskytexture = Mod_LoadReplacementTexture(name, NULL, true, true, true);
if (!alphaskytexture)

View file

@ -28,7 +28,7 @@ float scale_for_mip;
int screenwidth;
int ubasestep, errorterm, erroradjustup, erroradjustdown;
int vstartscan;
int r_wallindex, r_floorindex;
int r_wallindex, r_floorindex, r_skycolorindex;
// FIXME: should go away
extern void R_RotateBmodel (void);
@ -214,6 +214,11 @@ void SWR_Wallcolour_Callback(struct cvar_s *var, char *oldvalue)
D_FlushCaches();
}
void SWR_Fastskycolour_Callback(struct cvar_s *var, char *oldvalue)
{
r_skycolorindex = SCR_StringToPalIndex(var->string, 255);
}
/*
==============
D_DrawSurfaces
@ -264,7 +269,7 @@ void D_DrawSurfaces (void)
{
if (r_fastsky.value || r_worldentity.model->fromgame != fg_quake)
{
D_DrawSolidSurface (s, (int)r_fastskycolour.value & 0xFF);
D_DrawSolidSurface (s, r_skycolorindex & 0xFF);
}
else
{
@ -292,7 +297,7 @@ void D_DrawSurfaces (void)
d_zistepv = 0;
d_ziorigin = -0.9;
D_DrawSolidSurface (s, (int)r_fastskycolour.value & 0xFF);
D_DrawSolidSurface (s, r_skycolorindex & 0xFF);
D_DrawZSpans (s->spans);
continue;
}

View file

@ -206,7 +206,7 @@ void SWR_InitTextures (void)
// callback declares
extern cvar_t crosshaircolor, r_skyboxname, r_menutint, v_contrast;
extern cvar_t r_floorcolour, r_wallcolour, r_drawflat;
extern cvar_t r_floorcolour, r_wallcolour, r_drawflat, r_fastskycolour;
void SWCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Skyboxname_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Menutint_Callback(struct cvar_s *var, char *oldvalue);
@ -214,6 +214,7 @@ void SWV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Floorcolour_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Wallcolour_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Drawflat_Callback(struct cvar_s *var, char *oldvalue);
void SWR_Fastskycolour_Callback(struct cvar_s *var, char *oldvalue);
void SWR_DeInit (void)
{
@ -228,6 +229,7 @@ void SWR_DeInit (void)
Cvar_Unhook(&r_floorcolour);
Cvar_Unhook(&r_wallcolour);
Cvar_Unhook(&r_drawflat);
Cvar_Unhook(&r_fastskycolour);
SWDraw_Shutdown();
D_Shutdown();
@ -257,6 +259,7 @@ void SWR_Init (void)
Cvar_Hook(&r_floorcolour, SWR_Floorcolour_Callback);
Cvar_Hook(&r_wallcolour, SWR_Wallcolour_Callback);
Cvar_Hook(&r_drawflat, SWR_Drawflat_Callback);
Cvar_Hook(&r_fastskycolour, SWR_Fastskycolour_Callback);
if (!r_maxedges.value)
Cvar_SetValue (&r_maxedges, (float)NUMSTACKEDGES);