- missed some MAX's.

This commit is contained in:
Christoph Oelckers 2021-10-30 10:45:58 +02:00
parent 75c8e0af7c
commit 07a181090b
13 changed files with 28 additions and 28 deletions

View file

@ -390,7 +390,7 @@ CCMD(skyfog)
if (argv.argc() > 1) if (argv.argc() > 1)
{ {
// Do this only on the primary level. // Do this only on the primary level.
primaryLevel->skyfog = MAX(0, (int)strtoull(argv[1], NULL, 0)); primaryLevel->skyfog = max(0, (int)strtoull(argv[1], NULL, 0));
} }
} }

View file

@ -340,7 +340,7 @@ void DHUDMessage::ResetText (const char *text)
for (auto &line : Lines) for (auto &line : Lines)
{ {
Height += Font->GetHeight (); Height += Font->GetHeight ();
Width = MAX<int> (Width, line.Width); Width = max<int> (Width, line.Width);
} }
} }
@ -751,7 +751,7 @@ void DHUDMessageTypeOnFadeOut::Serialize(FSerializer &arc)
LineLen = CurrLine = 0; LineLen = CurrLine = 0;
} }
clamp(LineVisible, 0, LineLen); LineVisible = clamp(LineVisible, 0, LineLen);
} }
} }

View file

@ -531,7 +531,7 @@ DVector2 DBaseStatusBar::GetHUDScale() const
// Since status bars and HUDs can be designed for non 320x200 screens this needs to be factored in here. // Since status bars and HUDs can be designed for non 320x200 screens this needs to be factored in here.
// The global scaling factors are for resources at 320x200, so if the actual ones are higher resolution // The global scaling factors are for resources at 320x200, so if the actual ones are higher resolution
// the resulting scaling factor needs to be reduced accordingly. // the resulting scaling factor needs to be reduced accordingly.
int realscale = MAX<int>(1, (320 * scale) / hres); int realscale = max<int>(1, (320 * scale) / hres);
return{ double(realscale), double(realscale * (hud_aspectscale ? 1.2 : 1.)) }; return{ double(realscale), double(realscale * (hud_aspectscale ? 1.2 : 1.)) };
} }

View file

@ -178,7 +178,7 @@ void AddTiles(const FString& pathprefix, const void* tiles, FRemapTable *remap)
} }
speed = (anm >> 24) & 15; speed = (anm >> 24) & 15;
speed = MAX(1, (1 << speed) * 1000 / 120); // Convert from 120 Hz to 1000 Hz. speed = max(1, (1 << speed) * 1000 / 120); // Convert from 120 Hz to 1000 Hz.
TexAnim.AddSimpleAnim(texnum, picanm[pic] & 63, type, speed); TexAnim.AddSimpleAnim(texnum, picanm[pic] & 63, type, speed);
} }

View file

@ -149,7 +149,7 @@ static int FontScale;
void HU_DrawScores (player_t *player) void HU_DrawScores (player_t *player)
{ {
displayFont = NewSmallFont; displayFont = NewSmallFont;
FontScale = MAX(screen->GetHeight() / 400, 1); FontScale = max(screen->GetHeight() / 400, 1);
if (deathmatch) if (deathmatch)
{ {
@ -273,11 +273,11 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight); HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight);
height = displayFont->GetHeight() * FontScale; height = displayFont->GetHeight() * FontScale;
lineheight = MAX(height, maxiconheight * CleanYfac); lineheight = max(height, maxiconheight * CleanYfac);
ypadding = (lineheight - height + 1) / 2; ypadding = (lineheight - height + 1) / 2;
bottom = StatusBar->GetTopOfStatusbar(); bottom = StatusBar->GetTopOfStatusbar();
y = MAX(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2); y = max(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2);
HU_DrawTimeRemaining (bottom - height); HU_DrawTimeRemaining (bottom - height);
@ -304,7 +304,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
} }
} }
int scorexwidth = twod->GetWidth() / MAX(8, numTeams); int scorexwidth = twod->GetWidth() / max(8, numTeams);
int numscores = 0; int numscores = 0;
int scorex; int scorex;

View file

