Fix implicit casts of int expecting 4-byte width

This fixes the issue with certain compilers that have int set to
different sizes by either explicitly casting or setting templates
manually
This commit is contained in:
bitten2up 2024-05-03 17:53:53 +00:00 committed by Eidolon
parent 205da284e1
commit cfacbd91be
31 changed files with 83 additions and 81 deletions

View file

@ -2026,7 +2026,7 @@ bool CallFunc_SetLineRenderStyle(ACSVM::Thread *thread, const ACSVM::Word *argV,
}
alpha = argV[2];
alpha = std::clamp(alpha, 0, FRACUNIT);
alpha = std::clamp<fixed_t>(alpha, 0, FRACUNIT);
TAG_ITER_LINES(tag, lineId)
{

View file

@ -64,7 +64,7 @@ INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
}
// Calculate how much the magnitude exceeds the deadzone
adjustedMagnitude = std::min(adjustedMagnitude, JOYAXISRANGE) - jdeadzone;
adjustedMagnitude = std::min<INT32>(adjustedMagnitude, JOYAXISRANGE) - jdeadzone;
return (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
}
@ -133,10 +133,10 @@ class TiccmdBuilder
joystickvector.yaxis = (normalisedYAxis * normalisedMagnitude) / JOYAXISRANGE;
// Cap the values so they don't go above the correct maximum
joystickvector.xaxis = std::min(joystickvector.xaxis, JOYAXISRANGE);
joystickvector.xaxis = std::max(joystickvector.xaxis, -JOYAXISRANGE);
joystickvector.yaxis = std::min(joystickvector.yaxis, JOYAXISRANGE);
joystickvector.yaxis = std::max(joystickvector.yaxis, -JOYAXISRANGE);
joystickvector.xaxis = std::min<INT32>(joystickvector.xaxis, JOYAXISRANGE);
joystickvector.xaxis = std::max<INT32>(joystickvector.xaxis, -JOYAXISRANGE);
joystickvector.yaxis = std::min<INT32>(joystickvector.yaxis, JOYAXISRANGE);
joystickvector.yaxis = std::max<INT32>(joystickvector.yaxis, -JOYAXISRANGE);
}
void hook()
@ -379,7 +379,7 @@ class TiccmdBuilder
kart_analog_input();
// Digital users can input diagonal-back for shallow turns.
//
//
// There's probably some principled way of doing this in the gamepad handler itself,
// by only applying this filtering to inputs sourced from an axis. This is a little
// ugly with the current abstractions, though, and there's a fortunate trick here:

View file

@ -19,6 +19,7 @@
#include <nlohmann/json.hpp>
#include "doomdef.h"
#include "doomtype.h"
#include "console.h"
#include "d_main.h"
#include "d_player.h"

View file

