From df2b3b6b175ae0a5dd24426a8c612820898d7da0 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 5 Jul 2020 11:32:45 +0300 Subject: [PATCH 1/3] - made mouse scaling in Cocoa backend match other platforms --- source/common/platform/posix/cocoa/i_input.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/common/platform/posix/cocoa/i_input.mm b/source/common/platform/posix/cocoa/i_input.mm index 3b562bcb8..9c09cbced 100644 --- a/source/common/platform/posix/cocoa/i_input.mm +++ b/source/common/platform/posix/cocoa/i_input.mm @@ -497,8 +497,7 @@ void ProcessMouseMoveInGame(NSEvent* theEvent) if (!m_noprescale) { - x *= 3; - y *= 2; + x <<= 2; } event_t event = {}; From 893686709b2ca5c761b5ecaa2ff8629993cb7c84 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Jul 2020 12:32:59 +0200 Subject: [PATCH 2/3] - removed the redundant rfreq factor from CalcSmoothRatio. I never realized it was redundant when consolidating the interpolation math into one function - originally this was done in a way that it wasn't obvious. This also eliminates the dependency on refreshFreq which never actually made any sense. --- source/core/gamecontrol.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index c484cac01..b49be0006 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1022,10 +1022,9 @@ int CalcSmoothRatio(const ClockTicks &totalclk, const ClockTicks &ototalclk, int { const double TICRATE = 120.; - double rfreq = refreshfreq * TICRATE / timerGetClockRate(); double elapsedTime = (totalclk - ototalclk).toScale16F(); - double elapsedFrames = elapsedTime * rfreq * (1. / TICRATE); - double ratio = (elapsedFrames * realgameticspersec) / rfreq; + double elapsedFrames = elapsedTime * (1. / TICRATE); + double ratio = (elapsedFrames * realgameticspersec); return clamp(xs_RoundToInt(ratio * 65536), 0, 65536); } From 9caf1ead910805384194fcea5791002aa171711f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 14 Jul 2020 12:48:56 +0200 Subject: [PATCH 3/3] - use the common interpolation function for Blood. This keeps the main calculation for time difference in one place. --- source/blood/src/view.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 8a397d1a6..1a98a9b8b 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -3094,12 +3094,10 @@ void viewDrawScreen(bool sceneonly) lastUpdate = totalclock; if (!paused && (!M_Active() || gGameOptions.nGameType != 0)) { - gInterpolate = ((totalclock-gNetFifoClock)+4).toScale16()/4; - } - if (gInterpolate < 0 || gInterpolate > 65536) - { - gInterpolate = ClipRange(gInterpolate, 0, 65536); + gInterpolate = CalcSmoothRatio(totalclock, gNetFifoClock - 4, 30); } + else gInterpolate = 65536; + if (cl_interpolate) { CalcInterpolations();