|
ds@783
|
1 |
/** |
|
ds@783
|
2 |
* vim: set ts=4 : |
|
ds@1330
|
3 |
* ============================================================================= |
|
dvander@1233
|
4 |
* SourceMod SDKTools Extension |
|
ds@1947
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1330
|
6 |
* ============================================================================= |
|
ds@783
|
7 |
* |
|
ds@1330
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1330
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1330
|
10 |
* Free Software Foundation. |
|
dvander@1233
|
11 |
* |
|
ds@1330
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1330
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1330
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1330
|
15 |
* details. |
|
dvander@1233
|
16 |
* |
|
ds@1330
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1330
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
dvander@1233
|
19 |
* |
|
ds@1330
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1330
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1330
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1330
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1330
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1330
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1330
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1330
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@783
|
28 |
* |
|
ds@783
|
29 |
* Version: $Id$ |
|
ds@783
|
30 |
*/ |
|
ds@783
|
31 |
|
|
ds@783
|
32 |
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ |
|
ds@783
|
33 |
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ |
|
ds@783
|
34 |
|
|
ds@783
|
35 |
/** |
|
ds@783
|
36 |
* @file extension.h |
|
ds@783
|
37 |
* @brief SDK Tools extension code header. |
|
ds@783
|
38 |
*/ |
|
ds@783
|
39 |
|
|
ds@783
|
40 |
#include "smsdk_ext.h" |
|
ds@783
|
41 |
#include <IBinTools.h> |
|
ds@783
|
42 |
#include <IPlayerHelpers.h> |
|
faluco@1031
|
43 |
#include <IGameHelpers.h> |
|
faluco@1075
|
44 |
#include <IEngineTrace.h> |
|
dvander@1047
|
45 |
#include <IEngineSound.h> |
|
teame06@1236
|
46 |
#include <ivoiceserver.h> |
|
teame06@1239
|
47 |
#include <iplayerinfo.h> |
|
ds@2051
|
48 |
#include <server_class.h> |
|
ds@2051
|
49 |
#include <datamap.h> |
|
dvander@1052
|
50 |
#include <convar.h> |
|
faluco@1769
|
51 |
#include <iserver.h> |
|
faluco@1769
|
52 |
#include <cdll_int.h> |
|
ds@783
|
53 |
|
|
skamonkey@3280
|
54 |
#if SOURCE_ENGINE >= SE_ORANGEBOX |
|
skamonkey@3280
|
55 |
#include <itoolentity.h> |
|
skamonkey@3280
|
56 |
#endif |
|
skamonkey@3280
|
57 |
|
|
ds@783
|
58 |
/** |
|
ds@783
|
59 |
* @brief Implementation of the SDK Tools extension. |
|
ds@783
|
60 |
* Note: Uncomment one of the pre-defined virtual functions in order to use it. |
|
ds@783
|
61 |
*/ |
|
dvander@1052
|
62 |
class SDKTools : |
|
dvander@1052
|
63 |
public SDKExtension, |
|
dvander@1052
|
64 |
public IHandleTypeDispatch, |
|
teame06@1235
|
65 |
public IConCommandBaseAccessor, |
|
dvander@1628
|
66 |
public IClientListener, |
|
dvander@1628
|
67 |
public ICommandTargetProcessor |
|
ds@783
|
68 |
{ |
|
dvander@1052
|
69 |
public: //public IHandleTypeDispatch |
|
dvander@950
|
70 |
void OnHandleDestroy(HandleType_t type, void *object); |
|
dvander@1052
|
71 |
public: //public SDKExtension |
|
ds@783
|
72 |
virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); |
|
dvander@950
|
73 |
virtual void SDK_OnUnload(); |
|
ds@783
|
74 |
virtual void SDK_OnAllLoaded(); |
|
ds@783
|
75 |
//virtual void SDK_OnPauseChange(bool paused); |
|
ds@783
|
76 |
virtual bool QueryRunning(char *error, size_t maxlength); |
|
dvander@1023
|
77 |
virtual bool QueryInterfaceDrop(SMInterface *pInterface); |
|
dvander@1023
|
78 |
virtual void NotifyInterfaceDrop(SMInterface *pInterface); |
|
faluco@1993
|
79 |
virtual void OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax); |
|
dvander@2790
|
80 |
const char *GetExtensionVerString(); |
|
dvander@2790
|
81 |
const char *GetExtensionDateString(); |
|
ds@783
|
82 |
public: |
|
ds@783
|
83 |
#if defined SMEXT_CONF_METAMOD |
|
ds@783
|
84 |
virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late); |
|
ds@783
|
85 |
//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlen); |
|
ds@783
|
86 |
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlen); |
|
ds@783
|
87 |
#endif |
|
dvander@1052
|
88 |
public: //IConCommandBaseAccessor |
|
dvander@1052
|
89 |
bool RegisterConCommandBase(ConCommandBase *pVar); |
|
teame06@1235
|
90 |
public: //IClientListner |
|
pred@2711
|
91 |
void OnClientPutInServer(int client); |
|
teame06@1235
|
92 |
void OnClientDisconnecting(int client); |
|
teame06@1235
|
93 |
public: // IVoiceServer |
|
teame06@1235
|
94 |
bool OnSetClientListening(int iReceiver, int iSender, bool bListen); |
|
dvander@2044
|
95 |
void VoiceInit(); |
|
skamonkey@3913
|
96 |
#if SOURCE_ENGINE == SE_DOTA |
|
skamonkey@3913
|
97 |
void OnClientCommand(int client, const CCommand &args); |
|
skamonkey@3913
|
98 |
#elif SOURCE_ENGINE >= SE_ORANGEBOX |
|
fyrenmoo@2796
|
99 |
void OnClientCommand(edict_t *pEntity, const CCommand &args); |
|
fyrenmoo@2796
|
100 |
#else |
|
fyrenmoo@2796
|
101 |
void OnClientCommand(edict_t *pEntity); |
|
fyrenmoo@2796
|
102 |
#endif |
|
fyrenmoo@2796
|
103 |
|
|
dvander@1628
|
104 |
public: //ICommandTargetProcessor |
|
dvander@1628
|
105 |
bool ProcessCommandTarget(cmd_target_info_t *info); |
|
faluco@1262
|
106 |
public: |
|
faluco@1262
|
107 |
bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); |
|
faluco@1613
|
108 |
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax); |
|
ds@783
|
109 |
}; |
|
ds@783
|
110 |
|
|
teame06@1235
|
111 |
extern SDKTools g_SdkTools; |
|
ds@1114
|
112 |
/* Interfaces from engine or gamedll */ |
|
ds@783
|
113 |
extern IServerGameEnts *gameents; |
|
faluco@1075
|
114 |
extern IEngineTrace *enginetrace; |
|
ds@1114
|
115 |
extern IEngineSound *engsound; |
|
ds@1114
|
116 |
extern INetworkStringTableContainer *netstringtables; |
|
dvander@1169
|
117 |
extern IServerPluginHelpers *pluginhelpers; |
|
faluco@1219
|
118 |
extern IServerGameClients *serverClients; |
|
teame06@1235
|
119 |
extern IVoiceServer *voiceserver; |
|
teame06@1239
|
120 |
extern IPlayerInfoManager *playerinfomngr; |
|
faluco@1560
|
121 |
extern ICvar *icvar; |
|
faluco@1769
|
122 |
extern IServer *iserver; |
|
ds@2400
|
123 |
extern CGlobalVars *gpGlobals; |
|
skamonkey@3280
|
124 |
#if SOURCE_ENGINE >= SE_ORANGEBOX |
|
skamonkey@3280
|
125 |
extern IServerTools *servertools; |
|
skamonkey@3280
|
126 |
#endif |
|
ds@1114
|
127 |
/* Interfaces from SourceMod */ |
|
ds@783
|
128 |
extern IBinTools *g_pBinTools; |
|
dvander@950
|
129 |
extern IGameConfig *g_pGameConf; |
|
faluco@1031
|
130 |
extern IGameHelpers *g_pGameHelpers; |
|
ds@1114
|
131 |
/* Handle types */ |
|
dvander@950
|
132 |
extern HandleType_t g_CallHandle; |
|
faluco@1075
|
133 |
extern HandleType_t g_TraceHandle; |
|
faluco@1498
|
134 |
/* Call Wrappers */ |
|
faluco@1498
|
135 |
extern ICallWrapper *g_pAcceptInput; |
|
faluco@1735
|
136 |
/* Call classes */ |
|
faluco@1735
|
137 |
extern SourceHook::CallClass<IVEngineServer> *enginePatch; |
|
faluco@1735
|
138 |
extern SourceHook::CallClass<IEngineSound> *enginesoundPatch; |
|
faluco@1735
|
139 |
|
|
ds@2400
|
140 |
#include <compat_wrappers.h> |
|
ds@2400
|
141 |
|
|
faluco@1735
|
142 |
#define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func) |
|
ds@783
|
143 |
|
|
ds@783
|
144 |
#endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ |