3 * =============================================================================
4 * SourceMod SDKTools Extension
5 * Copyright (C) 2004-2008 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_EXTENSION_PROPER_H_
33 #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
37 * @brief SDK Tools extension code header.
40 #include "smsdk_ext.h"
41 #include <IBinTools.h>
42 #include <IPlayerHelpers.h>
43 #include <IGameHelpers.h>
44 #include <IEngineTrace.h>
45 #include <IEngineSound.h>
46 #include <ivoiceserver.h>
47 #include <iplayerinfo.h>
48 #include <server_class.h>
53 #include <compat_wrappers.h>
56 * @brief Implementation of the SDK Tools extension.
57 * Note: Uncomment one of the pre-defined virtual functions in order to use it.
61 public IHandleTypeDispatch,
62 public IConCommandBaseAccessor,
63 public IClientListener,
64 public ICommandTargetProcessor
66 public: //public IHandleTypeDispatch
67 void OnHandleDestroy(HandleType_t type, void *object);
68 public: //public SDKExtension
69 virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
70 virtual void SDK_OnUnload();
71 virtual void SDK_OnAllLoaded();
72 //virtual void SDK_OnPauseChange(bool paused);
73 virtual bool QueryRunning(char *error, size_t maxlength);
74 virtual bool QueryInterfaceDrop(SMInterface *pInterface);
75 virtual void NotifyInterfaceDrop(SMInterface *pInterface);
76 virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
78 #if defined SMEXT_CONF_METAMOD
79 virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);
80 //virtual bool SDK_OnMetamodUnload(char *error, size_t maxlen);
81 //virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen);
83 public: //IConCommandBaseAccessor
84 bool RegisterConCommandBase(ConCommandBase *pVar);
85 public: //IClientListner
86 void OnClientDisconnecting(int client);
87 public: // IVoiceServer
88 bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
90 public: //ICommandTargetProcessor
91 bool ProcessCommandTarget(cmd_target_info_t *info);
93 bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
94 void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
97 extern SDKTools g_SdkTools;
98 /* Interfaces from engine or gamedll */
99 extern IServerGameEnts *gameents;
100 extern IEngineTrace *enginetrace;
101 extern IEngineSound *engsound;
102 extern INetworkStringTableContainer *netstringtables;
103 extern IServerPluginHelpers *pluginhelpers;
104 extern IServerGameClients *serverClients;
105 extern IVoiceServer *voiceserver;
106 extern IPlayerInfoManager *playerinfomngr;
108 extern IServer *iserver;
109 /* Interfaces from SourceMod */
110 extern IBinTools *g_pBinTools;
111 extern IGameConfig *g_pGameConf;
112 extern IGameHelpers *g_pGameHelpers;
114 extern HandleType_t g_CallHandle;
115 extern HandleType_t g_TraceHandle;
117 extern ICallWrapper *g_pAcceptInput;
119 extern SourceHook::CallClass<IVEngineServer> *enginePatch;
120 extern SourceHook::CallClass<IEngineSound> *enginesoundPatch;
122 #define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func)
124 #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_