2 * ===============================================================
3 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
4 * ===============================================================
6 * This file is not open source and may not be copied without explicit
7 * written permission of AlliedModders LLC. This file may not be redistributed
8 * in whole or significant part.
9 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
14 #ifndef _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
15 #define _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
17 #include "sm_globals.h"
18 #include <ISourceMod.h>
20 #include "CDataPack.h"
22 using namespace SourceHook;
25 * @brief Implements SourceMod's global overall management, API, and logic
28 class SourceModBase : public ISourceMod
34 * @brief Initializes SourceMod, or returns an error on failure.
36 bool InitializeSourceMod(char *error, size_t err_max, bool late);
39 * @brief Starts everything SourceMod needs to run
41 void StartSourceMod(bool late);
44 * @brief Shuts down all SourceMod components
46 void CloseSourceMod();
49 * @brief Map change hook
51 bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
54 * @brief Level shutdown hook
59 * @brief Returns whether or not a map load is in progress
61 bool IsMapLoading() const;
64 * @brief Stores the global target index.
66 void SetGlobalTarget(unsigned int index);
69 * @brief Returns the global target index.
71 unsigned int GetGlobalTarget() const;
74 * @brief Sets whether if SoureMod needs to check player auths.
76 void SetAuthChecking(bool set);
78 const char *GetModPath() const;
79 const char *GetSourceModPath() const;
80 size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...);
81 void LogMessage(IExtension *pExt, const char *format, ...);
82 void LogError(IExtension *pExt, const char *format, ...);
83 size_t FormatString(char *buffer, size_t maxlength, IPluginContext *pContext, const cell_t *params, unsigned int param);
84 IDataPack *CreateDataPack();
85 void FreeDataPack(IDataPack *pack);
86 HandleType_t GetDataPackHandleType(bool readonly=false);
89 * @brief Loading plugins
91 void DoGlobalPluginLoads();
92 void GameFrame(bool simulating);
94 CStack<CDataPack *> m_freepacks;
95 char m_SMBaseDir[PLATFORM_MAX_PATH+1];
96 char m_SMRelDir[PLATFORM_MAX_PATH+1];
98 bool m_ExecPluginReload;
99 unsigned int m_target;
103 extern SourceModBase g_SourceMod;
104 extern HandleType_t g_WrBitBufType;
106 #endif //_INCLUDE_SOURCEMOD_GLOBALHEADER_H_