core/sourcemod.cpp
changeset 1407 bb6516a50eea
parent 1380 eeb8d3b56155
child 1411 a6e52857a881
     1.1 --- a/core/sourcemod.cpp	Tue Sep 11 15:10:18 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Tue Sep 11 18:02:59 2007 +0000
     1.3 @@ -71,8 +71,6 @@
     1.4  IForward *g_pOnGameFrame = NULL;
     1.5  IForward *g_pOnMapEnd = NULL;
     1.6  bool g_Loaded = false;
     1.7 -int g_StillFrames = 0;
     1.8 -float g_StillTime = 0.0f;
     1.9  IExtension *g_pGameExt = NULL;
    1.10  
    1.11  typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *);
    1.12 @@ -335,10 +333,6 @@
    1.13  	g_LastTime = 0.0f;
    1.14  	g_LastMenuTime = 0.0f;
    1.15  	g_LastAuthCheck = 0.0f;
    1.16 -	g_SimTicks.ticking = true;
    1.17 -	g_SimTicks.tickcount = 0;
    1.18 -	g_StillTime = 0.0f;
    1.19 -	g_StillFrames = 0;
    1.20  
    1.21  	/* Notify! */
    1.22  	SMGlobalClass *pBase = SMGlobalClass::head;
    1.23 @@ -375,27 +369,6 @@
    1.24  	RETURN_META_VALUE(MRES_IGNORED, true);
    1.25  }
    1.26  
    1.27 -void StartTickSimulation()
    1.28 -{
    1.29 -	g_SimTicks.ticking = false;
    1.30 -	g_SimTicks.tickcount = 0;
    1.31 -	g_SimTicks.ticktime = gpGlobals->curtime;
    1.32 -}
    1.33 -
    1.34 -void StopTickSimulation()
    1.35 -{
    1.36 -	g_SimTicks.ticking = true;
    1.37 -	g_Timers.MapChange(false);
    1.38 -	g_StillFrames = 0;
    1.39 -	g_LastTime = gpGlobals->curtime;
    1.40 -}
    1.41 -
    1.42 -void SimulateTick()
    1.43 -{
    1.44 -	g_SimTicks.tickcount++;
    1.45 -	g_SimTicks.ticktime = g_StillTime + (g_SimTicks.tickcount * gpGlobals->interval_per_tick);
    1.46 -}
    1.47 -
    1.48  void SourceModBase::GameFrame(bool simulating)
    1.49  {
    1.50  	g_DBMan.RunFrame();
    1.51 @@ -405,46 +378,7 @@
    1.52  	 * Note: This is all hardcoded rather than delegated to save
    1.53  	 * precious CPU cycles.
    1.54  	 */
    1.55 -	float curtime = gpGlobals->curtime;
    1.56 -	int framecount = gpGlobals->framecount;
    1.57 -
    1.58 -	/* Verify that we're still ticking */
    1.59 -	if (g_SimTicks.ticking)
    1.60 -	{
    1.61 -		if (g_StillFrames == 0)
    1.62 -		{
    1.63 -			g_StillFrames = framecount;
    1.64 -			g_StillTime = curtime;
    1.65 -		} else {
    1.66 -			/* Try to detect when we've stopped ticking.
    1.67 -			 * We do this once 10 frames pass and there have been no ticks.
    1.68 -			 */
    1.69 -			if (g_StillTime == curtime)
    1.70 -			{
    1.71 -				if (framecount - g_StillFrames >= 5)
    1.72 -				{
    1.73 -					StartTickSimulation();
    1.74 -					return;
    1.75 -				}
    1.76 -			} else {
    1.77 -				/* We're definitely ticking we get here, 
    1.78 -				 * but update everything as a precaution */
    1.79 -				g_StillFrames = framecount;
    1.80 -				g_StillTime = curtime;
    1.81 -			}
    1.82 -		}
    1.83 -	} else {
    1.84 -		/* We need to make sure we should still be simulating. */
    1.85 -		if (g_StillTime != curtime)
    1.86 -		{
    1.87 -			/* Wow, we're ticking again! It's time to revert. */
    1.88 -			StopTickSimulation();
    1.89 -			return;
    1.90 -		}
    1.91 -		/* Nope, not ticking.  Simulate! */
    1.92 -		SimulateTick();
    1.93 -		curtime = g_SimTicks.ticktime;
    1.94 -	}
    1.95 +	float curtime = engine->Time();
    1.96  
    1.97  	if (curtime - g_LastTime >= 0.1f)
    1.98  	{
    1.99 @@ -459,7 +393,7 @@
   1.100  		g_LastTime = curtime;
   1.101  	}
   1.102  
   1.103 -	if (g_SimTicks.ticking && curtime - g_LastMenuTime >= 1.0f)
   1.104 +	if (gpGlobals->curtime - g_LastMenuTime >= 1.0f)
   1.105  	{
   1.106  		g_ValveMenuStyle.ProcessWatchList();
   1.107  		g_RadioMenuStyle.ProcessWatchList();