1.1 --- a/core/sourcemod.cpp Wed Sep 12 07:22:38 2007 +0000
1.2 +++ b/core/sourcemod.cpp Wed Sep 12 22:46:00 2007 +0000
1.3 @@ -46,10 +46,6 @@
1.4 #include "Translator.h"
1.5 #include "ForwardSys.h"
1.6 #include "TimerSys.h"
1.7 -#include "MenuStyle_Valve.h"
1.8 -#include "MenuStyle_Radio.h"
1.9 -#include "Database.h"
1.10 -#include "HalfLife2.h"
1.11 #include "GameConfigs.h"
1.12
1.13 SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
1.14 @@ -65,10 +61,6 @@
1.15 ISourcePawnEngine *g_pSourcePawn = &g_SourcePawn;
1.16 IVirtualMachine *g_pVM;
1.17 IdentityToken_t *g_pCoreIdent = NULL;
1.18 -float g_LastTime = 0.0f;
1.19 -float g_LastMenuTime = 0.0f;
1.20 -float g_LastAuthCheck = 0.0f;
1.21 -IForward *g_pOnGameFrame = NULL;
1.22 IForward *g_pOnMapEnd = NULL;
1.23 bool g_Loaded = false;
1.24 IExtension *g_pGameExt = NULL;
1.25 @@ -286,7 +278,7 @@
1.26 void SourceModBase::StartSourceMod(bool late)
1.27 {
1.28 SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
1.29 - SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
1.30 + SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, &g_Timers, &TimerSystem::GameFrame, false);
1.31
1.32 enginePatch = SH_GET_CALLCLASS(engine);
1.33 gamedllPatch = SH_GET_CALLCLASS(gamedll);
1.34 @@ -330,9 +322,6 @@
1.35 m_IsMapLoading = true;
1.36 m_ExecPluginReload = true;
1.37 m_ExecOnMapEnd = true;
1.38 - g_LastTime = 0.0f;
1.39 - g_LastMenuTime = 0.0f;
1.40 - g_LastAuthCheck = 0.0f;
1.41
1.42 /* Notify! */
1.43 SMGlobalClass *pBase = SMGlobalClass::head;
1.44 @@ -354,11 +343,6 @@
1.45 pBase = pBase->m_pGlobalClassNext;
1.46 }
1.47
1.48 - if (!g_pOnGameFrame)
1.49 - {
1.50 - g_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
1.51 - }
1.52 -
1.53 if (!g_pOnMapEnd)
1.54 {
1.55 g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL);
1.56 @@ -369,43 +353,6 @@
1.57 RETURN_META_VALUE(MRES_IGNORED, true);
1.58 }
1.59
1.60 -void SourceModBase::GameFrame(bool simulating)
1.61 -{
1.62 - g_DBMan.RunFrame();
1.63 - g_HL2.ProcessFakeCliCmdQueue();
1.64 -
1.65 - /**
1.66 - * Note: This is all hardcoded rather than delegated to save
1.67 - * precious CPU cycles.
1.68 - */
1.69 - float curtime = engine->Time();
1.70 -
1.71 - if (curtime - g_LastTime >= 0.1f)
1.72 - {
1.73 - if (m_CheckingAuth
1.74 - && (gpGlobals->curtime - g_LastAuthCheck > 0.7f))
1.75 - {
1.76 - g_LastAuthCheck = gpGlobals->curtime;
1.77 - g_Players.RunAuthChecks();
1.78 - }
1.79 -
1.80 - g_Timers.RunFrame();
1.81 - g_LastTime = curtime;
1.82 - }
1.83 -
1.84 - if (gpGlobals->curtime - g_LastMenuTime >= 1.0f)
1.85 - {
1.86 - g_ValveMenuStyle.ProcessWatchList();
1.87 - g_RadioMenuStyle.ProcessWatchList();
1.88 - g_LastMenuTime = curtime;
1.89 - }
1.90 -
1.91 - if (g_pOnGameFrame && g_pOnGameFrame->GetFunctionCount())
1.92 - {
1.93 - g_pOnGameFrame->Execute(NULL);
1.94 - }
1.95 -}
1.96 -
1.97 void SourceModBase::LevelShutdown()
1.98 {
1.99 if (g_LevelEndBarrier)
1.100 @@ -521,11 +468,6 @@
1.101
1.102 if (g_Loaded)
1.103 {
1.104 - if (g_pOnGameFrame)
1.105 - {
1.106 - g_Forwards.ReleaseForward(g_pOnGameFrame);
1.107 - }
1.108 -
1.109 if (g_pOnMapEnd)
1.110 {
1.111 g_Forwards.ReleaseForward(g_pOnMapEnd);
1.112 @@ -570,7 +512,7 @@
1.113 }
1.114
1.115 SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelShutdown, gamedll, this, &SourceModBase::LevelShutdown, false);
1.116 - SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, this, &SourceModBase::GameFrame, false);
1.117 + SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, GameFrame, gamedll, &g_Timers, &TimerSystem::GameFrame, false);
1.118 }
1.119
1.120 /* Rest In Peace */
1.121 @@ -641,11 +583,6 @@
1.122 m_target = index;
1.123 }
1.124
1.125 -void SourceModBase::SetAuthChecking(bool set)
1.126 -{
1.127 - m_CheckingAuth = set;
1.128 -}
1.129 -
1.130 unsigned int SourceModBase::GetGlobalTarget() const
1.131 {
1.132 return m_target;