@ -452,7 +452,7 @@ static void SetupSectorDamage(sector_t *sector, int damage, int interval, int le
if (sector->damageamount == 0 && !(sector->Flags & (SECF_EXIT1|SECF_EXIT2))) if (sector->damageamount == 0 && !(sector->Flags & (SECF_EXIT1|SECF_EXIT2)))
{ {
sector->damageamount = damage; sector->damageamount = damage;
sector->damageinterval = MAX(1, interval); sector->damageinterval = max(1, interval);
sector->leakydamage = leakchance; sector->leakydamage = leakchance;
sector->damagetype = type; sector->damagetype = type;
sector->Flags = (sector->Flags & ~SECF_DAMAGEFLAGS) | (flags & SECF_DAMAGEFLAGS); sector->Flags = (sector->Flags & ~SECF_DAMAGEFLAGS) | (flags & SECF_DAMAGEFLAGS);

View file

@ -395,7 +395,7 @@ void FDynamicLight::UpdateLocation()
if (lighttype == FlickerLight || lighttype == RandomFlickerLight || lighttype == PulseLight) if (lighttype == FlickerLight || lighttype == RandomFlickerLight || lighttype == PulseLight)
{ {
intensity = float(MAX(GetIntensity(), GetSecondaryIntensity())); intensity = float(max(GetIntensity(), GetSecondaryIntensity()));
} }
else else
{ {

View file

@ -1301,7 +1301,7 @@ public:
double RenderRadius() const double RenderRadius() const
{ {
return MAX(radius, renderradius); return max(radius, renderradius);
} }
DVector3 PosRelative(int grp) const; DVector3 PosRelative(int grp) const;
@ -1453,7 +1453,7 @@ public:
// Better have it in one place, if something needs to be changed about the formula. // Better have it in one place, if something needs to be changed about the formula.
double DistanceBySpeed(AActor *dest, double speed) const double DistanceBySpeed(AActor *dest, double speed) const
{ {
return MAX(1., Distance2D(dest) / speed); return max(1., Distance2D(dest) / speed);
} }
int ApplyDamageFactor(FName damagetype, int damage) const; int ApplyDamageFactor(FName damagetype, int damage) const;

View file

@ -156,7 +156,7 @@ void R_InitColormaps (bool allowCustomColormap)
g /= 256; g /= 256;
b /= 256; b /= 256;
// The calculated average is too dark so brighten it according to the palettes's overall brightness // The calculated average is too dark so brighten it according to the palettes's overall brightness
int maxcol = MAX<int>(MAX<int>(palette_brightness, r), MAX<int>(g, b)); int maxcol = max<int>(max<int>(palette_brightness, r), max<int>(g, b));
fakecmaps[j].blend = PalEntry (255, r * 255 / maxcol, g * 255 / maxcol, b * 255 / maxcol); fakecmaps[j].blend = PalEntry (255, r * 255 / maxcol, g * 255 / maxcol, b * 255 / maxcol);
} }

View file

@ -452,7 +452,7 @@ void R_InitSpriteDefs ()
{ // voxel applies to a specific frame { // voxel applies to a specific frame
j = vh->Frame - 'A'; j = vh->Frame - 'A';
sprtemp[j].Voxel = voxdef; sprtemp[j].Voxel = voxdef;
maxframe = MAX<int>(maxframe, j); maxframe = max<int>(maxframe, j);
} }
} }
} }

View file