@ -592,7 +592,7 @@ modelfound:
fclose(f);
}
void HWR_AddPlayerModel(int skin) // For skins that were added after startup
void HWR_AddPlayerModel(INT32 skin) // For skins that were added after startup
{
FILE *f;
char name[24], filename[32];

View file

@ -564,7 +564,7 @@ void F_TickCreditsDemoExit(void)
if (!menuactive && M_MenuConfirmPressed(0))
{
g_credits.demo_exit = std::max(g_credits.demo_exit, kDemoExitTicCount - 64);
g_credits.demo_exit = std::max<tic_t>(g_credits.demo_exit, kDemoExitTicCount - 64);
}
if (INT32 val = F_CreditsDemoExitFade(); val >= 0)
@ -654,7 +654,7 @@ static boolean F_TickCreditsSlide(void)
if (g_credits.transition < FRACUNIT)
{
g_credits.transition = std::min(g_credits.transition + (FRACUNIT / TICRATE), FRACUNIT);
g_credits.transition = std::min<INT32>(g_credits.transition + (FRACUNIT / TICRATE), FRACUNIT);
if (g_credits.split_slide_id < g_credits.split_slide_strings.size())
{

View file

@ -307,7 +307,7 @@ void Dialogue::Tick(void)
}
}
slide = std::clamp(slide, 0, FRACUNIT);
slide = std::clamp<size_t>(slide, 0, FRACUNIT);
if (slide != FRACUNIT)
{
@ -354,7 +354,7 @@ void Dialogue::Draw(void)
INT32 speakernameedge = -6;
srb2::Draw drawer =
srb2::Draw drawer =
srb2::Draw(
BASEVIDWIDTH, BASEVIDHEIGHT - FixedToFloat(SlideAmount(height) - height)
).flags(V_SNAPTOBOTTOM);

View file

@ -3,7 +3,7 @@
// Copyright (C) 2024 by AJ "Tyron" Martinez.
// Copyright (C) 2024 by James Robert Roman.
// Copyright (C) 2024 by Kart Krew.
//
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
@ -219,7 +219,7 @@ private:
if (playerstat[position].gap >= BREAKAWAYDIST)
{
playerstat[position].boredom = std::min(BOREDOMTIME * 2, playerstat[position].boredom + 1);
playerstat[position].boredom = std::min<INT32>(BOREDOMTIME * 2, playerstat[position].boredom + 1);
}
else if (playerstat[position].boredom > 0)
{

View file

@ -34,7 +34,7 @@ namespace
fixed_t interval(tic_t t, tic_t d)
{
return (std::min(t, d) * FRACUNIT) / std::max(d, 1u);
return (std::min(t, d) * FRACUNIT) / std::max<tic_t>(d, 1u);
}
fixed_t interval(tic_t t, tic_t s, tic_t d)

View file

@ -1696,7 +1696,7 @@ static void K_drawKartItem(void)
// Quick Eggman numbers
if (stplyr->eggmanexplode > 1)
V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|V_SLIDEIN|fflags, kp_eggnum[std::min(5, G_TicsToSeconds(stplyr->eggmanexplode))]);
V_DrawScaledPatch(fx+17, fy+13-offset, V_HUDTRANS|V_SLIDEIN|fflags, kp_eggnum[std::min<INT32>(5, G_TicsToSeconds(stplyr->eggmanexplode))]);
if (stplyr->itemtype == KITEM_FLAMESHIELD && stplyr->flamelength > 0)
{
@ -2693,7 +2693,7 @@ static void K_drawBossHealthBar(void)
;
else if (bossinfo.visualbarimpact)
{
INT32 mag = std::min((bossinfo.visualbarimpact/4) + 1, 8u);
INT32 mag = std::min<UINT32>((bossinfo.visualbarimpact/4) + 1, 8u);
if (bossinfo.visualbarimpact & 1)
starty -= mag;
else
@ -2987,7 +2987,7 @@ static void K_drawRingCounter(boolean gametypeinfoshown)
if (stplyr->hudrings <= 0 && stplyr->ringvisualwarning > 1)
{
colorring = true;
colorring = true;
if ((leveltime/2 & 1))
{
ringmap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_CRIMSON, GTC_CACHE);
@ -3862,7 +3862,7 @@ static void K_DrawNameTagSphereMeter(INT32 x, INT32 y, INT32 width, INT32 sphere
// see also K_drawBlueSphereMeter
const UINT8 segColors[] = {73, 64, 52, 54, 55, 35, 34, 33, 202, 180, 181, 182, 164, 165, 166, 153, 152};
spheres = std::clamp(spheres, 0, 40);
spheres = std::clamp<INT32>(spheres, 0, 40);
int colorIndex = (spheres * sizeof segColors) / (40 + 1);
int px = r_splitscreen > 1 ? 1 : 2;
@ -5295,7 +5295,7 @@ static void K_drawInput(void)
char mode = ((stplyr->pflags & PF_ANALOGSTICK) ? '4' : '2') + (r_splitscreen > 1);
bool local = !demo.playback && P_IsMachineLocalPlayer(stplyr);
fixed_t slide = K_GetDialogueSlide(FRACUNIT);
INT32 tallySlide = []
INT32 tallySlide = [] -> INT32
{
if (r_splitscreen <= 1)
{
@ -5309,7 +5309,7 @@ static void K_drawInput(void)
if (stplyr->tally.state == TALLY_ST_GOTTHRU_SLIDEIN ||
stplyr->tally.state == TALLY_ST_GAMEOVER_SLIDEIN)
{
return Easing_OutQuad(std::min<fixed_t>(stplyr->tally.transition * 2, FRACUNIT), 0, kSlideDown);
return static_cast<INT32>(Easing_OutQuad(std::min<fixed_t>(stplyr->tally.transition * 2, FRACUNIT), 0, kSlideDown));
}
return kSlideDown;
}();
@ -5348,7 +5348,7 @@ static void K_drawChallengerScreen(void)
19,20,19,20,19,20,19,20,19,20, // frame 20-21, 1 tic, 5 alternating: all text vibrates from impact
21,22,23,24 // frame 22-25, 1 tic: CHALLENGER turns gold
};
const UINT8 offset = std::min(52-1u, (3*TICRATE)-mapreset);
const UINT8 offset = std::min<UINT32>(52-1u, (3*TICRATE)-mapreset);
V_DrawFadeScreen(0xFF00, 16); // Fade out
V_DrawScaledPatch(0, 0, 0, kp_challenger[anim[offset]]);

View file

@ -752,10 +752,10 @@ void K_CullTargetList(std::vector<TargetTracking>& targetList)
y2 = tr.result.y + kTrackerRadius;
}
x1 = std::max(x1 / kBlockWidth / FRACUNIT, 0);
x2 = std::min(x2 / kBlockWidth / FRACUNIT, kXBlocks - 1);
y1 = std::max(y1 / kBlockHeight / FRACUNIT, 0);
y2 = std::min(y2 / kBlockHeight / FRACUNIT, kYBlocks - 1);
x1 = std::max<INT32>(x1 / kBlockWidth / FRACUNIT, 0);
x2 = std::min<INT32>(x2 / kBlockWidth / FRACUNIT, kXBlocks - 1);
y1 = std::max<INT32>(y1 / kBlockHeight / FRACUNIT, 0);
y2 = std::min<INT32>(y2 / kBlockHeight / FRACUNIT, kYBlocks - 1);
bool allMine = true;

View file

@ -303,7 +303,7 @@ void level_tally_t::Init(player_t *player)
: (tutorialchallenge == TUTORIALSKIP_INPROGRESS && K_IsPlayerLosing(player))
);
time = std::min(static_cast<INT32>(player->realtime), (100 * 60 * TICRATE) - 1);
time = std::min<INT32>(static_cast<INT32>(player->realtime), (100 * 60 * TICRATE) - 1);
ringPool = player->totalring;
livesAdded = 0;
@ -372,7 +372,7 @@ void level_tally_t::Init(player_t *player)
{
if (playeringame[i] == true && players[i].spectator == false)
{
pointLimit = std::min(pointLimit, static_cast<int>(-players[i].roundscore));
pointLimit = std::min<INT32>(pointLimit, static_cast<int>(-players[i].roundscore));
}
}
}
@ -920,7 +920,7 @@ void level_tally_t::Tick(void)
done = true;
break;
}
default:
{
// error occured, silently fix
@ -1244,7 +1244,7 @@ void level_tally_t::Draw(void)
work_tics % 10
));
if (modeattacking && !demo.playback && (state == TALLY_ST_DONE || state == TALLY_ST_TEXT_PAUSE)
if (modeattacking && !demo.playback && (state == TALLY_ST_DONE || state == TALLY_ST_TEXT_PAUSE)
&& !K_IsPlayerLosing(&players[consoleplayer]) && players[consoleplayer].realtime < oldbest)
{
drawer_text
@ -1422,7 +1422,7 @@ void K_TickPlayerTally(player_t *player)
G_PlayerInputDown(G_LocalSplitscreenPartyPosition(player - players), gc_a, 0);
boolean allowFastForward = player->tally.state > TALLY_ST_GOTTHRU_SLIDEIN
&& player->tally.state <= TALLY_ST_DONE
&& player->tally.releasedFastForward
&& player->tally.releasedFastForward
// - Not allowed online so we don't have to do any
// networking.
// - Not allowed in replays because splitscreen party
@ -1439,8 +1439,8 @@ void K_TickPlayerTally(player_t *player)
player->tally.Tick();
while (player->tally.state != TALLY_ST_DONE && player->tally.state != TALLY_ST_GAMEOVER_DONE);
player->tally.delay = std::min(player->tally.delay, TICRATE);
player->tally.delay = std::min<INT32>(player->tally.delay, TICRATE);
if (Y_ShouldDoIntermission())
musiccountdown = 2; // gets decremented to 1 in G_Ticker to immediately trigger intermission music [blows raspberry]
}
@ -1457,7 +1457,7 @@ void K_TickPlayerTally(player_t *player)
{
player->tally.releasedFastForward = false;
}
}
void K_DrawPlayerTally(void)

View file

@ -2546,8 +2546,8 @@ static INT32 K_CalculateTrackComplexity(void)
if (delta < 0)
{
dist_factor = FixedDiv(FRACUNIT, std::max(1, dist_factor));
radius_factor = FixedDiv(FRACUNIT, std::max(1, radius_factor));
dist_factor = FixedDiv(FRACUNIT, std::max<fixed_t>(1, dist_factor));
radius_factor = FixedDiv(FRACUNIT, std::max<fixed_t>(1, radius_factor));
}
else
{

View file

@ -779,8 +779,8 @@ static void M_CreateScreenShotPalette(void)
for (i = 0, j = 0; i < 768; i += 3, j++)
{
RGBA_t locpal = ((cv_screenshot_colorprofile.value)
? pLocalPalette[(std::max(st_palette,0)*256)+j]
: pMasterPalette[(std::max(st_palette,0)*256)+j]);
? pLocalPalette[(std::max<INT32>(st_palette,0)*256)+j]
: pMasterPalette[(std::max<INT32>(st_palette,0)*256)+j]);
screenshot_palette[i] = locpal.s.red;
screenshot_palette[i+1] = locpal.s.green;
screenshot_palette[i+2] = locpal.s.blue;

View file

@ -201,7 +201,7 @@ void menu_open()
g_menu.insert(
g_menu.begin(),
menuitem_t {IT_DISABLED, "No addon options!", nullptr, nullptr, {}, 0, 0}
);
);
}
group_menu();
@ -267,7 +267,7 @@ void draw_menu()
K_drawButton((draw.x() + 8) * FRACUNIT, (draw.y() + 8) * FRACUNIT, 0, kp_button_y[0], M_MenuButtonHeld(0, MBT_Y));
draw = draw.y(32 + kMargin);
currentMenu->y = std::min(static_cast<int>(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]);
currentMenu->y = std::min(static_cast<INT32>(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]);
V_SetClipRect(0, draw.y() * FRACUNIT, BASEVIDWIDTH * FRACUNIT, (BASEVIDHEIGHT - draw.y() - kMargin) * FRACUNIT, 0);
M_DrawGenericMenu();

