From cfacbd91be0e8326f440ba2982c63200fbf03680 Mon Sep 17 00:00:00 2001 From: bitten2up <575-bitten2up@users.noreply.git.do.srb2.org> Date: Fri, 3 May 2024 17:53:53 +0000 Subject: [PATCH] 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 --- src/acs/call-funcs.cpp | 2 +- src/g_build_ticcmd.cpp | 12 ++++++------ src/g_demo.cpp | 1 + src/hardware/hw_md2.c | 2 +- src/k_credits.cpp | 4 ++-- src/k_dialogue.cpp | 4 ++-- src/k_director.cpp | 4 ++-- src/k_endcam.cpp | 2 +- src/k_hud.cpp | 14 +++++++------- src/k_hud_track.cpp | 8 ++++---- src/k_tally.cpp | 16 ++++++++-------- src/k_waypoint.cpp | 4 ++-- src/m_misc.cpp | 4 ++-- src/menus/transient/pause-addonoptions.cpp | 4 ++-- src/menus/transient/pause-cheats.cpp | 2 +- src/objects/checkpoint.cpp | 4 ++-- src/objects/destroyed-kart.cpp | 2 +- src/objects/gachabom-rebound.cpp | 4 ++-- src/objects/powerup-spinner.cpp | 2 +- src/objects/pulley.cpp | 2 +- src/p_setup.cpp | 10 +++++----- src/r_debug.cpp | 4 ++-- src/r_plane.cpp | 2 +- src/r_segs.cpp | 4 ++-- src/r_things.cpp | 10 +++++----- src/rhi/gl2/gl2_rhi.cpp | 2 +- src/sdl/i_video.cpp | 2 +- src/v_video.cpp | 18 +++++++++--------- src/y_inter.cpp | 4 ++-- thirdparty/libwebm/mkvmuxer/mkvmuxer.h | 2 +- thirdparty/libwebm/mkvmuxer/mkvmuxertypes.h | 9 +++++---- 31 files changed, 83 insertions(+), 81 deletions(-) diff --git a/src/acs/call-funcs.cpp b/src/acs/call-funcs.cpp index 196c31d01..3283bb865 100644 --- a/src/acs/call-funcs.cpp +++ b/src/acs/call-funcs.cpp @@ -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(alpha, 0, FRACUNIT); TAG_ITER_LINES(tag, lineId) { diff --git a/src/g_build_ticcmd.cpp b/src/g_build_ticcmd.cpp index 72655ada4..b74f48d2d 100644 --- a/src/g_build_ticcmd.cpp +++ b/src/g_build_ticcmd.cpp @@ -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(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(joystickvector.xaxis, JOYAXISRANGE); + joystickvector.xaxis = std::max(joystickvector.xaxis, -JOYAXISRANGE); + joystickvector.yaxis = std::min(joystickvector.yaxis, JOYAXISRANGE); + joystickvector.yaxis = std::max(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: diff --git a/src/g_demo.cpp b/src/g_demo.cpp index f11e6e214..4fc8642ec 100644 --- a/src/g_demo.cpp +++ b/src/g_demo.cpp @@ -19,6 +19,7 @@ #include #include "doomdef.h" +#include "doomtype.h" #include "console.h" #include "d_main.h" #include "d_player.h" diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 08a4e28cc..c6c25cb10 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -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]; diff --git a/src/k_credits.cpp b/src/k_credits.cpp index 36c364d1d..ad316c37e 100644 --- a/src/k_credits.cpp +++ b/src/k_credits.cpp @@ -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(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(g_credits.transition + (FRACUNIT / TICRATE), FRACUNIT); if (g_credits.split_slide_id < g_credits.split_slide_strings.size()) { diff --git a/src/k_dialogue.cpp b/src/k_dialogue.cpp index 61bd6982a..74abfa72e 100644 --- a/src/k_dialogue.cpp +++ b/src/k_dialogue.cpp @@ -307,7 +307,7 @@ void Dialogue::Tick(void) } } - slide = std::clamp(slide, 0, FRACUNIT); + slide = std::clamp(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); diff --git a/src/k_director.cpp b/src/k_director.cpp index b3881256f..00035f023 100644 --- a/src/k_director.cpp +++ b/src/k_director.cpp @@ -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(BOREDOMTIME * 2, playerstat[position].boredom + 1); } else if (playerstat[position].boredom > 0) { diff --git a/src/k_endcam.cpp b/src/k_endcam.cpp index 6bb26672c..378e00cc0 100644 --- a/src/k_endcam.cpp +++ b/src/k_endcam.cpp @@ -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(d, 1u); } fixed_t interval(tic_t t, tic_t s, tic_t d) diff --git a/src/k_hud.cpp b/src/k_hud.cpp index c4853b4db..f1f91cc4c 100644 --- a/src/k_hud.cpp +++ b/src/k_hud.cpp @@ -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(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((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(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(stplyr->tally.transition * 2, FRACUNIT), 0, kSlideDown); + return static_cast(Easing_OutQuad(std::min(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(52-1u, (3*TICRATE)-mapreset); V_DrawFadeScreen(0xFF00, 16); // Fade out V_DrawScaledPatch(0, 0, 0, kp_challenger[anim[offset]]); diff --git a/src/k_hud_track.cpp b/src/k_hud_track.cpp index 31fbe2d5d..4dd89cfcc 100644 --- a/src/k_hud_track.cpp +++ b/src/k_hud_track.cpp @@ -752,10 +752,10 @@ void K_CullTargetList(std::vector& 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(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); bool allMine = true; diff --git a/src/k_tally.cpp b/src/k_tally.cpp index 2f32ca16a..ee9b0373d 100644 --- a/src/k_tally.cpp +++ b/src/k_tally.cpp @@ -303,7 +303,7 @@ void level_tally_t::Init(player_t *player) : (tutorialchallenge == TUTORIALSKIP_INPROGRESS && K_IsPlayerLosing(player)) ); - time = std::min(static_cast(player->realtime), (100 * 60 * TICRATE) - 1); + time = std::min(static_cast(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(-players[i].roundscore)); + pointLimit = std::min(pointLimit, static_cast(-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(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) diff --git a/src/k_waypoint.cpp b/src/k_waypoint.cpp index 95eed059c..88d54ae0c 100644 --- a/src/k_waypoint.cpp +++ b/src/k_waypoint.cpp @@ -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(1, dist_factor)); + radius_factor = FixedDiv(FRACUNIT, std::max(1, radius_factor)); } else { diff --git a/src/m_misc.cpp b/src/m_misc.cpp index bbb4a3167..d6788a729 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -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(st_palette,0)*256)+j] + : pMasterPalette[(std::max(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; diff --git a/src/menus/transient/pause-addonoptions.cpp b/src/menus/transient/pause-addonoptions.cpp index 01cff6a2e..42e238234 100644 --- a/src/menus/transient/pause-addonoptions.cpp +++ b/src/menus/transient/pause-addonoptions.cpp @@ -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(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]); + currentMenu->y = std::min(static_cast(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]); V_SetClipRect(0, draw.y() * FRACUNIT, BASEVIDWIDTH * FRACUNIT, (BASEVIDHEIGHT - draw.y() - kMargin) * FRACUNIT, 0); M_DrawGenericMenu(); diff --git a/src/menus/transient/pause-cheats.cpp b/src/menus/transient/pause-cheats.cpp index 00cca24e0..bbd9a4d8b 100644 --- a/src/menus/transient/pause-cheats.cpp +++ b/src/menus/transient/pause-cheats.cpp @@ -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(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]); + currentMenu->y = std::min(static_cast(draw.y()), (BASEVIDHEIGHT/2) - g_menu_offsets[itemOn]); V_SetClipRect(0, draw.y() * FRACUNIT, BASEVIDWIDTH * FRACUNIT, (BASEVIDHEIGHT - draw.y() - kMargin) * FRACUNIT, 0); M_DrawGenericMenu(); diff --git a/src/objects/checkpoint.cpp b/src/objects/checkpoint.cpp index 512046398..7269e5b79 100644 --- a/src/objects/checkpoint.cpp +++ b/src/objects/checkpoint.cpp @@ -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(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(z_momentum, 1)); p->destscale = 0; p->scalespeed = p->scale / 35; p->color = SKINCOLOR_ULTRAMARINE; diff --git a/src/objects/destroyed-kart.cpp b/src/objects/destroyed-kart.cpp index e027c1cf0..b029d8304 100644 --- a/src/objects/destroyed-kart.cpp +++ b/src/objects/destroyed-kart.cpp @@ -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(1, Easing_OutCubic(f, 8, 1))) == 0) { vfx(f); } diff --git a/src/objects/gachabom-rebound.cpp b/src/objects/gachabom-rebound.cpp index f8fa3fb83..f278aa58e 100644 --- a/src/objects/gachabom-rebound.cpp +++ b/src/objects/gachabom-rebound.cpp @@ -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(t, 1u); if (newSpeed > mobj->scalespeed) { diff --git a/src/objects/powerup-spinner.cpp b/src/objects/powerup-spinner.cpp index f77254d11..100c1bf27 100644 --- a/src/objects/powerup-spinner.cpp +++ b/src/objects/powerup-spinner.cpp @@ -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(fuse, 0, duration()) * FRACUNIT / std::max(duration(), 1); if (fuse == duration() - 20) { diff --git a/src/objects/pulley.cpp b/src/objects/pulley.cpp index 3963a6f71..16fcb4b72 100644 --- a/src/objects/pulley.cpp +++ b/src/objects/pulley.cpp @@ -246,7 +246,7 @@ private: return; rope()->z = hook()->top(); - rope()->spriteyscale(Fixed {std::max(0, z - hook()->top())} / std::max(1, 32 * rope()->scale())); + rope()->spriteyscale(Fixed {std::max(0, z - hook()->top())} / std::max(1, 32 * rope()->scale())); } }; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 058f4a792..b68a5670a 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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(std::min(sides[ld->sidenum[0]].textureoffset >> FRACBITS, 25), -25); + INT16 fadealpha = std::max(std::min(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(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(std::min(sides[lines[i].sidenum[1]].rowoffset >> FRACBITS, 255), 0) + : std::max(std::min(sides[lines[i].sidenum[0]].rowoffset >> FRACBITS, 255), 0)); } else { diff --git a/src/r_debug.cpp b/src/r_debug.cpp index b7c7cdbb9..7dc8b2c2b 100644 --- a/src/r_debug.cpp +++ b/src/r_debug.cpp @@ -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((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((light * FRACUNIT) - adjust, 0, kRange); } return light / FRACUNIT; diff --git a/src/r_plane.cpp b/src/r_plane.cpp index decda706a..90f263126 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -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(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)); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 2455a5ab1..65a68c7b3 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -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(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(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; diff --git a/src/r_things.cpp b/src/r_things.cpp index e2590dcec..60bb2be45 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -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(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(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(std::max(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(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(lindex, 0, MAXLIGHTSCALE - 1); if (vis->cut & SC_SEMIBRIGHT) lindex = (MAXLIGHTSCALE/2) + (lindex >> 1); diff --git a/src/rhi/gl2/gl2_rhi.cpp b/src/rhi/gl2/gl2_rhi.cpp index 6d9024358..4c209aeb8 100644 --- a/src/rhi/gl2/gl2_rhi.cpp +++ b/src/rhi/gl2/gl2_rhi.cpp @@ -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(); diff --git a/src/sdl/i_video.cpp b/src/sdl/i_video.cpp index 3786b92d3..065ee3958 100644 --- a/src/sdl/i_video.cpp +++ b/src/sdl/i_video.cpp @@ -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; diff --git a/src/v_video.cpp b/src/v_video.cpp index dfab8889e..00db53b0d 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -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(0, x2 - x); + h = std::max(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(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(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(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(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(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(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(1, (*cwp) - 4) << FRACBITS, scale); return 0; } diff --git a/src/y_inter.cpp b/src/y_inter.cpp index 9f2372180..977374dca 100644 --- a/src/y_inter.cpp +++ b/src/y_inter.cpp @@ -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(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((timer/2) - 2*TICRATE, 2*TICRATE); } // TODO: code's a mess, I'm just making it extra clear diff --git a/thirdparty/libwebm/mkvmuxer/mkvmuxer.h b/thirdparty/libwebm/mkvmuxer/mkvmuxer.h index 2c4bb9e93..6400f6de0 100644 --- a/thirdparty/libwebm/mkvmuxer/mkvmuxer.h +++ b/thirdparty/libwebm/mkvmuxer/mkvmuxer.h @@ -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. diff --git a/thirdparty/libwebm/mkvmuxer/mkvmuxertypes.h b/thirdparty/libwebm/mkvmuxer/mkvmuxertypes.h index e5db12160..bc91ff139 100644 --- a/thirdparty/libwebm/mkvmuxer/mkvmuxertypes.h +++ b/thirdparty/libwebm/mkvmuxer/mkvmuxertypes.h @@ -8,14 +8,15 @@ #ifndef MKVMUXER_MKVMUXERTYPES_H_ #define MKVMUXER_MKVMUXERTYPES_H_ +#include 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