Fog_FogCommand_f: remove function calls from CLAMP and q_max macros

This commit is contained in:
Ozkan Sezer 2022-06-02 14:33:10 +03:00
parent 16d813859f
commit a82e3dd75e

View file

@ -115,6 +115,8 @@ handle the 'fog' console command
*/
void Fog_FogCommand_f (void)
{
float d, r, g, b, t;
switch (Cmd_Argc())
{
default:
@ -128,43 +130,52 @@ void Fog_FogCommand_f (void)
Con_Printf(" \"red\" is \"%f\"\n", fog_red);
Con_Printf(" \"green\" is \"%f\"\n", fog_green);
Con_Printf(" \"blue\" is \"%f\"\n", fog_blue);
break;
return;
case 2:
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
fog_red,
fog_green,
fog_blue,
0.0);
d = atof(Cmd_Argv(1));
t = 0.0f;
r = fog_red;
g = fog_green;
b = fog_blue;
break;
case 3: //TEST
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
fog_red,
fog_green,
fog_blue,
atof(Cmd_Argv(2)));
d = atof(Cmd_Argv(1));
t = atof(Cmd_Argv(2));
r = fog_red;
g = fog_green;
b = fog_blue;
break;
case 4:
Fog_Update(fog_density,
CLAMP(0.0, atof(Cmd_Argv(1)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
0.0);
d = fog_density;
t = 0.0f;
r = atof(Cmd_Argv(1));
g = atof(Cmd_Argv(2));
b = atof(Cmd_Argv(3));
break;
case 5:
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
0.0);
d = atof(Cmd_Argv(1));
r = atof(Cmd_Argv(2));
g = atof(Cmd_Argv(3));
b = atof(Cmd_Argv(4));
t = 0.0f;
break;
case 6: //TEST
Fog_Update(q_max(0.0, atof(Cmd_Argv(1))),
CLAMP(0.0, atof(Cmd_Argv(2)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(3)), 1.0),
CLAMP(0.0, atof(Cmd_Argv(4)), 1.0),
atof(Cmd_Argv(5)));
d = atof(Cmd_Argv(1));
r = atof(Cmd_Argv(2));
g = atof(Cmd_Argv(3));
b = atof(Cmd_Argv(4));
t = atof(Cmd_Argv(5));
break;
}
if (d < 0.0f) d = 0.0f;
if (r < 0.0f) r = 0.0f;
else if (r > 1.0f) r = 1.0f;
if (g < 0.0f) g = 0.0f;
else if (g > 1.0f) g = 1.0f;
if (b < 0.0f) b = 0.0f;
else if (b > 1.0f) b = 1.0f;
Fog_Update(d, r, g, b, t);
}
/*