diff --git a/src/posix/cocoa/i_timer.cpp b/src/posix/cocoa/i_timer.cpp index b08a43139d..901657eb95 100644 --- a/src/posix/cocoa/i_timer.cpp +++ b/src/posix/cocoa/i_timer.cpp @@ -186,7 +186,7 @@ unsigned int I_FPSTime() } -fixed_t I_GetTimeFrac(uint32* ms) +double I_GetTimeFrac(uint32* ms) { const uint32_t now = I_MSTime(); @@ -196,8 +196,8 @@ fixed_t I_GetTimeFrac(uint32* ms) } return 0 == s_ticStart - ? FRACUNIT - : clamp( (now - s_ticStart) * FRACUNIT * TICRATE / 1000, 0, FRACUNIT); + ? 1. + : clamp( (now - s_ticStart) * TICRATE / 1000., 0, 1); } diff --git a/src/posix/i_system.h b/src/posix/i_system.h index 3915036028..0515f2d857 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -62,7 +62,7 @@ extern int (*I_WaitForTic) (int); // tic will never arrive (unless it's the current one). extern void (*I_FreezeTime) (bool frozen); -fixed_t I_GetTimeFrac (uint32 *ms); +double I_GetTimeFrac (uint32 *ms); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed(); diff --git a/src/posix/sdl/i_timer.cpp b/src/posix/sdl/i_timer.cpp index 6255c8a96c..fa08659a10 100644 --- a/src/posix/sdl/i_timer.cpp +++ b/src/posix/sdl/i_timer.cpp @@ -178,7 +178,7 @@ void I_SelectTimer() } // Returns the fractional amount of a tic passed since the most recent tic -fixed_t I_GetTimeFrac (uint32 *ms) +double I_GetTimeFrac (uint32 *ms) { DWORD now = SDL_GetTicks (); if (ms) *ms = TicStart + (1000 / TICRATE); @@ -188,8 +188,7 @@ fixed_t I_GetTimeFrac (uint32 *ms) } else { - fixed_t frac = clamp ((now - TicStart)*FRACUNIT*TICRATE/1000, 0, FRACUNIT); - return frac; + return clamp((now - TicStart) * TICRATE / 1000., 0, 1); } } diff --git a/src/r_utility.cpp b/src/r_utility.cpp index c3229c14cc..224648770b 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -1006,12 +1006,12 @@ void R_SetupFrame (AActor *actor) iview->otic = nowtic; } - r_TicFrac = I_GetTimeFrac (&r_FrameTime); + r_TicFracF = I_GetTimeFrac (&r_FrameTime); if (cl_capfps || r_NoInterpolate) { - r_TicFrac = FRACUNIT; + r_TicFracF = 1.; } - r_TicFracF = FIXED2DBL(r_TicFrac); + r_TicFrac = FLOAT2FIXED(r_TicFracF); R_InterpolateView (player, r_TicFrac, iview); diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 0db4dd15e5..ebf90e476d 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -468,7 +468,7 @@ static void CALLBACK TimerTicked(UINT id, UINT msg, DWORD_PTR user, DWORD_PTR dw // //========================================================================== -fixed_t I_GetTimeFrac(uint32 *ms) +double I_GetTimeFrac(uint32 *ms) { DWORD now = timeGetTime(); if (ms != NULL) @@ -478,12 +478,11 @@ fixed_t I_GetTimeFrac(uint32 *ms) DWORD step = TicNext - TicStart; if (step == 0) { - return FRACUNIT; + return 1.; } else { - fixed_t frac = clamp ((now - TicStart)*FRACUNIT/step, 0, FRACUNIT); - return frac; + return clamp(double(now - TicStart) / step, 0, 1); } } diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 179af48046..8e75b22a3f 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -90,7 +90,7 @@ extern int (*I_WaitForTic) (int); // tic will never arrive (unless it's the current one). extern void (*I_FreezeTime) (bool frozen); -fixed_t I_GetTimeFrac (uint32 *ms); +double I_GetTimeFrac (uint32 *ms); // Return a seed value for the RNG. unsigned int I_MakeRNGSeed();