diff -r f5c07ec3c052 -r bb6516a50eea core/sourcemod.cpp --- a/core/sourcemod.cpp Tue Sep 11 15:10:18 2007 +0000 +++ b/core/sourcemod.cpp Tue Sep 11 18:02:59 2007 +0000 @@ -71,8 +71,6 @@ IForward *g_pOnGameFrame = NULL; IForward *g_pOnMapEnd = NULL; bool g_Loaded = false; -int g_StillFrames = 0; -float g_StillTime = 0.0f; IExtension *g_pGameExt = NULL; typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *); @@ -335,10 +333,6 @@ g_LastTime = 0.0f; g_LastMenuTime = 0.0f; g_LastAuthCheck = 0.0f; - g_SimTicks.ticking = true; - g_SimTicks.tickcount = 0; - g_StillTime = 0.0f; - g_StillFrames = 0; /* Notify! */ SMGlobalClass *pBase = SMGlobalClass::head; @@ -375,27 +369,6 @@ RETURN_META_VALUE(MRES_IGNORED, true); } -void StartTickSimulation() -{ - g_SimTicks.ticking = false; - g_SimTicks.tickcount = 0; - g_SimTicks.ticktime = gpGlobals->curtime; -} - -void StopTickSimulation() -{ - g_SimTicks.ticking = true; - g_Timers.MapChange(false); - g_StillFrames = 0; - g_LastTime = gpGlobals->curtime; -} - -void SimulateTick() -{ - g_SimTicks.tickcount++; - g_SimTicks.ticktime = g_StillTime + (g_SimTicks.tickcount * gpGlobals->interval_per_tick); -} - void SourceModBase::GameFrame(bool simulating) { g_DBMan.RunFrame(); @@ -405,46 +378,7 @@ * Note: This is all hardcoded rather than delegated to save * precious CPU cycles. */ - float curtime = gpGlobals->curtime; - int framecount = gpGlobals->framecount; - - /* Verify that we're still ticking */ - if (g_SimTicks.ticking) - { - if (g_StillFrames == 0) - { - g_StillFrames = framecount; - g_StillTime = curtime; - } else { - /* Try to detect when we've stopped ticking. - * We do this once 10 frames pass and there have been no ticks. - */ - if (g_StillTime == curtime) - { - if (framecount - g_StillFrames >= 5) - { - StartTickSimulation(); - return; - } - } else { - /* We're definitely ticking we get here, - * but update everything as a precaution */ - g_StillFrames = framecount; - g_StillTime = curtime; - } - } - } else { - /* We need to make sure we should still be simulating. */ - if (g_StillTime != curtime) - { - /* Wow, we're ticking again! It's time to revert. */ - StopTickSimulation(); - return; - } - /* Nope, not ticking. Simulate! */ - SimulateTick(); - curtime = g_SimTicks.ticktime; - } + float curtime = engine->Time(); if (curtime - g_LastTime >= 0.1f) { @@ -459,7 +393,7 @@ g_LastTime = curtime; } - if (g_SimTicks.ticking && curtime - g_LastMenuTime >= 1.0f) + if (gpGlobals->curtime - g_LastMenuTime >= 1.0f) { g_ValveMenuStyle.ProcessWatchList(); g_RadioMenuStyle.ProcessWatchList();