extensions/sdktools/extension.h
author Nicholas Hastings <skamonkey@gmail.com>
Wed May 25 13:31:14 2011 -0400 (2011-05-25)
changeset 3285 065beec73902
parent 3280 7aea1316eff7
child 3816 31650bb3c7e8
permissions -rw-r--r--
Backed out changeset: 65eb3df32b1c
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();
fyrenmoo@2796
    96
#if SOURCE_ENGINE >= SE_ORANGEBOX
fyrenmoo@2796
    97
	void OnClientCommand(edict_t *pEntity, const CCommand &args);
fyrenmoo@2796
    98
#else
fyrenmoo@2796
    99
	void OnClientCommand(edict_t *pEntity);
fyrenmoo@2796
   100
#endif
fyrenmoo@2796
   101
dvander@1628
   102
public: //ICommandTargetProcessor
dvander@1628
   103
	bool ProcessCommandTarget(cmd_target_info_t *info);
faluco@1262
   104
public:
faluco@1262
   105
	bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
faluco@1613
   106
	void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
ds@783
   107
};
ds@783
   108
teame06@1235
   109
extern SDKTools g_SdkTools;
ds@1114
   110
/* Interfaces from engine or gamedll */
ds@783
   111
extern IServerGameEnts *gameents;
faluco@1075
   112
extern IEngineTrace *enginetrace;
ds@1114
   113
extern IEngineSound *engsound;
ds@1114
   114
extern INetworkStringTableContainer *netstringtables;
dvander@1169
   115
extern IServerPluginHelpers *pluginhelpers;
faluco@1219
   116
extern IServerGameClients *serverClients;
teame06@1235
   117
extern IVoiceServer *voiceserver;
teame06@1239
   118
extern IPlayerInfoManager *playerinfomngr;
faluco@1560
   119
extern ICvar *icvar;
faluco@1769
   120
extern IServer *iserver;
ds@2400
   121
extern CGlobalVars *gpGlobals;
skamonkey@3280
   122
#if SOURCE_ENGINE >= SE_ORANGEBOX
skamonkey@3280
   123
extern IServerTools *servertools;
skamonkey@3280
   124
#endif
ds@1114
   125
/* Interfaces from SourceMod */
ds@783
   126
extern IBinTools *g_pBinTools;
dvander@950
   127
extern IGameConfig *g_pGameConf;
faluco@1031
   128
extern IGameHelpers *g_pGameHelpers;
ds@1114
   129
/* Handle types */
dvander@950
   130
extern HandleType_t g_CallHandle;
faluco@1075
   131
extern HandleType_t g_TraceHandle;
faluco@1498
   132
/* Call Wrappers */
faluco@1498
   133
extern ICallWrapper *g_pAcceptInput;
faluco@1735
   134
/* Call classes */
faluco@1735
   135
extern SourceHook::CallClass<IVEngineServer> *enginePatch;
faluco@1735
   136
extern SourceHook::CallClass<IEngineSound> *enginesoundPatch;
faluco@1735
   137
dvander@2838
   138
extern const char *tools_GetTeamName(int team);
dvander@2838
   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_