- replaced MIN/MAX in all non-common code.

This commit is contained in:
Christoph Oelckers 2021-10-30 10:16:52 +02:00
parent 226666ce7f
commit 1d0aed219e
43 changed files with 147 additions and 146 deletions

View file

@ -469,7 +469,7 @@ CCMD (puke)
return;
}
int arg[4] = { 0, 0, 0, 0 };
int argn = MIN<int>(argc - 2, countof(arg)), i;
int argn = min<int>(argc - 2, countof(arg)), i;
for (i = 0; i < argn; ++i)
{
@ -516,7 +516,7 @@ CCMD (pukename)
always = true;
argstart = 3;
}
argn = MIN<int>(argc - argstart, countof(arg));
argn = min<int>(argc - argstart, countof(arg));
for (i = 0; i < argn; ++i)
{
arg[i] = atoi(argv[argstart + i]);

View file

@ -222,7 +222,7 @@ static struct TicSpecial
{
int i;
specialsize = MAX(specialsize * 2, needed + 30);
specialsize = max(specialsize * 2, needed + 30);
DPrintf (DMSG_NOTIFY, "Expanding special size to %zu\n", specialsize);
@ -1151,7 +1151,7 @@ void NetUpdate (void)
netbuffer[k++] = lowtic;
}
numtics = MAX(0, lowtic - realstart);
numtics = max(0, lowtic - realstart);
if (numtics > BACKUPTICS)
I_Error ("NetUpdate: Node %d missed too many tics", i);
@ -1160,7 +1160,7 @@ void NetUpdate (void)
case 0:
default:
resendto[i] = lowtic; break;
case 1: resendto[i] = MAX(0, lowtic - 1); break;
case 1: resendto[i] = max(0, lowtic - 1); break;
case 2: resendto[i] = nettics[i]; break;
}
@ -1836,7 +1836,7 @@ static void TicStabilityEnd()
{
using namespace std::chrono;
uint64_t stabilityendtime = duration_cast<microseconds>(steady_clock::now().time_since_epoch()).count();
stabilityticduration = std::min(stabilityendtime - stabilitystarttime, (uint64_t)1'000'000);
stabilityticduration = min(stabilityendtime - stabilitystarttime, (uint64_t)1'000'000);
}
//
@ -2750,7 +2750,7 @@ static void RunScript(uint8_t **stream, AActor *pawn, int snum, int argn, int al
arg[i] = argval;
}
}
P_StartScript(pawn->Level, pawn, NULL, snum, primaryLevel->MapName, arg, MIN<int>(countof(arg), argn), ACS_NET | always);
P_StartScript(pawn->Level, pawn, NULL, snum, primaryLevel->MapName, arg, min<int>(countof(arg), argn), ACS_NET | always);
}
void Net_SkipCommand (int type, uint8_t **stream)
@ -2913,15 +2913,15 @@ int Net_GetLatency(int *ld, int *ad)
localdelay = ((localdelay / BACKUPTICS) * ticdup) * (1000 / TICRATE);
int severity = 0;
if (MAX(localdelay, arbitratordelay) > 200)
if (max(localdelay, arbitratordelay) > 200)
{
severity = 1;
}
if (MAX(localdelay, arbitratordelay) > 400)
if (max(localdelay, arbitratordelay) > 400)
{
severity = 2;
}
if (MAX(localdelay, arbitratordelay) >= ((BACKUPTICS / 2 - 1) * ticdup) * (1000 / TICRATE))
if (max(localdelay, arbitratordelay) >= ((BACKUPTICS / 2 - 1) * ticdup) * (1000 / TICRATE))
{
severity = 3;
}

View file

