Created
February 10, 2016 10:55
-
-
Save anonymous/86f8d963dad4fb213a44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/sdl/i_system.cpp.orig 2016-02-10 03:55:38.747944750 -0600 | |
+++ src/sdl/i_system.cpp 2016-02-10 03:58:18.228957592 -0600 | |
@@ -137,14 +137,13 @@ | |
static DWORD TicStart; | |
-static DWORD TicNext; | |
static DWORD BaseTime; | |
static int TicFrozen; | |
// Signal based timer. | |
static Semaphore timerWait; | |
static int tics; | |
-static DWORD sig_start, sig_next; | |
+static DWORD sig_start; | |
void I_SelectTimer(); | |
@@ -183,7 +182,6 @@ | |
if (saveMS) | |
{ | |
TicStart = tm; | |
- TicNext = Scale((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE); | |
} | |
return Scale(tm - BaseTime, TICRATE, 1000); | |
} | |
@@ -193,7 +191,6 @@ | |
if (saveMS) | |
{ | |
TicStart = sig_start; | |
- TicNext = sig_next; | |
} | |
return tics; | |
} | |
@@ -264,7 +261,6 @@ | |
if(!TicFrozen) | |
tics++; | |
sig_start = SDL_GetTicks(); | |
- sig_next = Scale((Scale (sig_start, TICRATE, 1000) + 1), 1000, TICRATE); | |
SEMAPHORE_SIGNAL(timerWait) | |
} | |
@@ -308,15 +304,14 @@ | |
fixed_t I_GetTimeFrac (uint32 *ms) | |
{ | |
DWORD now = SDL_GetTicks (); | |
- if (ms) *ms = TicNext; | |
- DWORD step = TicNext - TicStart; | |
- if (step == 0) | |
+ if (ms) *ms = TicStart + (1000 / TICRATE); | |
+ if (TicStart == 0) | |
{ | |
return FRACUNIT; | |
} | |
else | |
{ | |
- fixed_t frac = clamp<fixed_t> ((now - TicStart)*FRACUNIT/step, 0, FRACUNIT); | |
+ fixed_t frac = clamp<fixed_t> ((now - TicStart)*FRACUNIT*TICRATE/1000, 0, FRACUNIT); | |
return frac; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment