- Game time is now frozen during screen wipes. This obsoletes the DEM_WIPEON

and DEM_WIPEOFF commands. Fixes multimap demos desyncing when played back
  or recorded with wipes enabled, and prevents multiplayer games from
  starting until all players' wipes have finished.


SVN r1272 (trunk)
This commit is contained in:
Randy Heit 2008-10-21 02:27:21 +00:00
commit 30ef6a0c2d
11 changed files with 98 additions and 35 deletions

View file

@ -87,6 +87,7 @@ DWORD LanguageIDs[4] =
int (*I_GetTime) (bool saveMS);
int (*I_WaitForTic) (int);
void (*I_FreezTime) (bool frozen);
void I_Tactile (int on, int off, int total)
{
@ -116,6 +117,7 @@ unsigned int I_MSTime (void)
static DWORD TicStart;
static DWORD TicNext;
static int TicFrozen;
//
// I_GetTime
@ -123,6 +125,11 @@ static DWORD TicNext;
//
int I_GetTimePolled (bool saveMS)
{
if (TicFrozen != 0)
{
return TicFrozen;
}
DWORD tm = SDL_GetTicks ();
if (saveMS)
@ -137,12 +144,30 @@ int I_WaitForTicPolled (int prevtic)
{
int time;
assert (TicFrozen == 0);
while ((time = I_GetTimePolled(false)) <= prevtic)
;
return time;
}
void I_FreezeTimePolled (bool frozen)
{
if (frozen)
{
assert(TicFrozen == 0);
TicFrozen = I_GetTimePolled(false);
}
else
{
assert(TicFrozen != 0);
int froze = TicFrozen;
TicFrozen = 0;
int now = I_GetTimePolled(false);
basetime += (now - froze) * 1000 / TICRATE;
}
}
// Returns the fractional amount of a tic passed since the most recent tic
fixed_t I_GetTimeFrac (uint32 *ms)
{
@ -184,6 +209,7 @@ void I_Init (void)
I_GetTime = I_GetTimePolled;
I_WaitForTic = I_WaitForTicPolled;
I_FreezeTime = I_FreezeTimePolled;
atterm (I_ShutdownSound);
I_InitSound ();
}