@ -1249,7 +1249,7 @@ CCMD(event)
else
{
int arg[3] = { 0, 0, 0 };
int argn = MIN<int>(argc - 2, countof(arg));
int argn = min<int>(argc - 2, countof(arg));
for (int i = 0; i < argn; i++)
arg[i] = atoi(argv[2 + i]);
// call locally
@ -1274,7 +1274,7 @@ CCMD(netevent)
else
{
int arg[3] = { 0, 0, 0 };
int argn = MIN<int>(argc - 2, countof(arg));
int argn = min<int>(argc - 2, countof(arg));
for (int i = 0; i < argn; i++)
arg[i] = atoi(argv[2 + i]);
// call networked

View file

@ -837,7 +837,7 @@ void G_AddViewPitch (int look, bool mouse)
}
else
{
LocalViewPitch = MIN(LocalViewPitch + look, 0x78000000);
LocalViewPitch = min(LocalViewPitch + look, 0x78000000);
}
}
else if (look < 0)
@ -849,7 +849,7 @@ void G_AddViewPitch (int look, bool mouse)
}
else
{
LocalViewPitch = MAX(LocalViewPitch + look, -0x78000000);
LocalViewPitch = max(LocalViewPitch + look, -0x78000000);
}
}
if (look != 0)
@ -1319,7 +1319,7 @@ void G_Ticker ()
// Do some more aggressive GC maintenance when the game ticker is inactive.
if ((gamestate != GS_LEVEL && gamestate != GS_TITLELEVEL) || paused || P_CheckTickerPaused())
{
size_t ac = std::max<size_t>(10, GC::AllocCount);
size_t ac = max<size_t>(10, GC::AllocCount);
for (size_t i = 0; i < ac; i++)
{
if (!GC::CheckGC()) break;

View file

@ -34,6 +34,7 @@
*/
#include "doomtype.h"
#include "basics.h"
#include "doomstat.h"
#include "v_font.h"
#include "v_video.h"
@ -1235,7 +1236,7 @@ public:
wrapper->StatusbarToRealCoords(dx, dy, w, h);
if(clearDontDraw)
ClearRect(twod, static_cast<int>(MAX<double>(dx, dcx)), static_cast<int>(MAX<double>(dy, dcy)), static_cast<int>(MIN<double>(dcr,w+MAX<double>(dx, dcx))), static_cast<int>(MIN<double>(dcb,MAX<double>(dy, dcy)+h)), GPalette.BlackIndex, 0);
ClearRect(twod, static_cast<int>(max<double>(dx, dcx)), static_cast<int>(max<double>(dy, dcy)), static_cast<int>(min<double>(dcr,w+max<double>(dx, dcx))), static_cast<int>(min<double>(dcb,max<double>(dy, dcy)+h)), GPalette.BlackIndex, 0);
else
{
if(alphaMap)
@ -1245,8 +1246,8 @@ public:
DTA_DestHeightF, h,
DTA_ClipLeft, static_cast<int>(dcx),
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(MIN<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(MIN<double>(INT_MAX, dcb)),
DTA_ClipRight, static_cast<int>(min<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(min<double>(INT_MAX, dcb)),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
@ -1262,8 +1263,8 @@ public:
DTA_DestHeightF, h,
DTA_ClipLeft, static_cast<int>(dcx),
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(MIN<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(MIN<double>(INT_MAX, dcb)),
DTA_ClipRight, static_cast<int>(min<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(min<double>(INT_MAX, dcb)),
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
@ -1309,7 +1310,7 @@ public:
}
if(clearDontDraw)
ClearRect(twod, static_cast<int>(rcx), static_cast<int>(rcy), static_cast<int>(MIN<double>(rcr, rcx+w)), static_cast<int>(MIN<double>(rcb, rcy+h)), GPalette.BlackIndex, 0);
ClearRect(twod, static_cast<int>(rcx), static_cast<int>(rcy), static_cast<int>(min<double>(rcr, rcx+w)), static_cast<int>(min<double>(rcb, rcy+h)), GPalette.BlackIndex, 0);
else
{
if(alphaMap)

View file

@ -284,7 +284,7 @@ class CommandDrawImage : public SBarInfoCommandFlowControl
if (Slots[armorType] > 0 && SlotsIncrement[armorType] > 0)
{
//combine the alpha values
alpha *= MIN(1., Slots[armorType] / SlotsIncrement[armorType]);
alpha *= min(1., Slots[armorType] / SlotsIncrement[armorType]);
texture = statusBar->Images[image];
}
else
@ -2796,7 +2796,7 @@ class CommandDrawBar : public SBarInfoCommand
if(max != 0 && value > 0)
{
value = MIN(value / max, 1.);
value = min(value / max, 1.);
}
else
value = 0;
@ -2805,7 +2805,7 @@ class CommandDrawBar : public SBarInfoCommand
// [BL] Since we used a percentage (in order to get the most fluid animation)
// we need to establish a cut off point so the last pixel won't hang as the animation slows
if(pixel == -1 && statusBar->Images[foreground])
pixel = MAX(1 / 65536., 1./statusBar->Images[foreground]->GetDisplayWidth());
pixel = std::max(1 / 65536., 1./statusBar->Images[foreground]->GetDisplayWidth());
if(fabs(drawValue - value) < pixel)
drawValue = value;

View file

@ -730,7 +730,7 @@ void PClassActor::SetPainChance(FName type, int chance)
if (chance >= 0)
{
ActorInfo()->PainChances.Push({ type, MIN(chance, 256) });
ActorInfo()->PainChances.Push({ type, min(chance, 256) });
}
}

View file

@ -386,7 +386,7 @@ void DIntermissionScreenText::Drawer ()
// line feed characters.
int numrows;
auto font = generic_ui ? NewSmallFont : SmallFont;
auto fontscale = MAX(generic_ui ? MIN(twod->GetWidth() / 640, twod->GetHeight() / 400) : MIN(twod->GetWidth() / 400, twod->GetHeight() / 250), 1);
auto fontscale = max(generic_ui ? min(twod->GetWidth() / 640, twod->GetHeight() / 400) : min(twod->GetWidth() / 400, twod->GetHeight() / 250), 1);
int cleanwidth = twod->GetWidth() / fontscale;
int cleanheight = twod->GetHeight() / fontscale;
int refwidth = generic_ui ? 640 : 320;
@ -403,7 +403,7 @@ void DIntermissionScreenText::Drawer ()
int cx = (mTextX - refwidth/2) * fontscale + twod->GetWidth() / 2;
int cy = (mTextY - refheight/2) * fontscale + twod->GetHeight() / 2;
cx = MAX<int>(0, cx);
cx = max<int>(0, cx);
int startx = cx;
if (usesDefault)

View file

@ -708,7 +708,7 @@ static bool MatchHeader(const char * label, const char * hdata)
if (memcmp(hdata, "LEVEL=", 6) == 0)
{
size_t labellen = strlen(label);
labellen = MIN(size_t(8), labellen);
labellen = min(size_t(8), labellen);
if (strnicmp(hdata+6, label, labellen)==0 &&
(hdata[6+labellen]==0xa || hdata[6+labellen]==0xd))

View file

@ -870,7 +870,7 @@ bool MapLoader::LoadSegs (MapData * map)
if (vnum1 >= numvertexes || vnum2 >= numvertexes)
{
throw badseg(0, i, MAX(vnum1, vnum2));
throw badseg(0, i, max(vnum1, vnum2));
}
li->v1 = &Level->vertexes[vnum1];
@ -1890,7 +1890,7 @@ void MapLoader::LoadLineDefs2 (MapData * map)
Level->sides.Alloc(count);
memset(&Level->sides[0], 0, count * sizeof(side_t));
sidetemp.Resize(MAX<int>(count, Level->vertexes.Size()));
sidetemp.Resize(max<int>(count, Level->vertexes.Size()));
for (i = 0; i < count; i++)
{
sidetemp[i].a.special = sidetemp[i].a.tag = 0;
@ -1918,7 +1918,7 @@ void MapLoader::LoopSidedefs (bool firstloop)
int i;
int numsides = Level->sides.Size();
sidetemp.Resize(MAX<int>(Level->vertexes.Size(), numsides));
sidetemp.Resize(max<int>(Level->vertexes.Size(), numsides));
for (i = 0; i < (int)Level->vertexes.Size(); ++i)
{
@ -2816,7 +2816,7 @@ void MapLoader::LoadReject (MapData * map, bool junk)
else
{
// Check if the reject has some actual content. If not, free it.
rejectsize = MIN (rejectsize, neededsize);
rejectsize = min (rejectsize, neededsize);
Level->rejectmatrix.Alloc(rejectsize);
map->Read (ML_REJECT, &Level->rejectmatrix[0], rejectsize);

View file

@ -620,7 +620,7 @@ void M_StartupEpisodeMenu(FNewGameStartup *gs)
if (*c == '$') c = GStrings(c + 1);
int textwidth = ld->mFont->StringWidth(c);
int textright = posx + textwidth;
if (posx + textright > 320) posx = std::max(0, 320 - textright);
if (posx + textright > 320) posx = max(0, 320 - textright);
}
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
@ -1164,7 +1164,7 @@ void M_StartupSkillMenu(FNewGameStartup *gs)
if (*c == '$') c = GStrings(c + 1);
int textwidth = ld->mFont->StringWidth(c);
int textright = posx + textwidth;
if (posx + textright > 320) posx = std::max(0, 320 - textright);
if (posx + textright > 320) posx = max(0, 320 - textright);
}
unsigned firstitem = ld->mItems.Size();

View file

@ -79,7 +79,7 @@ DEFINE_ACTION_FUNCTION(FState, GetSpriteTexture)
if (numret > 0) ret[0].SetInt(sprframe->Texture[rotation].GetIndex());
if (numret > 1) ret[1].SetInt(!!(sprframe->Flip & (1 << rotation)));
if (numret > 2) ret[2].SetVector2(DVector2(scalex, scaley));
return MIN(3, numret);
return min(3, numret);
}

View file

@ -247,7 +247,7 @@ void FThinkerCollection::RunThinkers(FLevelLocals *Level)
Printf(TEXTCOLOR_YELLOW "Total, ms Averg, ms Calls Actor class\n");
Printf(TEXTCOLOR_YELLOW "---------- ---------- ------ --------------------\n");
const unsigned count = MIN(profilelimit > 0 ? profilelimit : UINT_MAX, sorted.Size());
const unsigned count = min(profilelimit > 0 ? profilelimit : UINT_MAX, sorted.Size());
for (unsigned i = 0; i < count; ++i)
{

View file

@ -157,11 +157,11 @@ void DLightningThinker::LightningFlash ()
LightningLightLevels[j] = tempSec->lightlevel;
if (special == Light_IndoorLightning1)
{
tempSec->SetLightLevel(MIN<int> (tempSec->lightlevel+64, flashLight));
tempSec->SetLightLevel(min<int> (tempSec->lightlevel+64, flashLight));
}
else if (special == Light_IndoorLightning2)
{
tempSec->SetLightLevel(MIN<int> (tempSec->lightlevel+32, flashLight));
tempSec->SetLightLevel(min<int> (tempSec->lightlevel+32, flashLight));
}
else
{

View file

@ -210,8 +210,8 @@ double DEarthquake::GetModIntensity(double intensity, bool fake) const
{
// Defaults to middle of the road.
divider = m_CountdownStart;
scalar = (m_Flags & QF_MAX) ? MAX(m_Countdown, m_CountdownStart - m_Countdown)
: MIN(m_Countdown, m_CountdownStart - m_Countdown);
scalar = (m_Flags & QF_MAX) ? max(m_Countdown, m_CountdownStart - m_Countdown)
: min(m_Countdown, m_CountdownStart - m_Countdown);
}
scalar = (scalar > divider) ? divider : scalar;
@ -311,20 +311,20 @@ int DEarthquake::StaticGetQuakeIntensities(double ticFrac, AActor *victim, FQuak
if (!(quake->m_Flags & QF_WAVE))
{
jiggers.RollIntensity = MAX(r, jiggers.RollIntensity) * falloff;
jiggers.RollIntensity = max(r, jiggers.RollIntensity) * falloff;
intensity *= falloff;
if (quake->m_Flags & QF_RELATIVE)
{
jiggers.RelIntensity.X = MAX(intensity.X, jiggers.RelIntensity.X);
jiggers.RelIntensity.Y = MAX(intensity.Y, jiggers.RelIntensity.Y);
jiggers.RelIntensity.Z = MAX(intensity.Z, jiggers.RelIntensity.Z);
jiggers.RelIntensity.X = max(intensity.X, jiggers.RelIntensity.X);
jiggers.RelIntensity.Y = max(intensity.Y, jiggers.RelIntensity.Y);
jiggers.RelIntensity.Z = max(intensity.Z, jiggers.RelIntensity.Z);
}
else
{
jiggers.Intensity.X = MAX(intensity.X, jiggers.Intensity.X);
jiggers.Intensity.Y = MAX(intensity.Y, jiggers.Intensity.Y);
jiggers.Intensity.Z = MAX(intensity.Z, jiggers.Intensity.Z);
jiggers.Intensity.X = max(intensity.X, jiggers.Intensity.X);
jiggers.Intensity.Y = max(intensity.Y, jiggers.Intensity.Y);
jiggers.Intensity.Z = max(intensity.Z, jiggers.Intensity.Z);
}
}
else

View file

@ -780,7 +780,7 @@ void P_LineOpening_XFloors (FLineOpening &open, AActor * thing, const line_t *li
double low1 = (open.lowfloorthroughportal & 1) ? open.lowfloor : lowestfloor[0];
double low2 = (open.lowfloorthroughportal & 2) ? open.lowfloor : lowestfloor[1];
open.lowfloor = MIN(low1, low2);
open.lowfloor = min(low1, low2);
}
}
}

View file

@ -244,14 +244,14 @@ bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, do
if(line->flags & ML_DONTPEGBOTTOM)
{
*ptexbot = y_offset +
MAX(line->frontsector->GetPlaneTexZ(sector_t::floor), line->backsector->GetPlaneTexZ(sector_t::floor));
max(line->frontsector->GetPlaneTexZ(sector_t::floor), line->backsector->GetPlaneTexZ(sector_t::floor));
*ptextop = *ptexbot + textureheight;
}
else
{
*ptextop = y_offset +
MIN(line->frontsector->GetPlaneTexZ(sector_t::ceiling), line->backsector->GetPlaneTexZ(sector_t::ceiling));
min(line->frontsector->GetPlaneTexZ(sector_t::ceiling), line->backsector->GetPlaneTexZ(sector_t::ceiling));
*ptexbot = *ptextop - textureheight;
}

View file

@ -2454,7 +2454,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
// Use unsigned iterator here to avoid issue with GCC 4.9/5.x
// optimizer. Might be some undefined behavior in this code,
// but I don't know what it is.
unsigned int initsize = MIN<unsigned int> (ArrayStore[arraynum].ArraySize, (LittleLong(chunk[1])-4)/4);
unsigned int initsize = min<unsigned int> (ArrayStore[arraynum].ArraySize, (LittleLong(chunk[1])-4)/4);
int32_t *elems = ArrayStore[arraynum].Elements;
for (unsigned int j = 0; j < initsize; ++j)
{
@ -2532,7 +2532,7 @@ bool FBehavior::Init(FLevelLocals *Level, int lumpnum, FileReader * fr, int len,
{
int32_t *elems = ArrayStore[arraynum].Elements;
// Ending zeros may be left out.
for (int j = MIN(LittleLong(chunk[1])-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData)
for (int j = min(LittleLong(chunk[1])-5, ArrayStore[arraynum].ArraySize); j > 0; --j, ++elems, ++chunkData)
{
// For ATAG, a value of 0 = Integer, 1 = String, 2 = FunctionPtr
// Our implementation uses the same tags for both String and FunctionPtr
@ -10309,7 +10309,7 @@ DLevelScript::DLevelScript (FLevelLocals *l, AActor *who, line_t *where, int num
assert(code->VarCount >= code->ArgCount);
Localvars.Resize(code->VarCount);
memset(&Localvars[0], 0, code->VarCount * sizeof(int32_t));
for (int i = 0; i < MIN<int>(argcount, code->ArgCount); ++i)
for (int i = 0; i < min<int>(argcount, code->ArgCount); ++i)
{
Localvars[i] = args[i];
}

View file

@ -1921,9 +1921,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burst)
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An self with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, int(self->radius * self->Height)/32);
numChunks = max<int> (4, int(self->radius * self->Height)/32);
i = (pr_burst.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
for (i = max (24, numChunks + i); i >= 0; i--)
{
double xo = (pr_burst() - 128) * self->radius / 128;
double yo = (pr_burst() - 128) * self->radius / 128;
@ -2492,7 +2492,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckIfTargetInLOS)
else { target = viewport; viewport = self; }
}
fov = MIN<DAngle>(fov, 360.);
fov = min<DAngle>(fov, 360.);
if (fov > 0)
{
@ -4785,11 +4785,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
{
if (pdelta > 0)
{
current -= MIN(pitchlimit, pdelta);
current -= min(pitchlimit, pdelta);
}
else //if (pdelta < 0)
{
current += MIN(pitchlimit, -pdelta);
current += min(pitchlimit, -pdelta);
}
mobj->SetPitch(current, !!(flags & FMDF_INTERPOLATE));
}

View file

@ -2987,12 +2987,12 @@ void A_Face(AActor *self, AActor *other, DAngle max_turn, DAngle max_pitch, DAng
{
if (self->Angles.Pitch > other_pitch)
{
max_pitch = MIN(max_pitch, (self->Angles.Pitch - other_pitch).Normalized360());
max_pitch = min(max_pitch, (self->Angles.Pitch - other_pitch).Normalized360());
self->Angles.Pitch -= max_pitch;
}
else
{
max_pitch = MIN(max_pitch, (other_pitch - self->Angles.Pitch).Normalized360());
max_pitch = min(max_pitch, (other_pitch - self->Angles.Pitch).Normalized360());
self->Angles.Pitch += max_pitch;
}
}

View file

@ -90,7 +90,7 @@ void P_TouchSpecialThing (AActor *special, AActor *toucher)
// The pickup is at or above the toucher's feet OR
// The pickup is below the toucher.
if (delta > toucher->Height || delta < MIN(-32., -special->Height))
if (delta > toucher->Height || delta < min(-32., -special->Height))
{ // out of reach
return;
}
@ -1467,7 +1467,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
}
}
const int realdamage = MAX(0, damage);
const int realdamage = max(0, damage);
target->Level->localEventManager->WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
needevent = false;
@ -1475,7 +1475,7 @@ static int DamageMobj (AActor *target, AActor *inflictor, AActor *source, int da
return realdamage;
}
}
return MAX(0, damage);
return max(0, damage);
}
static int DoDamageMobj(AActor *target, AActor *inflictor, AActor *source, int damage, FName mod, int flags, DAngle angle)
@ -1492,7 +1492,7 @@ static int DoDamageMobj(AActor *target, AActor *inflictor, AActor *source, int d
target->Level->localEventManager->WorldThingDamaged(target, inflictor, source, realdamage, mod, flags, angle);
}
return MAX(0, realdamage);
return max(0, realdamage);
}
DEFINE_ACTION_FUNCTION(AActor, DamageMobj)

View file

@ -2357,7 +2357,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// This is so that it does not walk off of things onto a drop off.
if (thing->flags2 & MF2_ONMOBJ)
{
floorz = MAX(thing->Z(), tm.floorz);
floorz = max(thing->Z(), tm.floorz);
}
if (floorz - tm.dropoffz > thing->MaxDropOffHeight &&
@ -4035,8 +4035,8 @@ struct aim_t
floorportalstate = false;
}
}
if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, MIN<DAngle>(0., bottompitch));
if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, MAX<DAngle>(0., toppitch), bottompitch);
if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, min<DAngle>(0., bottompitch));
if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, max<DAngle>(0., toppitch), bottompitch);
FPathTraverse it(lastsector->Level, startpos.X, startpos.Y, aimtrace.X, aimtrace.Y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac);
intercept_t *in;
@ -4114,11 +4114,11 @@ struct aim_t
// check portal in backsector when aiming up/downward is possible, the line doesn't have portals on both sides and there's actually a portal in the backsector
if ((planestocheck & aim_up) && toppitch < 0 && open.top != LINEOPEN_MAX && !entersec->PortalBlocksMovement(sector_t::ceiling))
{
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, MIN<DAngle>(0., bottompitch));
EnterSectorPortal(sector_t::ceiling, in->frac, entersec, toppitch, min<DAngle>(0., bottompitch));
}
if ((planestocheck & aim_down) && bottompitch > 0 && open.bottom != LINEOPEN_MIN && !entersec->PortalBlocksMovement(sector_t::floor))
{
EnterSectorPortal(sector_t::floor, in->frac, entersec, MAX<DAngle>(0., toppitch), bottompitch);
EnterSectorPortal(sector_t::floor, in->frac, entersec, max<DAngle>(0., toppitch), bottompitch);
}
continue; // shot continues
}
@ -6663,7 +6663,7 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos)
AActor *onmobj;
if (!P_TestMobjZ(thing, true, &onmobj) && onmobj->Z() <= thing->Z())
{
thing->SetZ(MIN(thing->ceilingz - thing->Height, onmobj->Top()));
thing->SetZ(min(thing->ceilingz - thing->Height, onmobj->Top()));
thing->UpdateRenderSectorList();
}
}

