From 56e8f09ae8335327cf6a8c7484ead411a09c84f9 Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Mon, 4 Mar 2019 16:33:06 -0500 Subject: [PATCH] fixed compiling for MSVC 2017 --- src/hardware/r_opengl/r_opengl.c | 4 ++-- src/k_kart.c | 3 ++- src/p_user.c | 2 +- src/r_things.c | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 3a8be6a0..0c4dfdce 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2056,7 +2056,7 @@ EXPORT void HWRAPI(DrawMD2) (INT32 *gl_cmd_buffer, md2_frame_t *frame, FTransfor EXPORT void HWRAPI(SetTransform) (FTransform *stransform) { static boolean special_splitscreen; - float used_fov; + double used_fov; pglLoadIdentity(); if (stransform) { @@ -2088,7 +2088,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform) pglLoadIdentity(); if (special_splitscreen) { - used_fov = atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI; + used_fov = atan(tan(used_fov*M_PIl/360)*0.8)*360/M_PIl; GLPerspective(used_fov, 2*ASPECT_RATIO); } else diff --git a/src/k_kart.c b/src/k_kart.c index 8e607191..f5fe06bc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1191,10 +1191,11 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) return; { // Normalize distance to the sum of the two objects' radii, since in a perfect world that would be the distance at the point of collision... - fixed_t dist = P_AproxDistance(distx, disty) ?: 1; + fixed_t dist = P_AproxDistance(distx, disty); fixed_t nx = FixedDiv(distx, dist); fixed_t ny = FixedDiv(disty, dist); + dist = dist ? dist : 1; distx = FixedMul(mobj1->radius+mobj2->radius, nx); disty = FixedMul(mobj1->radius+mobj2->radius, ny); diff --git a/src/p_user.c b/src/p_user.c index e26acdfd..7350b921 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6662,7 +6662,7 @@ static void P_MovePlayer(player_t *player) //CONS_Printf("leftover turn (%s): %5d or %4d%%\n", // player_names[player-players], // (INT16) (cmd->angleturn - (player->mo->angle>>16)), - // (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ?: 1)); + // (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1)); } } diff --git a/src/r_things.c b/src/r_things.c index e4eaf413..59a904cb 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1314,7 +1314,8 @@ static void R_ProjectSprite(mobj_t *thing) if (max(tz, tz2) < FixedMul(MINZ, this_scale)) // non-papersprite clipping is handled earlier return; - scalestep = (yscale2 - yscale)/(x2 - x1) ?: 1; + scalestep = (yscale2 - yscale)/(x2 - x1); + scalestep = scalestep ? scalestep : 1; // The following two are alternate sorting methods which might be more applicable in some circumstances. TODO - maybe enable via MF2? // sortscale = max(yscale, yscale2);