View file

@ -211,7 +211,7 @@ void draw_menu()
K_drawButton((draw.x() + 8) * FRACUNIT, (draw.y() + 8) * FRACUNIT, 0, kp_button_y[0], M_MenuButtonHeld(0, MBT_Y));
draw = draw.y(32 + kMargin);
currentMenu->y = std::min(static_cast<int>(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]);
currentMenu->y = std::min(static_cast<INT32>(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]);
V_SetClipRect(0, draw.y() * FRACUNIT, BASEVIDWIDTH * FRACUNIT, (BASEVIDHEIGHT - draw.y() - kMargin) * FRACUNIT, 0);
M_DrawGenericMenu();

View file

@ -181,7 +181,7 @@ struct Checkpoint : mobj_t
if (!clip_var())
{
speed(speed() - FixedDiv(speed() / 50, std::max(speed_multiplier(), 1)));
speed(speed() - FixedDiv(speed() / 50, std::max<fixed_t>(speed_multiplier(), 1)));
}
}
else if (!activated())
@ -324,7 +324,7 @@ private:
if (xy_momentum)
{
P_Thrust(p, dir, xy_momentum);
p->momz = P_RandomKey(PR_DECORATION, std::max(z_momentum, 1));
p->momz = P_RandomKey(PR_DECORATION, std::max<fixed_t>(z_momentum, 1));
p->destscale = 0;
p->scalespeed = p->scale / 35;
p->color = SKINCOLOR_ULTRAMARINE;

View file

@ -387,7 +387,7 @@ private:
{
fixed_t f = burning() * FRACUNIT / burn_duration();
if ((leveltime % std::max(1, Easing_OutCubic(f, 8, 1))) == 0)
if ((leveltime % std::max<fixed_t>(1, Easing_OutCubic(f, 8, 1))) == 0)
{
vfx(f);
}

View file

@ -88,7 +88,7 @@ bool award_target(mobj_t* mobj)
player->itemamount++;
if (player->roundconditions.gachabom_miser == 1)
player->roundconditions.gachabom_miser = 0;
//S_StartSoundAtVolume(target, sfx_grbnd3, 255/3);
S_StartSound(target, sfx_mbs54);
@ -127,7 +127,7 @@ void chase_rebound_target(mobj_t* mobj)
mobj->momz = zDelta / 4;
const tic_t t = distance_to_target(mobj) / travelDistance;
const fixed_t newSpeed = std::abs(mobj->scale - mobj->destscale) / std::max(t, 1u);
const fixed_t newSpeed = std::abs(mobj->scale - mobj->destscale) / std::max<tic_t>(t, 1u);
if (newSpeed > mobj->scalespeed)
{

View file

@ -45,7 +45,7 @@ struct Spinner : Mobj
void think()
{
fixed_t f = FRACUNIT - std::clamp(fuse, 0, duration()) * FRACUNIT / std::max(duration(), 1);
fixed_t f = FRACUNIT - std::clamp<INT32>(fuse, 0, duration()) * FRACUNIT / std::max<INT32>(duration(), 1);
if (fuse == duration() - 20)
{

View file

@ -246,7 +246,7 @@ private:
return;
rope()->z = hook()->top();
rope()->spriteyscale(Fixed {std::max(0, z - hook()->top())} / std::max<Fixed>(1, 32 * rope()->scale()));
rope()->spriteyscale(Fixed {std::max<fixed_t>(0, z - hook()->top())} / std::max<Fixed>(1, 32 * rope()->scale()));
}
};

View file

@ -3444,8 +3444,8 @@ static void P_ProcessLinedefsAfterSidedefs(void)
if (ld->flags & ML_DONTPEGBOTTOM) // alternate alpha (by texture offsets)
{
extracolormap_t *exc = R_CopyColormap(sides[ld->sidenum[0]].colormap_data, false);
INT16 alpha = std::max(std::min(sides[ld->sidenum[0]].textureoffset >> FRACBITS, 25), -25);
INT16 fadealpha = std::max(std::min(sides[ld->sidenum[0]].rowoffset >> FRACBITS, 25), -25);
INT16 alpha = std::max<fixed_t>(std::min<fixed_t>(sides[ld->sidenum[0]].textureoffset >> FRACBITS, 25), -25);
INT16 fadealpha = std::max<fixed_t>(std::min<fixed_t>(sides[ld->sidenum[0]].rowoffset >> FRACBITS, 25), -25);
// If alpha is negative, set "subtract alpha" flag and store absolute value
if (alpha < 0)
@ -5840,12 +5840,12 @@ static void P_ConvertBinaryLinedefTypes(void)
lines[i].args[0] = tag;
if (lines[i].flags & ML_DONTPEGBOTTOM)
{
lines[i].args[1] = std::max(sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, 0);
lines[i].args[1] = std::max<fixed_t>(sides[lines[i].sidenum[0]].textureoffset >> FRACBITS, 0);
// failsafe: if user specifies Back Y Offset and NOT Front Y Offset, use the Back Offset
// to be consistent with other light and fade specials
lines[i].args[2] = ((lines[i].sidenum[1] != 0xFFFF && !(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS)) ?
std::max(std::min(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS, 255), 0)
: std::max(std::min(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, 255), 0));
std::max<fixed_t>(std::min<fixed_t>(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS, 255), 0)
: std::max<fixed_t>(std::min<fixed_t>(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, 255), 0));
}
else
{

View file

@ -46,7 +46,7 @@ INT32 R_AdjustLightLevel(INT32 light)
if (!debugrender_highlight && cv_debugrender_contrast.value == 0)
{
const fixed_t darken = FixedMul(FixedMul(g_darkness.value[R_GetViewNumber()], mapheaderinfo[gamemap-1]->darkness), kRange);
return std::clamp((light * FRACUNIT) - darken, 0, kRange) / FRACUNIT;
return std::clamp<size_t>((light * FRACUNIT) - darken, 0, kRange) / FRACUNIT;
}
const fixed_t adjust = FixedMul(cv_debugrender_contrast.value, kRange);
@ -60,7 +60,7 @@ INT32 R_AdjustLightLevel(INT32 light)
}
else
{
light = std::clamp((light * FRACUNIT) - adjust, 0, kRange);
light = std::clamp<size_t>((light * FRACUNIT) - adjust, 0, kRange);
}
return light / FRACUNIT;

View file

@ -233,7 +233,7 @@ static void R_MapTiltedPlane(drawspandata_t *ds, void(*spanfunc)(drawspandata_t*
{
ds->bgofs = R_CalculateRippleOffset(ds, y);
R_SetTiltedSpan(ds, std::clamp(y, 0, viewheight));
R_SetTiltedSpan(ds, std::clamp<INT32>(y, 0, viewheight));
R_CalculatePlaneRipple(ds, ds->currentplane->viewangle + ds->currentplane->plangle);
R_SetSlopePlaneVectors(ds, ds->currentplane, y, (ds->xoffs + ds->planeripple.xfrac), (ds->yoffs + ds->planeripple.yfrac));

View file

@ -215,7 +215,7 @@ static void R_RenderMaskedSegLoop(drawcolumndata_t* dc, drawseg_t *drawseg, INT3
ldef = curline->linedef;
tripwire = P_IsLineTripWire(ldef);
range = std::max(drawseg->x2-drawseg->x1, 1);
range = std::max<INT32>(drawseg->x2-drawseg->x1, 1);
// Setup lighting based on the presence/lack-of 3D floors.
dc->numlights = 0;
@ -874,7 +874,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
R_SetColumnFunc(COLDRAWFUNC_FOG, brightmapped);
}
range = std::max(ds->x2-ds->x1, 1);
range = std::max<INT32>(ds->x2-ds->x1, 1);
//SoM: Moved these up here so they are available for my lightlist calculations
rw_scalestep = ds->scalestep;
spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep;

View file

@ -1082,7 +1082,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
// Vertically sheared sprite
for (dc.x = vis->x1; dc.x <= vis->x2; dc.x++, frac += vis->xiscale, dc.texturemid -= vis->shear.tan)
{
texturecolumn = std::clamp(frac >> FRACBITS, 0, patch->width - 1);
texturecolumn = std::clamp<fixed_t>(frac >> FRACBITS, 0, patch->width - 1);
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
if (bmpatch)
@ -1119,7 +1119,7 @@ static void R_DrawVisSprite(vissprite_t *vis)
// Non-paper drawing loop
for (dc.x = vis->x1; dc.x <= vis->x2; dc.x++, frac += vis->xiscale, sprtopscreen += vis->shear.tan)
{
texturecolumn = std::clamp(frac >> FRACBITS, 0, patch->width - 1);
texturecolumn = std::clamp<fixed_t>(frac >> FRACBITS, 0, patch->width - 1);
column = (column_t *)((UINT8 *)patch->columns + (patch->columnofs[texturecolumn]));
@ -2373,7 +2373,7 @@ static void R_ProjectSprite(mobj_t *thing)
}
// Less change in contrast in dark sectors
extralight = FixedMul(extralight, std::min(std::max(0, lightnum), LIGHTLEVELS - 1) * FRACUNIT / (LIGHTLEVELS - 1));
extralight = FixedMul(extralight, std::min<INT32>(std::max<INT32>(0, lightnum), LIGHTLEVELS - 1) * FRACUNIT / (LIGHTLEVELS - 1));
if (papersprite)
{
@ -2385,7 +2385,7 @@ static void R_ProjectSprite(mobj_t *thing)
fixed_t n = FixedDiv(FixedMul(xscale, LIGHTRESOLUTIONFIX), ((MAXLIGHTSCALE-1) << LIGHTSCALESHIFT));
// Less change in contrast at further distances, to counteract DOOM diminished light
extralight = FixedMul(extralight, std::min(n, FRACUNIT));
extralight = FixedMul(extralight, std::min<fixed_t>(n, FRACUNIT));
// Contrast is stronger for normal sprites, stronger than wall lighting is at the same distance
lightnum += FixedFloor((extralight / 4) + (FRACUNIT / 2)) / FRACUNIT;
@ -2551,7 +2551,7 @@ static void R_ProjectSprite(mobj_t *thing)
lindex = FixedMul(xscale, LIGHTRESOLUTIONFIX)>>(LIGHTSCALESHIFT);
// Mitigate against negative xscale and arithmetic overflow
lindex = std::clamp(lindex, 0, MAXLIGHTSCALE - 1);
lindex = std::clamp<INT32>(lindex, 0, MAXLIGHTSCALE - 1);
if (vis->cut & SC_SEMIBRIGHT)
lindex = (MAXLIGHTSCALE/2) + (lindex >> 1);

View file

@ -1918,7 +1918,7 @@ void Gl2Rhi::finish()
// I sure hope creating FBOs isn't costly on the driver!
for (auto& fbset : framebuffers_)
{
gl_->DeleteFramebuffers(1, &fbset.second);
gl_->DeleteFramebuffers(1, (GLuint*)&fbset.second);
GL_ASSERT;
}
framebuffers_.clear();

View file

@ -171,7 +171,7 @@ static SDL_bool Impl_CreateWindow(SDL_bool fullscreen);
//static void Impl_SetWindowName(const char *title);
static void Impl_SetWindowIcon(void);
static void SDLSetMode(INT32 width, INT32 height, SDL_bool fullscreen, SDL_bool reposition)
static void SDLSetMode(int width, int height, SDL_bool fullscreen, SDL_bool reposition)
{
static SDL_bool wasfullscreen = SDL_FALSE;

View file

@ -1088,8 +1088,8 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
if (y < clip->top)
y = clip->top;
w = std::max(0, x2 - x);
h = std::max(0, y2 - y);
w = std::max<INT32>(0, x2 - x);
h = std::max<INT32>(0, y2 - y);
}
g_2d.begin_quad()
@ -2117,7 +2117,7 @@ void V_DrawTitleCardStringFixed(fixed_t x, fixed_t y, fixed_t scale, const char
// otherwise; scalex must start at 0
// let's have each letter do 4 spins (360*4 + 90 = 1530 "degrees")
fakeang = std::min(360 + 90, let_time*41) * ANG1;
fakeang = std::min<INT32>(360 + 90, let_time*41) * ANG1;
scalex = FINESINE(fakeang>>ANGLETOFINESHIFT);
}
else if (!bossmode && let_time > threshold)
@ -2125,7 +2125,7 @@ void V_DrawTitleCardStringFixed(fixed_t x, fixed_t y, fixed_t scale, const char
// Make letters disappear...
let_time -= threshold;
fakeang = std::max(0, (360+90) - let_time*41)*ANG1;
fakeang = std::max<INT32>(0, (360+90) - let_time*41)*ANG1;
scalex = FINESINE(fakeang>>ANGLETOFINESHIFT);
}
@ -2205,7 +2205,7 @@ static inline fixed_t BunchedCharacterDim(
(void)chw;
(void)hchw;
(void)dupx;
(*cwp) = FixedMul(std::max(1, (*cwp) - 1) << FRACBITS, scale);
(*cwp) = FixedMul(std::max<INT32>(1, (*cwp) - 1) << FRACBITS, scale);
return 0;
}
@ -2219,7 +2219,7 @@ static inline fixed_t MenuCharacterDim(
(void)chw;
(void)hchw;
(void)dupx;
(*cwp) = FixedMul(std::max(1, (*cwp) - 2) << FRACBITS, scale);
(*cwp) = FixedMul(std::max<INT32>(1, (*cwp) - 2) << FRACBITS, scale);
return 0;
}
@ -2233,7 +2233,7 @@ static inline fixed_t GamemodeCharacterDim(
(void)chw;
(void)hchw;
(void)dupx;
(*cwp) = FixedMul(std::max(1, (*cwp) - 2) << FRACBITS, scale);
(*cwp) = FixedMul(std::max<INT32>(1, (*cwp) - 2) << FRACBITS, scale);
return 0;
}
@ -2247,7 +2247,7 @@ static inline fixed_t FileCharacterDim(
(void)chw;
(void)hchw;
(void)dupx;
(*cwp) = FixedMul(std::max(1, (*cwp) - 3) << FRACBITS, scale);
(*cwp) = FixedMul(std::max<INT32>(1, (*cwp) - 3) << FRACBITS, scale);
return 0;
}
@ -2261,7 +2261,7 @@ static inline fixed_t LSTitleCharacterDim(
(void)chw;
(void)hchw;
(void)dupx;
(*cwp) = FixedMul(std::max(1, (*cwp) - 4) << FRACBITS, scale);
(*cwp) = FixedMul(std::max<INT32>(1, (*cwp) - 4) << FRACBITS, scale);
return 0;
}

View file

@ -952,7 +952,7 @@ void Y_RoundQueueDrawer(y_data_t *standings, INT32 offset, boolean doanimations,
SINT8 deferxoffs = 0;
const INT32 desiredx2 = (290 + bufferspace);
spacetospecial = std::max(desiredx2 - widthofroundqueue - (24 - bufferspace), 16);
spacetospecial = std::max<INT32>(desiredx2 - widthofroundqueue - (24 - bufferspace), 16);
if (roundqueue.position == roundqueue.size)
{
@ -2234,7 +2234,7 @@ void Y_StartIntermission(void)
else
{
// Minimum two seconds for match results, then two second slideover approx halfway through
sorttic = std::max((timer/2) - 2*TICRATE, 2*TICRATE);
sorttic = std::max<INT32>((timer/2) - 2*TICRATE, 2*TICRATE);
}
// TODO: code's a mess, I'm just making it extra clear

View file

@ -1770,7 +1770,7 @@ class Segment {
// accounted for.
// index - index in the list of Cues which is currently being adjusted.
// cue_size - sum of size of all the CuePoint elements.
void MoveCuesBeforeClustersHelper(uint64_t diff, int index,
void MoveCuesBeforeClustersHelper(uint64_t diff, int32_t index,
uint64_t* cue_size);
// Seeds the random number generator used to make UIDs.

View file

@ -8,14 +8,15 @@
#ifndef MKVMUXER_MKVMUXERTYPES_H_
#define MKVMUXER_MKVMUXERTYPES_H_
#include <stdint.h>
namespace mkvmuxer {
typedef unsigned char uint8;
typedef short int16;
typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
} // namespace mkvmuxer
// Copied from Chromium basictypes.h