View file

@ -527,10 +527,10 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
}
else
{ // [RH] Link into every block this actor touches, not just the center one
x1 = MAX(0, x1);
y1 = MAX(0, y1);
x2 = MIN(Level->blockmap.bmapwidth - 1, x2);
y2 = MIN(Level->blockmap.bmapheight - 1, y2);
x1 = max(0, x1);
y1 = max(0, y1);
x2 = min(Level->blockmap.bmapwidth - 1, x2);
y2 = min(Level->blockmap.bmapheight - 1, y2);
for (int y = y1; y <= y2; ++y)
{
for (int x = x1; x <= x2; ++x)

View file

@ -1774,7 +1774,7 @@ bool P_SeekerMissile (AActor *actor, double thresh, double turnMax, bool precise
DAngle pitch = 0.;
if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER)))
{ // Need to seek vertically
double dist = MAX(1., actor->Distance2D(target));
double dist = max(1., actor->Distance2D(target));
// Aim at a player's eyes and at the middle of the actor for everything else.
double aimheight = target->Height/2;
if (target->player)
@ -1849,7 +1849,7 @@ double P_XYMovement (AActor *mo, DVector2 scroll)
// preserve the direction instead of clamping x and y independently.
double cx = mo->Vel.X == 0 ? 1. : clamp(mo->Vel.X, -maxmove, maxmove) / mo->Vel.X;
double cy = mo->Vel.Y == 0 ? 1. : clamp(mo->Vel.Y, -maxmove, maxmove) / mo->Vel.Y;
double fac = MIN(cx, cy);
double fac = min(cx, cy);
mo->Vel.X *= fac;
mo->Vel.Y *= fac;
@ -2439,7 +2439,7 @@ void P_ZMovement (AActor *mo, double oldfloorz)
}
if (mo->Vel.Z < sinkspeed)
{ // Dropping too fast, so slow down toward sinkspeed.
mo->Vel.Z -= MAX(sinkspeed*2, -8.);
mo->Vel.Z -= max(sinkspeed*2, -8.);
if (mo->Vel.Z > sinkspeed)
{
mo->Vel.Z = sinkspeed;
@ -2447,7 +2447,7 @@ void P_ZMovement (AActor *mo, double oldfloorz)
}
else if (mo->Vel.Z > sinkspeed)
{ // Dropping too slow/going up, so trend toward sinkspeed.
mo->Vel.Z = startvelz + MAX(sinkspeed/3, -8.);
mo->Vel.Z = startvelz + max(sinkspeed/3, -8.);
if (mo->Vel.Z < sinkspeed)
{
mo->Vel.Z = sinkspeed;
@ -6693,7 +6693,7 @@ AActor *P_OldSpawnMissile(AActor *source, AActor *owner, AActor *dest, PClassAct
th->VelFromAngle();
double dist = source->DistanceBySpeed(dest, MAX(1., th->Speed));
double dist = source->DistanceBySpeed(dest, max(1., th->Speed));
th->Vel.Z = (dest->Z() - source->Z()) / dist;
if (th->flags4 & MF4_SPECTRAL)

View file

@ -390,7 +390,7 @@ void AActor::UpdateRenderSectorList()
{
int bx = Level->blockmap.GetBlockX(X());
int by = Level->blockmap.GetBlockY(Y());
FBoundingBox bb(X(), Y(), MIN(radius*1.5, 128.)); // Don't go further than 128 map units, even for large actors
FBoundingBox bb(X(), Y(), min(radius*1.5, 128.)); // Don't go further than 128 map units, even for large actors
// Are there any portals near the actor's position?
if (Level->blockmap.isValidBlock(bx, by) && Level->PortalBlockmap(bx, by).neighborContainsLines)
{

View file

@ -192,8 +192,8 @@ void SightCheck::P_SightOpening(SightOpening &open, const line_t *linedef, doubl
if (ff == 0) ff = front->floorplane.ZatPoint(x, y);
if (bf == 0) bf = back->floorplane.ZatPoint(x, y);
open.bottom = MAX(ff, bf);
open.top = MIN(fc, bc);
open.bottom = max(ff, bf);
open.top = min(fc, bc);
// we only want to know if there is an opening, not how large it is.
open.range = open.bottom < open.top;

View file

@ -200,7 +200,7 @@ bool P_Teleport (AActor *thing, DVector3 pos, DAngle angle, int flags)
// [RH] Zoom player's field of vision
// [BC] && bHaltVelocity.
if (telezoom && thing->player->mo == thing && !(flags & TELF_KEEPVELOCITY))
thing->player->FOV = MIN (175.f, thing->player->DesiredFOV + 45.f);
thing->player->FOV = min (175.f, thing->player->DesiredFOV + 45.f);
}
}
// [BC] && bHaltVelocity.

View file

@ -453,7 +453,7 @@ void player_t::SetSubtitle(int num, FSoundID soundid)
if (text != nullptr)
{
SubtitleText = lumpname;
int sl = soundid == 0 ? 7000 : std::max<int>(7000, S_GetMSLength(soundid));
int sl = soundid == 0 ? 7000 : max<int>(7000, S_GetMSLength(soundid));
SubtitleCounter = sl * TICRATE / 1000;
}
}
@ -623,8 +623,8 @@ EXTERN_CVAR(Bool, cl_oldfreelooklimit);
static int GetSoftPitch(bool down)
{
int MAX_DN_ANGLE = MIN(56, (int)maxviewpitch); // Max looking down angle
int MAX_UP_ANGLE = MIN(32, (int)maxviewpitch); // Max looking up angle
int MAX_DN_ANGLE = min(56, (int)maxviewpitch); // Max looking down angle
int MAX_UP_ANGLE = min(32, (int)maxviewpitch); // Max looking up angle
return (down ? MAX_DN_ANGLE : ((cl_oldfreelooklimit) ? MAX_UP_ANGLE : MAX_DN_ANGLE));
}

View file

@ -72,8 +72,8 @@ struct BoundingRect
double distanceTo(const BoundingRect &other) const
{
if (intersects(other)) return 0;
return std::max(std::min(fabs(left - other.right), fabs(right - other.left)),
std::min(fabs(top - other.bottom), fabs(bottom - other.top)));
return max(min(fabs(left - other.right), fabs(right - other.left)),
min(fabs(top - other.bottom), fabs(bottom - other.top)));
}
void addVertex(double x, double y)

View file

@ -144,7 +144,7 @@ int CreateBloodTranslation(PalEntry color)
trans.Remap[0] = 0;
for (i = 1; i < 256; i++)
{
int bright = std::max(std::max(GPalette.BaseColors[i].r, GPalette.BaseColors[i].g), GPalette.BaseColors[i].b);
int bright = max(std::max(GPalette.BaseColors[i].r, GPalette.BaseColors[i].g), GPalette.BaseColors[i].b);
PalEntry pe = PalEntry(255, color.r*bright/255, color.g*bright/255, color.b*bright/255);
int entry = ColorMatcher.Pick(pe.r, pe.g, pe.b);
@ -484,7 +484,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
// Build player sprite translation
//h = 45.f;
v = MAX (0.1f, v);
v = max (0.1f, v);
for (i = start; i <= end; i++)
{
@ -498,7 +498,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
float mv[18] = { .16f, .19f, .22f, .25f, .31f, .35f, .38f, .41f, .47f, .54f, .60f, .65f, .71f, .77f, .83f, .89f, .94f, 1.f };
// Build player sprite translation
v = MAX (0.1f, v);
v = max (0.1f, v);
for (i = start; i <= end; i++)
{
@ -513,12 +513,12 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
if (gameinfo.gametype == GAME_Heretic)
{
// Build rain/lifegem translation
bases = MIN(bases * 1.3f, 1.f);
basev = MIN(basev * 1.3f, 1.f);
bases = min(bases * 1.3f, 1.f);
basev = min(basev * 1.3f, 1.f);
for (i = 145; i <= 168; i++)
{
s = MIN(bases, 0.8965f - 0.0962f * (float)(i - 161));
v = MIN(1.f, (0.2102f + 0.0489f * (float)(i - 144)) * basev);
s = min(bases, 0.8965f - 0.0962f * (float)(i - 161));
v = min(1.f, (0.2102f + 0.0489f * (float)(i - 144)) * basev);
HSVtoRGB(&r, &g, &b, h, s, v);
SetRemap(alttable, i, r, g, b);
SetPillarRemap(pillartable, i, h, s, v);

View file

@ -74,11 +74,11 @@ int wipe_CalcBurn (uint8_t *burnarray, int width, int height, int density)
{
unsigned int offs = (a+b) & (width - 1);
unsigned int v = M_Random();
v = MIN(from[offs] + 4 + (v & 15) + (v >> 3) + (M_Random() & 31), 255u);
v = min(from[offs] + 4 + (v & 15) + (v >> 3) + (M_Random() & 31), 255u);
from[offs] = from[width*2 + ((offs + width*3/2) & (width - 1))] = v;
}
density = MIN(density + 10, width * 7);
density = min(density + 10, width * 7);
from = burnarray;
for (b = 0; b <= height; b += 2)
@ -289,7 +289,7 @@ bool Wiper_Melt::Run(int ticks)
else if (y[i] < HEIGHT)
{
int dy = (y[i] < 16) ? y[i] + 1 : 8;
y[i] = MIN(y[i] + dy, HEIGHT);
y[i] = min(y[i] + dy, HEIGHT);
done = false;
}
if (ticks == 0)
@ -311,7 +311,7 @@ bool Wiper_Melt::Run(int ticks)
int w = startScreen->GetTexelWidth();
int h = startScreen->GetTexelHeight();
dpt.x = i * w / WIDTH;
dpt.y = MAX(0, y[i] * h / HEIGHT);
dpt.y = max(0, y[i] * h / HEIGHT);
rect.left = dpt.x;
rect.top = 0;
rect.right = (i + 1) * w / WIDTH;

View file

@ -141,7 +141,7 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
if (painFlash.a != 0)
{
cnt = DamageToAlpha[MIN (CPlayer->damagecount * painFlash.a / 255, (uint32_t)113)];
cnt = DamageToAlpha[min (CPlayer->damagecount * painFlash.a / 255, (uint32_t)113)];
// [BC] Allow users to tone down the intensity of the blood on the screen.
cnt = (int)( cnt * blood_fade_scalar );
@ -164,7 +164,7 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
if (CPlayer->poisoncount)
{
cnt = MIN (CPlayer->poisoncount, 64);
cnt = min (CPlayer->poisoncount, 64);
if (paletteflash & PF_POISON)
{
V_AddBlend(44/255.f, 92/255.f, 36/255.f, ((cnt + 7) >> 3) * 0.1f, blend);
@ -190,7 +190,7 @@ void V_AddPlayerBlend (player_t *CPlayer, float blend[4], float maxinvalpha, int
}
else
{
cnt= MIN(CPlayer->hazardcount/8, 64);
cnt= min(CPlayer->hazardcount/8, 64);
float r = ((Level->hazardcolor & 0xff0000) >> 16) / 255.f;
float g = ((Level->hazardcolor & 0xff00) >> 8) / 255.f;
float b = ((Level->hazardcolor & 0xff)) / 255.f;

View file

@ -57,8 +57,8 @@ DoomLevelAABBTree::DoomLevelAABBTree(FLevelLocals *lev)
FVector2 aabb_min, aabb_max;
const auto &left = nodes[staticroot];
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_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);
nodes.Push({ aabb_min, aabb_max, staticroot, dynamicroot });
@ -137,9 +137,9 @@ bool DoomLevelAABBTree::Update()
float y2 = (float)line.v2->fY();
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_top = MIN(y1, y2);
nodes[nodeIndex].aabb_top = min(y1, y2);
nodes[nodeIndex].aabb_bottom = MAX(y1, y2);
for (unsigned int j = 1; j < path.Size(); j++)
@ -147,8 +147,8 @@ bool DoomLevelAABBTree::Update()
auto &cur = nodes[path[j]];
const auto &left = nodes[cur.left_node];
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_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);
}
@ -181,10 +181,10 @@ int DoomLevelAABBTree::GenerateTreeNode(int *lines, int num_lines, const FVector
float x2 = (float)maplines[mapLines[lines[i]]].v2->fX();
float y2 = (float)maplines[mapLines[lines[i]]].v2->fY();
aabb_min.X = MIN(aabb_min.X, x1);
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_min.X = min(aabb_min.X, x1);
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);

View file

@ -705,7 +705,7 @@ bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool trans
if ((maplightbottomleft<ztop[0] && maplightbottomright>ztop[1]) ||
(maplightbottomleft>ztop[0] && maplightbottomright<ztop[1]))
{
float clen = MAX<float>(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1));
float clen = max<float>(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1));
float dch = ztop[1] - ztop[0];
float dfh = maplightbottomright - maplightbottomleft;
@ -745,7 +745,7 @@ bool HWWall::SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool trans
if ((maplightbottomleft<zbottom[0] && maplightbottomright>zbottom[1]) ||
(maplightbottomleft>zbottom[0] && maplightbottomright<zbottom[1]))
{
float clen = MAX<float>(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1));
float clen = max<float>(fabsf(glseg.x2 - glseg.x1), fabsf(glseg.y2 - glseg.y1));
float dch = zbottom[1] - zbottom[0];
float dfh = maplightbottomright - maplightbottomleft;
@ -1283,12 +1283,12 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
rowoffset = tci.RowOffset(seg->sidedef->GetTextureYOffset(side_t::mid));
if ((seg->linedef->flags & ML_DONTPEGBOTTOM) >0)
{
texturebottom = MAX(realfront->GetPlaneTexZ(sector_t::floor), realback->GetPlaneTexZ(sector_t::floor) + zalign) + rowoffset;
texturebottom = max(realfront->GetPlaneTexZ(sector_t::floor), realback->GetPlaneTexZ(sector_t::floor) + zalign) + rowoffset;
texturetop = texturebottom + tci.mRenderHeight;
}
else
{
texturetop = MIN(realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling) + zalign) + rowoffset;
texturetop = min(realfront->GetPlaneTexZ(sector_t::ceiling), realback->GetPlaneTexZ(sector_t::ceiling) + zalign) + rowoffset;
texturebottom = texturetop - tci.mRenderHeight;
}
}
@ -1319,8 +1319,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
else
{
// texture is missing - use the higher plane
topleft = MAX(bch1,fch1);
topright = MAX(bch2,fch2);
topleft = max(bch1,fch1);
topright = max(bch2,fch2);
}
}
else if ((bch1>fch1 || bch2>fch2) &&
@ -1334,8 +1334,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
else
{
// But not if there can be visual artifacts.
topleft = MIN(bch1,fch1);
topright = MIN(bch2,fch2);
topleft = min(bch1,fch1);
topright = min(bch2,fch2);
}
//
@ -1347,8 +1347,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
if (!tex || !tex->isValid())
{
// texture is missing - use the lower plane
bottomleft = MIN(bfh1,ffh1);
bottomright = MIN(bfh2,ffh2);
bottomleft = min(bfh1,ffh1);
bottomright = min(bfh2,ffh2);
}
else if (bfh1<ffh1 || bfh2<ffh2) // (!((bfh1<=ffh1 && bfh2<=ffh2) || (bfh1>=ffh1 && bfh2>=ffh2)))
{
@ -1360,8 +1360,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
else
{
// normal case - use the higher plane
bottomleft = MAX(bfh1,ffh1);
bottomright = MAX(bfh2,ffh2);
bottomleft = max(bfh1,ffh1);
bottomright = max(bfh2,ffh2);
}
//
@ -1514,8 +1514,8 @@ void HWWall::DoMidTexture(HWDrawInfo *di, seg_t * seg, bool drawfogboundary,
int i,t=0;
float v_factor=(zbottom[0]-ztop[0])/(tcs[LOLFT].v-tcs[UPLFT].v);
// only split the vertical area of the polygon that does not contain slopes.
float splittopv = MAX(tcs[UPLFT].v, tcs[UPRGT].v);
float splitbotv = MIN(tcs[LOLFT].v, tcs[LORGT].v);
float splittopv = max(tcs[UPLFT].v, tcs[UPRGT].v);
float splitbotv = min(tcs[LOLFT].v, tcs[LORGT].v);
// this is split vertically into sections.
for(i=0;i<v;i++)

View file

@ -305,7 +305,7 @@ namespace swrenderer
{
for (int i = x1; i < x2; i++)
{
ScreenY[i] = std::min(ScreenY[i], clip.sprbottomclip[i]);
ScreenY[i] = min(ScreenY[i], clip.sprbottomclip[i]);
}
}

View file

@ -233,8 +233,8 @@ namespace swrenderer
if (flipY)
std::swap(dc_yl, dc_yh);
dc_yl = std::max(dc_yl, cliptop);
dc_yh = std::min(dc_yh, clipbottom);
dc_yl = max(dc_yl, cliptop);
dc_yh = min(dc_yh, clipbottom);
if (dc_yl <= dc_yh)
{
@ -271,8 +271,8 @@ namespace swrenderer
if (flipY)
std::swap(dc_yl, dc_yh);
dc_yl = std::max(dc_yl, cliptop);
dc_yh = std::min(dc_yh, clipbottom);
dc_yl = max(dc_yl, cliptop);
dc_yh = min(dc_yh, clipbottom);
if (dc_yl < dc_yh)
{

View file

@ -1786,7 +1786,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(FWeaponSlots, LocateWeapon, LocateWeapon)
if (numret >= 1) ret[0].SetInt(retv);
if (numret >= 2) ret[1].SetInt(slot);
if (numret >= 3) ret[2].SetInt(index);
return MIN(numret, 3);
return min(numret, 3);
}
static PClassActor *GetWeapon(FWeaponSlots *self, int slot, int index)
@ -2123,7 +2123,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DBaseStatusBar, GetInventoryIcon, GetInventoryIcon
FTextureID icon = FSetTextureID(GetInventoryIcon(item, flags, &applyscale));
if (numret >= 1) ret[0].SetInt(icon.GetIndex());
if (numret >= 2) ret[1].SetInt(applyscale);
return MIN(numret, 2);
return min(numret, 2);
}
//=====================================================================================
@ -2489,7 +2489,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetViewWindow)
if (numret > 1) ret[1].SetInt(viewwindowy);
if (numret > 2) ret[2].SetInt(viewwidth);
if (numret > 3) ret[3].SetInt(viewheight);
return MIN(numret, 4);
return min(numret, 4);
}
DEFINE_ACTION_FUNCTION(_Console, MidPrint)

View file

@ -117,7 +117,7 @@ FSerializer &SerializeArgs(FSerializer& arc, const char *key, int *args, int *de
{
if (val->IsArray())
{
unsigned int cnt = MIN<unsigned>(val->Size(), 5);
unsigned int cnt = min<unsigned>(val->Size(), 5);
for (unsigned int i = 0; i < cnt; i++)
{
const rapidjson::Value &aval = (*val)[i];

View file

@ -1008,7 +1008,7 @@ static void S_AddSNDINFO (int lump)
sc.MustGetString ();
sfx = soundEngine->FindSoundTentative (sc.String);
sc.MustGetNumber ();
S_sfx[sfx].NearLimit = MIN(MAX(sc.Number, 0), 255);
S_sfx[sfx].NearLimit = min(max(sc.Number, 0), 255);
if (sc.CheckFloat())
{
S_sfx[sfx].LimitRange = float(sc.Float * sc.Float);

View file

@ -1004,11 +1004,11 @@ static void CalcSectorSoundOrg(const DVector3& listenpos, const sector_t* sec, i
// Set sound vertical position based on channel.
if (channum == CHAN_FLOOR)
{
pos.Y = (float)MIN<double>(sec->floorplane.ZatPoint(listenpos), listenpos.Z);
pos.Y = (float)min<double>(sec->floorplane.ZatPoint(listenpos), listenpos.Z);
}
else if (channum == CHAN_CEILING)
{
pos.Y = (float)MAX<double>(sec->ceilingplane.ZatPoint(listenpos), listenpos.Z);
pos.Y = (float)max<double>(sec->ceilingplane.ZatPoint(listenpos), listenpos.Z);
}
else if (channum == CHAN_INTERIOR)
{

View file

@ -150,10 +150,10 @@ int FNodeBuilder::CreateNode (uint32_t set, unsigned int count, fixed_t bbox[4])
D(PrintSet (2, set2));
node.intchildren[0] = CreateNode (set1, count1, node.nb_bbox[0]);
node.intchildren[1] = CreateNode (set2, count2, node.nb_bbox[1]);
bbox[BOXTOP] = MAX (node.nb_bbox[0][BOXTOP], node.nb_bbox[1][BOXTOP]);
bbox[BOXBOTTOM] = MIN (node.nb_bbox[0][BOXBOTTOM], node.nb_bbox[1][BOXBOTTOM]);
bbox[BOXLEFT] = MIN (node.nb_bbox[0][BOXLEFT], node.nb_bbox[1][BOXLEFT]);
bbox[BOXRIGHT] = MAX (node.nb_bbox[0][BOXRIGHT], node.nb_bbox[1][BOXRIGHT]);
bbox[BOXTOP] = max (node.nb_bbox[0][BOXTOP], node.nb_bbox[1][BOXTOP]);
bbox[BOXBOTTOM] = min (node.nb_bbox[0][BOXBOTTOM], node.nb_bbox[1][BOXBOTTOM]);
bbox[BOXLEFT] = min (node.nb_bbox[0][BOXLEFT], node.nb_bbox[1][BOXLEFT]);
bbox[BOXRIGHT] = max (node.nb_bbox[0][BOXRIGHT], node.nb_bbox[1][BOXRIGHT]);
return (int)Nodes.Push (node);
}
else
@ -643,7 +643,7 @@ int FNodeBuilder::Heuristic (node_t &node, uint32_t set, bool honorNoSplit)
frac = 1 - frac;
}
int penalty = int(1 / frac);
score = MAX(score - penalty, 1);
score = std::max(score - penalty, 1);
D(Printf ("Penalized splitter by %d for being near endpt of seg %d (%f).\n", penalty, i, frac));
}

View file

@ -699,9 +699,9 @@ int FNodeBuilder::FVertexMap::InsertVertex (FNodeBuilder::FPrivVert &vert)
// 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 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 maxy = MIN (MaxY, fixed64_t(vert.y) + VERTEX_EPSILON);
fixed64_t maxy = min (MaxY, fixed64_t(vert.y) + VERTEX_EPSILON);
int blk[4] =
{

View file

@ -831,7 +831,7 @@ DEFINE_ACTION_FUNCTION(DStatusScreen, GetPlayerWidths)
if (numret > 0) ret[0].SetInt(maxnamewidth);
if (numret > 1) ret[1].SetInt(maxscorewidth);
if (numret > 2) ret[2].SetInt(maxiconheight);
return MIN(numret, 3);
return min(numret, 3);
}
//====================================================================