added Orange Box compat to sdktools
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401566
This commit is contained in:
parent
ee6c08d687
commit
4a8f76afd9
@ -36,6 +36,12 @@
|
|||||||
#include "vglobals.h"
|
#include "vglobals.h"
|
||||||
#include "tempents.h"
|
#include "tempents.h"
|
||||||
|
|
||||||
|
#if defined ORANGEBOX_BUILD
|
||||||
|
#define SDKTOOLS_GAME_FILE "sdktools.games.ep2.txt"
|
||||||
|
#else
|
||||||
|
#define SDKTOOLS_GAME_FILE "sdktools.games"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file extension.cpp
|
* @file extension.cpp
|
||||||
* @brief Implements SDK Tools extension code.
|
* @brief Implements SDK Tools extension code.
|
||||||
@ -55,6 +61,7 @@ IGameHelpers *g_pGameHelpers = NULL;
|
|||||||
IServerGameClients *serverClients = NULL;
|
IServerGameClients *serverClients = NULL;
|
||||||
IVoiceServer *voiceserver = NULL;
|
IVoiceServer *voiceserver = NULL;
|
||||||
IPlayerInfoManager *playerinfomngr = NULL;
|
IPlayerInfoManager *playerinfomngr = NULL;
|
||||||
|
ICvar *icvar = NULL;
|
||||||
HandleType_t g_CallHandle = 0;
|
HandleType_t g_CallHandle = 0;
|
||||||
HandleType_t g_TraceHandle = 0;
|
HandleType_t g_TraceHandle = 0;
|
||||||
|
|
||||||
@ -81,7 +88,7 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
SM_GET_IFACE(GAMEHELPERS, g_pGameHelpers);
|
SM_GET_IFACE(GAMEHELPERS, g_pGameHelpers);
|
||||||
|
|
||||||
if (!gameconfs->LoadGameConfigFile("sdktools.games", &g_pGameConf, error, maxlength))
|
if (!gameconfs->LoadGameConfigFile(SDKTOOLS_GAME_FILE, &g_pGameConf, error, maxlength))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -90,7 +97,10 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
g_CallHandle = handlesys->CreateType("ValveCall", this, 0, NULL, NULL, myself->GetIdentity(), NULL);
|
g_CallHandle = handlesys->CreateType("ValveCall", this, 0, NULL, NULL, myself->GetIdentity(), NULL);
|
||||||
g_TraceHandle = handlesys->CreateType("TraceRay", this, 0, NULL, NULL, myself->GetIdentity(), NULL);
|
g_TraceHandle = handlesys->CreateType("TraceRay", this, 0, NULL, NULL, myself->GetIdentity(), NULL);
|
||||||
|
|
||||||
ConCommandBaseMgr::OneTimeInit(this);
|
#if defined ORANGEBOX_BUILD
|
||||||
|
g_pCVar = icvar;
|
||||||
|
#endif
|
||||||
|
CONVAR_REGISTER(this);
|
||||||
|
|
||||||
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SDKTools::LevelInit, true);
|
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SDKTools::LevelInit, true);
|
||||||
|
|
||||||
@ -111,7 +121,7 @@ void SDKTools::OnHandleDestroy(HandleType_t type, void *object)
|
|||||||
|
|
||||||
void SDKTools::SDK_OnUnload()
|
void SDKTools::SDK_OnUnload()
|
||||||
{
|
{
|
||||||
List<ValveCall *>::iterator iter;
|
SourceHook::List<ValveCall *>::iterator iter;
|
||||||
for (iter = g_RegCalls.begin();
|
for (iter = g_RegCalls.begin();
|
||||||
iter != g_RegCalls.end();
|
iter != g_RegCalls.end();
|
||||||
iter++)
|
iter++)
|
||||||
@ -138,14 +148,15 @@ void SDKTools::SDK_OnUnload()
|
|||||||
|
|
||||||
bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
||||||
{
|
{
|
||||||
GET_V_IFACE_ANY(serverFactory, gameents, IServerGameEnts, INTERFACEVERSION_SERVERGAMEENTS);
|
GET_V_IFACE_ANY(GetServerFactory, gameents, IServerGameEnts, INTERFACEVERSION_SERVERGAMEENTS);
|
||||||
GET_V_IFACE_ANY(engineFactory, engsound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
GET_V_IFACE_ANY(GetEngineFactory, engsound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION);
|
||||||
GET_V_IFACE_ANY(engineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER);
|
||||||
GET_V_IFACE_ANY(engineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER);
|
||||||
GET_V_IFACE_ANY(engineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
GET_V_IFACE_ANY(GetEngineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||||
GET_V_IFACE_ANY(serverFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
|
GET_V_IFACE_ANY(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
|
||||||
GET_V_IFACE_ANY(engineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER);
|
GET_V_IFACE_ANY(GetEngineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER);
|
||||||
GET_V_IFACE_ANY(serverFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
GET_V_IFACE_ANY(GetServerFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
||||||
|
GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,7 +189,7 @@ bool SDKTools::QueryInterfaceDrop(SMInterface *pInterface)
|
|||||||
|
|
||||||
void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface)
|
void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface)
|
||||||
{
|
{
|
||||||
List<ValveCall *>::iterator iter;
|
SourceHook::List<ValveCall *>::iterator iter;
|
||||||
for (iter = g_RegCalls.begin();
|
for (iter = g_RegCalls.begin();
|
||||||
iter != g_RegCalls.end();
|
iter != g_RegCalls.end();
|
||||||
iter++)
|
iter++)
|
||||||
@ -200,7 +211,11 @@ void SDKTools::NotifyInterfaceDrop(SMInterface *pInterface)
|
|||||||
|
|
||||||
bool SDKTools::RegisterConCommandBase(ConCommandBase *pVar)
|
bool SDKTools::RegisterConCommandBase(ConCommandBase *pVar)
|
||||||
{
|
{
|
||||||
|
#if defined METAMOD_PLAPI_VERSION
|
||||||
|
return g_SMAPI->RegisterConCommandBase(g_PLAPI, pVar);
|
||||||
|
#else
|
||||||
return g_SMAPI->RegisterConCmdBase(g_PLAPI, pVar);
|
return g_SMAPI->RegisterConCmdBase(g_PLAPI, pVar);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDKTools::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
|
bool SDKTools::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <ivoiceserver.h>
|
#include <ivoiceserver.h>
|
||||||
#include <iplayerinfo.h>
|
#include <iplayerinfo.h>
|
||||||
#include <convar.h>
|
#include <convar.h>
|
||||||
|
#include <compat_wrappers.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implementation of the SDK Tools extension.
|
* @brief Implementation of the SDK Tools extension.
|
||||||
@ -93,6 +94,7 @@ extern IServerPluginHelpers *pluginhelpers;
|
|||||||
extern IServerGameClients *serverClients;
|
extern IServerGameClients *serverClients;
|
||||||
extern IVoiceServer *voiceserver;
|
extern IVoiceServer *voiceserver;
|
||||||
extern IPlayerInfoManager *playerinfomngr;
|
extern IPlayerInfoManager *playerinfomngr;
|
||||||
|
extern ICvar *icvar;
|
||||||
/* Interfaces from SourceMod */
|
/* Interfaces from SourceMod */
|
||||||
extern IBinTools *g_pBinTools;
|
extern IBinTools *g_pBinTools;
|
||||||
extern IGameConfig *g_pGameConf;
|
extern IGameConfig *g_pGameConf;
|
||||||
|
@ -202,8 +202,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\dlls;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(HL2SDKOB)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
@ -283,7 +283,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -364,7 +364,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM142);$(SOURCEMM142)\sourcemm;$(SOURCEMM142)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
MinimalRebuild="true"
|
MinimalRebuild="true"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
@ -446,8 +446,8 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\dlls;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(HL2SDKOB)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
RuntimeTypeInfo="false"
|
RuntimeTypeInfo="false"
|
||||||
@ -527,7 +527,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
@ -608,7 +608,7 @@
|
|||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
FavorSizeOrSpeed="1"
|
FavorSizeOrSpeed="1"
|
||||||
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM142);$(SOURCEMM142)\sourcemm;$(SOURCEMM142)\sourcehook"
|
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"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableEnhancedInstructionSet="1"
|
EnableEnhancedInstructionSet="1"
|
||||||
|
@ -262,7 +262,7 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
|||||||
/** Exposes the extension to Metamod */
|
/** Exposes the extension to Metamod */
|
||||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||||
{
|
{
|
||||||
if (name && !strcmp(name, PLAPI_NAME))
|
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||||
{
|
{
|
||||||
if (code)
|
if (code)
|
||||||
{
|
{
|
||||||
@ -283,8 +283,8 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
|
|||||||
{
|
{
|
||||||
PLUGIN_SAVEVARS();
|
PLUGIN_SAVEVARS();
|
||||||
|
|
||||||
GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
|
||||||
GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
|
||||||
|
|
||||||
m_SourceMMLoaded = true;
|
m_SourceMMLoaded = true;
|
||||||
|
|
||||||
|
@ -82,6 +82,10 @@
|
|||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined METAMOD_PLAPI_VERSION
|
||||||
|
#include <metamod_wrappers.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourcePawn;
|
using namespace SourcePawn;
|
||||||
|
|
||||||
|
@ -47,19 +47,22 @@ CON_COMMAND(sm_print_telist, "Prints the temp entity list")
|
|||||||
|
|
||||||
CON_COMMAND(sm_dump_teprops, "Dumps tempentity props to a file")
|
CON_COMMAND(sm_dump_teprops, "Dumps tempentity props to a file")
|
||||||
{
|
{
|
||||||
|
#if !defined ORANGEBOX_BUILD
|
||||||
|
CCommand args;
|
||||||
|
#endif
|
||||||
if (!g_TEManager.IsAvailable())
|
if (!g_TEManager.IsAvailable())
|
||||||
{
|
{
|
||||||
META_CONPRINT("The tempent portion of SDKTools failed to load.\n");
|
META_CONPRINT("The tempent portion of SDKTools failed to load.\n");
|
||||||
META_CONPRINT("Check that you have the latest sdktools.games.txt file!\n");
|
META_CONPRINT("Check that you have the latest sdktools.games.txt file!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int argc = engine->Cmd_Argc();
|
int argc = args.ArgC();
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
META_CONPRINT("Usage: sm_dump_teprops <file>\n");
|
META_CONPRINT("Usage: sm_dump_teprops <file>\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *arg = engine->Cmd_Argv(1);
|
const char *arg = args.Arg(1);
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
if (!arg || arg[0] == '\0' || ((fp = fopen(arg, "wt")) == NULL))
|
if (!arg || arg[0] == '\0' || ((fp = fopen(arg, "wt")) == NULL))
|
||||||
{
|
{
|
||||||
@ -320,7 +323,7 @@ void TempEntityManager::Shutdown()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TempEntityInfo *>::iterator iter;
|
SourceHook::List<TempEntityInfo *>::iterator iter;
|
||||||
for (iter=m_TEList.begin(); iter!=m_TEList.end(); iter++)
|
for (iter=m_TEList.begin(); iter!=m_TEList.end(); iter++)
|
||||||
{
|
{
|
||||||
delete (*iter);
|
delete (*iter);
|
||||||
|
@ -38,8 +38,6 @@
|
|||||||
#include <sh_string.h>
|
#include <sh_string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace SourceHook;
|
|
||||||
|
|
||||||
class TempEntityInfo
|
class TempEntityInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -61,7 +59,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
void *m_Me;
|
void *m_Me;
|
||||||
ServerClass *m_Sc;
|
ServerClass *m_Sc;
|
||||||
String m_Name;
|
SourceHook::String m_Name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TempEntityManager
|
class TempEntityManager
|
||||||
@ -79,7 +77,7 @@ public:
|
|||||||
void DumpList();
|
void DumpList();
|
||||||
void DumpProps(FILE *fp);
|
void DumpProps(FILE *fp);
|
||||||
private:
|
private:
|
||||||
List<TempEntityInfo *> m_TEList;
|
SourceHook::List<TempEntityInfo *> m_TEList;
|
||||||
IBasicTrie *m_TempEntInfo;
|
IBasicTrie *m_TempEntInfo;
|
||||||
void *m_ListHead;
|
void *m_ListHead;
|
||||||
int m_NameOffs;
|
int m_NameOffs;
|
||||||
@ -91,7 +89,7 @@ private:
|
|||||||
struct TEHookInfo
|
struct TEHookInfo
|
||||||
{
|
{
|
||||||
TempEntityInfo *te;
|
TempEntityInfo *te;
|
||||||
List<IPluginFunction *> lst;
|
SourceHook::List<IPluginFunction *> lst;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TempEntHooks : public IPluginsListener
|
class TempEntHooks : public IPluginsListener
|
||||||
@ -110,7 +108,7 @@ private:
|
|||||||
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
|
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);
|
||||||
private:
|
private:
|
||||||
IBasicTrie *m_TEHooks;
|
IBasicTrie *m_TEHooks;
|
||||||
List<TEHookInfo *> m_HookInfo;
|
SourceHook::List<TEHookInfo *> m_HookInfo;
|
||||||
size_t m_HookCount;
|
size_t m_HookCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void TempEntHooks::Shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
plsys->RemovePluginsListener(this);
|
plsys->RemovePluginsListener(this);
|
||||||
List<TEHookInfo *>::iterator iter;
|
SourceHook::List<TEHookInfo *>::iterator iter;
|
||||||
for (iter=m_HookInfo.begin(); iter!=m_HookInfo.end(); iter++)
|
for (iter=m_HookInfo.begin(); iter!=m_HookInfo.end(); iter++)
|
||||||
{
|
{
|
||||||
delete (*iter);
|
delete (*iter);
|
||||||
@ -77,13 +77,13 @@ void TempEntHooks::Shutdown()
|
|||||||
|
|
||||||
void TempEntHooks::OnPluginUnloaded(IPlugin *plugin)
|
void TempEntHooks::OnPluginUnloaded(IPlugin *plugin)
|
||||||
{
|
{
|
||||||
List<TEHookInfo *>::iterator iter = m_HookInfo.begin();
|
SourceHook::List<TEHookInfo *>::iterator iter = m_HookInfo.begin();
|
||||||
IPluginContext *pContext = plugin->GetBaseContext();
|
IPluginContext *pContext = plugin->GetBaseContext();
|
||||||
|
|
||||||
/* For each hook list... */
|
/* For each hook list... */
|
||||||
while (iter != m_HookInfo.end())
|
while (iter != m_HookInfo.end())
|
||||||
{
|
{
|
||||||
List<IPluginFunction *>::iterator f_iter = (*iter)->lst.begin();
|
SourceHook::List<IPluginFunction *>::iterator f_iter = (*iter)->lst.begin();
|
||||||
|
|
||||||
/* Find the hooks on the given temp entity */
|
/* Find the hooks on the given temp entity */
|
||||||
while (f_iter != (*iter)->lst.end())
|
while (f_iter != (*iter)->lst.end())
|
||||||
@ -177,7 +177,7 @@ bool TempEntHooks::RemoveHook(const char *name, IPluginFunction *pFunc)
|
|||||||
|
|
||||||
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
|
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
|
||||||
{
|
{
|
||||||
List<IPluginFunction *>::iterator iter;
|
SourceHook::List<IPluginFunction *>::iterator iter;
|
||||||
if ((iter=pInfo->lst.find(pFunc)) != pInfo->lst.end())
|
if ((iter=pInfo->lst.find(pFunc)) != pInfo->lst.end())
|
||||||
{
|
{
|
||||||
pInfo->lst.erase(iter);
|
pInfo->lst.erase(iter);
|
||||||
@ -205,7 +205,7 @@ void TempEntHooks::OnPlaybackTempEntity(IRecipientFilter &filter, float delay, c
|
|||||||
|
|
||||||
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
|
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
|
||||||
{
|
{
|
||||||
List<IPluginFunction *>::iterator iter;
|
SourceHook::List<IPluginFunction *>::iterator iter;
|
||||||
IPluginFunction *pFunc;
|
IPluginFunction *pFunc;
|
||||||
size_t size;
|
size_t size;
|
||||||
cell_t res = static_cast<ResultType>(Pl_Continue);
|
cell_t res = static_cast<ResultType>(Pl_Continue);
|
||||||
|
@ -37,22 +37,21 @@
|
|||||||
#include "vdecoder.h"
|
#include "vdecoder.h"
|
||||||
|
|
||||||
using namespace SourceMod;
|
using namespace SourceMod;
|
||||||
using namespace SourceHook;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Info necessary to call a Valve function
|
* @brief Info necessary to call a Valve function
|
||||||
*/
|
*/
|
||||||
struct ValveCall
|
struct ValveCall
|
||||||
{
|
{
|
||||||
ICallWrapper *call; /**< From IBinTools */
|
ICallWrapper *call; /**< From IBinTools */
|
||||||
ValveCallType type; /**< Call type */
|
ValveCallType type; /**< Call type */
|
||||||
ValvePassInfo *vparams; /**< Valve parameter info */
|
ValvePassInfo *vparams; /**< Valve parameter info */
|
||||||
ValvePassInfo *retinfo; /**< Return buffer info */
|
ValvePassInfo *retinfo; /**< Return buffer info */
|
||||||
ValvePassInfo *thisinfo; /**< Thiscall info */
|
ValvePassInfo *thisinfo; /**< Thiscall info */
|
||||||
size_t stackSize; /**< Stack size */
|
size_t stackSize; /**< Stack size */
|
||||||
size_t stackEnd; /**< End of the bintools stack */
|
size_t stackEnd; /**< End of the bintools stack */
|
||||||
unsigned char *retbuf; /**< Return buffer */
|
unsigned char *retbuf; /**< Return buffer */
|
||||||
CStack<unsigned char *> stk; /**< Parameter stack */
|
SourceHook::CStack<unsigned char *> stk; /**< Parameter stack */
|
||||||
|
|
||||||
unsigned char *stk_get();
|
unsigned char *stk_get();
|
||||||
void stk_put(unsigned char *ptr);
|
void stk_put(unsigned char *ptr);
|
||||||
|
@ -106,9 +106,9 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
|
|||||||
void *addrInBase = NULL;
|
void *addrInBase = NULL;
|
||||||
if (params[1] == SDKLibrary_Server)
|
if (params[1] == SDKLibrary_Server)
|
||||||
{
|
{
|
||||||
addrInBase = (void *)g_SMAPI->serverFactory(false);
|
addrInBase = (void *)g_SMAPI->GetServerFactory(false);
|
||||||
} else if (params[1] == SDKLibrary_Engine) {
|
} else if (params[1] == SDKLibrary_Engine) {
|
||||||
addrInBase = (void *)g_SMAPI->engineFactory(false);
|
addrInBase = (void *)g_SMAPI->GetEngineFactory(false);
|
||||||
}
|
}
|
||||||
if (addrInBase == NULL)
|
if (addrInBase == NULL)
|
||||||
{
|
{
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
#include "vglobals.h"
|
#include "vglobals.h"
|
||||||
#include "CellRecipientFilter.h"
|
#include "CellRecipientFilter.h"
|
||||||
|
|
||||||
List<ValveCall *> g_RegCalls;
|
SourceHook::List<ValveCall *> g_RegCalls;
|
||||||
List<ICallWrapper *> g_CallWraps;
|
SourceHook::List<ICallWrapper *> g_CallWraps;
|
||||||
|
|
||||||
inline void InitPass(ValvePassInfo &info, ValveType vtype, PassType type, unsigned int flags, unsigned int decflags=0)
|
inline void InitPass(ValvePassInfo &info, ValveType vtype, PassType type, unsigned int flags, unsigned int decflags=0)
|
||||||
{
|
{
|
||||||
@ -331,7 +331,7 @@ static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String *g_lightstyle[MAX_LIGHTSTYLES] = {NULL};
|
static SourceHook::String *g_lightstyle[MAX_LIGHTSTYLES] = {NULL};
|
||||||
static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
|
static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
int style = params[1];
|
int style = params[1];
|
||||||
@ -347,7 +347,7 @@ static cell_t SetLightStyle(IPluginContext *pContext, const cell_t *params)
|
|||||||
* this or not on shutdown, but for ~4K of memory MAX, it doesn't seem worth it yet.
|
* this or not on shutdown, but for ~4K of memory MAX, it doesn't seem worth it yet.
|
||||||
* So, it's a :TODO:!
|
* So, it's a :TODO:!
|
||||||
*/
|
*/
|
||||||
g_lightstyle[style] = new String();
|
g_lightstyle[style] = new SourceHook::String();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *str;
|
char *str;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <sh_list.h>
|
#include <sh_list.h>
|
||||||
|
|
||||||
extern List<ValveCall *> g_RegCalls;
|
extern SourceHook::List<ValveCall *> g_RegCalls;
|
||||||
extern sp_nativeinfo_t g_Natives[];
|
extern sp_nativeinfo_t g_Natives[];
|
||||||
extern sp_nativeinfo_t g_SoundNatives[];
|
extern sp_nativeinfo_t g_SoundNatives[];
|
||||||
|
|
||||||
|
@ -239,7 +239,11 @@ static cell_t AddToStringTable(IPluginContext *pContext, const cell_t *params)
|
|||||||
pContext->LocalToString(params[2], &str);
|
pContext->LocalToString(params[2], &str);
|
||||||
pContext->LocalToString(params[3], &userdata);
|
pContext->LocalToString(params[3], &userdata);
|
||||||
|
|
||||||
|
#if defined ORANGEBOX_BUILD
|
||||||
|
pTable->AddString(true, str, params[4], userdata);
|
||||||
|
#else
|
||||||
pTable->AddString(str, params[4], userdata);
|
pTable->AddString(str, params[4], userdata);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
3
gamedata/sdktools.games.ep2.txt
Normal file
3
gamedata/sdktools.games.ep2.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"Games"
|
||||||
|
{
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user