From ef728429e06b31e023e78afb48496854d451080e Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 26 Aug 2020 09:47:38 +1000 Subject: [PATCH] - Core: Remove legacy smoothratio calculator `CalcSmoothRatio()`. --- source/core/gamecontrol.cpp | 49 --------------------------------- source/core/gamecontrol.h | 1 - source/core/gamecvars.cpp | 2 -- source/core/gamecvars.h | 2 -- source/games/duke/src/inlines.h | 6 ---- 5 files changed, 60 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 45019411e..85731f809 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -97,9 +97,6 @@ int myconnectindex, numplayers; int connecthead, connectpoint2[MAXMULTIPLAYERS]; int32_t xres = -1, yres = -1, bpp = 0; auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. -static int lastototalclk; -static uint64_t elapsedTime; -static uint64_t lastTime; int gameclock; int lastTic; @@ -1127,52 +1124,6 @@ void S_SetSoundPaused(int state) } } -double CalcSmoothRatio(int totalclk, int ototalclk, int realgameticspersec) -{ - double ratio, result; - - if (cl_debugintrpl) - { - Printf("ototalclk: %d\ntotalclk: %d\n", ototalclk, totalclk); - } - - if (!cl_legacyintrpl) - { - double const gametics = 1'000'000'000. / realgameticspersec; - uint64_t currentTime = I_GetTimeNS(); - - if ((lastototalclk == ototalclk) && (lastTime != 0)) - { - elapsedTime += currentTime - lastTime; - } - else - { - lastototalclk = ototalclk; - elapsedTime = lastTime != 0 ? (currentTime - lastTime) / 72 : 0; - } - lastTime = currentTime; - ratio = elapsedTime / gametics; - - if (cl_debugintrpl) - { - Printf("gametics: %.3f ms\nelapsedTime: %.3f ms\n", (gametics / 1'000'000.), (elapsedTime / 1'000'000.)); - } - } - else - { - ratio = (0.5 + (totalclk - ototalclk)) / (120 / realgameticspersec); - } - - result = clamp2(ratio * MaxSmoothRatio, 0., MaxSmoothRatio); - - if (cl_debugintrpl) - { - Printf("ratio: %f\nresult: %f\n", ratio, result); - } - - return result; -} - FString G_GetDemoPath() { FString path = M_GetDemoPath(); diff --git a/source/core/gamecontrol.h b/source/core/gamecontrol.h index 6a81622af..fa5628fb9 100644 --- a/source/core/gamecontrol.h +++ b/source/core/gamecontrol.h @@ -192,7 +192,6 @@ void S_ResumeSound(bool notsfx); void S_SetSoundPaused(int state); void G_FatalEngineError(void); -double CalcSmoothRatio(int totalclk, int ototalclk, int realgameticspersec); enum { MaxSmoothRatio = FRACUNIT diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 663b9b677..80080d1d5 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -91,8 +91,6 @@ CVARD(Bool, cl_slopetilting, false, CVAR_ARCHIVE, "enable/disable slope tilting" CVARD(Int, cl_showweapon, 1, CVAR_ARCHIVE, "enable/disable show weapons") // only implemented in Blood CVARD(Bool, cl_sointerpolation, true, CVAR_ARCHIVE, "enable/disable sector object interpolation") // only implemented in SW CVARD(Bool, cl_syncinput, false, CVAR_ARCHIVE, "enable/disable synchronized input with game's ticrate") // only implemented in SW -CVARD(Bool, cl_debugintrpl, false, CVAR_NOSAVE, "print information regarding calculated smoothratio for interpolation") -CVARD(Bool, cl_legacyintrpl, false, CVAR_ARCHIVE, "perform legacy interpolation calculations") CUSTOM_CVARD(Int, cl_crosshairscale, 50, CVAR_ARCHIVE, "changes the size of the crosshair") { if (self < 1) self = 1; diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index 21e4e6fa4..dd7c823f7 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -25,8 +25,6 @@ EXTERN_CVAR(Int, cl_weaponswitch) EXTERN_CVAR(Int, cl_crosshairscale) EXTERN_CVAR(Bool, cl_sointerpolation) EXTERN_CVAR(Bool, cl_syncinput) -EXTERN_CVAR(Bool, cl_debugintrpl) -EXTERN_CVAR(Bool, cl_legacyintrpl) EXTERN_CVAR(Bool, demorec_seeds_cvar) EXTERN_CVAR(Bool, demoplay_diffs) diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index df7fb13c1..76de0f1b2 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -169,12 +169,6 @@ inline bool playrunning() return (paused == 0 || (paused == 1 && (ud.recstat == 2 || ud.multimode > 1))); } -inline double calc_smoothratio(int totalclk, int ototalclk) -{ - double smoothratio = CalcSmoothRatio(totalclk, ototalclk, REALGAMETICSPERSEC); - return (playrunning() ? smoothratio : MaxSmoothRatio); -} - inline void backupplayer(player_struct* p) { backuppos(p);