core/sourcemod.cpp
changeset 531 9886d8efdf7f
parent 520 7676d61cde2d
child 532 fe6bb91d79b1
     1.1 --- a/core/sourcemod.cpp	Mon Feb 26 04:24:06 2007 +0000
     1.2 +++ b/core/sourcemod.cpp	Mon Feb 26 04:36:15 2007 +0000
     1.3 @@ -25,6 +25,7 @@
     1.4  #include "sm_stringutil.h"
     1.5  #include "CPlayerManager.h"
     1.6  #include "CTranslator.h"
     1.7 +#include "ForwardSys.h"
     1.8  
     1.9  SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
    1.10  SH_DECL_HOOK0_void(IServerGameDLL, LevelShutdown, SH_NOATTRIB, false);
    1.11 @@ -40,6 +41,7 @@
    1.12  IdentityToken_t *g_pCoreIdent = NULL;
    1.13  float g_LastTime = 0.0f;
    1.14  float g_LastAuthCheck = 0.0f;
    1.15 +IForward *g_pOnGameFrame = NULL;
    1.16  
    1.17  typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *);
    1.18  typedef unsigned int (*GETEXPORTCOUNT)();
    1.19 @@ -203,6 +205,11 @@
    1.20  	g_Admins.DumpAdminCache(AdminCache_Overrides, true);
    1.21  	g_Admins.DumpAdminCache(AdminCache_Groups, true);
    1.22  
    1.23 +	if (!g_pOnGameFrame)
    1.24 +	{
    1.25 +		g_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
    1.26 +	}
    1.27 +
    1.28  	RETURN_META_VALUE(MRES_IGNORED, true);
    1.29  }
    1.30  
    1.31 @@ -223,6 +230,11 @@
    1.32  		}
    1.33  		g_LastTime = curtime;
    1.34  	}
    1.35 +	
    1.36 +	if (g_pOnGameFrame && g_pOnGameFrame->GetFunctionCount())
    1.37 +	{
    1.38 +		g_pOnGameFrame->Execute(NULL);
    1.39 +	}
    1.40  }
    1.41  
    1.42  void SourceModBase::LevelShutdown()
    1.43 @@ -296,6 +308,11 @@
    1.44  
    1.45  void SourceModBase::CloseSourceMod()
    1.46  {
    1.47 +	if (g_pOnGameFrame)
    1.48 +	{
    1.49 +		g_Forwards.ReleaseForward(g_pOnGameFrame);
    1.50 +	}
    1.51 +
    1.52  	/* Notify! */
    1.53  	SMGlobalClass *pBase = SMGlobalClass::head;
    1.54  	while (pBase)