From 07a181090b11ed0931b15c537dff870b199cd8af Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 30 Oct 2021 10:45:58 +0200 Subject: [PATCH] - missed some MAX's. --- src/g_dumpinfo.cpp | 2 +- src/g_statusbar/hudmessages.cpp | 4 ++-- src/g_statusbar/shared_sbar.cpp | 2 +- src/gamedata/textures/buildloader.cpp | 2 +- src/hu_scores.cpp | 8 ++++---- src/maploader/specials.cpp | 2 +- src/playsim/a_dynlight.cpp | 2 +- src/playsim/actor.h | 4 ++-- src/r_data/colormaps.cpp | 2 +- src/r_data/sprites.cpp | 2 +- src/rendering/hwrenderer/doom_aabbtree.cpp | 20 +++++++++---------- src/sound/s_sndseq.cpp | 2 +- src/utility/nodebuilder/nodebuild_utility.cpp | 4 ++-- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/g_dumpinfo.cpp b/src/g_dumpinfo.cpp index 6cdcc593b..a026863de 100644 --- a/src/g_dumpinfo.cpp +++ b/src/g_dumpinfo.cpp @@ -390,7 +390,7 @@ CCMD(skyfog) if (argv.argc() > 1) { // 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)); } } diff --git a/src/g_statusbar/hudmessages.cpp b/src/g_statusbar/hudmessages.cpp index ba9b7a190..f35832528 100644 --- a/src/g_statusbar/hudmessages.cpp +++ b/src/g_statusbar/hudmessages.cpp @@ -340,7 +340,7 @@ void DHUDMessage::ResetText (const char *text) for (auto &line : Lines) { Height += Font->GetHeight (); - Width = MAX (Width, line.Width); + Width = max (Width, line.Width); } } @@ -751,7 +751,7 @@ void DHUDMessageTypeOnFadeOut::Serialize(FSerializer &arc) LineLen = CurrLine = 0; } - clamp(LineVisible, 0, LineLen); + LineVisible = clamp(LineVisible, 0, LineLen); } } diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index e6f386b7c..74811fada 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -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. // 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. - int realscale = MAX(1, (320 * scale) / hres); + int realscale = max(1, (320 * scale) / hres); return{ double(realscale), double(realscale * (hud_aspectscale ? 1.2 : 1.)) }; } diff --git a/src/gamedata/textures/buildloader.cpp b/src/gamedata/textures/buildloader.cpp index 047ad14be..78c6a6af7 100644 --- a/src/gamedata/textures/buildloader.cpp +++ b/src/gamedata/textures/buildloader.cpp @@ -178,7 +178,7 @@ void AddTiles(const FString& pathprefix, const void* tiles, FRemapTable *remap) } 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); } diff --git a/src/hu_scores.cpp b/src/hu_scores.cpp index 6e662ab6b..68dd60c33 100644 --- a/src/hu_scores.cpp +++ b/src/hu_scores.cpp @@ -149,7 +149,7 @@ static int FontScale; void HU_DrawScores (player_t *player) { displayFont = NewSmallFont; - FontScale = MAX(screen->GetHeight() / 400, 1); + FontScale = max(screen->GetHeight() / 400, 1); if (deathmatch) { @@ -273,11 +273,11 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER HU_GetPlayerWidths(maxnamewidth, maxscorewidth, maxiconheight); height = displayFont->GetHeight() * FontScale; - lineheight = MAX(height, maxiconheight * CleanYfac); + lineheight = max(height, maxiconheight * CleanYfac); ypadding = (lineheight - height + 1) / 2; 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); @@ -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 scorex; diff --git a/src/maploader/specials.cpp b/src/maploader/specials.cpp index 280eba279..d0fa1d5a9 100644 --- a/src/maploader/specials.cpp +++ b/src/maploader/specials.cpp @@ -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))) { sector->damageamount = damage; - sector->damageinterval = MAX(1, interval); + sector->damageinterval = max(1, interval); sector->leakydamage = leakchance; sector->damagetype = type; sector->Flags = (sector->Flags & ~SECF_DAMAGEFLAGS) | (flags & SECF_DAMAGEFLAGS); diff --git a/src/playsim/a_dynlight.cpp b/src/playsim/a_dynlight.cpp index 8a5838f1d..6c1e72fd3 100644 --- a/src/playsim/a_dynlight.cpp +++ b/src/playsim/a_dynlight.cpp @@ -395,7 +395,7 @@ void FDynamicLight::UpdateLocation() if (lighttype == FlickerLight || lighttype == RandomFlickerLight || lighttype == PulseLight) { - intensity = float(MAX(GetIntensity(), GetSecondaryIntensity())); + intensity = float(max(GetIntensity(), GetSecondaryIntensity())); } else { diff --git a/src/playsim/actor.h b/src/playsim/actor.h index e604cbfeb..7226aa97f 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -1301,7 +1301,7 @@ public: double RenderRadius() const { - return MAX(radius, renderradius); + return max(radius, renderradius); } 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. 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; diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index b46a9b49c..7dd7279f2 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -156,7 +156,7 @@ void R_InitColormaps (bool allowCustomColormap) g /= 256; b /= 256; // The calculated average is too dark so brighten it according to the palettes's overall brightness - int maxcol = MAX(MAX(palette_brightness, r), MAX(g, b)); + int maxcol = max(max(palette_brightness, r), max(g, b)); fakecmaps[j].blend = PalEntry (255, r * 255 / maxcol, g * 255 / maxcol, b * 255 / maxcol); } diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index 3b88669e8..b3b5cf451 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -452,7 +452,7 @@ void R_InitSpriteDefs () { // voxel applies to a specific frame j = vh->Frame - 'A'; sprtemp[j].Voxel = voxdef; - maxframe = MAX(maxframe, j); + maxframe = max(maxframe, j); } } } diff --git a/src/rendering/hwrenderer/doom_aabbtree.cpp b/src/rendering/hwrenderer/doom_aabbtree.cpp index 5420e561e..718040b8e 100644 --- a/src/rendering/hwrenderer/doom_aabbtree.cpp +++ b/src/rendering/hwrenderer/doom_aabbtree.cpp @@ -59,8 +59,8 @@ DoomLevelAABBTree::DoomLevelAABBTree(FLevelLocals *lev) const auto &right = nodes[dynamicroot]; aabb_min.X = min(left.aabb_left, right.aabb_left); aabb_min.Y = min(left.aabb_top, right.aabb_top); - aabb_max.X = MAX(left.aabb_right, right.aabb_right); - aabb_max.Y = MAX(left.aabb_bottom, right.aabb_bottom); + aabb_max.X = max(left.aabb_right, right.aabb_right); + aabb_max.Y = max(left.aabb_bottom, right.aabb_bottom); nodes.Push({ aabb_min, aabb_max, staticroot, dynamicroot }); } @@ -138,9 +138,9 @@ bool DoomLevelAABBTree::Update() int nodeIndex = path[0]; 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_bottom = MAX(y1, y2); + nodes[nodeIndex].aabb_bottom = max(y1, y2); for (unsigned int j = 1; j < path.Size(); j++) { @@ -149,8 +149,8 @@ bool DoomLevelAABBTree::Update() const auto &right = nodes[cur.right_node]; cur.aabb_left = min(left.aabb_left, right.aabb_left); cur.aabb_top = min(left.aabb_top, right.aabb_top); - cur.aabb_right = MAX(left.aabb_right, right.aabb_right); - cur.aabb_bottom = MAX(left.aabb_bottom, right.aabb_bottom); + cur.aabb_right = max(left.aabb_right, right.aabb_right); + cur.aabb_bottom = max(left.aabb_bottom, right.aabb_bottom); } 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.Y = min(aabb_min.Y, y1); aabb_min.Y = min(aabb_min.Y, y2); - aabb_max.X = MAX(aabb_max.X, x1); - aabb_max.X = MAX(aabb_max.X, x2); - aabb_max.Y = MAX(aabb_max.Y, y1); - aabb_max.Y = MAX(aabb_max.Y, y2); + aabb_max.X = max(aabb_max.X, x1); + aabb_max.X = max(aabb_max.X, x2); + aabb_max.Y = max(aabb_max.Y, y1); + aabb_max.Y = max(aabb_max.Y, y2); median += centroids[mapLines[lines[i]]]; } diff --git a/src/sound/s_sndseq.cpp b/src/sound/s_sndseq.cpp index abe16c3c8..ed82d8a57 100644 --- a/src/sound/s_sndseq.cpp +++ b/src/sound/s_sndseq.cpp @@ -704,7 +704,7 @@ void S_ParseSndSeq (int levellump) delaybase = sc.Number; ScriptTemp.Push(MakeCommand(SS_CMD_DELAYRAND, sc.Number)); sc.MustGetNumber (); - ScriptTemp.Push(MAX(1, sc.Number - delaybase + 1)); + ScriptTemp.Push(max(1, sc.Number - delaybase + 1)); break; case SS_STRING_VOLUME: // volume is in range 0..100 diff --git a/src/utility/nodebuilder/nodebuild_utility.cpp b/src/utility/nodebuilder/nodebuild_utility.cpp index 5aff74b5b..30ead3424 100644 --- a/src/utility/nodebuilder/nodebuild_utility.cpp +++ b/src/utility/nodebuilder/nodebuild_utility.cpp @@ -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 // both sides of the boundary so that SelectVertexClose can find // 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 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); int blk[4] =