- replaced MIN/MAX in all non-common code.
This commit is contained in:
parent
226666ce7f
commit
1d0aed219e
43 changed files with 147 additions and 146 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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++)
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue