dvander@1945: /**
dvander@1945: * vim: set ts=4 :
dvander@1945: * =============================================================================
pred@1963: * SourceMod Team Fortress 2 Extension
ds@1947: * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
dvander@1945: * =============================================================================
dvander@1945: *
dvander@1945: * This program is free software; you can redistribute it and/or modify it under
dvander@1945: * the terms of the GNU General Public License, version 3.0, as published by the
dvander@1945: * Free Software Foundation.
dvander@1945: *
dvander@1945: * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@1945: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@1945: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dvander@1945: * details.
dvander@1945: *
dvander@1945: * You should have received a copy of the GNU General Public License along with
dvander@1945: * this program. If not, see .
dvander@1945: *
dvander@1945: * As a special exception, AlliedModders LLC gives you permission to link the
dvander@1945: * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@1945: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@1945: * by the Valve Corporation. You must obey the GNU General Public License in
dvander@1945: * all respects for all other code used. Additionally, AlliedModders LLC grants
dvander@1945: * this exception to all derivative works. AlliedModders LLC defines further
dvander@1945: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@1945: * or .
dvander@1945: *
dvander@1945: * Version: $Id$
dvander@1945: */
dvander@1945:
dvander@1945: #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
dvander@1945: #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
dvander@1945:
dvander@1945: /**
dvander@1945: * @file extension.h
dvander@1945: * @brief Sample extension code header.
dvander@1945: */
dvander@1945:
dvander@1945: #include "smsdk_ext.h"
dvander@1945: #include
ds@2051: #include
pred@2075: #include
dvander@1945:
dvander@1945: /**
dvander@1945: * @brief Sample implementation of the SDK Extension.
dvander@1945: * Note: Uncomment one of the pre-defined virtual functions in order to use it.
dvander@1945: */
dvander@1945: class TF2Tools :
dvander@1945: public SDKExtension,
pred@1979: public ICommandTargetProcessor,
pred@2075: public IConCommandBaseAccessor,
pred@2619: public IGameEventListener2,
pred@2619: public IPluginsListener
dvander@1945: {
pred@2619: public: //SDKExtension
dvander@1945: /**
dvander@1945: * @brief This is called after the initial loading sequence has been processed.
dvander@1945: *
dvander@1945: * @param error Error message buffer.
dvander@1945: * @param maxlength Size of error message buffer.
dvander@1945: * @param late Whether or not the module was loaded after map load.
dvander@1945: * @return True to succeed loading, false to fail.
dvander@1945: */
dvander@1945: virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
dvander@1945:
dvander@1945: /**
dvander@1945: * @brief This is called right before the extension is unloaded.
dvander@1945: */
dvander@1945: virtual void SDK_OnUnload();
dvander@1945:
dvander@1945: /**
dvander@1945: * @brief This is called once all known extensions have been loaded.
dvander@1945: * Note: It is is a good idea to add natives here, if any are provided.
dvander@1945: */
dvander@1945: virtual void SDK_OnAllLoaded();
dvander@1945:
dvander@1945: /**
dvander@1945: * @brief this is called when Core wants to know if your extension is working.
dvander@1945: *
dvander@1945: * @param error Error message buffer.
dvander@1945: * @param maxlength Size of error message buffer.
dvander@1945: * @return True if working, false otherwise.
dvander@1945: */
dvander@1945: virtual bool QueryRunning(char *error, size_t maxlength);
dvander@1945:
dvander@1945: void NotifyInterfaceDrop(SMInterface *pInterface);
dvander@1945: bool QueryInterfaceDrop(SMInterface *pInterface);
dvander@2783:
dvander@2790: const char *GetExtensionVerString();
dvander@2790: const char *GetExtensionDateString();
pred@2619: public: //ICommandTargetProcessor
dvander@1945: bool ProcessCommandTarget(cmd_target_info_t *info);
pred@2619: public: //IConCommandBaseAccessor
pred@1979: bool RegisterConCommandBase(ConCommandBase *pVar);
pred@2619: public: //IGameEventManager
pred@2075: IGameEventManager2 *m_GameEventManager;
pred@2075: void FireGameEvent( IGameEvent *event );
pred@2619: public: //IPluginsListener
pred@2619: void OnPluginLoaded(IPlugin *plugin);
pred@2619: void OnPluginUnloaded(IPlugin *plugin);
dvander@1945: public:
dvander@1945: #if defined SMEXT_CONF_METAMOD
dvander@1945: /**
dvander@1945: * @brief Called when Metamod is attached, before the extension version is called.
dvander@1945: *
dvander@1945: * @param error Error buffer.
dvander@1945: * @param maxlength Maximum size of error buffer.
dvander@1945: * @param late Whether or not Metamod considers this a late load.
dvander@1945: * @return True to succeed, false to fail.
dvander@1945: */
dvander@1945: virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
dvander@1945: #endif
pred@2619: private:
pred@2619: bool m_DetoursEnabled;
dvander@1945: };
dvander@1945:
pred@1963: enum TFClassType
pred@1963: {
pred@1963: TFClass_Unknown = 0,
pred@1963: TFClass_Scout,
pred@1963: TFClass_Sniper,
pred@1963: TFClass_Soldier,
pred@1963: TFClass_DemoMan,
pred@1963: TFClass_Medic,
pred@1963: TFClass_Heavy,
pred@1963: TFClass_Pyro,
pred@1963: TFClass_Spy,
pred@1963: TFClass_Engineer
pred@1963: };
pred@1963:
pred@1963: TFClassType ClassnameToType(const char *classname);
pred@1963:
dvander@1945: extern IBinTools *g_pBinTools;
dvander@1945: extern IGameConfig *g_pGameConf;
pred@1963: extern sm_sendprop_info_t *playerSharedOffset;
pred@1963:
pred@1963: void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
pred@1963:
pred@1963: int FindResourceEntity();
pred@1963: int FindEntityByNetClass(int start, const char *classname);
pred@1963:
pred@1963: extern int g_resourceEntity;
pred@1963:
dvander@1945:
dvander@1945: #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_