Advertisement
Guest User

Untitled

a guest
Sep 14th, 2014
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.51 KB | None | 0 0
  1. --- src/sdl/i_system.cpp    2014-09-07 14:15:44.000000000 +0000
  2. +++ src/sdl/i_system.cpp.new    2014-09-14 20:56:40.003386878 +0000
  3. @@ -123,14 +123,13 @@ void I_EndRead(void)
  4.  
  5.  
  6.  static DWORD TicStart;
  7. -static DWORD TicNext;
  8.  static DWORD BaseTime;
  9.  static int TicFrozen;
  10.  
  11.  // Signal based timer.
  12.  static Semaphore timerWait;
  13.  static int tics;
  14. -static DWORD sig_start, sig_next;
  15. +static DWORD sig_start;
  16.  
  17.  void I_SelectTimer();
  18.  
  19. @@ -169,7 +168,6 @@ int I_GetTimePolled (bool saveMS)
  20.     if (saveMS)
  21.     {
  22.         TicStart = tm;
  23. -       TicNext = Scale((Scale (tm, TICRATE, 1000) + 1), 1000, TICRATE);
  24.     }
  25.     return Scale(tm - BaseTime, TICRATE, 1000);
  26.  }
  27. @@ -179,7 +177,6 @@ int I_GetTimeSignaled (bool saveMS)
  28.     if (saveMS)
  29.     {
  30.         TicStart = sig_start;
  31. -       TicNext = sig_next;
  32.     }
  33.     return tics;
  34.  }
  35. @@ -250,7 +247,6 @@ void I_HandleAlarm (int sig)
  36.     if(!TicFrozen)
  37.         tics++;
  38.     sig_start = SDL_GetTicks();
  39. -   sig_next = Scale((Scale (sig_start, TICRATE, 1000) + 1), 1000, TICRATE);
  40.     SEMAPHORE_SIGNAL(timerWait)
  41.  }
  42.  
  43. @@ -293,15 +289,14 @@ void I_SelectTimer()
  44.  fixed_t I_GetTimeFrac (uint32 *ms)
  45.  {
  46.     DWORD now = SDL_GetTicks ();
  47. -   if (ms) *ms = TicNext;
  48. -   DWORD step = TicNext - TicStart;
  49. -   if (step == 0)
  50. +   if (ms) *ms = TicStart + (1000 / TICRATE);
  51. +   if (TicStart == 0)
  52.     {
  53.         return FRACUNIT;
  54.     }
  55.     else
  56.     {
  57. -       fixed_t frac = clamp<fixed_t> ((now - TicStart)*FRACUNIT/step, 0, FRACUNIT);
  58. +       fixed_t frac = clamp<fixed_t> ((now - TicStart)*FRACUNIT*TICRATE/1000, 0, FRACUNIT);
  59.         return frac;
  60.     }
  61.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement