Warn when fog rgb is specified above 2. fog rgb is supposed to be floats, not byte values. The oversaturation causes problems with skyboxes and other infinite-distance type things.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5730 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2020-07-15 23:47:04 +00:00
parent 457b7e5f58
commit 6ffa59d684
1 changed files with 15 additions and 7 deletions

View File

@ -4389,6 +4389,7 @@ void CL_FTP_f(void)
void CL_Fog_f(void)
{
int ftype;
vec3_t rgb;
if (!Q_strcasecmp(Cmd_Argv(0), "waterfog"))
ftype = FOGTYPE_WATER;
else if (!Q_strcasecmp(Cmd_Argv(0), "skyroomfog"))
@ -4404,6 +4405,7 @@ void CL_Fog_f(void)
else
{
CL_ResetFog(ftype);
VectorSet(rgb, 0.3,0.3,0.3);
switch(Cmd_Argc())
{
@ -4414,23 +4416,29 @@ void CL_Fog_f(void)
break;
case 3:
cl.fog[ftype].density = atof(Cmd_Argv(1));
cl.fog[ftype].colour[0] = cl.fog[ftype].colour[1] = cl.fog[ftype].colour[2] = SRGBf(atof(Cmd_Argv(2)));
rgb[0] = rgb[1] = rgb[2] = atof(Cmd_Argv(2));
break;
case 4:
cl.fog[ftype].density = 0.05; //make something up for vauge compat with fitzquake, so it doesn't get the default of 0
cl.fog[ftype].colour[0] = SRGBf(atof(Cmd_Argv(1)));
cl.fog[ftype].colour[1] = SRGBf(atof(Cmd_Argv(2)));
cl.fog[ftype].colour[2] = SRGBf(atof(Cmd_Argv(3)));
rgb[0] = atof(Cmd_Argv(1));
rgb[1] = atof(Cmd_Argv(2));
rgb[2] = atof(Cmd_Argv(3));
break;
case 5:
default:
cl.fog[ftype].density = atof(Cmd_Argv(1));
cl.fog[ftype].colour[0] = SRGBf(atof(Cmd_Argv(2)));
cl.fog[ftype].colour[1] = SRGBf(atof(Cmd_Argv(3)));
cl.fog[ftype].colour[2] = SRGBf(atof(Cmd_Argv(4)));
rgb[0] = atof(Cmd_Argv(2));
rgb[1] = atof(Cmd_Argv(3));
rgb[2] = atof(Cmd_Argv(4));
break;
}
if (rgb[0]>=2 || rgb[1]>=2 || rgb[2]>=2) //we allow SOME slop for hdr fog... hopefully we won't need it. this is mostly just an issue when skyfog is enabled[default .5] ('why is my sky white on map FOO')
Con_Printf(CON_WARNING "Fog colour of %g %g %g exceeds standard 0-1 range\n", rgb[0], rgb[1], rgb[2]);
cl.fog[ftype].colour[0] = SRGBf(rgb[0]);
cl.fog[ftype].colour[1] = SRGBf(rgb[1]);
cl.fog[ftype].colour[2] = SRGBf(rgb[2]);
if (cls.state == ca_active)
cl.fog[ftype].time += 1;