Merge branch 'master' of https://github.com/rheit/zdoom into z_osx_clean

This commit is contained in:
alexey.lysiuk 2014-09-20 11:54:21 +03:00
commit 0f602fb1ce
7 changed files with 66 additions and 11 deletions

View file

@ -14,14 +14,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();
@ -60,7 +59,6 @@ int I_GetTimePolled (bool saveMS)
if (saveMS)
{
TicStart = tm;
TicNext = Scale((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE);
}
return Scale(tm - BaseTime, TICRATE, 1000);
}
@ -70,7 +68,6 @@ int I_GetTimeSignaled (bool saveMS)
if (saveMS)
{
TicStart = sig_start;
TicNext = sig_next;
}
return tics;
}
@ -141,7 +138,6 @@ void I_HandleAlarm (int sig)
if(!TicFrozen)
tics++;
sig_start = SDL_GetTicks();
sig_next = Scale((Scale (sig_start, TICRATE, 1000) + 1), 1000, TICRATE);
SEMAPHORE_SIGNAL(timerWait)
}
@ -184,15 +180,14 @@ void I_SelectTimer()
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;
}
}