Build against MM:S 1.10.
3 * =============================================================================
5 * Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
33 #define _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
35 #include "sm_globals.h"
36 #include <ISourceMod.h>
38 #include <sh_vector.h>
39 #include "CDataPack.h"
41 using namespace SourceHook;
44 # define IF_DEBUG_SPEW
45 # define ENDIF_DEBUG_SPEW
47 # define IF_DEBUG_SPEW \
48 if (sm_show_debug_spew) \
50 # define ENDIF_DEBUG_SPEW \
55 * @brief Implements SourceMod's global overall management, API, and logic
66 * @brief Initializes SourceMod, or returns an error on failure.
68 bool InitializeSourceMod(char *error, size_t maxlength, bool late);
71 * @brief Starts everything SourceMod needs to run
73 void StartSourceMod(bool late);
76 * @brief Shuts down all SourceMod components
78 void CloseSourceMod();
81 * @brief Map change hook
83 bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
86 * @brief Level shutdown hook
91 * @brief Returns whether or not a map load is in progress
93 bool IsMapLoading() const;
96 * @brief Stores the global target index.
98 unsigned int SetGlobalTarget(unsigned int index);
101 * @brief Returns the global target index.
103 unsigned int GetGlobalTarget() const;
104 public: // SMGlobalClass
105 ConfigResult OnSourceModConfigChanged(const char *key,
110 public: // ISourceMod
111 const char *GetGamePath() const;
112 const char *GetSourceModPath() const;
113 size_t BuildPath(PathType type, char *buffer, size_t maxlength, const char *format, ...);
114 void LogMessage(IExtension *pExt, const char *format, ...);
115 void LogError(IExtension *pExt, const char *format, ...);
116 size_t FormatString(char *buffer, size_t maxlength, IPluginContext *pContext, const cell_t *params, unsigned int param);
117 IDataPack *CreateDataPack();
118 void FreeDataPack(IDataPack *pack);
119 HandleType_t GetDataPackHandleType(bool readonly=false);
120 KeyValues *ReadKeyValuesHandle(Handle_t hndl, HandleError *err=NULL, bool root=false);
121 const char *GetGameFolderName() const;
122 ISourcePawnEngine *GetScriptingEngine();
123 IVirtualMachine *GetScriptingVM();
124 void AllPluginsLoaded();
125 time_t GetAdjustedTime();
127 void GlobalUnpause();
128 void DoGlobalPluginLoads();
129 void AddGameFrameHook(GAME_FRAME_HOOK hook);
130 void RemoveGameFrameHook(GAME_FRAME_HOOK hook);
131 void ProcessGameFrameHooks(bool simulating);
132 size_t Format(char *buffer, size_t maxlength, const char *fmt, ...);
133 size_t FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list ap);
134 void AddFrameAction(FRAMEACTION fn, void *data);
135 const char *GetCoreConfigValue(const char *key);
137 int GetShApiVersion();
140 CStack<CDataPack *> m_freepacks;
141 char m_SMBaseDir[PLATFORM_MAX_PATH];
142 char m_SMRelDir[PLATFORM_MAX_PATH];
145 bool m_ExecPluginReload;
147 unsigned int m_target;
149 CVector<GAME_FRAME_HOOK> m_frame_hooks;
152 extern bool g_Loaded;
153 extern bool sm_show_debug_spew;
154 extern SourceModBase g_SourceMod;
156 #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_