- replaced MIN/MAX in common code.

This commit is contained in:
Christoph Oelckers 2021-10-30 10:46:17 +02:00
commit eb69bbcae0
63 changed files with 200 additions and 236 deletions

View file

@ -151,8 +151,8 @@ int GetUIScale(F2DDrawer *drawer, int altval)
// block scales that result in something larger than the current screen.
int vmax = drawer->GetHeight() / 200;
int hmax = drawer->GetWidth() / 320;
int max = MAX(vmax, hmax);
return MAX(1,MIN(scaleval, max));
int max = std::max(vmax, hmax);
return std::max(1,min(scaleval, max));
}
// The new console font is twice as high, so the scaling calculation must factor that in.
@ -172,8 +172,8 @@ int GetConScale(F2DDrawer* drawer, int altval)
// block scales that result in something larger than the current screen.
int vmax = drawer->GetHeight() / 400;
int hmax = drawer->GetWidth() / 640;
int max = MAX(vmax, hmax);
return MAX(1, MIN(scaleval, max));
int max = std::max(vmax, hmax);
return std::max(1, min(scaleval, max));
}
@ -357,7 +357,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
if (numret > 1) ret[1].SetInt(y);
if (numret > 2) ret[2].SetInt(w);
if (numret > 3) ret[3].SetInt(h);
return MIN(numret, 4);
return min(numret, 4);
}
@ -460,7 +460,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetFullscreenRect)
if (numret >= 2) ret[1].SetFloat(rect.top);
if (numret >= 3) ret[2].SetFloat(rect.width);
if (numret >= 4) ret[3].SetFloat(rect.height);
return MIN(numret, 4);
return min(numret, 4);
}
@ -905,7 +905,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_Alpha:
parms->Alpha = (float)(MIN<double>(1., ListGetDouble(tags)));
parms->Alpha = (float)(min<double>(1., ListGetDouble(tags)));
break;
case DTA_AlphaChannel:
@ -1090,7 +1090,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double
break;
case DTA_ShadowAlpha:
//parms->shadowAlpha = (float)MIN(1., ListGetDouble(tags));
//parms->shadowAlpha = (float)min(1., ListGetDouble(tags));
break;
case DTA_ShadowColor:
@ -1286,10 +1286,10 @@ static void VirtualToRealCoords(F2DDrawer *drawer, double Width, double Height,
{
case 1:
default:
myratio = MIN(64.0f / 27.0f, myratio);
myratio = min(64.0f / 27.0f, myratio);
break;
case 0:
myratio = MIN(16.0f / 9.0f, myratio);
myratio = min(16.0f / 9.0f, myratio);
case -1:
break;
}
@ -1348,7 +1348,7 @@ DEFINE_ACTION_FUNCTION(_Screen, VirtualToRealCoords)
VirtualToRealCoords(twod, x, y, w, h, vw, vh, vbottom, handleaspect);
if (numret >= 1) ret[0].SetVector2(DVector2(x, y));
if (numret >= 2) ret[1].SetVector2(DVector2(w, h));
return MIN(numret, 2);
return min(numret, 2);
}
void VirtualToRealCoordsInt(F2DDrawer *drawer, int &x, int &y, int &w, int &h,
@ -1594,7 +1594,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawLineFrame)
void V_CalcCleanFacs(int designwidth, int designheight, int realwidth, int realheight, int* cleanx, int* cleany, int* _cx1, int* _cx2)
{
if (designheight < 240 && realheight >= 480) designheight = 240;
*cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
*cleanx = *cleany = min(realwidth / designwidth, realheight / designheight);
}