added request amb234 (OnMapEnd)

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40724
This commit is contained in:
David Anderson 2007-05-02 17:49:23 +00:00
parent d57f543820
commit 3c3906b494
2 changed files with 21 additions and 0 deletions

View File

@ -45,6 +45,7 @@ IdentityToken_t *g_pCoreIdent = NULL;
float g_LastTime = 0.0f;
float g_LastAuthCheck = 0.0f;
IForward *g_pOnGameFrame = NULL;
IForward *g_pOnMapEnd = NULL;
bool g_Loaded = false;
typedef int (*GIVEENGINEPOINTER)(ISourcePawnEngine *);
@ -288,6 +289,11 @@ bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, ch
g_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
}
if (!g_pOnMapEnd)
{
g_pOnMapEnd = g_Forwards.CreateForward("OnMapEnd", ET_Ignore, 0, NULL);
}
RETURN_META_VALUE(MRES_IGNORED, true);
}
@ -319,6 +325,11 @@ void SourceModBase::GameFrame(bool simulating)
void SourceModBase::LevelShutdown()
{
if (g_pOnMapEnd)
{
g_pOnMapEnd->Execute(NULL);
}
if (m_ExecPluginReload)
{
g_PluginSys.ReloadOrUnloadPlugins();
@ -396,6 +407,11 @@ void SourceModBase::CloseSourceMod()
{
g_Forwards.ReleaseForward(g_pOnGameFrame);
}
if (g_pOnMapEnd)
{
g_Forwards.ReleaseForward(g_pOnMapEnd);
}
/* Notify! */
SMGlobalClass *pBase = SMGlobalClass::head;

View File

@ -121,6 +121,11 @@ forward OnGameFrame();
*/
forward OnMapStart();
/**
* Called right before a map ends.
*/
forward OnMapEnd();
/**
* Returns the calling plugin's Handle.
*