3 * ================================================================
5 * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
6 * ================================================================
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License,
10 * version 3.0, as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to
21 * link the code of this program (as well as its derivative works) to
22 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any
23 * Game MODs that run on software by the Valve Corporation. You must
24 * obey the GNU General Public License in all respects for all other
25 * code used. Additionally, AlliedModders LLC grants this exception
26 * to all derivative works. AlliedModders LLC defines further
27 * exceptions, found in LICENSE.txt (as of this writing, version
28 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
33 #ifndef _INCLUDE_SOURCEMOD_GLOBALS_H_
34 #define _INCLUDE_SOURCEMOD_GLOBALS_H_
37 * @file Contains global headers that most files in SourceMod will need.
40 #include <sp_vm_types.h>
41 #include <sp_vm_api.h>
42 #include "sm_platform.h"
43 #include <IShareSys.h>
45 using namespace SourcePawn;
46 using namespace SourceMod;
48 class IServerPluginCallbacks;
51 * @brief Lists result codes possible from attempting to set a core configuration option.
55 ConfigResult_Accept = 0, /**< Config option was successfully set */
56 ConfigResult_Reject = 1, /**< Config option was given an invalid value and was rejected */
57 ConfigResult_Ignore = 2 /**< Config option was invalid, but ignored */
61 * @brief Lists possible sources of a config option change
65 ConfigSource_File = 0, /**< Config option was set from config file (core.cfg) */
66 ConfigSource_Console = 1, /**< Config option was set from console command (sm config) */
70 * @brief Any class deriving from this will be automatically initiated/shutdown by SourceMod
74 friend class SourceMod_Core;
75 friend class SourceModBase;
76 friend class CoreConfig;
77 friend class CExtensionManager;
82 * @brief Called when SourceMod is initially loading
84 virtual void OnSourceModStartup(bool late)
89 * @brief Called after all global classes have initialized
91 virtual void OnSourceModAllInitialized()
96 * @brief Called when SourceMod is shutting down
98 virtual void OnSourceModShutdown()
103 * @brief Called after SourceMod is completely shut down
105 virtual void OnSourceModAllShutdown()
110 * @brief Called when a core config option is changed.
111 * @note This is called once BEFORE OnSourceModStartup() when SourceMod is loading
112 * @note It can then be called again when the 'sm config' command is used
114 virtual ConfigResult OnSourceModConfigChanged(const char *key,
120 return ConfigResult_Ignore;
124 * @brief Called when the level changes.
126 virtual void OnSourceModLevelChange(const char *mapName)
131 * @brief Called when the level ends.
133 virtual void OnSourceModLevelEnd()
138 * @brief Called after plugins are loaded on mapchange.
140 virtual void OnSourceModPluginsLoaded()
145 * @brief Called when SourceMod receives a pointer to IServerPluginCallbacks from SourceMM
147 virtual void OnSourceModVSPReceived(IServerPluginCallbacks *iface)
152 * @brief Called once all MM:S plugins are loaded.
154 virtual void OnSourceModGameInitialized()
159 * @brief Called when an identity is dropped (right now, extensions only)
161 virtual void OnSourceModIdentityDropped(IdentityToken_t *pToken)
165 SMGlobalClass *m_pGlobalClassNext;
166 static SMGlobalClass *head;
169 extern ISourcePawnEngine *g_pSourcePawn;
170 extern IVirtualMachine *g_pVM;
171 extern IdentityToken_t *g_pCoreIdent;
173 #include "sm_autonatives.h"
175 #endif //_INCLUDE_SOURCEMOD_GLOBALS_H_