@ -59,8 +59,8 @@ DoomLevelAABBTree::DoomLevelAABBTree(FLevelLocals *lev)
const auto &right = nodes[dynamicroot]; const auto &right = nodes[dynamicroot];
aabb_min.X = min(left.aabb_left, right.aabb_left); aabb_min.X = min(left.aabb_left, right.aabb_left);
aabb_min.Y = min(left.aabb_top, right.aabb_top); aabb_min.Y = min(left.aabb_top, right.aabb_top);
aabb_max.X = MAX(left.aabb_right, right.aabb_right); aabb_max.X = max(left.aabb_right, right.aabb_right);
aabb_max.Y = MAX(left.aabb_bottom, right.aabb_bottom); aabb_max.Y = max(left.aabb_bottom, right.aabb_bottom);
nodes.Push({ aabb_min, aabb_max, staticroot, dynamicroot }); nodes.Push({ aabb_min, aabb_max, staticroot, dynamicroot });
} }
@ -138,9 +138,9 @@ bool DoomLevelAABBTree::Update()
int nodeIndex = path[0]; int nodeIndex = path[0];
nodes[nodeIndex].aabb_left = min(x1, x2); nodes[nodeIndex].aabb_left = min(x1, x2);
nodes[nodeIndex].aabb_right = MAX(x1, x2); nodes[nodeIndex].aabb_right = max(x1, x2);
nodes[nodeIndex].aabb_top = min(y1, y2); nodes[nodeIndex].aabb_top = min(y1, y2);
nodes[nodeIndex].aabb_bottom = MAX(y1, y2); nodes[nodeIndex].aabb_bottom = max(y1, y2);
for (unsigned int j = 1; j < path.Size(); j++) for (unsigned int j = 1; j < path.Size(); j++)
{ {
@ -149,8 +149,8 @@ bool DoomLevelAABBTree::Update()
const auto &right = nodes[cur.right_node]; const auto &right = nodes[cur.right_node];
cur.aabb_left = min(left.aabb_left, right.aabb_left); cur.aabb_left = min(left.aabb_left, right.aabb_left);
cur.aabb_top = min(left.aabb_top, right.aabb_top); cur.aabb_top = min(left.aabb_top, right.aabb_top);
cur.aabb_right = MAX(left.aabb_right, right.aabb_right); cur.aabb_right = max(left.aabb_right, right.aabb_right);
cur.aabb_bottom = MAX(left.aabb_bottom, right.aabb_bottom); cur.aabb_bottom = max(left.aabb_bottom, right.aabb_bottom);
} }
treelines[i] = treeline; treelines[i] = treeline;
@ -185,10 +185,10 @@ int DoomLevelAABBTree::GenerateTreeNode(int *lines, int num_lines, const FVector
aabb_min.X = min(aabb_min.X, x2); aabb_min.X = min(aabb_min.X, x2);
aabb_min.Y = min(aabb_min.Y, y1); aabb_min.Y = min(aabb_min.Y, y1);
aabb_min.Y = min(aabb_min.Y, y2); aabb_min.Y = min(aabb_min.Y, y2);
aabb_max.X = MAX(aabb_max.X, x1); aabb_max.X = max(aabb_max.X, x1);
aabb_max.X = MAX(aabb_max.X, x2); aabb_max.X = max(aabb_max.X, x2);
aabb_max.Y = MAX(aabb_max.Y, y1); aabb_max.Y = max(aabb_max.Y, y1);
aabb_max.Y = MAX(aabb_max.Y, y2); aabb_max.Y = max(aabb_max.Y, y2);
median += centroids[mapLines[lines[i]]]; median += centroids[mapLines[lines[i]]];
} }

View file

@ -704,7 +704,7 @@ void S_ParseSndSeq (int levellump)
delaybase = sc.Number; delaybase = sc.Number;
ScriptTemp.Push(MakeCommand(SS_CMD_DELAYRAND, sc.Number)); ScriptTemp.Push(MakeCommand(SS_CMD_DELAYRAND, sc.Number));
sc.MustGetNumber (); sc.MustGetNumber ();
ScriptTemp.Push(MAX(1, sc.Number - delaybase + 1)); ScriptTemp.Push(max(1, sc.Number - delaybase + 1));
break; break;
case SS_STRING_VOLUME: // volume is in range 0..100 case SS_STRING_VOLUME: // volume is in range 0..100

View file

@ -698,9 +698,9 @@ int FNodeBuilder::FVertexMap::InsertVertex (FNodeBuilder::FPrivVert &vert)
// If a vertex is near a block boundary, then it will be inserted on // If a vertex is near a block boundary, then it will be inserted on
// both sides of the boundary so that SelectVertexClose can find // both sides of the boundary so that SelectVertexClose can find
// it by checking in only one block. // it by checking in only one block.
fixed64_t minx = MAX (MinX, fixed64_t(vert.x) - VERTEX_EPSILON); fixed64_t minx = max (MinX, fixed64_t(vert.x) - VERTEX_EPSILON);
fixed64_t maxx = min (MaxX, fixed64_t(vert.x) + VERTEX_EPSILON); fixed64_t maxx = min (MaxX, fixed64_t(vert.x) + VERTEX_EPSILON);
fixed64_t miny = MAX (MinY, fixed64_t(vert.y) - VERTEX_EPSILON); fixed64_t miny = max (MinY, fixed64_t(vert.y) - VERTEX_EPSILON);
fixed64_t maxy = min (MaxY, fixed64_t(vert.y) + VERTEX_EPSILON); fixed64_t maxy = min (MaxY, fixed64_t(vert.y) + VERTEX_EPSILON);
int blk[4] = int blk[4] =