skeleton tf2 extension for ferret sourcemod-1.1.0
authorDavid Anderson <dvander@alliedmods.net>
Fri Nov 23 05:27:58 2007 +0000 (2007-11-23)
branchsourcemod-1.1.0
changeset 171658ef565eb734
parent 1715 f9ecab642e25
child 1782 aa53ee1d9db1
skeleton tf2 extension for ferret
extensions/tf2/Makefile.ep1
extensions/tf2/Makefile.ep2
extensions/tf2/Makefile.orig
extensions/tf2/extension.cpp
extensions/tf2/extension.h
extensions/tf2/msvc8/tf2.sln
extensions/tf2/msvc8/tf2.vcproj
extensions/tf2/natives.cpp
extensions/tf2/sdk/smsdk_config.h
extensions/tf2/sdk/smsdk_ext.cpp
extensions/tf2/sdk/smsdk_ext.h
extensions/tf2/svn_version.h
extensions/tf2/svn_version.tpl
extensions/tf2/version.rc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/tf2/Makefile.ep1	Fri Nov 23 05:27:58 2007 +0000
     1.3 @@ -0,0 +1,88 @@
     1.4 +#(C)2004-2006 SourceMM Development Team
     1.5 +# Makefile written by David "BAILOPAN" Anderson
     1.6 +
     1.7 +SMSDK = ../..
     1.8 +SRCDS = ~/srcds
     1.9 +SOURCEMM = ../../../sourcemm
    1.10 +HL2SDK = ../../../hl2sdk
    1.11 +
    1.12 +#####################################
    1.13 +### EDIT BELOW FOR OTHER PROJECTS ###
    1.14 +#####################################
    1.15 +
    1.16 +PROJECT = game.cstrike
    1.17 +
    1.18 +#Uncomment for SourceMM-enabled extensions
    1.19 +LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
    1.20 +
    1.21 +OBJECTS = sdk/smsdk_ext.cpp extension.cpp natives.cpp RegNatives.cpp timeleft.cpp
    1.22 +
    1.23 +##############################################
    1.24 +### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
    1.25 +##############################################
    1.26 +
    1.27 +C_OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
    1.28 +C_DEBUG_FLAGS = -g -ggdb3
    1.29 +CPP_GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
    1.30 +CPP = gcc-4.1
    1.31 +
    1.32 +HL2PUB = $(HL2SDK)/public
    1.33 +HL2LIB = $(HL2SDK)/linux_sdk
    1.34 +
    1.35 +LINK = $(LINK_HL2) -static-libgcc
    1.36 +
    1.37 +INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
    1.38 +          -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SOURCEMM) -I$(SOURCEMM)/sourcehook -I$(SOURCEMM)/sourcemm \
    1.39 +	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
    1.40 +
    1.41 +CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
    1.42 +	-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp \
    1.43 +	-Wall -Werror -fPIC -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H
    1.44 +CPPFLAGS = -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
    1.45 +
    1.46 +################################################
    1.47 +### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
    1.48 +################################################
    1.49 +
    1.50 +ifeq "$(DEBUG)" "true"
    1.51 +	BIN_DIR = Debug
    1.52 +	CFLAGS += $(C_DEBUG_FLAGS)
    1.53 +else
    1.54 +	BIN_DIR = Release
    1.55 +	CFLAGS += $(C_OPT_FLAGS)
    1.56 +endif
    1.57 +
    1.58 +
    1.59 +GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
    1.60 +ifeq "$(GCC_VERSION)" "4"
    1.61 +	CPPFLAGS += $(CPP_GCC4_FLAGS)
    1.62 +endif
    1.63 +
    1.64 +BINARY = $(PROJECT).ext.so
    1.65 +
    1.66 +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
    1.67 +
    1.68 +$(BIN_DIR)/%.o: %.cpp
    1.69 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
    1.70 +
    1.71 +all:
    1.72 +	mkdir -p $(BIN_DIR)/sdk
    1.73 +	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
    1.74 +	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
    1.75 +	$(MAKE) -f Makefile.ep1 extension
    1.76 +
    1.77 +extension: $(OBJ_LINUX)
    1.78 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
    1.79 +
    1.80 +debug:	
    1.81 +	$(MAKE) -f Makefile.ep1 all DEBUG=true
    1.82 +
    1.83 +default: all
    1.84 +
    1.85 +clean:
    1.86 +	rm -rf Release/*.o
    1.87 +	rm -rf Release/sdk/*.o
    1.88 +	rm -rf Release/$(BINARY)
    1.89 +	rm -rf Debug/*.o
    1.90 +	rm -rf Debug/sdk/*.o
    1.91 +	rm -rf Debug/$(BINARY)
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/extensions/tf2/Makefile.ep2	Fri Nov 23 05:27:58 2007 +0000
     2.3 @@ -0,0 +1,88 @@
     2.4 +#(C)2004-2006 SourceMM Development Team
     2.5 +# Makefile written by David "BAILOPAN" Anderson
     2.6 +
     2.7 +SMSDK = ../..
     2.8 +SRCDS = ~/srcds
     2.9 +SOURCEMM = ../../../sourcemm
    2.10 +HL2SDK = ../../../hl2sdk-ob
    2.11 +
    2.12 +#####################################
    2.13 +### EDIT BELOW FOR OTHER PROJECTS ###
    2.14 +#####################################
    2.15 +
    2.16 +PROJECT = game.cstrike
    2.17 +
    2.18 +#Uncomment for SourceMM-enabled extensions
    2.19 +LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
    2.20 +
    2.21 +OBJECTS = sdk/smsdk_ext.cpp extension.cpp natives.cpp RegNatives.cpp timeleft.cpp
    2.22 +
    2.23 +##############################################
    2.24 +### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
    2.25 +##############################################
    2.26 +
    2.27 +C_OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
    2.28 +C_DEBUG_FLAGS = -g -ggdb3
    2.29 +CPP_GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
    2.30 +CPP = gcc-4.1
    2.31 +
    2.32 +HL2PUB = $(HL2SDK)/public
    2.33 +HL2LIB = $(HL2SDK)/linux_sdk
    2.34 +
    2.35 +LINK = $(LINK_HL2) -static-libgcc
    2.36 +
    2.37 +INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
    2.38 +          -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SOURCEMM) -I$(SOURCEMM)/sourcehook -I$(SOURCEMM)/sourcemm \
    2.39 +	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
    2.40 +
    2.41 +CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
    2.42 +	-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp \
    2.43 +	-Wall -Werror -fPIC -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -DORANGEBOX_BUILD
    2.44 +CPPFLAGS = -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
    2.45 +
    2.46 +################################################
    2.47 +### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
    2.48 +################################################
    2.49 +
    2.50 +ifeq "$(DEBUG)" "true"
    2.51 +	BIN_DIR = Debug
    2.52 +	CFLAGS += $(C_DEBUG_FLAGS)
    2.53 +else
    2.54 +	BIN_DIR = Release
    2.55 +	CFLAGS += $(C_OPT_FLAGS)
    2.56 +endif
    2.57 +
    2.58 +
    2.59 +GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
    2.60 +ifeq "$(GCC_VERSION)" "4"
    2.61 +	CPPFLAGS += $(CPP_GCC4_FLAGS)
    2.62 +endif
    2.63 +
    2.64 +BINARY = $(PROJECT).ext.so
    2.65 +
    2.66 +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
    2.67 +
    2.68 +$(BIN_DIR)/%.o: %.cpp
    2.69 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
    2.70 +
    2.71 +all:
    2.72 +	mkdir -p $(BIN_DIR)/sdk
    2.73 +	ln -sf $(SRCDS)/orangebox/bin/vstdlib_i486.so vstdlib_i486.so
    2.74 +	ln -sf $(SRCDS)/orangebox/bin/tier0_i486.so tier0_i486.so
    2.75 +	$(MAKE) -f Makefile.ep2 extension
    2.76 +
    2.77 +extension: $(OBJ_LINUX)
    2.78 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
    2.79 +
    2.80 +debug:	
    2.81 +	$(MAKE) -f Makefile.ep2 all DEBUG=true
    2.82 +
    2.83 +default: all
    2.84 +
    2.85 +clean:
    2.86 +	rm -rf Release/*.o
    2.87 +	rm -rf Release/sdk/*.o
    2.88 +	rm -rf Release/$(BINARY)
    2.89 +	rm -rf Debug/*.o
    2.90 +	rm -rf Debug/sdk/*.o
    2.91 +	rm -rf Debug/$(BINARY)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/extensions/tf2/Makefile.orig	Fri Nov 23 05:27:58 2007 +0000
     3.3 @@ -0,0 +1,88 @@
     3.4 +#(C)2004-2006 SourceMM Development Team
     3.5 +# Makefile written by David "BAILOPAN" Anderson
     3.6 +
     3.7 +SMSDK = ../..
     3.8 +SRCDS = ~/srcds
     3.9 +SOURCEMM = ../../../sourcemm-1.4.2
    3.10 +HL2SDK = ../../../hl2sdk
    3.11 +
    3.12 +#####################################
    3.13 +### EDIT BELOW FOR OTHER PROJECTS ###
    3.14 +#####################################
    3.15 +
    3.16 +PROJECT = game.cstrike
    3.17 +
    3.18 +#Uncomment for SourceMM-enabled extensions
    3.19 +LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
    3.20 +
    3.21 +OBJECTS = sdk/smsdk_ext.cpp extension.cpp natives.cpp RegNatives.cpp timeleft.cpp
    3.22 +
    3.23 +##############################################
    3.24 +### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
    3.25 +##############################################
    3.26 +
    3.27 +C_OPT_FLAGS = -O3 -funroll-loops -s -pipe -fno-strict-aliasing
    3.28 +C_DEBUG_FLAGS = -g -ggdb3
    3.29 +CPP_GCC4_FLAGS = -fvisibility=hidden -fvisibility-inlines-hidden
    3.30 +CPP = gcc-4.1
    3.31 +
    3.32 +HL2PUB = $(HL2SDK)/public
    3.33 +HL2LIB = $(HL2SDK)/linux_sdk
    3.34 +
    3.35 +LINK = $(LINK_HL2) -static-libgcc
    3.36 +
    3.37 +INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
    3.38 +          -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SOURCEMM) -I$(SOURCEMM)/sourcehook -I$(SOURCEMM)/sourcemm \
    3.39 +	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
    3.40 +
    3.41 +CFLAGS = -D_LINUX -DNDEBUG -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
    3.42 +	-Dstrnicmp=strncasecmp -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp \
    3.43 +	-Wall -Werror -fPIC -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H
    3.44 +CPPFLAGS = -Wno-non-virtual-dtor -fno-exceptions -fno-rtti
    3.45 +
    3.46 +################################################
    3.47 +### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ###
    3.48 +################################################
    3.49 +
    3.50 +ifeq "$(DEBUG)" "true"
    3.51 +	BIN_DIR = Debug
    3.52 +	CFLAGS += $(C_DEBUG_FLAGS)
    3.53 +else
    3.54 +	BIN_DIR = Release
    3.55 +	CFLAGS += $(C_OPT_FLAGS)
    3.56 +endif
    3.57 +
    3.58 +
    3.59 +GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
    3.60 +ifeq "$(GCC_VERSION)" "4"
    3.61 +	CPPFLAGS += $(CPP_GCC4_FLAGS)
    3.62 +endif
    3.63 +
    3.64 +BINARY = $(PROJECT).ext.so
    3.65 +
    3.66 +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
    3.67 +
    3.68 +$(BIN_DIR)/%.o: %.cpp
    3.69 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
    3.70 +
    3.71 +all:
    3.72 +	mkdir -p $(BIN_DIR)/sdk
    3.73 +	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
    3.74 +	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
    3.75 +	$(MAKE) -f Makefile.orig extension
    3.76 +
    3.77 +extension: $(OBJ_LINUX)
    3.78 +	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
    3.79 +
    3.80 +debug:	
    3.81 +	$(MAKE) -f Makefile.orig all DEBUG=true
    3.82 +
    3.83 +default: all
    3.84 +
    3.85 +clean:
    3.86 +	rm -rf Release/*.o
    3.87 +	rm -rf Release/sdk/*.o
    3.88 +	rm -rf Release/$(BINARY)
    3.89 +	rm -rf Debug/*.o
    3.90 +	rm -rf Debug/sdk/*.o
    3.91 +	rm -rf Debug/$(BINARY)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/extensions/tf2/extension.cpp	Fri Nov 23 05:27:58 2007 +0000
     4.3 @@ -0,0 +1,88 @@
     4.4 +/**
     4.5 + * vim: set ts=4 :
     4.6 + * =============================================================================
     4.7 + * SourceMod Counter-Strike:Source Extension
     4.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     4.9 + * =============================================================================
    4.10 + *
    4.11 + * This program is free software; you can redistribute it and/or modify it under
    4.12 + * the terms of the GNU General Public License, version 3.0, as published by the
    4.13 + * Free Software Foundation.
    4.14 + * 
    4.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
    4.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    4.18 + * details.
    4.19 + *
    4.20 + * You should have received a copy of the GNU General Public License along with
    4.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    4.22 + *
    4.23 + * As a special exception, AlliedModders LLC gives you permission to link the
    4.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    4.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    4.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
    4.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    4.28 + * this exception to all derivative works.  AlliedModders LLC defines further
    4.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    4.30 + * or <http://www.sourcemod.net/license.php>.
    4.31 + *
    4.32 + * Version: $Id$
    4.33 + */
    4.34 +
    4.35 +#include "extension.h"
    4.36 +
    4.37 +/**
    4.38 + * @file extension.cpp
    4.39 + * @brief Implement extension code here.
    4.40 + */
    4.41 +
    4.42 +SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
    4.43 +
    4.44 +TF2Tools g_TF2Tools;
    4.45 +IGameConfig *g_pGameConf = NULL;
    4.46 +
    4.47 +SMEXT_LINK(&g_TF2Tools);
    4.48 +
    4.49 +extern sp_nativeinfo_t g_TFNatives[];
    4.50 +
    4.51 +bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
    4.52 +{
    4.53 +	sharesys->AddDependency(myself, "bintools.ext", true, true);
    4.54 +
    4.55 +	char conf_error[255];
    4.56 +	if (!gameconfs->LoadGameConfigFile("sm-tf2.games", &g_pGameConf, conf_error, sizeof(conf_error)))
    4.57 +	{
    4.58 +		if (error)
    4.59 +		{
    4.60 +			snprintf(error, maxlength, "Could not read sm-cstrike.games.txt: %s", conf_error);
    4.61 +		}
    4.62 +		return false;
    4.63 +	}
    4.64 +
    4.65 +	sharesys->AddNatives(myself, g_TFNatives);
    4.66 +	sharesys->RegisterLibrary(myself, "tf2");
    4.67 +
    4.68 +	return true;
    4.69 +}
    4.70 +
    4.71 +bool TF2Tools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
    4.72 +{
    4.73 +	GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
    4.74 +
    4.75 +	return true;
    4.76 +}
    4.77 +
    4.78 +void TF2Tools::SDK_OnUnload()
    4.79 +{
    4.80 +	gameconfs->CloseGameConfigFile(g_pGameConf);
    4.81 +}
    4.82 +
    4.83 +void TF2Tools::SDK_OnAllLoaded()
    4.84 +{
    4.85 +}
    4.86 +
    4.87 +bool TF2Tools::QueryRunning(char *error, size_t maxlength)
    4.88 +{
    4.89 +	return true;
    4.90 +}
    4.91 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/extensions/tf2/extension.h	Fri Nov 23 05:27:58 2007 +0000
     5.3 @@ -0,0 +1,121 @@
     5.4 +/**
     5.5 + * vim: set ts=4 :
     5.6 + * =============================================================================
     5.7 + * SourceMod Counter-Strike:Source Extension
     5.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     5.9 + * =============================================================================
    5.10 + *
    5.11 + * This program is free software; you can redistribute it and/or modify it under
    5.12 + * the terms of the GNU General Public License, version 3.0, as published by the
    5.13 + * Free Software Foundation.
    5.14 + * 
    5.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
    5.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    5.18 + * details.
    5.19 + *
    5.20 + * You should have received a copy of the GNU General Public License along with
    5.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    5.22 + *
    5.23 + * As a special exception, AlliedModders LLC gives you permission to link the
    5.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    5.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    5.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
    5.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    5.28 + * this exception to all derivative works.  AlliedModders LLC defines further
    5.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    5.30 + * or <http://www.sourcemod.net/license.php>.
    5.31 + *
    5.32 + * Version: $Id$
    5.33 + */
    5.34 +
    5.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
    5.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
    5.37 +
    5.38 +/**
    5.39 + * @file extension.h
    5.40 + * @brief Sample extension code header.
    5.41 + */
    5.42 +
    5.43 +#include "smsdk_ext.h"
    5.44 +
    5.45 +/**
    5.46 + * @brief Sample implementation of the SDK Extension.
    5.47 + * Note: Uncomment one of the pre-defined virtual functions in order to use it.
    5.48 + */
    5.49 +class TF2Tools : public SDKExtension
    5.50 +{
    5.51 +public:
    5.52 +	/**
    5.53 +	 * @brief This is called after the initial loading sequence has been processed.
    5.54 +	 *
    5.55 +	 * @param error		Error message buffer.
    5.56 +	 * @param maxlength	Size of error message buffer.
    5.57 +	 * @param late		Whether or not the module was loaded after map load.
    5.58 +	 * @return			True to succeed loading, false to fail.
    5.59 +	 */
    5.60 +	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
    5.61 +	
    5.62 +	/**
    5.63 +	 * @brief This is called right before the extension is unloaded.
    5.64 +	 */
    5.65 +	virtual void SDK_OnUnload();
    5.66 +
    5.67 +	/**
    5.68 +	 * @brief This is called once all known extensions have been loaded.
    5.69 +	 * Note: It is is a good idea to add natives here, if any are provided.
    5.70 +	 */
    5.71 +	virtual void SDK_OnAllLoaded();
    5.72 +
    5.73 +	/**
    5.74 +	 * @brief Called when the pause state is changed.
    5.75 +	 */
    5.76 +	//virtual void SDK_OnPauseChange(bool paused);
    5.77 +
    5.78 +	/**
    5.79 +	 * @brief this is called when Core wants to know if your extension is working.
    5.80 +	 *
    5.81 +	 * @param error		Error message buffer.
    5.82 +	 * @param maxlength	Size of error message buffer.
    5.83 +	 * @return			True if working, false otherwise.
    5.84 +	 */
    5.85 +	virtual bool QueryRunning(char *error, size_t maxlength);
    5.86 +
    5.87 +	//void NotifyInterfaceDrop(SMInterface *pInterface);
    5.88 +	//bool QueryInterfaceDrop(SMInterface *pInterface);
    5.89 +public:
    5.90 +#if defined SMEXT_CONF_METAMOD
    5.91 +	/**
    5.92 +	 * @brief Called when Metamod is attached, before the extension version is called.
    5.93 +	 *
    5.94 +	 * @param error			Error buffer.
    5.95 +	 * @param maxlength		Maximum size of error buffer.
    5.96 +	 * @param late			Whether or not Metamod considers this a late load.
    5.97 +	 * @return				True to succeed, false to fail.
    5.98 +	 */
    5.99 +	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
   5.100 +
   5.101 +	/**
   5.102 +	 * @brief Called when Metamod is detaching, after the extension version is called.
   5.103 +	 * NOTE: By default this is blocked unless sent from SourceMod.
   5.104 +	 *
   5.105 +	 * @param error			Error buffer.
   5.106 +	 * @param maxlength		Maximum size of error buffer.
   5.107 +	 * @return				True to succeed, false to fail.
   5.108 +	 */
   5.109 +	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
   5.110 +
   5.111 +	/**
   5.112 +	 * @brief Called when Metamod's pause state is changing.
   5.113 +	 * NOTE: By default this is blocked unless sent from SourceMod.
   5.114 +	 *
   5.115 +	 * @param paused		Pause state being set.
   5.116 +	 * @param error			Error buffer.
   5.117 +	 * @param maxlength		Maximum size of error buffer.
   5.118 +	 * @return				True to succeed, false to fail.
   5.119 +	 */
   5.120 +	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
   5.121 +#endif
   5.122 +};
   5.123 +
   5.124 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/extensions/tf2/msvc8/tf2.sln	Fri Nov 23 05:27:58 2007 +0000
     6.3 @@ -0,0 +1,32 @@
     6.4 +
     6.5 +Microsoft Visual Studio Solution File, Format Version 9.00
     6.6 +# Visual Studio 2005
     6.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tf2", "tf2.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
     6.8 +EndProject
     6.9 +Global
    6.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    6.11 +		Debug - Episode1|Win32 = Debug - Episode1|Win32
    6.12 +		Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
    6.13 +		Debug - Orange Box|Win32 = Debug - Orange Box|Win32
    6.14 +		Release - Episode 1|Win32 = Release - Episode 1|Win32
    6.15 +		Release - Old Metamod|Win32 = Release - Old Metamod|Win32
    6.16 +		Release - Orange Box|Win32 = Release - Orange Box|Win32
    6.17 +	EndGlobalSection
    6.18 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    6.19 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode1|Win32.ActiveCfg = Debug - Episode1|Win32
    6.20 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Episode1|Win32.Build.0 = Debug - Episode1|Win32
    6.21 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
    6.22 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
    6.23 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
    6.24 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
    6.25 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
    6.26 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
    6.27 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
    6.28 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
    6.29 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
    6.30 +		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
    6.31 +	EndGlobalSection
    6.32 +	GlobalSection(SolutionProperties) = preSolution
    6.33 +		HideSolutionNode = FALSE
    6.34 +	EndGlobalSection
    6.35 +EndGlobal
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/extensions/tf2/msvc8/tf2.vcproj	Fri Nov 23 05:27:58 2007 +0000
     7.3 @@ -0,0 +1,719 @@
     7.4 +<?xml version="1.0" encoding="Windows-1252"?>
     7.5 +<VisualStudioProject
     7.6 +	ProjectType="Visual C++"
     7.7 +	Version="8.00"
     7.8 +	Name="tf2"
     7.9 +	ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
    7.10 +	RootNamespace="tf2"
    7.11 +	Keyword="Win32Proj"
    7.12 +	>
    7.13 +	<Platforms>
    7.14 +		<Platform
    7.15 +			Name="Win32"
    7.16 +		/>
    7.17 +	</Platforms>
    7.18 +	<ToolFiles>
    7.19 +	</ToolFiles>
    7.20 +	<Configurations>
    7.21 +		<Configuration
    7.22 +			Name="Debug|Win32"
    7.23 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    7.24 +			IntermediateDirectory="$(ConfigurationName)"
    7.25 +			ConfigurationType="2"
    7.26 +			CharacterSet="2"
    7.27 +			>
    7.28 +			<Tool
    7.29 +				Name="VCPreBuildEventTool"
    7.30 +			/>
    7.31 +			<Tool
    7.32 +				Name="VCCustomBuildTool"
    7.33 +			/>
    7.34 +			<Tool
    7.35 +				Name="VCXMLDataGeneratorTool"
    7.36 +			/>
    7.37 +			<Tool
    7.38 +				Name="VCWebServiceProxyGeneratorTool"
    7.39 +			/>
    7.40 +			<Tool
    7.41 +				Name="VCMIDLTool"
    7.42 +			/>
    7.43 +			<Tool
    7.44 +				Name="VCCLCompilerTool"
    7.45 +				Optimization="0"
    7.46 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions"
    7.47 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
    7.48 +				MinimalRebuild="true"
    7.49 +				BasicRuntimeChecks="3"
    7.50 +				RuntimeLibrary="1"
    7.51 +				EnableEnhancedInstructionSet="1"
    7.52 +				RuntimeTypeInfo="false"
    7.53 +				UsePrecompiledHeader="0"
    7.54 +				WarningLevel="3"
    7.55 +				Detect64BitPortabilityProblems="false"
    7.56 +				DebugInformationFormat="4"
    7.57 +			/>
    7.58 +			<Tool
    7.59 +				Name="VCManagedResourceCompilerTool"
    7.60 +			/>
    7.61 +			<Tool
    7.62 +				Name="VCResourceCompilerTool"
    7.63 +			/>
    7.64 +			<Tool
    7.65 +				Name="VCPreLinkEventTool"
    7.66 +			/>
    7.67 +			<Tool
    7.68 +				Name="VCLinkerTool"
    7.69 +				AdditionalDependencies="tier0.lib"
    7.70 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
    7.71 +				LinkIncremental="2"
    7.72 +				GenerateDebugInformation="true"
    7.73 +				SubSystem="2"
    7.74 +				TargetMachine="1"
    7.75 +			/>
    7.76 +			<Tool
    7.77 +				Name="VCALinkTool"
    7.78 +			/>
    7.79 +			<Tool
    7.80 +				Name="VCManifestTool"
    7.81 +			/>
    7.82 +			<Tool
    7.83 +				Name="VCXDCMakeTool"
    7.84 +			/>
    7.85 +			<Tool
    7.86 +				Name="VCBscMakeTool"
    7.87 +			/>
    7.88 +			<Tool
    7.89 +				Name="VCFxCopTool"
    7.90 +			/>
    7.91 +			<Tool
    7.92 +				Name="VCAppVerifierTool"
    7.93 +			/>
    7.94 +			<Tool
    7.95 +				Name="VCWebDeploymentTool"
    7.96 +			/>
    7.97 +			<Tool
    7.98 +				Name="VCPostBuildEventTool"
    7.99 +			/>
   7.100 +		</Configuration>
   7.101 +		<Configuration
   7.102 +			Name="Release|Win32"
   7.103 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.104 +			IntermediateDirectory="$(ConfigurationName)"
   7.105 +			ConfigurationType="2"
   7.106 +			CharacterSet="2"
   7.107 +			WholeProgramOptimization="1"
   7.108 +			>
   7.109 +			<Tool
   7.110 +				Name="VCPreBuildEventTool"
   7.111 +			/>
   7.112 +			<Tool
   7.113 +				Name="VCCustomBuildTool"
   7.114 +			/>
   7.115 +			<Tool
   7.116 +				Name="VCXMLDataGeneratorTool"
   7.117 +			/>
   7.118 +			<Tool
   7.119 +				Name="VCWebServiceProxyGeneratorTool"
   7.120 +			/>
   7.121 +			<Tool
   7.122 +				Name="VCMIDLTool"
   7.123 +			/>
   7.124 +			<Tool
   7.125 +				Name="VCCLCompilerTool"
   7.126 +				FavorSizeOrSpeed="1"
   7.127 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions"
   7.128 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.129 +				RuntimeLibrary="0"
   7.130 +				EnableEnhancedInstructionSet="1"
   7.131 +				RuntimeTypeInfo="false"
   7.132 +				UsePrecompiledHeader="0"
   7.133 +				WarningLevel="3"
   7.134 +				Detect64BitPortabilityProblems="false"
   7.135 +				DebugInformationFormat="3"
   7.136 +			/>
   7.137 +			<Tool
   7.138 +				Name="VCManagedResourceCompilerTool"
   7.139 +			/>
   7.140 +			<Tool
   7.141 +				Name="VCResourceCompilerTool"
   7.142 +			/>
   7.143 +			<Tool
   7.144 +				Name="VCPreLinkEventTool"
   7.145 +			/>
   7.146 +			<Tool
   7.147 +				Name="VCLinkerTool"
   7.148 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.149 +				LinkIncremental="1"
   7.150 +				GenerateDebugInformation="true"
   7.151 +				SubSystem="2"
   7.152 +				OptimizeReferences="2"
   7.153 +				EnableCOMDATFolding="2"
   7.154 +				TargetMachine="1"
   7.155 +			/>
   7.156 +			<Tool
   7.157 +				Name="VCALinkTool"
   7.158 +			/>
   7.159 +			<Tool
   7.160 +				Name="VCManifestTool"
   7.161 +			/>
   7.162 +			<Tool
   7.163 +				Name="VCXDCMakeTool"
   7.164 +			/>
   7.165 +			<Tool
   7.166 +				Name="VCBscMakeTool"
   7.167 +			/>
   7.168 +			<Tool
   7.169 +				Name="VCFxCopTool"
   7.170 +			/>
   7.171 +			<Tool
   7.172 +				Name="VCAppVerifierTool"
   7.173 +			/>
   7.174 +			<Tool
   7.175 +				Name="VCWebDeploymentTool"
   7.176 +			/>
   7.177 +			<Tool
   7.178 +				Name="VCPostBuildEventTool"
   7.179 +			/>
   7.180 +		</Configuration>
   7.181 +		<Configuration
   7.182 +			Name="Debug - Episode1|Win32"
   7.183 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.184 +			IntermediateDirectory="$(ConfigurationName)"
   7.185 +			ConfigurationType="2"
   7.186 +			CharacterSet="2"
   7.187 +			>
   7.188 +			<Tool
   7.189 +				Name="VCPreBuildEventTool"
   7.190 +			/>
   7.191 +			<Tool
   7.192 +				Name="VCCustomBuildTool"
   7.193 +			/>
   7.194 +			<Tool
   7.195 +				Name="VCXMLDataGeneratorTool"
   7.196 +			/>
   7.197 +			<Tool
   7.198 +				Name="VCWebServiceProxyGeneratorTool"
   7.199 +			/>
   7.200 +			<Tool
   7.201 +				Name="VCMIDLTool"
   7.202 +			/>
   7.203 +			<Tool
   7.204 +				Name="VCCLCompilerTool"
   7.205 +				Optimization="0"
   7.206 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
   7.207 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.208 +				MinimalRebuild="true"
   7.209 +				BasicRuntimeChecks="3"
   7.210 +				RuntimeLibrary="1"
   7.211 +				EnableEnhancedInstructionSet="1"
   7.212 +				RuntimeTypeInfo="false"
   7.213 +				UsePrecompiledHeader="0"
   7.214 +				WarningLevel="3"
   7.215 +				Detect64BitPortabilityProblems="false"
   7.216 +				DebugInformationFormat="4"
   7.217 +			/>
   7.218 +			<Tool
   7.219 +				Name="VCManagedResourceCompilerTool"
   7.220 +			/>
   7.221 +			<Tool
   7.222 +				Name="VCResourceCompilerTool"
   7.223 +			/>
   7.224 +			<Tool
   7.225 +				Name="VCPreLinkEventTool"
   7.226 +			/>
   7.227 +			<Tool
   7.228 +				Name="VCLinkerTool"
   7.229 +				AdditionalDependencies="$(HL2SDK)\lib\public\tier0.lib $(HL2SDK)\lib\public\tier1.lib $(HL2SDK)\lib\public\vstdlib.lib $(HL2SDK)\lib\public\mathlib.lib"
   7.230 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.231 +				LinkIncremental="2"
   7.232 +				GenerateDebugInformation="true"
   7.233 +				SubSystem="2"
   7.234 +				TargetMachine="1"
   7.235 +			/>
   7.236 +			<Tool
   7.237 +				Name="VCALinkTool"
   7.238 +			/>
   7.239 +			<Tool
   7.240 +				Name="VCManifestTool"
   7.241 +			/>
   7.242 +			<Tool
   7.243 +				Name="VCXDCMakeTool"
   7.244 +			/>
   7.245 +			<Tool
   7.246 +				Name="VCBscMakeTool"
   7.247 +			/>
   7.248 +			<Tool
   7.249 +				Name="VCFxCopTool"
   7.250 +			/>
   7.251 +			<Tool
   7.252 +				Name="VCAppVerifierTool"
   7.253 +			/>
   7.254 +			<Tool
   7.255 +				Name="VCWebDeploymentTool"
   7.256 +			/>
   7.257 +			<Tool
   7.258 +				Name="VCPostBuildEventTool"
   7.259 +			/>
   7.260 +		</Configuration>
   7.261 +		<Configuration
   7.262 +			Name="Debug - Orange Box|Win32"
   7.263 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.264 +			IntermediateDirectory="$(ConfigurationName)"
   7.265 +			ConfigurationType="2"
   7.266 +			CharacterSet="2"
   7.267 +			>
   7.268 +			<Tool
   7.269 +				Name="VCPreBuildEventTool"
   7.270 +			/>
   7.271 +			<Tool
   7.272 +				Name="VCCustomBuildTool"
   7.273 +			/>
   7.274 +			<Tool
   7.275 +				Name="VCXMLDataGeneratorTool"
   7.276 +			/>
   7.277 +			<Tool
   7.278 +				Name="VCWebServiceProxyGeneratorTool"
   7.279 +			/>
   7.280 +			<Tool
   7.281 +				Name="VCMIDLTool"
   7.282 +			/>
   7.283 +			<Tool
   7.284 +				Name="VCCLCompilerTool"
   7.285 +				Optimization="0"
   7.286 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDKOB)\public;$(HL2SDKOB)\public\dlls;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(HL2SDKOB)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
   7.287 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.288 +				MinimalRebuild="true"
   7.289 +				BasicRuntimeChecks="3"
   7.290 +				RuntimeLibrary="1"
   7.291 +				EnableEnhancedInstructionSet="1"
   7.292 +				RuntimeTypeInfo="false"
   7.293 +				UsePrecompiledHeader="0"
   7.294 +				WarningLevel="3"
   7.295 +				Detect64BitPortabilityProblems="false"
   7.296 +				DebugInformationFormat="4"
   7.297 +			/>
   7.298 +			<Tool
   7.299 +				Name="VCManagedResourceCompilerTool"
   7.300 +			/>
   7.301 +			<Tool
   7.302 +				Name="VCResourceCompilerTool"
   7.303 +			/>
   7.304 +			<Tool
   7.305 +				Name="VCPreLinkEventTool"
   7.306 +			/>
   7.307 +			<Tool
   7.308 +				Name="VCLinkerTool"
   7.309 +				AdditionalDependencies="$(HL2SDKOB)\lib\public\tier0.lib $(HL2SDKOB)\lib\public\tier1.lib $(HL2SDKOB)\lib\public\vstdlib.lib $(HL2SDKOB)\lib\public\mathlib.lib"
   7.310 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.311 +				LinkIncremental="2"
   7.312 +				GenerateDebugInformation="true"
   7.313 +				SubSystem="2"
   7.314 +				TargetMachine="1"
   7.315 +			/>
   7.316 +			<Tool
   7.317 +				Name="VCALinkTool"
   7.318 +			/>
   7.319 +			<Tool
   7.320 +				Name="VCManifestTool"
   7.321 +			/>
   7.322 +			<Tool
   7.323 +				Name="VCXDCMakeTool"
   7.324 +			/>
   7.325 +			<Tool
   7.326 +				Name="VCBscMakeTool"
   7.327 +			/>
   7.328 +			<Tool
   7.329 +				Name="VCFxCopTool"
   7.330 +			/>
   7.331 +			<Tool
   7.332 +				Name="VCAppVerifierTool"
   7.333 +			/>
   7.334 +			<Tool
   7.335 +				Name="VCWebDeploymentTool"
   7.336 +			/>
   7.337 +			<Tool
   7.338 +				Name="VCPostBuildEventTool"
   7.339 +			/>
   7.340 +		</Configuration>
   7.341 +		<Configuration
   7.342 +			Name="Debug - Old Metamod|Win32"
   7.343 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.344 +			IntermediateDirectory="$(ConfigurationName)"
   7.345 +			ConfigurationType="2"
   7.346 +			CharacterSet="2"
   7.347 +			>
   7.348 +			<Tool
   7.349 +				Name="VCPreBuildEventTool"
   7.350 +			/>
   7.351 +			<Tool
   7.352 +				Name="VCCustomBuildTool"
   7.353 +			/>
   7.354 +			<Tool
   7.355 +				Name="VCXMLDataGeneratorTool"
   7.356 +			/>
   7.357 +			<Tool
   7.358 +				Name="VCWebServiceProxyGeneratorTool"
   7.359 +			/>
   7.360 +			<Tool
   7.361 +				Name="VCMIDLTool"
   7.362 +			/>
   7.363 +			<Tool
   7.364 +				Name="VCCLCompilerTool"
   7.365 +				Optimization="0"
   7.366 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM142);$(SOURCEMM142)\sourcemm;$(SOURCEMM142)\sourcehook"
   7.367 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.368 +				MinimalRebuild="true"
   7.369 +				BasicRuntimeChecks="3"
   7.370 +				RuntimeLibrary="1"
   7.371 +				EnableEnhancedInstructionSet="1"
   7.372 +				RuntimeTypeInfo="false"
   7.373 +				UsePrecompiledHeader="0"
   7.374 +				WarningLevel="3"
   7.375 +				Detect64BitPortabilityProblems="false"
   7.376 +				DebugInformationFormat="4"
   7.377 +			/>
   7.378 +			<Tool
   7.379 +				Name="VCManagedResourceCompilerTool"
   7.380 +			/>
   7.381 +			<Tool
   7.382 +				Name="VCResourceCompilerTool"
   7.383 +			/>
   7.384 +			<Tool
   7.385 +				Name="VCPreLinkEventTool"
   7.386 +			/>
   7.387 +			<Tool
   7.388 +				Name="VCLinkerTool"
   7.389 +				AdditionalDependencies="$(HL2SDK)\lib\public\tier0.lib $(HL2SDK)\lib\public\tier1.lib $(HL2SDK)\lib\public\vstdlib.lib $(HL2SDK)\lib\public\mathlib.lib"
   7.390 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.391 +				LinkIncremental="2"
   7.392 +				GenerateDebugInformation="true"
   7.393 +				SubSystem="2"
   7.394 +				TargetMachine="1"
   7.395 +			/>
   7.396 +			<Tool
   7.397 +				Name="VCALinkTool"
   7.398 +			/>
   7.399 +			<Tool
   7.400 +				Name="VCManifestTool"
   7.401 +			/>
   7.402 +			<Tool
   7.403 +				Name="VCXDCMakeTool"
   7.404 +			/>
   7.405 +			<Tool
   7.406 +				Name="VCBscMakeTool"
   7.407 +			/>
   7.408 +			<Tool
   7.409 +				Name="VCFxCopTool"
   7.410 +			/>
   7.411 +			<Tool
   7.412 +				Name="VCAppVerifierTool"
   7.413 +			/>
   7.414 +			<Tool
   7.415 +				Name="VCWebDeploymentTool"
   7.416 +			/>
   7.417 +			<Tool
   7.418 +				Name="VCPostBuildEventTool"
   7.419 +			/>
   7.420 +		</Configuration>
   7.421 +		<Configuration
   7.422 +			Name="Release - Old Metamod|Win32"
   7.423 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.424 +			IntermediateDirectory="$(ConfigurationName)"
   7.425 +			ConfigurationType="2"
   7.426 +			CharacterSet="2"
   7.427 +			WholeProgramOptimization="1"
   7.428 +			>
   7.429 +			<Tool
   7.430 +				Name="VCPreBuildEventTool"
   7.431 +			/>
   7.432 +			<Tool
   7.433 +				Name="VCCustomBuildTool"
   7.434 +			/>
   7.435 +			<Tool
   7.436 +				Name="VCXMLDataGeneratorTool"
   7.437 +			/>
   7.438 +			<Tool
   7.439 +				Name="VCWebServiceProxyGeneratorTool"
   7.440 +			/>
   7.441 +			<Tool
   7.442 +				Name="VCMIDLTool"
   7.443 +			/>
   7.444 +			<Tool
   7.445 +				Name="VCCLCompilerTool"
   7.446 +				FavorSizeOrSpeed="1"
   7.447 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM142);$(SOURCEMM142)\sourcemm;$(SOURCEMM142)\sourcehook"
   7.448 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.449 +				RuntimeLibrary="0"
   7.450 +				EnableEnhancedInstructionSet="1"
   7.451 +				RuntimeTypeInfo="false"
   7.452 +				UsePrecompiledHeader="0"
   7.453 +				WarningLevel="3"
   7.454 +				Detect64BitPortabilityProblems="false"
   7.455 +				DebugInformationFormat="3"
   7.456 +			/>
   7.457 +			<Tool
   7.458 +				Name="VCManagedResourceCompilerTool"
   7.459 +			/>
   7.460 +			<Tool
   7.461 +				Name="VCResourceCompilerTool"
   7.462 +			/>
   7.463 +			<Tool
   7.464 +				Name="VCPreLinkEventTool"
   7.465 +			/>
   7.466 +			<Tool
   7.467 +				Name="VCLinkerTool"
   7.468 +				AdditionalDependencies="$(HL2SDK)\lib\public\tier0.lib $(HL2SDK)\lib\public\tier1.lib $(HL2SDK)\lib\public\vstdlib.lib $(HL2SDK)\lib\public\mathlib.lib"
   7.469 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.470 +				LinkIncremental="1"
   7.471 +				GenerateDebugInformation="true"
   7.472 +				SubSystem="2"
   7.473 +				OptimizeReferences="2"
   7.474 +				EnableCOMDATFolding="2"
   7.475 +				TargetMachine="1"
   7.476 +			/>
   7.477 +			<Tool
   7.478 +				Name="VCALinkTool"
   7.479 +			/>
   7.480 +			<Tool
   7.481 +				Name="VCManifestTool"
   7.482 +			/>
   7.483 +			<Tool
   7.484 +				Name="VCXDCMakeTool"
   7.485 +			/>
   7.486 +			<Tool
   7.487 +				Name="VCBscMakeTool"
   7.488 +			/>
   7.489 +			<Tool
   7.490 +				Name="VCFxCopTool"
   7.491 +			/>
   7.492 +			<Tool
   7.493 +				Name="VCAppVerifierTool"
   7.494 +			/>
   7.495 +			<Tool
   7.496 +				Name="VCWebDeploymentTool"
   7.497 +			/>
   7.498 +			<Tool
   7.499 +				Name="VCPostBuildEventTool"
   7.500 +			/>
   7.501 +		</Configuration>
   7.502 +		<Configuration
   7.503 +			Name="Release - Orange Box|Win32"
   7.504 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.505 +			IntermediateDirectory="$(ConfigurationName)"
   7.506 +			ConfigurationType="2"
   7.507 +			CharacterSet="2"
   7.508 +			WholeProgramOptimization="1"
   7.509 +			>
   7.510 +			<Tool
   7.511 +				Name="VCPreBuildEventTool"
   7.512 +			/>
   7.513 +			<Tool
   7.514 +				Name="VCCustomBuildTool"
   7.515 +			/>
   7.516 +			<Tool
   7.517 +				Name="VCXMLDataGeneratorTool"
   7.518 +			/>
   7.519 +			<Tool
   7.520 +				Name="VCWebServiceProxyGeneratorTool"
   7.521 +			/>
   7.522 +			<Tool
   7.523 +				Name="VCMIDLTool"
   7.524 +			/>
   7.525 +			<Tool
   7.526 +				Name="VCCLCompilerTool"
   7.527 +				FavorSizeOrSpeed="1"
   7.528 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDKOB)\public;$(HL2SDKOB)\public\dlls;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(HL2SDKOB)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
   7.529 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.530 +				RuntimeLibrary="0"
   7.531 +				EnableEnhancedInstructionSet="1"
   7.532 +				RuntimeTypeInfo="false"
   7.533 +				UsePrecompiledHeader="0"
   7.534 +				WarningLevel="3"
   7.535 +				Detect64BitPortabilityProblems="false"
   7.536 +				DebugInformationFormat="3"
   7.537 +			/>
   7.538 +			<Tool
   7.539 +				Name="VCManagedResourceCompilerTool"
   7.540 +			/>
   7.541 +			<Tool
   7.542 +				Name="VCResourceCompilerTool"
   7.543 +			/>
   7.544 +			<Tool
   7.545 +				Name="VCPreLinkEventTool"
   7.546 +			/>
   7.547 +			<Tool
   7.548 +				Name="VCLinkerTool"
   7.549 +				AdditionalDependencies="$(HL2SDKOB)\lib\public\tier0.lib $(HL2SDKOB)\lib\public\tier1.lib $(HL2SDKOB)\lib\public\vstdlib.lib $(HL2SDKOB)\lib\public\mathlib.lib"
   7.550 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.551 +				LinkIncremental="1"
   7.552 +				GenerateDebugInformation="true"
   7.553 +				SubSystem="2"
   7.554 +				OptimizeReferences="2"
   7.555 +				EnableCOMDATFolding="2"
   7.556 +				TargetMachine="1"
   7.557 +			/>
   7.558 +			<Tool
   7.559 +				Name="VCALinkTool"
   7.560 +			/>
   7.561 +			<Tool
   7.562 +				Name="VCManifestTool"
   7.563 +			/>
   7.564 +			<Tool
   7.565 +				Name="VCXDCMakeTool"
   7.566 +			/>
   7.567 +			<Tool
   7.568 +				Name="VCBscMakeTool"
   7.569 +			/>
   7.570 +			<Tool
   7.571 +				Name="VCFxCopTool"
   7.572 +			/>
   7.573 +			<Tool
   7.574 +				Name="VCAppVerifierTool"
   7.575 +			/>
   7.576 +			<Tool
   7.577 +				Name="VCWebDeploymentTool"
   7.578 +			/>
   7.579 +			<Tool
   7.580 +				Name="VCPostBuildEventTool"
   7.581 +			/>
   7.582 +		</Configuration>
   7.583 +		<Configuration
   7.584 +			Name="Release - Episode 1|Win32"
   7.585 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   7.586 +			IntermediateDirectory="$(ConfigurationName)"
   7.587 +			ConfigurationType="2"
   7.588 +			CharacterSet="2"
   7.589 +			WholeProgramOptimization="1"
   7.590 +			>
   7.591 +			<Tool
   7.592 +				Name="VCPreBuildEventTool"
   7.593 +			/>
   7.594 +			<Tool
   7.595 +				Name="VCCustomBuildTool"
   7.596 +			/>
   7.597 +			<Tool
   7.598 +				Name="VCXMLDataGeneratorTool"
   7.599 +			/>
   7.600 +			<Tool
   7.601 +				Name="VCWebServiceProxyGeneratorTool"
   7.602 +			/>
   7.603 +			<Tool
   7.604 +				Name="VCMIDLTool"
   7.605 +			/>
   7.606 +			<Tool
   7.607 +				Name="VCCLCompilerTool"
   7.608 +				FavorSizeOrSpeed="1"
   7.609 +				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;..\..\..\public\extensions;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
   7.610 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CSTRIKE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
   7.611 +				RuntimeLibrary="0"
   7.612 +				EnableEnhancedInstructionSet="1"
   7.613 +				RuntimeTypeInfo="false"
   7.614 +				UsePrecompiledHeader="0"
   7.615 +				WarningLevel="3"
   7.616 +				Detect64BitPortabilityProblems="false"
   7.617 +				DebugInformationFormat="3"
   7.618 +			/>
   7.619 +			<Tool
   7.620 +				Name="VCManagedResourceCompilerTool"
   7.621 +			/>
   7.622 +			<Tool
   7.623 +				Name="VCResourceCompilerTool"
   7.624 +			/>
   7.625 +			<Tool
   7.626 +				Name="VCPreLinkEventTool"
   7.627 +			/>
   7.628 +			<Tool
   7.629 +				Name="VCLinkerTool"
   7.630 +				AdditionalDependencies="$(HL2SDK)\lib\public\tier0.lib $(HL2SDK)\lib\public\tier1.lib $(HL2SDK)\lib\public\vstdlib.lib $(HL2SDK)\lib\public\mathlib.lib"
   7.631 +				OutputFile="$(OutDir)\game.tf2.ext.dll"
   7.632 +				LinkIncremental="1"
   7.633 +				GenerateDebugInformation="true"
   7.634 +				SubSystem="2"
   7.635 +				OptimizeReferences="2"
   7.636 +				EnableCOMDATFolding="2"
   7.637 +				TargetMachine="1"
   7.638 +			/>
   7.639 +			<Tool
   7.640 +				Name="VCALinkTool"
   7.641 +			/>
   7.642 +			<Tool
   7.643 +				Name="VCManifestTool"
   7.644 +			/>
   7.645 +			<Tool
   7.646 +				Name="VCXDCMakeTool"
   7.647 +			/>
   7.648 +			<Tool
   7.649 +				Name="VCBscMakeTool"
   7.650 +			/>
   7.651 +			<Tool
   7.652 +				Name="VCFxCopTool"
   7.653 +			/>
   7.654 +			<Tool
   7.655 +				Name="VCAppVerifierTool"
   7.656 +			/>
   7.657 +			<Tool
   7.658 +				Name="VCWebDeploymentTool"
   7.659 +			/>
   7.660 +			<Tool
   7.661 +				Name="VCPostBuildEventTool"
   7.662 +			/>
   7.663 +		</Configuration>
   7.664 +	</Configurations>
   7.665 +	<References>
   7.666 +	</References>
   7.667 +	<Files>
   7.668 +		<Filter
   7.669 +			Name="Source Files"
   7.670 +			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
   7.671 +			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
   7.672 +			>
   7.673 +			<File
   7.674 +				RelativePath="..\extension.cpp"
   7.675 +				>
   7.676 +			</File>
   7.677 +			<File
   7.678 +				RelativePath="..\natives.cpp"
   7.679 +				>
   7.680 +			</File>
   7.681 +		</Filter>
   7.682 +		<Filter
   7.683 +			Name="Header Files"
   7.684 +			Filter="h;hpp;hxx;hm;inl;inc;xsd"
   7.685 +			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
   7.686 +			>
   7.687 +			<File
   7.688 +				RelativePath="..\extension.h"
   7.689 +				>
   7.690 +			</File>
   7.691 +		</Filter>
   7.692 +		<Filter
   7.693 +			Name="Resource Files"
   7.694 +			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
   7.695 +			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
   7.696 +			>
   7.697 +			<File
   7.698 +				RelativePath="..\version.rc"
   7.699 +				>
   7.700 +			</File>
   7.701 +		</Filter>
   7.702 +		<Filter
   7.703 +			Name="SourceMod SDK"
   7.704 +			UniqueIdentifier="{31958233-BB2D-4e41-A8F9-CE8A4684F436}"
   7.705 +			>
   7.706 +			<File
   7.707 +				RelativePath="..\sdk\smsdk_config.h"
   7.708 +				>
   7.709 +			</File>
   7.710 +			<File
   7.711 +				RelativePath="..\sdk\smsdk_ext.cpp"
   7.712 +				>
   7.713 +			</File>
   7.714 +			<File
   7.715 +				RelativePath="..\sdk\smsdk_ext.h"
   7.716 +				>
   7.717 +			</File>
   7.718 +		</Filter>
   7.719 +	</Files>
   7.720 +	<Globals>
   7.721 +	</Globals>
   7.722 +</VisualStudioProject>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/extensions/tf2/natives.cpp	Fri Nov 23 05:27:58 2007 +0000
     8.3 @@ -0,0 +1,67 @@
     8.4 +/**
     8.5 + * vim: set ts=4 :
     8.6 + * =============================================================================
     8.7 + * SourceMod Counter-Strike:Source Extension
     8.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     8.9 + * =============================================================================
    8.10 + *
    8.11 + * This program is free software; you can redistribute it and/or modify it under
    8.12 + * the terms of the GNU General Public License, version 3.0, as published by the
    8.13 + * Free Software Foundation.
    8.14 + * 
    8.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
    8.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    8.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    8.18 + * details.
    8.19 + *
    8.20 + * You should have received a copy of the GNU General Public License along with
    8.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    8.22 + *
    8.23 + * As a special exception, AlliedModders LLC gives you permission to link the
    8.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    8.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    8.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
    8.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    8.28 + * this exception to all derivative works.  AlliedModders LLC defines further
    8.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    8.30 + * or <http://www.sourcemod.net/license.php>.
    8.31 + *
    8.32 + * Version: $Id$
    8.33 + */
    8.34 +
    8.35 +#include "extension.h"
    8.36 +
    8.37 +inline CBaseEntity *GetCBaseEntity(int num, bool onlyPlayers)
    8.38 +{
    8.39 +	edict_t *pEdict = engine->PEntityOfEntIndex(num);
    8.40 +	if (!pEdict || pEdict->IsFree())
    8.41 +	{
    8.42 +		return NULL;
    8.43 +	}
    8.44 +
    8.45 +	if (num > 0 && num < playerhelpers->GetMaxClients())
    8.46 +	{
    8.47 +		IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(pEdict);
    8.48 +		if (!pPlayer || !pPlayer->IsConnected())
    8.49 +		{
    8.50 +			return NULL;
    8.51 +		}
    8.52 +	}
    8.53 +	else if (onlyPlayers)
    8.54 +	{
    8.55 +		return NULL;
    8.56 +	}
    8.57 +
    8.58 +	IServerUnknown *pUnk;
    8.59 +	if ((pUnk=pEdict->GetUnknown()) == NULL)
    8.60 +	{
    8.61 +		return NULL;
    8.62 +	}
    8.63 +
    8.64 +	return pUnk->GetBaseEntity();
    8.65 +}
    8.66 +
    8.67 +sp_nativeinfo_t g_TFNatives[] = 
    8.68 +{
    8.69 +	{NULL,							NULL}
    8.70 +};
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/extensions/tf2/sdk/smsdk_config.h	Fri Nov 23 05:27:58 2007 +0000
     9.3 @@ -0,0 +1,76 @@
     9.4 +/**
     9.5 + * vim: set ts=4 :
     9.6 + * =============================================================================
     9.7 + * SourceMod Counter-Strike:Source Extension
     9.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
     9.9 + * =============================================================================
    9.10 + *
    9.11 + * This program is free software; you can redistribute it and/or modify it under
    9.12 + * the terms of the GNU General Public License, version 3.0, as published by the
    9.13 + * Free Software Foundation.
    9.14 + * 
    9.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
    9.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    9.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    9.18 + * details.
    9.19 + *
    9.20 + * You should have received a copy of the GNU General Public License along with
    9.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    9.22 + *
    9.23 + * As a special exception, AlliedModders LLC gives you permission to link the
    9.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    9.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    9.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
    9.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    9.28 + * this exception to all derivative works.  AlliedModders LLC defines further
    9.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    9.30 + * or <http://www.sourcemod.net/license.php>.
    9.31 + *
    9.32 + * Version: $Id$
    9.33 + */
    9.34 +
    9.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
    9.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
    9.37 +
    9.38 +/**
    9.39 + * @file smsdk_config.h
    9.40 + * @brief Contains macros for configuring basic extension information.
    9.41 + */
    9.42 +
    9.43 +#include "svn_version.h"
    9.44 +
    9.45 +/* Basic information exposed publicly */
    9.46 +#define SMEXT_CONF_NAME			"TF2 Tools"
    9.47 +#define SMEXT_CONF_DESCRIPTION	"TF2 extended functionality"
    9.48 +#define SMEXT_CONF_VERSION		SVN_FULL_VERSION
    9.49 +#define SMEXT_CONF_AUTHOR		"AlliedModders LLC"
    9.50 +#define SMEXT_CONF_URL			"http://www.sourcemod.net/"
    9.51 +#define SMEXT_CONF_LOGTAG		"TF2"
    9.52 +#define SMEXT_CONF_LICENSE		"GPL"
    9.53 +#define SMEXT_CONF_DATESTRING	__DATE__
    9.54 +
    9.55 +/** 
    9.56 + * @brief Exposes plugin's main interface.
    9.57 + */
    9.58 +#define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name;
    9.59 +
    9.60 +/**
    9.61 + * @brief Sets whether or not this plugin required Metamod.
    9.62 + * NOTE: Uncomment to enable, comment to disable.
    9.63 + */
    9.64 +#define SMEXT_CONF_METAMOD		
    9.65 +
    9.66 +/** Enable interfaces you want to use here by uncommenting lines */
    9.67 +//#define SMEXT_ENABLE_FORWARDSYS
    9.68 +//#define SMEXT_ENABLE_HANDLESYS
    9.69 +#define SMEXT_ENABLE_PLAYERHELPERS
    9.70 +//#define SMEXT_ENABLE_DBMANAGER
    9.71 +#define SMEXT_ENABLE_GAMECONF
    9.72 +//#define SMEXT_ENABLE_MEMUTILS
    9.73 +//#define SMEXT_ENABLE_GAMEHELPERS
    9.74 +//#define SMEXT_ENABLE_TIMERSYS
    9.75 +//#define SMEXT_ENABLE_THREADER
    9.76 +//#define SMEXT_ENABLE_LIBSYS
    9.77 +//#define SMEXT_ENABLE_USERMSGS
    9.78 +
    9.79 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/extensions/tf2/sdk/smsdk_ext.cpp	Fri Nov 23 05:27:58 2007 +0000
    10.3 @@ -0,0 +1,422 @@
    10.4 +/**
    10.5 + * vim: set ts=4 :
    10.6 + * =============================================================================
    10.7 + * SourceMod Base Extension Code
    10.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
    10.9 + * =============================================================================
   10.10 + *
   10.11 + * This program is free software; you can redistribute it and/or modify it under
   10.12 + * the terms of the GNU General Public License, version 3.0, as published by the
   10.13 + * Free Software Foundation.
   10.14 + * 
   10.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
   10.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   10.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   10.18 + * details.
   10.19 + *
   10.20 + * You should have received a copy of the GNU General Public License along with
   10.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   10.22 + *
   10.23 + * As a special exception, AlliedModders LLC gives you permission to link the
   10.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   10.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   10.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
   10.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   10.28 + * this exception to all derivative works.  AlliedModders LLC defines further
   10.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   10.30 + * or <http://www.sourcemod.net/license.php>.
   10.31 + *
   10.32 + * Version: $Id$
   10.33 + */
   10.34 +
   10.35 +#include <stdio.h>
   10.36 +#include <malloc.h>
   10.37 +#include "smsdk_ext.h"
   10.38 +
   10.39 +/**
   10.40 + * @file smsdk_ext.cpp
   10.41 + * @brief Contains wrappers for making Extensions easier to write.
   10.42 + */
   10.43 +
   10.44 +IExtension *myself = NULL;				/**< Ourself */
   10.45 +IShareSys *g_pShareSys = NULL;			/**< Share system */
   10.46 +IShareSys *sharesys = NULL;				/**< Share system */
   10.47 +ISourceMod *g_pSM = NULL;				/**< SourceMod helpers */
   10.48 +ISourceMod *smutils = NULL;				/**< SourceMod helpers */
   10.49 +
   10.50 +#if defined SMEXT_ENABLE_FORWARDSYS
   10.51 +IForwardManager *g_pForwards = NULL;	/**< Forward system */
   10.52 +IForwardManager *forwards = NULL;		/**< Forward system */
   10.53 +#endif
   10.54 +#if defined SMEXT_ENABLE_HANDLESYS
   10.55 +IHandleSys *g_pHandleSys = NULL;		/**< Handle system */
   10.56 +IHandleSys *handlesys = NULL;			/**< Handle system */
   10.57 +#endif
   10.58 +#if defined SMEXT_ENABLE_PLAYERHELPERS
   10.59 +IPlayerManager *playerhelpers = NULL;	/**< Player helpers */
   10.60 +#endif //SMEXT_ENABLE_PLAYERHELPERS
   10.61 +#if defined SMEXT_ENABLE_DBMANAGER
   10.62 +IDBManager *dbi = NULL;					/**< DB Manager */
   10.63 +#endif //SMEXT_ENABLE_DBMANAGER
   10.64 +#if defined SMEXT_ENABLE_GAMECONF
   10.65 +IGameConfigManager *gameconfs = NULL;	/**< Game config manager */
   10.66 +#endif //SMEXT_ENABLE_DBMANAGER
   10.67 +#if defined SMEXT_ENABLE_MEMUTILS
   10.68 +IMemoryUtils *memutils = NULL;
   10.69 +#endif //SMEXT_ENABLE_DBMANAGER
   10.70 +#if defined SMEXT_ENABLE_GAMEHELPERS
   10.71 +IGameHelpers *gamehelpers = NULL;
   10.72 +#endif
   10.73 +#if defined SMEXT_ENABLE_TIMERSYS
   10.74 +ITimerSystem *timersys = NULL;
   10.75 +#endif
   10.76 +#if defined SMEXT_ENABLE_ADTFACTORY
   10.77 +IADTFactory *adtfactory = NULL;
   10.78 +#endif
   10.79 +#if defined SMEXT_ENABLE_THREADER
   10.80 +IThreader *threader = NULL;
   10.81 +#endif
   10.82 +#if defined SMEXT_ENABLE_LIBSYS
   10.83 +ILibrarySys *libsys = NULL;
   10.84 +#endif
   10.85 +#if defined SMEXT_ENABLE_USERMSGS
   10.86 +IUserMessages *usermsgs = NULL;
   10.87 +#endif
   10.88 +
   10.89 +/** Exports the main interface */
   10.90 +PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
   10.91 +{
   10.92 +	return g_pExtensionIface;
   10.93 +}
   10.94 +
   10.95 +SDKExtension::SDKExtension()
   10.96 +{
   10.97 +#if defined SMEXT_CONF_METAMOD
   10.98 +	m_SourceMMLoaded = false;
   10.99 +	m_WeAreUnloaded = false;
  10.100 +	m_WeGotPauseChange = false;
  10.101 +#endif
  10.102 +}
  10.103 +
  10.104 +bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late)
  10.105 +{
  10.106 +	g_pShareSys = sharesys = sys;
  10.107 +	myself = me;
  10.108 +
  10.109 +#if defined SMEXT_CONF_METAMOD
  10.110 +	m_WeAreUnloaded = true;
  10.111 +
  10.112 +	if (!m_SourceMMLoaded)
  10.113 +	{
  10.114 +		if (error)
  10.115 +		{
  10.116 +			snprintf(error, maxlength, "Metamod attach failed");
  10.117 +		}
  10.118 +		return false;
  10.119 +	}
  10.120 +#endif
  10.121 +	SM_GET_IFACE(SOURCEMOD, g_pSM);
  10.122 +	smutils = g_pSM;
  10.123 +#if defined SMEXT_ENABLE_HANDLESYS
  10.124 +	SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys);
  10.125 +	handlesys = g_pHandleSys;
  10.126 +#endif
  10.127 +#if defined SMEXT_ENABLE_FORWARDSYS
  10.128 +	SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
  10.129 +	forwards = g_pForwards;
  10.130 +#endif
  10.131 +#if defined SMEXT_ENABLE_PLAYERHELPERS
  10.132 +	SM_GET_IFACE(PLAYERMANAGER, playerhelpers);
  10.133 +#endif
  10.134 +#if defined SMEXT_ENABLE_DBMANAGER
  10.135 +	SM_GET_IFACE(DBI, dbi);
  10.136 +#endif
  10.137 +#if defined SMEXT_ENABLE_GAMECONF
  10.138 +	SM_GET_IFACE(GAMECONFIG, gameconfs);
  10.139 +#endif
  10.140 +#if defined SMEXT_ENABLE_MEMUTILS
  10.141 +	SM_GET_IFACE(MEMORYUTILS, memutils);
  10.142 +#endif
  10.143 +#if defined SMEXT_ENABLE_GAMEHELPERS
  10.144 +	SM_GET_IFACE(GAMEHELPERS, gamehelpers);
  10.145 +#endif
  10.146 +#if defined SMEXT_ENABLE_TIMERSYS
  10.147 +	SM_GET_IFACE(TIMERSYS, timersys);
  10.148 +#endif
  10.149 +#if defined SMEXT_ENABLE_ADTFACTORY
  10.150 +	SM_GET_IFACE(ADTFACTORY, adtfactory);
  10.151 +#endif
  10.152 +#if defined SMEXT_ENABLE_THREADER
  10.153 +	SM_GET_IFACE(THREADER, threader);
  10.154 +#endif
  10.155 +#if defined SMEXT_ENABLE_LIBSYS
  10.156 +	SM_GET_IFACE(LIBRARYSYS, libsys);
  10.157 +#endif
  10.158 +#if defined SMEXT_ENABLE_USERMSGS
  10.159 +	SM_GET_IFACE(USERMSGS, usermsgs);
  10.160 +#endif
  10.161 +
  10.162 +	if (SDK_OnLoad(error, maxlength, late))
  10.163 +	{
  10.164 +#if defined SMEXT_CONF_METAMOD
  10.165 +		m_WeAreUnloaded = true;
  10.166 +#endif
  10.167 +		return true;
  10.168 +	}
  10.169 +
  10.170 +	return false;
  10.171 +}
  10.172 +
  10.173 +bool SDKExtension::IsMetamodExtension()
  10.174 +{
  10.175 +#if defined SMEXT_CONF_METAMOD
  10.176 +	return true;
  10.177 +#else
  10.178 +	return false;
  10.179 +#endif
  10.180 +}
  10.181 +
  10.182 +void SDKExtension::OnExtensionPauseChange(bool state)
  10.183 +{
  10.184 +#if defined SMEXT_CONF_METAMOD
  10.185 +	m_WeGotPauseChange = true;
  10.186 +#endif
  10.187 +	SDK_OnPauseChange(state);
  10.188 +}
  10.189 +
  10.190 +void SDKExtension::OnExtensionsAllLoaded()
  10.191 +{
  10.192 +	SDK_OnAllLoaded();
  10.193 +}
  10.194 +
  10.195 +void SDKExtension::OnExtensionUnload()
  10.196 +{
  10.197 +#if defined SMEXT_CONF_METAMOD
  10.198 +	m_WeAreUnloaded = true;
  10.199 +#endif
  10.200 +	SDK_OnUnload();
  10.201 +}
  10.202 +
  10.203 +const char *SDKExtension::GetExtensionAuthor()
  10.204 +{
  10.205 +	return SMEXT_CONF_AUTHOR;
  10.206 +}
  10.207 +
  10.208 +const char *SDKExtension::GetExtensionDateString()
  10.209 +{
  10.210 +	return SMEXT_CONF_DATESTRING;
  10.211 +}
  10.212 +
  10.213 +const char *SDKExtension::GetExtensionDescription()
  10.214 +{
  10.215 +	return SMEXT_CONF_DESCRIPTION;
  10.216 +}
  10.217 +
  10.218 +const char *SDKExtension::GetExtensionVerString()
  10.219 +{
  10.220 +	return SMEXT_CONF_VERSION;
  10.221 +}
  10.222 +
  10.223 +const char *SDKExtension::GetExtensionName()
  10.224 +{
  10.225 +	return SMEXT_CONF_NAME;
  10.226 +}
  10.227 +
  10.228 +const char *SDKExtension::GetExtensionTag()
  10.229 +{
  10.230 +	return SMEXT_CONF_LOGTAG;
  10.231 +}
  10.232 +
  10.233 +const char *SDKExtension::GetExtensionURL()
  10.234 +{
  10.235 +	return SMEXT_CONF_URL;
  10.236 +}
  10.237 +
  10.238 +bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late)
  10.239 +{
  10.240 +	return true;
  10.241 +}
  10.242 +
  10.243 +void SDKExtension::SDK_OnUnload()
  10.244 +{
  10.245 +}
  10.246 +
  10.247 +void SDKExtension::SDK_OnPauseChange(bool paused)
  10.248 +{
  10.249 +}
  10.250 +
  10.251 +void SDKExtension::SDK_OnAllLoaded()
  10.252 +{
  10.253 +}
  10.254 +
  10.255 +#if defined SMEXT_CONF_METAMOD
  10.256 +
  10.257 +PluginId g_PLID = 0;						/**< Metamod plugin ID */
  10.258 +ISmmPlugin *g_PLAPI = NULL;					/**< Metamod plugin API */
  10.259 +SourceHook::ISourceHook *g_SHPtr = NULL;	/**< SourceHook pointer */
  10.260 +ISmmAPI *g_SMAPI = NULL;					/**< SourceMM API pointer */
  10.261 +
  10.262 +IVEngineServer *engine = NULL;				/**< IVEngineServer pointer */
  10.263 +IServerGameDLL *gamedll = NULL;				/**< IServerGameDLL pointer */
  10.264 +
  10.265 +/** Exposes the extension to Metamod */
  10.266 +SMM_API void *PL_EXPOSURE(const char *name, int *code)
  10.267 +{
  10.268 +	if (name && !strcmp(name, METAMOD_PLAPI_NAME))
  10.269 +	{
  10.270 +		if (code)
  10.271 +		{
  10.272 +			*code = IFACE_OK;
  10.273 +		}
  10.274 +		return static_cast<void *>(g_pExtensionIface);
  10.275 +	}
  10.276 +
  10.277 +	if (code)
  10.278 +	{
  10.279 +		*code = IFACE_FAILED;
  10.280 +	}
  10.281 +
  10.282 +	return NULL;
  10.283 +}
  10.284 +
  10.285 +bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
  10.286 +{
  10.287 +	PLUGIN_SAVEVARS();
  10.288 +
  10.289 +	GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
  10.290 +	GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
  10.291 +
  10.292 +	m_SourceMMLoaded = true;
  10.293 +
  10.294 +	return SDK_OnMetamodLoad(ismm, error, maxlen, late);
  10.295 +}
  10.296 +
  10.297 +bool SDKExtension::Unload(char *error, size_t maxlen)
  10.298 +{
  10.299 +	if (!m_WeAreUnloaded)
  10.300 +	{
  10.301 +		if (error)
  10.302 +		{
  10.303 +			snprintf(error, maxlen, "This extension must be unloaded by SourceMod.");
  10.304 +		}
  10.305 +		return false;
  10.306 +	}
  10.307 +
  10.308 +	return SDK_OnMetamodUnload(error, maxlen);
  10.309 +}
  10.310 +
  10.311 +bool SDKExtension::Pause(char *error, size_t maxlen)
  10.312 +{
  10.313 +	if (!m_WeGotPauseChange)
  10.314 +	{
  10.315 +		if (error)
  10.316 +		{
  10.317 +			snprintf(error, maxlen, "This extension must be paused by SourceMod.");
  10.318 +		}
  10.319 +		return false;
  10.320 +	}
  10.321 +
  10.322 +	m_WeGotPauseChange = false;
  10.323 +
  10.324 +	return SDK_OnMetamodPauseChange(true, error, maxlen);
  10.325 +}
  10.326 +
  10.327 +bool SDKExtension::Unpause(char *error, size_t maxlen)
  10.328 +{
  10.329 +	if (!m_WeGotPauseChange)
  10.330 +	{
  10.331 +		if (error)
  10.332 +		{
  10.333 +			snprintf(error, maxlen, "This extension must be unpaused by SourceMod.");
  10.334 +		}
  10.335 +		return false;
  10.336 +	}
  10.337 +
  10.338 +	m_WeGotPauseChange = false;
  10.339 +
  10.340 +	return SDK_OnMetamodPauseChange(false, error, maxlen);
  10.341 +}
  10.342 +
  10.343 +const char *SDKExtension::GetAuthor()
  10.344 +{
  10.345 +	return GetExtensionAuthor();
  10.346 +}
  10.347 +
  10.348 +const char *SDKExtension::GetDate()
  10.349 +{
  10.350 +	return GetExtensionDateString();
  10.351 +}
  10.352 +
  10.353 +const char *SDKExtension::GetDescription()
  10.354 +{
  10.355 +	return GetExtensionDescription();
  10.356 +}
  10.357 +
  10.358 +const char *SDKExtension::GetLicense()
  10.359 +{
  10.360 +	return SMEXT_CONF_LICENSE;
  10.361 +}
  10.362 +
  10.363 +const char *SDKExtension::GetLogTag()
  10.364 +{
  10.365 +	return GetExtensionTag();
  10.366 +}
  10.367 +
  10.368 +const char *SDKExtension::GetName()
  10.369 +{
  10.370 +	return GetExtensionName();
  10.371 +}
  10.372 +
  10.373 +const char *SDKExtension::GetURL()
  10.374 +{
  10.375 +	return GetExtensionURL();
  10.376 +}
  10.377 +
  10.378 +const char *SDKExtension::GetVersion()
  10.379 +{
  10.380 +	return GetExtensionVerString();
  10.381 +}
  10.382 +
  10.383 +bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
  10.384 +{
  10.385 +	return true;
  10.386 +}
  10.387 +
  10.388 +bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
  10.389 +{
  10.390 +	return true;
  10.391 +}
  10.392 +
  10.393 +bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength)
  10.394 +{
  10.395 +	return true;
  10.396 +}
  10.397 +
  10.398 +#endif
  10.399 +
  10.400 +/* Overload a few things to prevent libstdc++ linking */
  10.401 +#if defined __linux__
  10.402 +extern "C" void __cxa_pure_virtual(void)
  10.403 +{
  10.404 +}
  10.405 +
  10.406 +void *operator new(size_t size)
  10.407 +{
  10.408 +	return malloc(size);
  10.409 +}
  10.410 +
  10.411 +void *operator new[](size_t size) 
  10.412 +{
  10.413 +	return malloc(size);
  10.414 +}
  10.415 +
  10.416 +void operator delete(void *ptr) 
  10.417 +{
  10.418 +	free(ptr);
  10.419 +}
  10.420 +
  10.421 +void operator delete[](void * ptr)
  10.422 +{
  10.423 +	free(ptr);
  10.424 +}
  10.425 +#endif
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/extensions/tf2/sdk/smsdk_ext.h	Fri Nov 23 05:27:58 2007 +0000
    11.3 @@ -0,0 +1,310 @@
    11.4 +/**
    11.5 + * vim: set ts=4 :
    11.6 + * =============================================================================
    11.7 + * SourceMod Base Extension Code
    11.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
    11.9 + * =============================================================================
   11.10 + *
   11.11 + * This program is free software; you can redistribute it and/or modify it under
   11.12 + * the terms of the GNU General Public License, version 3.0, as published by the
   11.13 + * Free Software Foundation.
   11.14 + * 
   11.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
   11.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   11.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   11.18 + * details.
   11.19 + *
   11.20 + * You should have received a copy of the GNU General Public License along with
   11.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   11.22 + *
   11.23 + * As a special exception, AlliedModders LLC gives you permission to link the
   11.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   11.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   11.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
   11.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   11.28 + * this exception to all derivative works.  AlliedModders LLC defines further
   11.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   11.30 + * or <http://www.sourcemod.net/license.php>.
   11.31 + *
   11.32 + * Version: $Id$
   11.33 + */
   11.34 +
   11.35 +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
   11.36 +#define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
   11.37 +
   11.38 +/**
   11.39 + * @file smsdk_ext.h
   11.40 + * @brief Contains wrappers for making Extensions easier to write.
   11.41 + */
   11.42 +
   11.43 +#include "smsdk_config.h"
   11.44 +#include <IExtensionSys.h>
   11.45 +#include <IHandleSys.h>
   11.46 +#include <sp_vm_api.h>
   11.47 +#include <sm_platform.h>
   11.48 +#include <ISourceMod.h>
   11.49 +#if defined SMEXT_ENABLE_FORWARDSYS
   11.50 +#include <IForwardSys.h>
   11.51 +#endif //SMEXT_ENABLE_FORWARDSYS
   11.52 +#if defined SMEXT_ENABLE_PLAYERHELPERS
   11.53 +#include <IPlayerHelpers.h>
   11.54 +#endif //SMEXT_ENABLE_PlAYERHELPERS
   11.55 +#if defined SMEXT_ENABLE_DBMANAGER
   11.56 +#include <IDBDriver.h>
   11.57 +#endif //SMEXT_ENABLE_DBMANAGER
   11.58 +#if defined SMEXT_ENABLE_GAMECONF
   11.59 +#include <IGameConfigs.h>
   11.60 +#endif
   11.61 +#if defined SMEXT_ENABLE_MEMUTILS
   11.62 +#include <IMemoryUtils.h>
   11.63 +#endif
   11.64 +#if defined SMEXT_ENABLE_GAMEHELPERS
   11.65 +#include <IGameHelpers.h>
   11.66 +#endif
   11.67 +#if defined SMEXT_ENABLE_TIMERSYS
   11.68 +#include <ITimerSystem.h>
   11.69 +#endif
   11.70 +#if defined SMEXT_ENABLE_ADTFACTORY
   11.71 +#include <IADTFactory.h>
   11.72 +#endif
   11.73 +#if defined SMEXT_ENABLE_THREADER
   11.74 +#include <IThreader.h>
   11.75 +#endif
   11.76 +#if defined SMEXT_ENABLE_LIBSYS
   11.77 +#include <ILibrarySys.h>
   11.78 +#endif
   11.79 +#if defined SMEXT_ENABLE_USERMSGS
   11.80 +#include <IUserMessages.h>
   11.81 +#endif
   11.82 +
   11.83 +#if defined SMEXT_CONF_METAMOD
   11.84 +#include <ISmmPlugin.h>
   11.85 +#include <eiface.h>
   11.86 +#endif
   11.87 +
   11.88 +#if !defined METAMOD_PLAPI_VERSION
   11.89 +	#include <metamod_wrappers.h>
   11.90 +#endif
   11.91 +
   11.92 +using namespace SourceMod;
   11.93 +using namespace SourcePawn;
   11.94 +
   11.95 +class SDKExtension : 
   11.96 +#if defined SMEXT_CONF_METAMOD
   11.97 +	public ISmmPlugin,
   11.98 +#endif
   11.99 +	public IExtensionInterface
  11.100 +{
  11.101 +public:
  11.102 +	/** Constructor */
  11.103 +	SDKExtension();
  11.104 +public:
  11.105 +	/**
  11.106 +	 * @brief This is called after the initial loading sequence has been processed.
  11.107 +	 *
  11.108 +	 * @param error		Error message buffer.
  11.109 +	 * @param maxlength	Size of error message buffer.
  11.110 +	 * @param late		Whether or not the module was loaded after map load.
  11.111 +	 * @return			True to succeed loading, false to fail.
  11.112 +	 */
  11.113 +	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
  11.114 +	
  11.115 +	/**
  11.116 +	 * @brief This is called right before the extension is unloaded.
  11.117 +	 */
  11.118 +	virtual void SDK_OnUnload();
  11.119 +
  11.120 +	/**
  11.121 +	 * @brief This is called once all known extensions have been loaded.
  11.122 +	 */
  11.123 +	virtual void SDK_OnAllLoaded();
  11.124 +
  11.125 +	/**
  11.126 +	 * @brief Called when the pause state is changed.
  11.127 +	 */
  11.128 +	virtual void SDK_OnPauseChange(bool paused);
  11.129 +
  11.130 +#if defined SMEXT_CONF_METAMOD
  11.131 +	/**
  11.132 +	 * @brief Called when Metamod is attached, before the extension version is called.
  11.133 +	 *
  11.134 +	 * @param error			Error buffer.
  11.135 +	 * @param maxlength		Maximum size of error buffer.
  11.136 +	 * @param late			Whether or not Metamod considers this a late load.
  11.137 +	 * @return				True to succeed, false to fail.
  11.138 +	 */
  11.139 +	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
  11.140 +
  11.141 +	/**
  11.142 +	 * @brief Called when Metamod is detaching, after the extension version is called.
  11.143 +	 * NOTE: By default this is blocked unless sent from SourceMod.
  11.144 +	 *
  11.145 +	 * @param error			Error buffer.
  11.146 +	 * @param maxlength		Maximum size of error buffer.
  11.147 +	 * @return				True to succeed, false to fail.
  11.148 +	 */
  11.149 +	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
  11.150 +
  11.151 +	/**
  11.152 +	 * @brief Called when Metamod's pause state is changing.
  11.153 +	 * NOTE: By default this is blocked unless sent from SourceMod.
  11.154 +	 *
  11.155 +	 * @param paused		Pause state being set.
  11.156 +	 * @param error			Error buffer.
  11.157 +	 * @param maxlength		Maximum size of error buffer.
  11.158 +	 * @return				True to succeed, false to fail.
  11.159 +	 */
  11.160 +	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
  11.161 +#endif
  11.162 +
  11.163 +public: //IExtensionInterface
  11.164 +	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late);
  11.165 +	virtual void OnExtensionUnload();
  11.166 +	virtual void OnExtensionsAllLoaded();
  11.167 +
  11.168 +	/** Returns whether or not this is a Metamod-based extension */
  11.169 +	virtual bool IsMetamodExtension();
  11.170 +
  11.171 +	/**
  11.172 +	 * @brief Called when the pause state changes.
  11.173 +	 * 
  11.174 +	 * @param state			True if being paused, false if being unpaused.
  11.175 +	 */
  11.176 +	virtual void OnExtensionPauseChange(bool state);
  11.177 +
  11.178 +	/** Returns name */
  11.179 +	virtual const char *GetExtensionName();
  11.180 +	/** Returns URL */
  11.181 +	virtual const char *GetExtensionURL();
  11.182 +	/** Returns log tag */
  11.183 +	virtual const char *GetExtensionTag();
  11.184 +	/** Returns author */
  11.185 +	virtual const char *GetExtensionAuthor();
  11.186 +	/** Returns version string */
  11.187 +	virtual const char *GetExtensionVerString();
  11.188 +	/** Returns description string */
  11.189 +	virtual const char *GetExtensionDescription();
  11.190 +	/** Returns date string */
  11.191 +	virtual const char *GetExtensionDateString();
  11.192 +#if defined SMEXT_CONF_METAMOD
  11.193 +public: //ISmmPlugin
  11.194 +	/** Called when the extension is attached to Metamod. */
  11.195 +	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late);
  11.196 +	/** Returns the author to MM */
  11.197 +	virtual const char *GetAuthor();
  11.198 +	/** Returns the name to MM */
  11.199 +	virtual const char *GetName();
  11.200 +	/** Returns the description to MM */
  11.201 +	virtual const char *GetDescription();
  11.202 +	/** Returns the URL to MM */
  11.203 +	virtual const char *GetURL();
  11.204 +	/** Returns the license to MM */
  11.205 +	virtual const char *GetLicense();
  11.206 +	/** Returns the version string to MM */
  11.207 +	virtual const char *GetVersion();
  11.208 +	/** Returns the date string to MM */
  11.209 +	virtual const char *GetDate();
  11.210 +	/** Returns the logtag to MM */
  11.211 +	virtual const char *GetLogTag();
  11.212 +	/** Called on unload */
  11.213 +	virtual bool Unload(char *error, size_t maxlength);
  11.214 +	/** Called on pause */
  11.215 +	virtual bool Pause(char *error, size_t maxlength);
  11.216 +	/** Called on unpause */
  11.217 +	virtual bool Unpause(char *error, size_t maxlength);
  11.218 +private:
  11.219 +	bool m_SourceMMLoaded;
  11.220 +	bool m_WeAreUnloaded;
  11.221 +	bool m_WeGotPauseChange;
  11.222 +#endif
  11.223 +};
  11.224 +
  11.225 +extern SDKExtension *g_pExtensionIface;
  11.226 +extern IExtension *myself;
  11.227 +
  11.228 +extern IShareSys *g_pShareSys;
  11.229 +extern IShareSys *sharesys;				/* Note: Newer name */
  11.230 +extern ISourceMod *g_pSM;
  11.231 +extern ISourceMod *smutils;				/* Note: Newer name */
  11.232 +
  11.233 +/* Optional interfaces are below */
  11.234 +#if defined SMEXT_ENABLE_FORWARDSYS
  11.235 +extern IForwardManager *g_pForwards;
  11.236 +extern IForwardManager *forwards;		/* Note: Newer name */
  11.237 +#endif //SMEXT_ENABLE_FORWARDSYS
  11.238 +#if defined SMEXT_ENABLE_HANDLESYS
  11.239 +extern IHandleSys *g_pHandleSys;
  11.240 +extern IHandleSys *handlesys;			/* Note: Newer name */
  11.241 +#endif //SMEXT_ENABLE_HANDLESYS
  11.242 +#if defined SMEXT_ENABLE_PLAYERHELPERS
  11.243 +extern IPlayerManager *playerhelpers;
  11.244 +#endif //SMEXT_ENABLE_PLAYERHELPERS
  11.245 +#if defined SMEXT_ENABLE_DBMANAGER
  11.246 +extern IDBManager *dbi;
  11.247 +#endif //SMEXT_ENABLE_DBMANAGER
  11.248 +#if defined SMEXT_ENABLE_GAMECONF
  11.249 +extern IGameConfigManager *gameconfs;
  11.250 +#endif //SMEXT_ENABLE_DBMANAGER
  11.251 +#if defined SMEXT_ENABLE_MEMUTILS
  11.252 +extern IMemoryUtils *memutils;
  11.253 +#endif
  11.254 +#if defined SMEXT_ENABLE_GAMEHELPERS
  11.255 +extern IGameHelpers *gamehelpers;
  11.256 +#endif
  11.257 +#if defined SMEXT_ENABLE_TIMERSYS
  11.258 +extern ITimerSystem *timersys;
  11.259 +#endif
  11.260 +#if defined SMEXT_ENABLE_ADTFACTORY
  11.261 +extern IADTFactory *adtfactory;
  11.262 +#endif
  11.263 +#if defined SMEXT_ENABLE_THREADER
  11.264 +extern IThreader *threader;
  11.265 +#endif
  11.266 +#if defined SMEXT_ENABLE_LIBSYS
  11.267 +extern ILibrarySys *libsys;
  11.268 +#endif
  11.269 +#if defined SMEXT_ENABLE_USERMSGS
  11.270 +extern IUserMessages *usermsgs;
  11.271 +#endif
  11.272 +
  11.273 +#if defined SMEXT_CONF_METAMOD
  11.274 +PLUGIN_GLOBALVARS();
  11.275 +extern IVEngineServer *engine;
  11.276 +extern IServerGameDLL *gamedll;
  11.277 +#endif
  11.278 +
  11.279 +/** Creates a SourceMod interface macro pair */
  11.280 +#define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION
  11.281 +/** Automates retrieving SourceMod interfaces */
  11.282 +#define SM_GET_IFACE(prefix, addr) \
  11.283 +	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \
  11.284 +	{ \
  11.285 +		if (error != NULL && maxlength) \
  11.286 +		{ \
  11.287 +			size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
  11.288 +			if (len >= maxlength) \
  11.289 +			{ \
  11.290 +				error[maxlength - 1] = '\0'; \
  11.291 +			} \
  11.292 +		} \
  11.293 +		return false; \
  11.294 +	}
  11.295 +/** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */
  11.296 +#define SM_GET_LATE_IFACE(prefix, addr) \
  11.297 +	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)
  11.298 +/** Validates a SourceMod interface pointer */
  11.299 +#define SM_CHECK_IFACE(prefix, addr) \
  11.300 +	if (!addr) \
  11.301 +	{ \
  11.302 +		if (error != NULL && maxlength) \
  11.303 +		{ \
  11.304 +			size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \
  11.305 +			if (len >= maxlength) \
  11.306 +			{ \
  11.307 +				error[maxlength - 1] = '\0'; \
  11.308 +			} \
  11.309 +		} \
  11.310 +		return false; \
  11.311 +	}
  11.312 +
  11.313 +#endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/extensions/tf2/svn_version.h	Fri Nov 23 05:27:58 2007 +0000
    12.3 @@ -0,0 +1,42 @@
    12.4 +/**
    12.5 + * vim: set ts=4 :
    12.6 + * =============================================================================
    12.7 + * SourceMod SDKTools Extension
    12.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
    12.9 + * =============================================================================
   12.10 + *
   12.11 + * This program is free software; you can redistribute it and/or modify it under
   12.12 + * the terms of the GNU General Public License, version 3.0, as published by the
   12.13 + * Free Software Foundation.
   12.14 + * 
   12.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
   12.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   12.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   12.18 + * details.
   12.19 + *
   12.20 + * You should have received a copy of the GNU General Public License along with
   12.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   12.22 + *
   12.23 + * As a special exception, AlliedModders LLC gives you permission to link the
   12.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   12.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   12.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
   12.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   12.28 + * this exception to all derivative works.  AlliedModders LLC defines further
   12.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   12.30 + * or <http://www.sourcemod.net/license.php>.
   12.31 + *
   12.32 + * Version: $Id$
   12.33 + */
   12.34 +
   12.35 +/**
   12.36 + * Autogenerated by build scripts
   12.37 + */
   12.38 +
   12.39 +#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
   12.40 +#define _INCLUDE_SDKTOOLS_VERSION_H_
   12.41 +
   12.42 +#define SVN_FULL_VERSION	"1.0.0.1336"
   12.43 +#define SVN_FILE_VERSION	1,0,0,1336
   12.44 +
   12.45 +#endif //_INCLUDE_SDKTOOLS_VERSION_H_
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/extensions/tf2/svn_version.tpl	Fri Nov 23 05:27:58 2007 +0000
    13.3 @@ -0,0 +1,42 @@
    13.4 +/**
    13.5 + * vim: set ts=4 :
    13.6 + * =============================================================================
    13.7 + * SourceMod SDKTools Extension
    13.8 + * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
    13.9 + * =============================================================================
   13.10 + *
   13.11 + * This program is free software; you can redistribute it and/or modify it under
   13.12 + * the terms of the GNU General Public License, version 3.0, as published by the
   13.13 + * Free Software Foundation.
   13.14 + * 
   13.15 + * This program is distributed in the hope that it will be useful, but WITHOUT
   13.16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13.17 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   13.18 + * details.
   13.19 + *
   13.20 + * You should have received a copy of the GNU General Public License along with
   13.21 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   13.22 + *
   13.23 + * As a special exception, AlliedModders LLC gives you permission to link the
   13.24 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   13.25 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   13.26 + * by the Valve Corporation.  You must obey the GNU General Public License in
   13.27 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   13.28 + * this exception to all derivative works.  AlliedModders LLC defines further
   13.29 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   13.30 + * or <http://www.sourcemod.net/license.php>.
   13.31 + *
   13.32 + * Version: $Id$
   13.33 + */
   13.34 +
   13.35 +/**
   13.36 + * Autogenerated by build scripts
   13.37 + */
   13.38 +
   13.39 +#ifndef _INCLUDE_SDKTOOLS_VERSION_H_
   13.40 +#define _INCLUDE_SDKTOOLS_VERSION_H_
   13.41 +
   13.42 +#define SVN_FULL_VERSION	"$PMAJOR$.$PMINOR$.$PREVISION$.$LOCAL_BUILD$"
   13.43 +#define SVN_FILE_VERSION	$PMAJOR$,$PMINOR$,$PREVISION$,$LOCAL_BUILD$
   13.44 +
   13.45 +#endif //_INCLUDE_SDKTOOLS_VERSION_H_
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/extensions/tf2/version.rc	Fri Nov 23 05:27:58 2007 +0000
    14.3 @@ -0,0 +1,104 @@
    14.4 +// Microsoft Visual C++ generated resource script.
    14.5 +//
    14.6 +//#include "resource.h"
    14.7 +
    14.8 +#define APSTUDIO_READONLY_SYMBOLS
    14.9 +/////////////////////////////////////////////////////////////////////////////
   14.10 +//
   14.11 +// Generated from the TEXTINCLUDE 2 resource.
   14.12 +//
   14.13 +#include "winres.h"
   14.14 +
   14.15 +#include "svn_version.h"
   14.16 +
   14.17 +/////////////////////////////////////////////////////////////////////////////
   14.18 +#undef APSTUDIO_READONLY_SYMBOLS
   14.19 +
   14.20 +/////////////////////////////////////////////////////////////////////////////
   14.21 +// English (U.S.) resources
   14.22 +
   14.23 +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
   14.24 +#ifdef _WIN32
   14.25 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
   14.26 +#pragma code_page(1252)
   14.27 +#endif //_WIN32
   14.28 +
   14.29 +/////////////////////////////////////////////////////////////////////////////
   14.30 +//
   14.31 +// Version
   14.32 +//
   14.33 +
   14.34 +VS_VERSION_INFO VERSIONINFO
   14.35 + FILEVERSION  SVN_FILE_VERSION
   14.36 + PRODUCTVERSION SVN_FILE_VERSION
   14.37 + FILEFLAGSMASK 0x17L
   14.38 +#ifdef _DEBUG
   14.39 + FILEFLAGS 0x1L
   14.40 +#else
   14.41 + FILEFLAGS 0x0L
   14.42 +#endif
   14.43 + FILEOS 0x4L
   14.44 + FILETYPE 0x2L
   14.45 + FILESUBTYPE 0x0L
   14.46 +BEGIN
   14.47 +    BLOCK "StringFileInfo"
   14.48 +    BEGIN
   14.49 +        BLOCK "000004b0"
   14.50 +        BEGIN
   14.51 +            VALUE "Comments", "SourceMod CS:S Extension"
   14.52 +            VALUE "FileDescription", "SourceMod CS:S Extension"
   14.53 +            VALUE "FileVersion", SVN_FULL_VERSION
   14.54 +            VALUE "InternalName", "SourceMod CS:S Extension"
   14.55 +            VALUE "LegalCopyright", "Copyright (c) 2004-2007, AlliedModders LLC"
   14.56 +            VALUE "OriginalFilename", "game.cstrike.ext.dll"
   14.57 +            VALUE "ProductName", "SourceMod CS:S Extension"
   14.58 +            VALUE "ProductVersion", SVN_FULL_VERSION
   14.59 +        END
   14.60 +    END
   14.61 +    BLOCK "VarFileInfo"
   14.62 +    BEGIN
   14.63 +        VALUE "Translation", 0x0, 1200
   14.64 +    END
   14.65 +END
   14.66 +
   14.67 +
   14.68 +#ifdef APSTUDIO_INVOKED
   14.69 +/////////////////////////////////////////////////////////////////////////////
   14.70 +//
   14.71 +// TEXTINCLUDE
   14.72 +//
   14.73 +
   14.74 +1 TEXTINCLUDE 
   14.75 +BEGIN
   14.76 +    "resource.h\0"
   14.77 +END
   14.78 +
   14.79 +2 TEXTINCLUDE 
   14.80 +BEGIN
   14.81 +    "#include ""winres.h""\r\n"
   14.82 +    "\0"
   14.83 +END
   14.84 +
   14.85 +3 TEXTINCLUDE 
   14.86 +BEGIN
   14.87 +    "\r\n"
   14.88 +    "\0"
   14.89 +END
   14.90 +
   14.91 +#endif    // APSTUDIO_INVOKED
   14.92 +
   14.93 +#endif    // English (U.S.) resources
   14.94 +/////////////////////////////////////////////////////////////////////////////
   14.95 +
   14.96 +
   14.97 +
   14.98 +#ifndef APSTUDIO_INVOKED
   14.99 +/////////////////////////////////////////////////////////////////////////////
  14.100 +//
  14.101 +// Generated from the TEXTINCLUDE 3 resource.
  14.102 +//
  14.103 +
  14.104 +
  14.105 +/////////////////////////////////////////////////////////////////////////////
  14.106 +#endif    // not APSTUDIO_INVOKED
  14.107 +