CTR/PSP: Don't allow bad fog values to pass

This commit is contained in:
MotoLegacy 2024-11-25 00:20:52 -08:00
parent b1537dae13
commit 0df971f883
2 changed files with 30 additions and 0 deletions

View file

@ -44,6 +44,11 @@ update internal variables
*/
void Fog_Update (float start, float end, float red, float green, float blue, float time)
{
if (start <= 0.01f || end <= 0.01f) {
start = 0.0f;
end = 0.0f;
}
//save previous settings for fade
if (time > 0)
{
@ -99,6 +104,11 @@ void Fog_ParseServerMessage (void)
blue = MSG_ReadByte() / 255.0;
time = MSG_ReadShort() / 100.0;
if (start < 0.01f || end < 0.01f) {
start = 0.0f;
end = 0.0f;
}
Fog_Update (start, end, red, green, blue, time);
}
@ -243,6 +253,11 @@ void Fog_ParseWorldspawn (void)
fog_density_gl = ((fog_start / fog_end))/3.5;
}
if (r_refdef.fog_start <= 0.01 || r_refdef.fog_end <= 0.01) {
r_refdef.fog_start = 0.0f;
r_refdef.fog_end = 0.0f;
}
}
/*

View file

@ -37,6 +37,11 @@ update internal variables
*/
void Fog_Update (float start, float end, float red, float green, float blue, float time)
{
if (start <= 0.01f || end <= 0.01f) {
start = 0.0f;
end = 0.0f;
}
//save previous settings for fade
if (time > 0)
{
@ -89,6 +94,11 @@ void Fog_ParseServerMessage (void)
blue = MSG_ReadByte() / 255.0;
time = MSG_ReadShort() / 100.0;
if (start < 0.01f || end < 0.01f) {
start = 0.0f;
end = 0.0f;
}
Fog_Update (start, end, red, green, blue, time);
}
@ -230,6 +240,11 @@ void Fog_ParseWorldspawn (void)
sscanf(value, "%f %f %f %f %f", &r_refdef.fog_start, &r_refdef.fog_end, &r_refdef.fog_red, &r_refdef.fog_green, &r_refdef.fog_blue);
}
}
if (r_refdef.fog_start <= 0.01 || r_refdef.fog_end <= 0.01) {
r_refdef.fog_start = 0.0f;
r_refdef.fog_end = 0.0f;
}
}
/*