Added preliminary support for Left 4 Dead; some things may not yet work.

This commit is contained in:
Scott Ehlert 2008-11-14 09:18:30 -06:00
parent 7e3f9ada31
commit ff7a2c6b73
74 changed files with 2285 additions and 421 deletions

View File

@ -41,7 +41,7 @@
* While the OB build only runs on MM:S 1.6.0+ (SH 5+), the older one
* can technically be compiled against any MM:S version after 1.4.2.
*/
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
extern int __SourceHook_FHAddConCommandDispatch(void *, ISourceHook::AddHookMode, bool, class fastdelegate::FastDelegate1<const CCommand &, void>);
#else
@ -53,7 +53,7 @@ extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate
#elif SH_IMPL_VERSION == 3
extern bool __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
#endif //SH_IMPL_VERSION
#endif //ORANGEBOX_BUILD
#endif //SE_ORANGEBOX
ChatTriggers g_ChatTriggers;
bool g_bSupressSilentFails = false;
@ -118,31 +118,8 @@ void ChatTriggers::OnSourceModAllInitialized_Post()
void ChatTriggers::OnSourceModGameInitialized()
{
unsigned int total = 2;
ConCommandBase *pCmd = icvar->GetCommands();
const char *name;
while (pCmd)
{
if (pCmd->IsCommand())
{
name = pCmd->GetName();
if (!m_pSayCmd && strcmp(name, "say") == 0)
{
m_pSayCmd = (ConCommand *)pCmd;
if (--total == 0)
{
break;
}
} else if (!m_pSayTeamCmd && strcmp(name, "say_team") == 0) {
m_pSayTeamCmd = (ConCommand *)pCmd;
if (--total == 0)
{
break;
}
}
}
pCmd = const_cast<ConCommandBase *>(pCmd->GetNext());
}
m_pSayCmd = FindCommand("say");
m_pSayTeamCmd = FindCommand("say_team");
if (m_pSayCmd)
{
@ -173,7 +150,7 @@ void ChatTriggers::OnSourceModShutdown()
g_Forwards.ReleaseForward(m_pDidFloodBlock);
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
{
#else
@ -267,7 +244,7 @@ void ChatTriggers::OnSayCommand_Pre()
/**
* Test if this is actually a command!
*/
if (!PreProcessTrigger(engine->PEntityOfEntIndex(client), args, is_quoted))
if (!PreProcessTrigger(PEntityOfEntIndex(client), args, is_quoted))
{
CPlayer *pPlayer;
if (is_silent
@ -299,7 +276,7 @@ void ChatTriggers::OnSayCommand_Pre()
RETURN_META(MRES_IGNORED);
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Post(const CCommand &command)
#else
void ChatTriggers::OnSayCommand_Post()
@ -315,7 +292,7 @@ void ChatTriggers::OnSayCommand_Post()
/* Execute the cached command */
int client = g_ConCmds.GetCommandClient();
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
serverpluginhelpers->ClientCommand(engine->PEntityOfEntIndex(client), m_ToExecute);
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
SetReplyTo(old);
}
}

View File

@ -54,7 +54,7 @@ public: //SMGlobalClass
char *error,
size_t maxlength);
private: //ConCommand
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void OnSayCommand_Pre(const CCommand &command);
void OnSayCommand_Post(const CCommand &command);
#else

View File

@ -40,7 +40,7 @@
ConCmdManager g_ConCmds;
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#else
SH_DECL_HOOK0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
@ -205,7 +205,7 @@ void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
delete pList;
}
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void CommandCallback(const CCommand &command)
{
#else
@ -515,7 +515,7 @@ bool ConCmdManager::CheckAccess(int client, const char *cmd, AdminCmdInfo *pAdmi
return true;
}
edict_t *pEdict = engine->PEntityOfEntIndex(client);
edict_t *pEdict = PEntityOfEntIndex(client);
/* If we got here, the command failed... */
char buffer[128];
@ -897,23 +897,7 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
{
pInfo = new ConCmdInfo();
/* Find the commandopan */
ConCommandBase *pBase = icvar->GetCommands();
ConCommand *pCmd = NULL;
while (pBase)
{
if (strcmp(pBase->GetName(), name) == 0)
{
/* Don't want to return convar with same name */
if (!pBase->IsCommand())
{
return NULL;
}
pCmd = (ConCommand *)pBase;
break;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
ConCommand *pCmd = FindCommand(name);
if (!pCmd)
{

View File

@ -98,7 +98,7 @@ class ConCmdManager :
public IPluginsListener,
public IConCommandTracker
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
friend void CommandCallback(const CCommand &command);
#else
friend void CommandCallback();

View File

@ -41,16 +41,18 @@
ConVarManager g_ConVarManager;
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
#define CallGlobalChangeCallbacks CallGlobalChangeCallback
#endif
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *, float);
#else
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar *, const char *);
#endif
SH_DECL_HOOK1_void(ICvar, InstallGlobalChangeCallback, SH_NOATTRIB, false, FnChangeCallback_t);
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
@ -79,12 +81,41 @@ void ConVarManager::OnSourceModStartup(bool late)
m_ConVarType = g_HandleSys.CreateType("ConVar", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength)
{
#if defined WIN32 || defined _WIN32
MEMORY_BASIC_INFORMATION mem;
if (!VirtualQuery(pAddr, &mem, sizeof(mem)))
return false;
if (mem.AllocationBase == NULL)
return false;
HMODULE dll = (HMODULE)mem.AllocationBase;
GetModuleFileName(dll, (LPTSTR)buffer, maxlength);
#elif defined __linux__
Dl_info info;
if (!dladdr(pAddr, &info))
return false;
if (!info.dli_fbase || !info.dli_fname)
return false;
const char *dllpath = info.dli_fname;
snprintf(buffer, maxlength, "%s", dllpath);
#endif
return true;
}
void InstallCallback(FnChangeCallback_t callback)
{
char path[MAX_PATH];
GetFileOfAddress((void *)callback, path, sizeof(path));
printf("Yo: %s\n", path);
}
void ConVarManager::OnSourceModAllInitialized()
{
/**
* Episode 2 has this function by default, but the older versions do not.
*/
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
if (g_SMAPI->GetGameDLLVersion() >= 6)
{
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gamedll, this, &ConVarManager::OnQueryCvarValueFinished, false);
@ -93,6 +124,7 @@ void ConVarManager::OnSourceModAllInitialized()
#endif
SH_ADD_HOOK_STATICFUNC(ICvar, CallGlobalChangeCallbacks, icvar, OnConVarChanged, false);
SH_ADD_HOOK_STATICFUNC(ICvar, InstallGlobalChangeCallback, icvar, InstallCallback, false);
/* Add the 'convars' option to the 'sm' console command */
g_RootMenu.AddRootConsoleCommand("cvars", "View convars created by a plugin", this);
@ -359,17 +391,10 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
}
}
/* To prevent creating a convar that has the same name as a console command... ugh */
ConCommandBase *pBase = icvar->GetCommands();
while (pBase)
/* Prevent creating a convar that has the same name as a console command */
if (FindCommand(name))
{
if (pBase->IsCommand() && strcmp(pBase->GetName(), name) == 0)
{
return BAD_HANDLE;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
return BAD_HANDLE;
}
/* Create and initialize ConVarInfo structure */
@ -595,7 +620,7 @@ void ConVarManager::AddConVarToPluginList(IPluginContext *pContext, const ConVar
}
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue)
#else
void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
@ -623,7 +648,7 @@ void ConVarManager::OnConVarChanged(ConVar *pConVar, const char *oldValue)
i != pInfo->changeListeners.end();
i++)
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
(*i)->OnConVarChanged(pConVar, oldValue, flOldValue);
#else
(*i)->OnConVarChanged(pConVar, oldValue, atof(oldValue));
@ -668,7 +693,7 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
cell_t ret;
pCallback->PushCell(cookie);
pCallback->PushCell(engine->IndexOfEdict(pPlayer));
pCallback->PushCell(IndexOfEdict(pPlayer));
pCallback->PushCell(result);
pCallback->PushString(cvarName);

View File

@ -140,7 +140,7 @@ private:
/**
* Static callback that Valve's ConVar object executes when the convar's value changes.
*/
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
#else
static void OnConVarChanged(ConVar *pConVar, const char *oldValue);

View File

@ -61,7 +61,7 @@ ConVar *g_ServerCfgFile = NULL;
void CheckAndFinalizeConfigs();
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
void Hook_ExecDispatchPre(const CCommand &cmd)
#else
@ -70,7 +70,7 @@ extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelega
void Hook_ExecDispatchPre()
#endif
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand cmd;
#endif
@ -84,7 +84,7 @@ void Hook_ExecDispatchPre()
}
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void Hook_ExecDispatchPost(const CCommand &cmd)
#else
void Hook_ExecDispatchPost()
@ -103,7 +103,7 @@ void CheckAndFinalizeConfigs()
if ((g_bServerExecd || g_ServerCfgFile == NULL)
&& g_bGotServerStart)
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
g_PendingInternalPush = true;
#else
SM_InternalCmdTrigger();
@ -151,17 +151,7 @@ void CoreConfig::OnSourceModLevelChange(const char *mapName)
if (g_ServerCfgFile != NULL)
{
ConCommandBase *pBase = icvar->GetCommands();
while (pBase != NULL)
{
if (pBase->IsCommand() && strcmp(pBase->GetName(), "exec") == 0)
{
break;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
g_pExecPtr = (ConCommand *)pBase;
g_pExecPtr = FindCommand("exec");
if (g_pExecPtr != NULL)
{
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_pExecPtr, Hook_ExecDispatchPre, false);

View File

@ -50,7 +50,9 @@
#include "sh_string.h"
#include "sm_version.h"
#ifdef ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
@ -724,7 +726,7 @@ public:
CON_COMMAND(sm_gamedata_md5, "Checks the MD5 sum for a given gamedata file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif

View File

@ -481,7 +481,7 @@ void CHalfLife2::PushCommandStack(const CCommand *cmd)
CachedCommandInfo info;
info.args = cmd;
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
strncopy(info.cmd, cmd->Arg(0), sizeof(info.cmd));
#endif
@ -505,7 +505,7 @@ void CHalfLife2::PopCommandStack()
const char *CHalfLife2::CurrentCommandName()
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
return m_CommandStack.front().args->Arg(0);
#else
return m_CommandStack.front().cmd;

View File

@ -74,7 +74,7 @@ struct DelayedFakeCliCmd
struct CachedCommandInfo
{
const CCommand *args;
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
char cmd[300];
#endif
};

View File

@ -5,8 +5,9 @@ SMSDK = ..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../hl2sdk
HL2SDK_OB = ../../hl2sdk-ob
SOURCEMM14 = ../../sourcemm-1.4
SOURCEMM16 = ../../sourcemm-1.6
HL2SDK_L4D = ../../hl2sdk-l4d
SOURCEMM14 = ../../mmsource-legacy
SOURCEMM16 = ../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -45,8 +46,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -55,15 +57,28 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
BINARY = sourcemod.2.ep2.so
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
BINARY = sourcemod.2.l4d.so
override ENGSET = true
endif
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
LINK += $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so \
tier0_i486.so -lpthread -static-libgcc
@ -73,8 +88,7 @@ INCLUDE_SMSDK = -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
INCLUDE_SM16 = -I. -I.. -I$(SOURCEMM16)/sourcehook $(INCLUDE_SMSDK)
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/vstdlib \
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook \
-I$(METAMOD)/sourcemm -Isystems $(INCLUDE_SMSDK)
-I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -Isystems $(INCLUDE_SMSDK)
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
@ -117,7 +131,7 @@ all: check
check:
if [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -314,7 +314,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
if (sound != NULL)
{
edict_t *pEdict = engine->PEntityOfEntIndex(client);
edict_t *pEdict = PEntityOfEntIndex(client);
if (pEdict)
{
ICollideable *pCollideable = pEdict->GetCollideable();

View File

@ -88,7 +88,7 @@ void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
return;
}
int client = engine->IndexOfEdict(pEdict);
int client = IndexOfEdict(pEdict);
if (client < 1 || client > 256)
{
return;
@ -325,7 +325,7 @@ void CValveMenuDisplay::SendRawDisplay(int client, int priority, unsigned int ti
m_pKv->SetInt("time", time ? time : 200);
SH_CALL(g_pSPHCC, &IServerPluginHelpers::CreateMessage)(
engine->PEntityOfEntIndex(client),
PEntityOfEntIndex(client),
DIALOG_MENU,
m_pKv,
vsp_interface);

View File

@ -37,7 +37,7 @@
float g_next_vote = 0.0f;
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue);
#else
void OnVoteDelayChange(ConVar *cvar, const char *value);
@ -52,7 +52,7 @@ ConVar sm_vote_delay("sm_vote_delay",
0.0,
OnVoteDelayChange);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void OnVoteDelayChange(IConVar *cvar, const char *value, float flOldValue)
#else
void OnVoteDelayChange(ConVar *cvar, const char *value)

View File

@ -40,7 +40,7 @@ NextMapManager g_NextMap;
SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#else
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
@ -55,30 +55,13 @@ bool g_forcedChange = false;
void NextMapManager::OnSourceModAllInitialized_Post()
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_ADD_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#else
SH_ADD_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
#endif
ConCommandBase *pBase = icvar->GetCommands();
ConCommand *pCmd = NULL;
while (pBase)
{
if (strcmp(pBase->GetName(), "changelevel") == 0)
{
/* Don't want to return convar with same name */
if (!pBase->IsCommand())
{
break;
}
pCmd = (ConCommand *)pBase;
break;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
ConCommand *pCmd = FindCommand("changelevel");
if (pCmd != NULL)
{
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdChangeLevelCallback, false);
@ -88,7 +71,7 @@ void NextMapManager::OnSourceModAllInitialized_Post()
void NextMapManager::OnSourceModShutdown()
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_REMOVE_HOOK(IVEngineServer, ChangeLevel, engine, SH_MEMBER(this, &NextMapManager::HookChangeLevel), false);
#else
SH_REMOVE_HOOK_MEMFUNC(IVEngineServer, ChangeLevel, engine, this, &NextMapManager::HookChangeLevel, false);
@ -203,7 +186,7 @@ NextMapManager::NextMapManager()
m_mapHistory = SourceHook::List<MapChangeData *>();
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command)
{
#else

View File

@ -58,7 +58,7 @@ struct MapChangeData
time_t startTime;
};
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command);
#else
void CmdChangeLevelCallback();
@ -69,7 +69,7 @@ class NextMapManager : public SMGlobalClass
public:
NextMapManager();
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
friend void CmdChangeLevelCallback(const CCommand &command);
#else
friend void CmdChangeLevelCallback();

View File

@ -61,7 +61,7 @@ List<ICommandTargetProcessor *> target_processors;
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int);
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, edict_t *);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
#else
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
@ -69,7 +69,7 @@ SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *)
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#else
extern bool __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
@ -151,24 +151,7 @@ void PlayerManager::OnSourceModAllInitialized()
g_ConVarManager.AddConVarChangeListener("tv_enable", this);
ConCommandBase *pBase = icvar->GetCommands();
ConCommand *pCmd = NULL;
while (pBase)
{
if (strcmp(pBase->GetName(), "maxplayers") == 0)
{
/* Don't want to return convar with same name */
if (!pBase->IsCommand())
{
break;
}
pCmd = (ConCommand *)pBase;
break;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
ConCommand *pCmd = FindCommand("maxplayers");
if (pCmd != NULL)
{
SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, pCmd, CmdMaxplayersCallback, true);
@ -408,7 +391,7 @@ void PlayerManager::RunAuthChecks()
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
List<IClientListener *>::iterator iter;
@ -452,7 +435,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
bool orig_value = META_RESULT_ORIG_RET(bool);
CPlayer *pPlayer = &m_Players[client];
@ -492,7 +475,7 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
/* If they're not connected, they're a bot */
@ -590,7 +573,7 @@ void PlayerManager::OnSourceModLevelEnd()
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (pPlayer->IsConnected())
@ -628,7 +611,7 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
m_cldisconnect_post->PushCell(client);
m_cldisconnect_post->Execute(&res, NULL);
@ -642,7 +625,7 @@ void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
}
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
{
#else
@ -650,7 +633,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
{
CCommand args;
#endif
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
cell_t res = Pl_Continue;
CPlayer *pPlayer = &m_Players[client];
@ -705,7 +688,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
{
cell_t res;
int client = engine->IndexOfEdict(pEntity);
int client = IndexOfEdict(pEntity);
CPlayer *pPlayer = &m_Players[client];
if (!pPlayer->IsConnected())
@ -713,7 +696,7 @@ void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
return;
}
m_clinfochanged->PushCell(engine->IndexOfEdict(pEntity));
m_clinfochanged->PushCell(client);
m_clinfochanged->Execute(&res, NULL);
IPlayerInfo *info = pPlayer->GetPlayerInfo();
@ -833,7 +816,7 @@ void PlayerManager::RemoveClientListener(IClientListener *listener)
IGamePlayer *PlayerManager::GetGamePlayer(edict_t *pEdict)
{
int index = engine->IndexOfEdict(pEdict);
int index = IndexOfEdict(pEdict);
return GetGamePlayer(index);
}
@ -1304,7 +1287,7 @@ void PlayerManager::MaxPlayersChanged( int newvalue /*= -1*/ )
}
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void CmdMaxplayersCallback(const CCommand &command)
{
#else
@ -1342,7 +1325,7 @@ void CPlayer::Initialize(const char *name, const char *ip, edict_t *pEntity)
m_Name.assign(name);
m_Ip.assign(ip);
m_pEdict = pEntity;
m_iIndex = engine->IndexOfEdict(pEntity);
m_iIndex = IndexOfEdict(pEntity);
m_LangId = g_Translator.GetServerLanguage();
char ip2[24], *ptr;
@ -1364,7 +1347,7 @@ void CPlayer::Connect()
m_IsInGame = true;
const char *var = g_Players.GetPassInfoVar();
int client = engine->IndexOfEdict(m_pEdict);
int client = IndexOfEdict(m_pEdict);
if (var[0] != '\0')
{
const char *pass = engine->GetClientConVarValue(client, var);
@ -1611,7 +1594,7 @@ void CPlayer::DoBasicAdminChecks()
/* First check the name */
AdminId id;
int client = engine->IndexOfEdict(m_pEdict);
int client = IndexOfEdict(m_pEdict);
if ((id = g_Admins.FindAdminByIdentity("name", GetName())) != INVALID_ADMIN_ID)
{

View File

@ -135,7 +135,7 @@ public:
void OnClientPutInServer(edict_t *pEntity, char const *playername);
void OnClientDisconnect(edict_t *pEntity);
void OnClientDisconnect_Post(edict_t *pEntity);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void OnClientCommand(edict_t *pEntity, const CCommand &args);
#else
void OnClientCommand(edict_t *pEntity);
@ -204,7 +204,7 @@ private:
int m_ListenClient;
};
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void CmdMaxplayersCallback(const CCommand &command);
#else
void CmdMaxplayersCallback();

View File

@ -34,7 +34,11 @@
UserMessages g_UserMsgs;
#if SOURCE_ENGINE == SE_LEFT4DEAD
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
#else
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
#endif
SH_DECL_HOOK0_void(IVEngineServer, MessageEnd, SH_NOATTRIB, 0);
UserMessages::UserMessages() : m_InterceptBuffer(m_pBase, 2500)
@ -164,9 +168,17 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
if (m_CurFlags & USERMSG_BLOCKHOOKS)
{
#if SOURCE_ENGINE == SE_LEFT4DEAD
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
#else
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
#endif
} else {
#if SOURCE_ENGINE == SE_LEFT4DEAD
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
#else
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
#endif
}
return buffer;
@ -279,7 +291,11 @@ void UserMessages::_DecRefCounter()
}
}
#if SOURCE_ENGINE == SE_LEFT4DEAD
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
#else
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
#endif
{
bool is_intercept_empty = m_msgIntercepts[msg_type].empty();
bool is_hook_empty = m_msgHooks[msg_type].empty();
@ -305,7 +321,11 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
RETURN_META_VALUE(MRES_IGNORED, NULL);
}
#if SOURCE_ENGINE == SE_LEFT4DEAD
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
#else
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
#endif
{
if (!m_InHook)
{
@ -444,7 +464,11 @@ void UserMessages::OnMessageEnd_Pre()
{
bf_write *engine_bfw;
#if SOURCE_ENGINE == SE_LEFT4DEAD
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
#else
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
#endif
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
ENGINE_CALL(MessageEnd)();

View File

@ -72,8 +72,13 @@ public: //IUserMessages
bf_write *StartMessage(int msg_id, const cell_t players[], unsigned int playersNum, int flags);
bool EndMessage();
public:
#if SOURCE_ENGINE == SE_LEFT4DEAD
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
#else
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
#endif
void OnMessageEnd_Pre();
void OnMessageEnd_Post();
private:

View File

@ -35,8 +35,9 @@
#include "concmd_cleaner.h"
#include "sm_stringutil.h"
#include "sourcemm_api.h"
#include "compat_wrappers.h"
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
#endif
@ -56,7 +57,7 @@ ConCommandBase *FindConCommandBase(const char *name);
class ConCommandCleaner : public SMGlobalClass
{
public:
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
void OnSourceModAllInitialized()
{
SH_ADD_HOOK_MEMFUNC(ICvar, UnregisterConCommand, icvar, this, &ConCommandCleaner::UnlinkConCommandBase, false);
@ -95,7 +96,7 @@ public:
while (iter != tracked_bases.end())
{
/* This is just god-awful! */
if (FindConCommandBase((*iter)->name) != (*iter)->pBase)
if (FindCommandBase((*iter)->name) != (*iter)->pBase)
{
pInfo = (*iter);
iter = tracked_bases.erase(iter);
@ -143,22 +144,6 @@ public:
}
} s_ConCmdTracker;
ConCommandBase *FindConCommandBase(const char *name)
{
const ConCommandBase *pBase = icvar->GetCommands();
while (pBase != NULL)
{
if (strcmp(pBase->GetName(), name) == 0)
{
return const_cast<ConCommandBase *>(pBase);
}
pBase = pBase->GetNext();
}
return NULL;
}
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me)
{
s_ConCmdTracker.AddTarget(pBase, me);

View File

@ -38,7 +38,6 @@ public:
virtual void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe) = 0;
};
ConCommandBase *FindConCommandBase(const char *name);
void TrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
void UntrackConCommandBase(ConCommandBase *pBase, IConCommandTracker *me);
void Global_OnUnlinkConCommandBase(ConCommandBase *pBase);

712
core/convar_sm_l4d.h Normal file
View File

@ -0,0 +1,712 @@
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $Workfile: $
// $Date: $
//
//-----------------------------------------------------------------------------
// $NoKeywords: $
//===========================================================================//
#ifndef CONVAR_H
#define CONVAR_H
#if _WIN32
#pragma once
#endif
#include "tier0/dbg.h"
#include "tier1/iconvar.h"
#include "tier1/utlvector.h"
#include "tier1/utlstring.h"
#include "icvar.h"
#ifdef _WIN32
#define FORCEINLINE_CVAR FORCEINLINE
#elif _LINUX
#define FORCEINLINE_CVAR inline
#else
#error "implement me"
#endif
//-----------------------------------------------------------------------------
// Forward declarations
//-----------------------------------------------------------------------------
class ConVar;
class CCommand;
class ConCommand;
class ConCommandBase;
struct characterset_t;
//-----------------------------------------------------------------------------
// Any executable that wants to use ConVars need to implement one of
// these to hook up access to console variables.
//-----------------------------------------------------------------------------
class IConCommandBaseAccessor
{
public:
// Flags is a combination of FCVAR flags in cvar.h.
// hOut is filled in with a handle to the variable.
virtual bool RegisterConCommandBase( ConCommandBase *pVar ) = 0;
};
//-----------------------------------------------------------------------------
// Helper method for console development
//-----------------------------------------------------------------------------
#if defined( _X360 ) && !defined( _RETAIL )
void ConVar_PublishToVXConsole();
#endif
//-----------------------------------------------------------------------------
// Called when a ConCommand needs to execute
//-----------------------------------------------------------------------------
typedef void ( *FnCommandCallbackV1_t )( void );
typedef void ( *FnCommandCallback_t )( const CCommand &command );
#define COMMAND_COMPLETION_MAXITEMS 64
#define COMMAND_COMPLETION_ITEM_LENGTH 64
//-----------------------------------------------------------------------------
// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings
//-----------------------------------------------------------------------------
typedef int ( *FnCommandCompletionCallback )( const char *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] );
//-----------------------------------------------------------------------------
// Interface version
//-----------------------------------------------------------------------------
class ICommandCallback
{
public:
virtual void CommandCallback( const CCommand &command ) = 0;
};
class ICommandCompletionCallback
{
public:
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands ) = 0;
};
//-----------------------------------------------------------------------------
// Purpose: The base console invoked command/cvar interface
//-----------------------------------------------------------------------------
class ConCommandBase
{
friend class CCvar;
friend class ConVar;
friend class ConCommand;
friend void ConVar_Register( int nCVarFlag, IConCommandBaseAccessor *pAccessor );
friend void ConVar_PublishToVXConsole();
// FIXME: Remove when ConVar changes are done
friend class CDefaultCvar;
public:
ConCommandBase( void );
ConCommandBase( const char *pName, const char *pHelpString = 0,
int flags = 0 );
virtual ~ConCommandBase( void );
virtual bool IsCommand( void ) const;
// Check flag
virtual bool IsFlagSet( int flag ) const;
// Set flag
virtual void AddFlags( int flags );
// Remove flag
virtual void RemoveFlags( int flags );
// Get flags
virtual int GetFlags( void ) const;
// Return name of cvar
virtual const char *GetName( void ) const;
// Return help text for cvar
virtual const char *GetHelpText( void ) const;
// Deal with next pointer
const ConCommandBase *GetNext( void ) const;
ConCommandBase *GetNext( void );
inline void SetNext(ConCommandBase *pBase)
{
m_pNext = pBase;
}
virtual bool IsRegistered( void ) const;
// Returns the DLL identifier
virtual CVarDLLIdentifier_t GetDLLIdentifier() const;
protected:
virtual void Create( const char *pName, const char *pHelpString = 0,
int flags = 0 );
// Used internally by OneTimeInit to initialize/shutdown
virtual void Init();
void Shutdown();
// Internal copy routine ( uses new operator from correct module )
char *CopyString( const char *from );
private:
// Next ConVar in chain
// Prior to register, it points to the next convar in the DLL.
// Once registered, though, m_pNext is reset to point to the next
// convar in the global list
ConCommandBase *m_pNext;
// Has the cvar been added to the global list?
bool m_bRegistered;
// Static data
const char *m_pszName;
const char *m_pszHelpString;
// ConVar flags
int m_nFlags;
protected:
// ConVars add themselves to this list for the executable.
// Then ConVar_Register runs through all the console variables
// and registers them into a global list stored in vstdlib.dll
static ConCommandBase *s_pConCommandBases;
// ConVars in this executable use this 'global' to access values.
static IConCommandBaseAccessor *s_pAccessor;
public:
inline void SetFlags(int flags)
{
m_nFlags = flags;
}
};
//-----------------------------------------------------------------------------
// Command tokenizer
//-----------------------------------------------------------------------------
class CCommand
{
public:
CCommand();
CCommand( int nArgC, const char **ppArgV );
bool Tokenize( const char *pCommand, characterset_t *pBreakSet = NULL );
void Reset();
int ArgC() const;
const char **ArgV() const;
const char *ArgS() const; // All args that occur after the 0th arg, in string form
const char *GetCommandString() const; // The entire command in string form, including the 0th arg
const char *operator[]( int nIndex ) const; // Gets at arguments
const char *Arg( int nIndex ) const; // Gets at arguments
// Helper functions to parse arguments to commands.
const char* FindArg( const char *pName ) const;
int FindArgInt( const char *pName, int nDefaultVal ) const;
static int MaxCommandLength();
static characterset_t* DefaultBreakSet();
private:
enum
{
COMMAND_MAX_ARGC = 64,
COMMAND_MAX_LENGTH = 512,
};
int m_nArgc;
int m_nArgv0Size;
char m_pArgSBuffer[ COMMAND_MAX_LENGTH ];
char m_pArgvBuffer[ COMMAND_MAX_LENGTH ];
const char* m_ppArgv[ COMMAND_MAX_ARGC ];
};
inline int CCommand::MaxCommandLength()
{
return COMMAND_MAX_LENGTH - 1;
}
inline int CCommand::ArgC() const
{
return m_nArgc;
}
inline const char **CCommand::ArgV() const
{
return m_nArgc ? (const char**)m_ppArgv : NULL;
}
inline const char *CCommand::ArgS() const
{
return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : "";
}
inline const char *CCommand::GetCommandString() const
{
return m_nArgc ? m_pArgSBuffer : "";
}
inline const char *CCommand::Arg( int nIndex ) const
{
// FIXME: Many command handlers appear to not be particularly careful
// about checking for valid argc range. For now, we're going to
// do the extra check and return an empty string if it's out of range
if ( nIndex < 0 || nIndex >= m_nArgc )
return "";
return m_ppArgv[nIndex];
}
inline const char *CCommand::operator[]( int nIndex ) const
{
return Arg( nIndex );
}
//-----------------------------------------------------------------------------
// Purpose: The console invoked command
//-----------------------------------------------------------------------------
class ConCommand : public ConCommandBase
{
friend class CCvar;
public:
typedef ConCommandBase BaseClass;
ConCommand( const char *pName, FnCommandCallbackV1_t callback,
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
ConCommand( const char *pName, FnCommandCallback_t callback,
const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 );
ConCommand( const char *pName, ICommandCallback *pCallback,
const char *pHelpString = 0, int flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 );
virtual ~ConCommand( void );
virtual bool IsCommand( void ) const;
virtual int AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands );
virtual bool CanAutoComplete( void );
// Invoke the function
virtual void Dispatch( const CCommand &command );
private:
// NOTE: To maintain backward compat, we have to be very careful:
// All public virtual methods must appear in the same order always
// since engine code will be calling into this code, which *does not match*
// in the mod code; it's using slightly different, but compatible versions
// of this class. Also: Be very careful about adding new fields to this class.
// Those fields will not exist in the version of this class that is instanced
// in mod code.
// Call this function when executing the command
union
{
FnCommandCallbackV1_t m_fnCommandCallbackV1;
FnCommandCallback_t m_fnCommandCallback;
ICommandCallback *m_pCommandCallback;
};
union
{
FnCommandCompletionCallback m_fnCompletionCallback;
ICommandCompletionCallback *m_pCommandCompletionCallback;
};
bool m_bHasCompletionCallback : 1;
bool m_bUsingNewCommandCallback : 1;
bool m_bUsingCommandCallbackInterface : 1;
public:
inline FnCommandCallback_t GetCallback() const
{
return m_fnCommandCallback;
}
};
//-----------------------------------------------------------------------------
// Purpose: A console variable
//-----------------------------------------------------------------------------
class ConVar : public ConCommandBase, public IConVar
{
friend class CCvar;
friend class ConVarRef;
public:
typedef ConCommandBase BaseClass;
ConVar( const char *pName, const char *pDefaultValue, int flags = 0);
ConVar( const char *pName, const char *pDefaultValue, int flags,
const char *pHelpString );
ConVar( const char *pName, const char *pDefaultValue, int flags,
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax );
ConVar( const char *pName, const char *pDefaultValue, int flags,
const char *pHelpString, FnChangeCallback_t callback );
ConVar( const char *pName, const char *pDefaultValue, int flags,
const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax,
FnChangeCallback_t callback );
virtual ~ConVar( void );
virtual bool IsCommand( void ) const;
virtual bool IsFlagSet( int flag ) const;
virtual void AddFlags( int flags );
virtual int GetFlags( void ) const;
virtual const char *GetName( void ) const;
virtual const char* GetHelpText( void ) const;
virtual bool IsRegistered( void ) const;
// Install a change callback (there shouldn't already be one....)
void InstallChangeCallback( FnChangeCallback_t callback );
// Retrieve value
FORCEINLINE_CVAR float GetFloat( void ) const;
FORCEINLINE_CVAR int GetInt( void ) const;
FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); }
FORCEINLINE_CVAR char const *GetString( void ) const;
// Used internally by OneTimeInit to initialize.
virtual void Init();
virtual const char *GetBaseName( void ) const;
virtual int GetSplitScreenPlayerSlot ( void ) const;
// Any function that allocates/frees memory needs to be virtual or else you'll have crashes
// from alloc/free across dll/exe boundaries.
// These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue).
virtual void SetValue( const char *value );
virtual void SetValue( float value );
virtual void SetValue( int value );
// Reset to default value
void Revert( void );
// True if it has a min/max setting
bool GetMin( float& minVal ) const;
bool GetMax( float& maxVal ) const;
const char *GetDefault( void ) const;
private:
// Called by CCvar when the value of a var is changing.
virtual void InternalSetValue(const char *value);
// For CVARs marked FCVAR_NEVER_AS_STRING
virtual void InternalSetFloatValue( float fNewValue );
virtual void InternalSetIntValue( int nValue );
virtual bool ClampValue( float& value );
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
virtual void Create( const char *pName, const char *pDefaultValue, int flags = 0,
const char *pHelpString = 0, bool bMin = false, float fMin = 0.0,
bool bMax = false, float fMax = false, FnChangeCallback_t callback = 0 );
private:
// This either points to "this" or it points to the original declaration of a ConVar.
// This allows ConVars to exist in separate modules, and they all use the first one to be declared.
// m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar).
ConVar *m_pParent;
// Static data
const char *m_pszDefaultValue;
// Value
// Dynamically allocated
char *m_pszString;
int m_StringLength;
// Values
float m_fValue;
int m_nValue;
// Min/Max values
bool m_bHasMin;
float m_fMinVal;
bool m_bHasMax;
float m_fMaxVal;
// Call this function when ConVar changes
FnChangeCallback_t m_fnChangeCallback;
public:
inline FnChangeCallback_t GetCallback() const
{
return m_fnChangeCallback;
}
inline void SetMin(bool set, float min=0.0)
{
m_bHasMin = set;
m_fMinVal = min;
}
inline void SetMax(bool set, float max=0.0)
{
m_bHasMax = set;
m_fMaxVal = max;
}
};
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a float
// Output : float
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR float ConVar::GetFloat( void ) const
{
return m_pParent->m_fValue;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as an int
// Output : int
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR int ConVar::GetInt( void ) const
{
return m_pParent->m_nValue;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
// Output : const char *
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR const char *ConVar::GetString( void ) const
{
if ( m_nFlags & FCVAR_NEVER_AS_STRING )
return "FCVAR_NEVER_AS_STRING";
return ( m_pParent->m_pszString ) ? m_pParent->m_pszString : "";
}
//-----------------------------------------------------------------------------
// Used to read/write convars that already exist (replaces the FindVar method)
//-----------------------------------------------------------------------------
class ConVarRef
{
public:
ConVarRef( const char *pName );
ConVarRef( const char *pName, bool bIgnoreMissing );
ConVarRef( IConVar *pConVar );
void Init( const char *pName, bool bIgnoreMissing );
bool IsValid() const;
bool IsFlagSet( int nFlags ) const;
IConVar *GetLinkedConVar();
// Get/Set value
float GetFloat( void ) const;
int GetInt( void ) const;
bool GetBool() const { return !!GetInt(); }
const char *GetString( void ) const;
void SetValue( const char *pValue );
void SetValue( float flValue );
void SetValue( int nValue );
void SetValue( bool bValue );
const char *GetName() const;
const char *GetDefault() const;
private:
// High-speed method to read convar data
IConVar *m_pConVar;
ConVar *m_pConVarState;
};
//-----------------------------------------------------------------------------
// Did we find an existing convar of that name?
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int nFlags ) const
{
return ( m_pConVar->IsFlagSet( nFlags ) != 0 );
}
FORCEINLINE_CVAR IConVar *ConVarRef::GetLinkedConVar()
{
return m_pConVar;
}
FORCEINLINE_CVAR const char *ConVarRef::GetName() const
{
return m_pConVar->GetName();
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a float
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR float ConVarRef::GetFloat( void ) const
{
return m_pConVarState->m_fValue;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as an int
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR int ConVarRef::GetInt( void ) const
{
return m_pConVarState->m_nValue;
}
//-----------------------------------------------------------------------------
// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc.
//-----------------------------------------------------------------------------
FORCEINLINE_CVAR const char *ConVarRef::GetString( void ) const
{
Assert( !IsFlagSet( FCVAR_NEVER_AS_STRING ) );
return m_pConVarState->m_pszString;
}
FORCEINLINE_CVAR void ConVarRef::SetValue( const char *pValue )
{
m_pConVar->SetValue( pValue );
}
FORCEINLINE_CVAR void ConVarRef::SetValue( float flValue )
{
m_pConVar->SetValue( flValue );
}
FORCEINLINE_CVAR void ConVarRef::SetValue( int nValue )
{
m_pConVar->SetValue( nValue );
}
FORCEINLINE_CVAR void ConVarRef::SetValue( bool bValue )
{
m_pConVar->SetValue( bValue ? 1 : 0 );
}
FORCEINLINE_CVAR const char *ConVarRef::GetDefault() const
{
return m_pConVarState->m_pszDefaultValue;
}
//-----------------------------------------------------------------------------
// Called by the framework to register ConCommands with the ICVar
//-----------------------------------------------------------------------------
void ConVar_Register( int nCVarFlag = 0, IConCommandBaseAccessor *pAccessor = NULL );
void ConVar_Unregister( );
//-----------------------------------------------------------------------------
// Utility methods
//-----------------------------------------------------------------------------
void ConVar_PrintFlags( const ConCommandBase *var );
void ConVar_PrintDescription( const ConCommandBase *pVar );
//-----------------------------------------------------------------------------
// Purpose: Utility class to quickly allow ConCommands to call member methods
//-----------------------------------------------------------------------------
#ifdef _MSC_VER
#pragma warning (disable : 4355 )
#endif
template< class T >
class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback
{
typedef ConCommand BaseClass;
typedef void ( T::*FnMemberCommandCallback_t )( const CCommand &command );
typedef int ( T::*FnMemberCommandCompletionCallback_t )( const char *pPartial, CUtlVector< CUtlString > &commands );
public:
CConCommandMemberAccessor( T* pOwner, const char *pName, FnMemberCommandCallback_t callback, const char *pHelpString = 0,
int flags = 0, FnMemberCommandCompletionCallback_t completionFunc = 0 ) :
BaseClass( pName, this, pHelpString, flags, ( completionFunc != 0 ) ? this : NULL )
{
m_pOwner = pOwner;
m_Func = callback;
m_CompletionFunc = completionFunc;
}
~CConCommandMemberAccessor()
{
Shutdown();
}
void SetOwner( T* pOwner )
{
m_pOwner = pOwner;
}
virtual void CommandCallback( const CCommand &command )
{
Assert( m_pOwner && m_Func );
(m_pOwner->*m_Func)( command );
}
virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands )
{
Assert( m_pOwner && m_CompletionFunc );
return (m_pOwner->*m_CompletionFunc)( pPartial, commands );
}
private:
T* m_pOwner;
FnMemberCommandCallback_t m_Func;
FnMemberCommandCompletionCallback_t m_CompletionFunc;
};
#ifdef _MSC_VER
#pragma warning ( default : 4355 )
#endif
//-----------------------------------------------------------------------------
// Purpose: Utility macros to quicky generate a simple console command
//-----------------------------------------------------------------------------
#define CON_COMMAND( name, description ) \
static void name( const CCommand &args ); \
static ConCommand name##_command( #name, name, description ); \
static void name( const CCommand &args )
#define CON_COMMAND_F( name, description, flags ) \
static void name( const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags ); \
static void name( const CCommand &args )
#define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \
static void name( const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags, completion ); \
static void name( const CCommand &args )
#define CON_COMMAND_EXTERN( name, _funcname, description ) \
void _funcname( const CCommand &args ); \
static ConCommand name##_command( #name, _funcname, description ); \
void _funcname( const CCommand &args )
#define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \
void _funcname( const CCommand &args ); \
static ConCommand name##_command( #name, _funcname, description, flags ); \
void _funcname( const CCommand &args )
#define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \
void _funcname( const CCommand &args ); \
friend class CCommandMemberInitializer_##_funcname; \
class CCommandMemberInitializer_##_funcname \
{ \
public: \
CCommandMemberInitializer_##_funcname() : m_ConCommandAccessor( NULL, name, &_thisclass::_funcname, description, flags ) \
{ \
m_ConCommandAccessor.SetOwner( GET_OUTER( _thisclass, m_##_funcname##_register ) ); \
} \
private: \
CConCommandMemberAccessor< _thisclass > m_ConCommandAccessor; \
}; \
\
CCommandMemberInitializer_##_funcname m_##_funcname##_register; \
#endif // CONVAR_H

View File

@ -6,30 +6,39 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
Release - Episode 1|Win32 = Release - Episode 1|Win32
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
Release - Orange Box|Win32 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -122,7 +122,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -203,7 +203,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
@ -283,7 +283,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=3"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -363,7 +363,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=3"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -444,7 +444,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(HL2SDKOB)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=3"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
@ -524,7 +524,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -604,7 +604,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -685,7 +685,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(HL2SDK)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
@ -739,6 +739,247 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="CrazyDebug - Left 4 Dead|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(HL2SDKL4D)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=4"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(HL2SDKL4D)\lib\public\tier0.lib&quot; &quot;$(HL2SDKL4D)\lib\public\tier1.lib&quot; &quot;$(HL2SDKL4D)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKL4D)\lib\public\mathlib.lib&quot; dbghelp.lib &quot;Wsock32.lib&quot;"
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug - Left 4 Dead|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(HL2SDKL4D)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=4"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(HL2SDKL4D)\lib\public\tier0.lib&quot; &quot;$(HL2SDKL4D)\lib\public\tier1.lib&quot; &quot;$(HL2SDKL4D)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKL4D)\lib\public\mathlib.lib&quot; &quot;Wsock32.lib&quot;"
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release - Left 4 Dead|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(HL2SDKL4D)\public\vstdlib&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=4"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="0"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(HL2SDKL4D)\lib\public\tier0.lib&quot; &quot;$(HL2SDKL4D)\lib\public\tier1.lib&quot; &quot;$(HL2SDKL4D)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKL4D)\lib\public\mathlib.lib&quot; &quot;Wsock32.lib&quot;"
OutputFile="$(OutDir)\sourcemod.2.l4d.dll"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
@ -831,6 +1072,22 @@
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug - Left 4 Dead|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release - Left 4 Dead|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Database.cpp"

View File

@ -61,7 +61,7 @@ RootConsoleMenu::~RootConsoleMenu()
void RootConsoleMenu::OnSourceModStartup(bool late)
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
g_pCVar = icvar;
#endif
CONVAR_REGISTER(this);
@ -291,7 +291,7 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &
CON_COMMAND(sm, "SourceMod Menu")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
g_RootMenu.GotRootCmd(args);
@ -327,7 +327,7 @@ void write_handles_to_game(const char *fmt, ...)
CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle leaks")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
if (args.ArgC() < 2)

View File

@ -44,7 +44,11 @@
#include <bitbuf.h>
#include <sm_trie_tpl.h>
#if SOURCE_ENGINE == SE_LEFT4DEAD
#define NET_SETCONVAR 6
#else
#define NET_SETCONVAR 5
#endif
enum ConVarBounds
{
@ -63,7 +67,11 @@ struct GlobCmdIter
struct ConCmdIter
{
#if SOURCE_ENGINE == SE_LEFT4DEAD
ICvarIteratorInternal *pLast;
#else
const ConCommandBase *pLast;
#endif
};
class ConsoleHelpers :
@ -129,7 +137,7 @@ public:
*flags = (*ppCmd)->GetFlags();
return true;
}
else if ((pCmd=FindConCommandBase(name)))
else if ((pCmd=FindCommandBase(name)))
{
m_CmdFlags.insert(name, pCmd);
TrackConCommandBase(pCmd, this);
@ -151,7 +159,7 @@ public:
TrackConCommandBase((*ppCmd), this);
return true;
}
else if ((pCmd=FindConCommandBase(name)))
else if ((pCmd=FindCommandBase(name)))
{
m_CmdFlags.insert(name, pCmd);
pCmd->SetFlags(flags);
@ -167,7 +175,7 @@ private:
KTrie<ConCommandBase *> m_CmdFlags;
} s_CommandFlagsHelper;
#ifndef ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
static void ReplicateConVar(ConVar *pConVar)
{
int maxClients = g_Players.GetMaxClients();
@ -341,7 +349,7 @@ static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
pConVar->SetValue(params[2]);
#ifndef ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -390,7 +398,7 @@ static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
float value = sp_ctof(params[2]);
pConVar->SetValue(value);
#ifndef ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -441,7 +449,7 @@ static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
pConVar->SetValue(value);
#ifndef ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -472,7 +480,7 @@ static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
pConVar->Revert();
#ifndef ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
/* Should we replicate it? */
if (params[3] && IsFlagSet(pConVar, FCVAR_REPLICATED))
{
@ -1151,12 +1159,21 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
pContext->LocalToPhysAddr(params[3], &pIsCmd);
pContext->LocalToPhysAddr(params[4], &pFlags);
#if SOURCE_ENGINE == SE_LEFT4DEAD
ICvarIteratorInternal *cvarIter = icvar->FactoryInternalIterator();
cvarIter->SetFirst();
if (!cvarIter->IsValid())
{
return BAD_HANDLE;
}
pConCmd = cvarIter->Get();
#else
pConCmd = icvar->GetCommands();
if (pConCmd == NULL)
{
return BAD_HANDLE;
}
#endif
pContext->StringToLocalUTF8(params[1], params[2], pConCmd->GetName(), NULL);
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
@ -1169,7 +1186,11 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
}
pIter = new ConCmdIter;
#if SOURCE_ENGINE == SE_LEFT4DEAD
pIter->pLast = cvarIter;
#else
pIter->pLast = pConCmd;
#endif
if ((hndl = g_HandleSys.CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
== BAD_HANDLE)
@ -1187,6 +1208,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
ConCmdIter *pIter;
cell_t *pIsCmd, *pFlags;
const char *desc;
const ConCommandBase *pConCmd;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err = g_HandleSys.ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
@ -1199,21 +1221,33 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
return 0;
}
if ((pIter->pLast = pIter->pLast->GetNext()) == NULL)
#if SOURCE_ENGINE == SE_LEFT4DEAD
ICvarIteratorInternal *cvarIter = pIter->pLast;
cvarIter->Next();
if (!cvarIter->IsValid())
{
return 0;
}
pConCmd = cvarIter->Get();
#else
pConCmd = pIter->pLast->GetNext();
if (pConCmd == NULL)
{
return 0;
}
pIter->pLast = pConCmd;
#endif
pContext->LocalToPhysAddr(params[4], &pIsCmd);
pContext->LocalToPhysAddr(params[5], &pFlags);
pContext->StringToLocalUTF8(params[2], params[3], pIter->pLast->GetName(), NULL);
*pIsCmd = pIter->pLast->IsCommand() ? 1 : 0;
*pFlags = pIter->pLast->GetFlags();
pContext->StringToLocalUTF8(params[2], params[3], pConCmd->GetName(), NULL);
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
*pFlags = pConCmd->GetFlags();
if (params[7])
{
desc = pIter->pLast->GetHelpText();
desc = pConCmd->GetHelpText();
pContext->StringToLocalUTF8(params[6], params[7], (desc && desc[0]) ? desc : "", NULL);
}

View File

@ -56,7 +56,7 @@ enum PropFieldType
inline edict_t *GetEdict(cell_t num)
{
edict_t *pEdict = engine->PEntityOfEntIndex(num);
edict_t *pEdict = PEntityOfEntIndex(num);
if (!pEdict || pEdict->IsFree())
{
return NULL;
@ -74,7 +74,7 @@ inline edict_t *GetEdict(cell_t num)
inline edict_t *GetEntity(cell_t num, CBaseEntity **pData)
{
edict_t *pEdict = engine->PEntityOfEntIndex(num);
edict_t *pEdict = PEntityOfEntIndex(num);
if (!pEdict || pEdict->IsFree())
{
return NULL;
@ -156,12 +156,12 @@ static cell_t CreateEdict(IPluginContext *pContext, const cell_t *params)
return 0;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
static cell_t RemoveEdict(IPluginContext *pContext, const cell_t *params)
{
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
edict_t *pEdict = PEntityOfEntIndex(params[1]);
if (!pEdict)
{

View File

@ -97,7 +97,7 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
return 0;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)

View File

@ -31,7 +31,7 @@
#include "sm_globals.h"
#include <vector.h>
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
#include <mathlib.h>
#else
#include <math_base.h>

View File

@ -237,4 +237,3 @@ void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
return ptr;
}

View File

@ -32,10 +32,12 @@
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
#define _INCLUDE_SOURCEMOD_MM_API_H_
#if defined ORANGEBOX_BUILD
#include "convar_sm_ob.h"
#if SOURCE_ENGINE == SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
#include "convar_sm.h"
#endif
#include <ISmmPlugin.h>
#include <eiface.h>

View File

@ -69,11 +69,13 @@ CLocalExtension::CLocalExtension(const char *filename)
path,
PLATFORM_MAX_PATH,
#if defined METAMOD_PLAPI_VERSION
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_LEFT4DEAD
"extensions/auto.2.l4d/%s",
#elif SOURCE_ENGINE == SE_ORANGEBOX
"extensions/auto.2.ep2/%s",
#else
"extensions/auto.2.ep1/%s",
#endif //ORANGEBOX_BUILD
#endif //SOURCE_ENGINE == SE_LEFT4DEAD
#else //METAMOD_PLAPI_VERSION
"extensions/auto.1.ep1/%s",
#endif //METAMOD_PLAPI_VERSION

View File

@ -47,7 +47,9 @@
#include "sm_trie.h"
#include "sourcemod.h"
#include <IRootConsoleMenu.h>
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
-I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
@ -109,7 +122,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
-I$(SOURCEMM16)/sourcehook
@ -109,7 +122,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a tier0_i486.so
@ -56,8 +68,10 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/extensions -I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \
-I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -107,7 +121,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -108,7 +121,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
MYSQL = ../../../mysql-5.0
#####################################
@ -36,8 +37,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -45,14 +47,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -60,11 +72,12 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SOURCEMM16)/sourcehook \
-I$(MYSQL)/include
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
endif
LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -static-libgcc -lpthread
@ -114,7 +127,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SOURCEMM16)/sourcehook
endif
@ -108,7 +121,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -35,8 +36,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -44,14 +46,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so tier0_i486.so
@ -59,8 +71,10 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/tier0 \
-I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/extensions -I$(SMSDK)/public/sourcepawn
-I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \
-I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -111,7 +125,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -30,6 +30,7 @@
*/
#include "extension.h"
#include <compat_wrappers.h>
#include "vcallbuilder.h"
#include "vnatives.h"
#include "vhelpers.h"
@ -38,7 +39,9 @@
#include "vsound.h"
#include "output.h"
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_LEFT4DEAD
#define SDKTOOLS_GAME_FILE "sdktools.games.l4d"
#elif SOURCE_ENGINE == SE_ORANGEBOX
#define SDKTOOLS_GAME_FILE "sdktools.games.ep2"
#else
#define SDKTOOLS_GAME_FILE "sdktools.games"
@ -65,6 +68,7 @@ IVoiceServer *voiceserver = NULL;
IPlayerInfoManager *playerinfomngr = NULL;
ICvar *icvar = NULL;
IServer *iserver = NULL;
CGlobalVars *gpGlobals;
SourceHook::CallClass<IVEngineServer> *enginePatch = NULL;
SourceHook::CallClass<IEngineSound> *enginesoundPatch = NULL;
HandleType_t g_CallHandle = 0;
@ -125,7 +129,7 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
return false;
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
g_pCVar = icvar;
#endif
CONVAR_REGISTER(this);
@ -231,6 +235,7 @@ bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool
GET_V_IFACE_ANY(GetServerFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION);
gpGlobals = ismm->GetCGlobals();
enginePatch = SH_GET_CALLCLASS(engine);
enginesoundPatch = SH_GET_CALLCLASS(engsound);

View File

@ -50,7 +50,6 @@
#include <convar.h>
#include <iserver.h>
#include <cdll_int.h>
#include <compat_wrappers.h>
/**
* @brief Implementation of the SDK Tools extension.
@ -106,6 +105,7 @@ extern IVoiceServer *voiceserver;
extern IPlayerInfoManager *playerinfomngr;
extern ICvar *icvar;
extern IServer *iserver;
extern CGlobalVars *gpGlobals;
/* Interfaces from SourceMod */
extern IBinTools *g_pBinTools;
extern IGameConfig *g_pGameConf;
@ -119,6 +119,8 @@ extern ICallWrapper *g_pAcceptInput;
extern SourceHook::CallClass<IVEngineServer> *enginePatch;
extern SourceHook::CallClass<IEngineSound> *enginesoundPatch;
#include <compat_wrappers.h>
#define ENGINE_CALL(func) SH_CALL(enginePatch, &IVEngineServer::func)
#endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_

View File

@ -38,7 +38,7 @@ ICallWrapper *g_pAcceptInput = NULL;
unsigned char g_Variant_t[SIZEOF_VARIANT_T] = {0};
#define ENTINDEX_TO_CBASEENTITY(index, buffer) \
pEdict = engine->PEntityOfEntIndex(index); \
pEdict = PEntityOfEntIndex(index); \
if (!pEdict || pEdict->IsFree()) \
{ \
return pContext->ThrowNativeError("Entity %d is not valid or is freed", index); \

View File

@ -1,26 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2008
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdktools", "sdktools.vcproj", "{7A740927-C751-4312-BF9D-6367F8C508F8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
Release - Episode 1|Win32 = Release - Episode 1|Win32
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
Release - Orange Box|Win32 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
{7A740927-C751-4312-BF9D-6367F8C508F8}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32

View File

@ -42,7 +42,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
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;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -123,7 +123,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(SOURCEMM14)&quot;;&quot;$(SOURCEMM14)\sourcemm&quot;;&quot;$(SOURCEMM14)\sourcehook&quot;"
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;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="false"
@ -203,7 +203,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=3"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -284,7 +284,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKOB)\common&quot;;&quot;$(HL2SDKOB)\public&quot;;&quot;$(HL2SDKOB)\public\engine&quot;;&quot;$(HL2SDKOB)\public\game\server&quot;;&quot;$(HL2SDKOB)\public\mathlib&quot;;&quot;$(HL2SDKOB)\public\tier0&quot;;&quot;$(HL2SDKOB)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=3"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="false"
@ -364,7 +364,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
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;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@ -445,7 +445,7 @@
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDK)\public&quot;;&quot;$(HL2SDK)\public\dlls&quot;;&quot;$(HL2SDK)\public\engine&quot;;&quot;$(HL2SDK)\public\mathlib&quot;;&quot;$(HL2SDK)\public\tier0&quot;;&quot;$(HL2SDK)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
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;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=2"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="false"
@ -499,6 +499,167 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug - Left 4 Dead|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=4"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(HL2SDKL4D)\lib\public\tier0.lib&quot; &quot;$(HL2SDKL4D)\lib\public\tier1.lib&quot; &quot;$(HL2SDKL4D)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKL4D)\lib\public\mathlib.lib&quot;"
OutputFile="$(OutDir)\sdktools.ext.dll"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMT"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release - Left 4 Dead|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;&quot;$(HL2SDKL4D)\common&quot;;&quot;$(HL2SDKL4D)\public&quot;;&quot;$(HL2SDKL4D)\public\engine&quot;;&quot;$(HL2SDKL4D)\public\game\server&quot;;&quot;$(HL2SDKL4D)\public\mathlib&quot;;&quot;$(HL2SDKL4D)\public\tier0&quot;;&quot;$(HL2SDKL4D)\public\tier1&quot;;&quot;$(SOURCEMM16)&quot;;&quot;$(SOURCEMM16)\sourcemm&quot;;&quot;$(SOURCEMM16)\sourcehook&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;ORANGEBOX_BUILD;SE_EPISODEONE=2;SE_ORANGEBOX=3;SE_LEFT4DEAD=4;SOURCE_ENGINE=4"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="&quot;$(HL2SDKL4D)\lib\public\tier0.lib&quot; &quot;$(HL2SDKL4D)\lib\public\tier1.lib&quot; &quot;$(HL2SDKL4D)\lib\public\vstdlib.lib&quot; &quot;$(HL2SDKL4D)\lib\public\mathlib.lib&quot;"
OutputFile="$(OutDir)\sdktools.ext.dll"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBC;LIBCD;LIBCMTD"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>

View File

@ -251,7 +251,7 @@ void EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
int serial = pEdict->m_NetworkSerialNumber;
if (serial != hook->entity_filter && hook->entity_index == engine->IndexOfEdict(pEdict))
if (serial != hook->entity_filter && hook->entity_index == IndexOfEdict(pEdict))
{
// same entity index but different serial number. Entity has changed, kill the hook.
_iter = pOutputName->hooks.erase(_iter);
@ -264,7 +264,7 @@ void EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
{
//fire the forward to hook->pf
hook->pf->PushString(pOutputName->Name);
hook->pf->PushCell(engine->IndexOfEdict(pEdict));
hook->pf->PushCell(IndexOfEdict(pEdict));
edict_t *pEdictActivator = gameents->BaseEntityToEdict(pActivator);
if (!pEdictActivator)
@ -273,7 +273,7 @@ void EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
}
else
{
hook->pf->PushCell(engine->IndexOfEdict(pEdictActivator));
hook->pf->PushCell(IndexOfEdict(pEdictActivator));
}
//hook->pf->PushCell(handle);
hook->pf->PushFloat(fDelay);
@ -466,7 +466,7 @@ edict_t *EntityOutputManager::BaseHandleToEdict(CBaseHandle &hndl)
edict_t *pStoredEdict;
pStoredEdict = engine->PEntityOfEntIndex(index);
pStoredEdict = PEntityOfEntIndex(index);
if (pStoredEdict == NULL)
{

View File

@ -40,7 +40,7 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Entity Outputs are disabled - See error logs for details");
}
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
edict_t *pEdict = PEntityOfEntIndex(params[1]);
if (!pEdict)
{
return pContext->ThrowNativeError("Invalid Entity index %i", params[1]);
@ -72,7 +72,7 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
hook = g_OutputManager.NewHook();
hook->entity_filter = pEdict->m_NetworkSerialNumber;
hook->entity_index = engine->IndexOfEdict(pEdict);
hook->entity_index = IndexOfEdict(pEdict);
hook->only_once= !!params[4];
hook->pf = pFunction;
hook->m_parent = pOutputName;
@ -220,7 +220,7 @@ cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
}
// Find the classname of the entity and lookup the classname and output structures
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
edict_t *pEdict = PEntityOfEntIndex(params[1]);
if (!pEdict)
{
return pContext->ThrowNativeError("Invalid Entity index %i", params[1]);
@ -249,7 +249,7 @@ cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
for (_iter=pOutputName->hooks.begin(); _iter!=pOutputName->hooks.end(); _iter++)
{
hook = (omg_hooks *)*_iter;
if (hook->pf == pFunction && hook->entity_index == engine->IndexOfEdict(pEdict))
if (hook->pf == pFunction && hook->entity_index == IndexOfEdict(pEdict))
{
// remove this hook.
if (hook->in_use)

View File

@ -72,7 +72,7 @@ void SDKTools::OnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax
for (int i=0; i<edictCount; i++)
{
edict_t *pEdict = engine->PEntityOfEntIndex(i);
edict_t *pEdict = PEntityOfEntIndex(i);
if (!pEdict || pEdict->IsFree())
{
continue;

View File

@ -47,7 +47,7 @@ CON_COMMAND(sm_print_telist, "Prints the temp entity list")
CON_COMMAND(sm_dump_teprops, "Dumps tempentity props to a file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
if (!g_TEManager.IsAvailable())

View File

@ -39,7 +39,7 @@ public:
{
cell_t res = 1;
edict_t *pEdict = gameents->BaseEntityToEdict(reinterpret_cast<CBaseEntity *>(pEntity));
m_pFunc->PushCell(engine->IndexOfEdict(pEdict));
m_pFunc->PushCell(IndexOfEdict(pEdict));
m_pFunc->PushCell(contentsMask);
m_pFunc->PushCell(m_Data);
m_pFunc->Execute(&res);
@ -506,7 +506,7 @@ static cell_t smn_TRGetEntityIndex(IPluginContext *pContext, const cell_t *param
}
edict_t *pEdict = gameents->BaseEntityToEdict(tr->m_pEnt);
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
static cell_t smn_TRGetPointContents(IPluginContext *pContext, const cell_t *params)
@ -527,9 +527,13 @@ static cell_t smn_TRGetPointContents(IPluginContext *pContext, const cell_t *par
{
mask = enginetrace->GetPointContents(pos);
} else {
#if SOURCE_ENGINE == SE_LEFT4DEAD
mask = enginetrace->GetPointContents(pos, 0, &hentity);
#else
mask = enginetrace->GetPointContents(pos, &hentity);
#endif
edict_t *pEdict = gameents->BaseEntityToEdict(reinterpret_cast<CBaseEntity *>(hentity));
*ent = engine->IndexOfEdict(pEdict);
*ent = IndexOfEdict(pEdict);
}
return mask;
@ -537,7 +541,7 @@ static cell_t smn_TRGetPointContents(IPluginContext *pContext, const cell_t *par
static cell_t smn_TRGetPointContentsEnt(IPluginContext *pContext, const cell_t *params)
{
edict_t *pEdict = engine->PEntityOfEntIndex(params[1]);
edict_t *pEdict = PEntityOfEntIndex(params[1]);
if (!pEdict || pEdict->IsFree())
{
return pContext->ThrowNativeError("Entity %d is invalid", params[1]);

View File

@ -413,14 +413,14 @@ static cell_t SDKCall(IPluginContext *pContext, const cell_t *params)
{
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
} else if (vc->retinfo->vtype == Valve_Edict) {
edict_t *pEdict = *(edict_t **)(vc->retbuf);
if (!pEdict || pEdict->IsFree())
{
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
} else if (vc->retinfo->vtype == Valve_Bool) {
bool *addr = (bool *)vc->retbuf;
if (vc->retinfo->flags & PASSFLAG_ASPOINTER)

View File

@ -223,7 +223,7 @@ DataStatus EncodeValveParam(IPluginContext *pContext,
if (pEntity)
{
edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
*addr = engine->IndexOfEdict(pEdict);
*addr = IndexOfEdict(pEdict);
} else {
*addr = -1;
}
@ -238,7 +238,7 @@ DataStatus EncodeValveParam(IPluginContext *pContext,
edict_t *pEdict = *(edict_t **)buffer;
if (pEdict)
{
*addr = engine->IndexOfEdict(pEdict);
*addr = IndexOfEdict(pEdict);
} else {
*addr = -1;
}
@ -415,7 +415,7 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
} else if (param == 0) {
if (data->decflags & VDECODE_FLAG_ALLOWWORLD)
{
pEdict = engine->PEntityOfEntIndex(0);
pEdict = PEntityOfEntIndex(0);
} else {
pContext->ThrowNativeError("World not allowed");
return Data_Fail;
@ -479,13 +479,13 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
} else if (param == 0) {
if (data->decflags & VDECODE_FLAG_ALLOWWORLD)
{
pEdict = engine->PEntityOfEntIndex(0);
pEdict = PEntityOfEntIndex(0);
} else {
pContext->ThrowNativeError("World not allowed");
return Data_Fail;
}
} else {
pEdict = engine->PEntityOfEntIndex(param);
pEdict = PEntityOfEntIndex(param);
if (!pEdict || pEdict->IsFree())
{
pContext->ThrowNativeError("Entity %d is not valid or is freed", param);
@ -547,13 +547,13 @@ DataStatus DecodeValveParam(IPluginContext *pContext,
} else if (param == 0) {
if (data->decflags & VDECODE_FLAG_ALLOWWORLD)
{
pEdict = engine->PEntityOfEntIndex(0);
pEdict = PEntityOfEntIndex(0);
} else {
pContext->ThrowNativeError("World not allowed");
return Data_Fail;
}
} else {
pEdict = engine->PEntityOfEntIndex(param);
pEdict = PEntityOfEntIndex(param);
if (!pEdict || pEdict->IsFree())
{
pContext->ThrowNativeError("Entity %d is not valid or is freed", param);

View File

@ -247,7 +247,7 @@ int GetClientAimTarget(edict_t *pEdict, bool only_players)
return -1;
}
int ent_index = engine->IndexOfEdict(pTarget);
int ent_index = IndexOfEdict(pTarget);
IGamePlayer *pTargetPlayer = playerhelpers->GetGamePlayer(ent_index);
if (pTargetPlayer != NULL && !pTargetPlayer->IsInGame())
@ -269,7 +269,7 @@ bool IsEyeAnglesSupported()
bool GetPlayerInfo(int client, player_info_t *info)
{
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
return engine->GetPlayerInfo(client, info);
#else
return (iserver) ? iserver->GetPlayerInfo(client-1, info) : false;
@ -420,7 +420,7 @@ void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level)
CON_COMMAND(sm_dump_netprops_xml, "Dumps the networkable property table as an XML file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
@ -462,7 +462,7 @@ CON_COMMAND(sm_dump_netprops_xml, "Dumps the networkable property table as an XM
CON_COMMAND(sm_dump_netprops, "Dumps the networkable property table as a text file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
@ -517,7 +517,7 @@ void _ignore_invalid_parameter(
CON_COMMAND(sm_dump_classes, "Dumps the class list as a text file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif
@ -710,7 +710,7 @@ void UTIL_DrawDataTable(FILE *fp, datamap_t *pMap, int level)
CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
{
#if !defined ORANGEBOX_BUILD
#if SOURCE_ENGINE == SE_EPISODEONE
CCommand args;
#endif

View File

@ -175,7 +175,7 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params)
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params)
@ -211,7 +211,7 @@ static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
static cell_t IgniteEntity(IPluginContext *pContext, const cell_t *params)
@ -290,7 +290,7 @@ static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params)
return 1;
}
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
/* :TODO: This is Team Fortress 2 specific */
static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params)
{
@ -352,7 +352,7 @@ static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params
return pContext->ThrowNativeError("Client %d is not in game", params[1]);
}
edict_t *pEdict = engine->PEntityOfEntIndex(params[2]);
edict_t *pEdict = PEntityOfEntIndex(params[2]);
if (!pEdict || pEdict->IsFree())
{
return pContext->ThrowNativeError("Entity %d is not valid", params[2]);
@ -639,9 +639,49 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
#if SOURCE_ENGINE == SE_LEFT4DEAD
static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
if (!pCall)
{
ValvePassInfo pass[4];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[1], Valve_POD, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[2], Valve_Bool, PassType_Basic, PASSFLAG_BYVAL);
InitPass(pass[3], Valve_CBaseEntity, PassType_Basic, PASSFLAG_BYVAL);
if (!CreateBaseCall("CreateEntityByName", ValveCall_Static, &pass[3], pass, 3, &pCall))
{
return pContext->ThrowNativeError("\"CreateEntityByName\" not supported by this mod");
} else if (!pCall) {
return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialized");
}
}
CBaseEntity *pEntity = NULL;
START_CALL();
DECODE_VALVE_PARAM(1, vparams, 0);
DECODE_VALVE_PARAM(2, vparams, 1);
*(bool *)(vptr + 8) = true;
FINISH_CALL_SIMPLE(&pEntity);
if (pEntity == NULL)
{
return -1;
}
edict_t *pEdict = gameents->BaseEntityToEdict(pEntity);
if (!pEdict)
{
return -1;
}
return IndexOfEdict(pEdict);
}
#else
static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
{
static ValveCall *pCall = NULL;
@ -676,8 +716,9 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
return -1;
}
return engine->IndexOfEdict(pEdict);
return IndexOfEdict(pEdict);
}
#endif
static cell_t DispatchSpawn(IPluginContext *pContext, const cell_t *params)
{
@ -764,7 +805,7 @@ static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *par
{
ValvePassInfo pass[3];
InitPass(pass[0], Valve_String, PassType_Basic, PASSFLAG_BYVAL);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
InitPass(pass[1], Valve_Vector, PassType_Basic, PASSFLAG_BYVAL);
#else
InitPass(pass[1], Valve_Vector, PassType_Object, PASSFLAG_BYVAL|PASSFLAG_OCTOR|PASSFLAG_OASSIGNOP);

View File

@ -239,7 +239,7 @@ static cell_t AddToStringTable(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &str);
pContext->LocalToString(params[3], &userdata);
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
pTable->AddString(true, str, params[4], userdata);
#else
pTable->AddString(str, params[4], userdata);

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -52,8 +53,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -61,14 +63,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -76,8 +88,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SOURCEMM16)/sourcehook
endif
@ -135,7 +148,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,23 +33,34 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
INCLUDE += -I$(HL2SDK)/public/dlls -I$(HL2SDK)/game_shared
SRCDS = $(SRCDS_BASE)
override ENGSET = true
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/public/mathlib
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/game/shared
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/game/shared
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn -I$(HL2SDK_OB)/game/shared
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -108,7 +121,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -33,8 +34,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -42,14 +44,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a tier0_i486.so
@ -57,8 +69,10 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/extensions -I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \
-I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -110,7 +124,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -33,8 +34,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -42,14 +44,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -57,8 +69,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
-I$(SOURCEMM16)/sourcehook
@ -110,7 +123,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -58,6 +58,18 @@
}
}
"left4dead"
{
"Offsets"
{
"GetDataDescMap"
{
"windows" "11"
"linux" "12"
}
}
}
/**
* Which games support ShowMenu?
*/
@ -75,6 +87,7 @@
"game" "diprip"
"game" "synergy"
"game" "FortressForever"
"game" "left4dead"
}
"Keys"

View File

@ -0,0 +1,361 @@
"Games"
{
/* Sounds */
"#default"
{
"Keys"
{
"SlapSoundCount" "3"
"SlapSound1" "player/pl_fallpain1.wav"
"SlapSound2" "player/pl_fallpain3.wav"
"SlapSound3" "player/pl_pain5.wav"
"m_iFrags" "m_iFrags"
}
"Offsets"
{
"m_iHealth"
{
"class" "CBasePlayer"
"prop" "m_iHealth"
}
"m_lifeState"
{
"class" "CBasePlayer"
"prop" "m_lifeState"
}
}
}
/* General Temp Entities */
"#default"
{
"#supported"
{
"game" "left4dead"
}
"Offsets"
{
/* Offset into CBaseTempEntity constructor */
"s_pTempEntities"
{
"windows" "17"
}
"GetTEName"
{
"windows" "4"
"linux" "4"
}
"GetTENext"
{
"windows" "8"
"linux" "8"
}
"TE_GetServerClass"
{
"windows" "0"
"linux" "0"
}
}
"Signatures"
{
"CBaseTempEntity"
{
"library" "server"
"windows" "\x8B\xC1\x8B\x4C\x24\x04\xC7\x00\x2A\x2A\x2A\x2A\x89\x48\x04\x8B\x15\x2A\x2A\x2A\x2A\x89\x50\x08\xA3\x2A\x2A\x2A\x2A\xC2\x04\x00"
}
"s_pTempEntities"
{
"library" "server"
"linux" "@_ZN15CBaseTempEntity15s_pTempEntitiesE"
}
}
}
/* Create Entity Signatures */
"#default"
{
"#supported"
{
"game" "left4dead"
}
"Signatures"
{
"DispatchSpawn"
{
"library" "server"
"linux" "@_Z13DispatchSpawnP11CBaseEntity"
"windows" "\x53\x55\x56\x8B\x74\x24\x10\x85\xF6\x57\x0F\x84\x2A\x2A\x2A\x2A\x8B\x1D\x2A\x2A\x2A\x2A\x8B\x03\x8B\x50\x64\x8B\xCB"
}
"CreateEntityByName"
{
"library" "server"
"linux" "@_Z18CreateEntityByNamePKcib"
"windows" "\x56\x8B\x74\x24\x0C\x83\xFE\xFF\x57\x8B\x7C\x24\x0C\x74\x27\x8B\x0D\x2A\x2A\x2A\x2A\x8B\x01\x8B\x50\x54\x56\xFF\xD2"
}
}
}
/* CGlobalEntityList */
"#default"
{
"#supported"
{
"game" "left4dead"
}
"Offsets"
{
/* Offset into LevelShutdown */
"gEntList"
{
"windows" "11"
}
}
"Signatures"
{
"LevelShutdown"
{
"library" "server"
"windows" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8"
}
"gEntList"
{
"library" "server"
"linux" "@gEntList"
}
/* Functions in CGlobalEntityList */
"FindEntityByClassname"
{
"library" "server"
"windows" "\x53\x55\x56\x8B\xF1\x8B\x4C\x24\x10\x85\xC9\x57\x74\x19\x8B\x01\x8B\x50\x08\xFF\xD2\x8B\x00\x25\xFF\x0F\x00\x00\x83\xC0\x01\xC1\xE0\x04\x8B\x3C\x30\xEB\x06\x8B\xBE\x2A\x2A\x2A\x2A\x85\xFF\x74\x39\x8B\x5C\x24\x18\x8B\x2D\x2A\x2A\x2A\x2A\xEB\x03"
"linux" "@_ZN17CGlobalEntityList21FindEntityByClassnameEP11CBaseEntityPKc"
}
}
}
/* General GameRules */
"#default"
{
"#supported"
{
"game" "left4dead"
}
"Offsets"
{
/* Offset into CreateGameRulesObject */
"g_pGameRules"
{
"windows" "2"
}
}
"Signatures"
{
/* This signature sometimes has multiple matches, but this
* does not matter as g_pGameRules is involved in all of them.
* The same g_pGameRules offset applies to each match.
*
* Sometimes this block of bytes is at the beginning of the static
* CreateGameRulesObject function and sometimes it is in the middle
* of an entirely different function. This depends on the game.
*/
"CreateGameRulesObject"
{
"library" "server"
"windows" "\x8B\x0D\x2A\x2A\x2A\x2A\x85\xC9\x74\x2A\x8B\x01\x8B\x50\x2A\x6A\x01\xFF\xD2"
}
"g_pGameRules"
{
"library" "server"
"linux" "@g_pGameRules"
}
}
}
/* IServer interface pointer */
"#default"
{
"Offsets"
{
/* Offset into IVEngineServer::CreateFakeClient */
"sv"
{
"windows" "6"
}
}
"Signatures"
{
/* CBaseServer object for IServer interface */
"sv"
{
"library" "engine"
"linux" "@sv"
}
}
}
/* EntityFactoryDictionary function */
"#default"
{
"Signatures"
{
"EntityFactory"
{
"library" "server"
"windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3"
"linux" "@_Z23EntityFactoryDictionaryv"
}
}
}
/* CBaseEntityOutput::FireOutput */
"#default"
{
"#supported"
{
"game" "left4dead"
}
"Signatures"
{
"FireOutput"
{
"library" "server"
"windows" "\x81\xEC\x1C\x01\x00\x00\x53\x55\x56\x8B\x71\x14\x85\xF6"
"linux" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f"
}
}
"Offsets"
{
"FireOutputBackup"
{
"windows" "6"
"linux" "10"
}
}
}
/* SetUserInfo data */
"#default"
{
"Offsets"
{
/**
* CBaseClient::SetUserCVar(char const*,char const*);
* Linux offset straight from VTable dump.
* Windows offset is crazy. Found the windows 'SetName' function using string "(%d)%-0.*s"
* Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1)
*/
"SetUserCvar"
{
"windows" "17"
"linux" "62"
}
/**
* Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made.
* Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end.
* Linux: mov byte ptr [esi+0B0h], 0
* Win: mov byte ptr [esi+0B0h], 0
*/
"InfoChanged"
{
"windows" "176"
"linux" "176"
}
}
}
/* Left 4 Dead */
"left4dead"
{
"Offsets"
{
"GiveNamedItem"
{
"windows" "480"
"linux" "481"
}
"RemovePlayerItem"
{
"windows" "269"
"linux" "270"
}
"Weapon_GetSlot"
{
"windows" "267"
"linux" "268"
}
"Ignite"
{
"windows" "206"
"linux" "207"
}
"Extinguish"
{
"windows" "210"
"linux" "211"
}
"Teleport"
{
"windows" "105"
"linux" "106"
}
"CommitSuicide"
{
"windows" "449"
"linux" "449"
}
"GetVelocity"
{
"windows" "136"
"linux" "137"
}
"EyeAngles"
{
"windows" "127"
"linux" "128"
}
"AcceptInput"
{
"windows" "37"
"linux" "38"
}
"DispatchKeyValue"
{
"windows" "29"
"linux" "28"
}
"DispatchKeyValueFloat"
{
"windows" "28"
"linux" "29"
}
"DispatchKeyValueVector"
{
"windows" "27"
"linux" "30"
}
"SetEntityModel"
{
"windows" "23"
"linux" "24"
}
"WeaponEquip"
{
"windows" "260"
"linux" "261"
}
"Activate"
{
"windows" "31"
"linux" "32"
}
}
}
}

View File

@ -1,7 +1,7 @@
# (C)2004-2008 SourceMod Development Team
# Makefile written by David "BAILOPAN" Anderson
SOURCEMM16 = ../../sourcemm-1.6
SOURCEMM16 = ../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -23,7 +23,7 @@ CPP = gcc-4.1
LINK = -static-libgcc
INCLUDE = -I$(SOURCEMM16) -I$(SOURCEMM16)/sourcehook -I$(SOURCEMM16)/sourcemm
INCLUDE = -I$(SOURCEMM16) -I$(SOURCEMM16)/sourcehook
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Wno-uninitialized \

View File

@ -67,6 +67,7 @@
#define FILENAME_1_4_EP1 "sourcemod.1.ep1" PLATFORM_EXT
#define FILENAME_1_6_EP2 "sourcemod.2.ep2" PLATFORM_EXT
#define FILENAME_1_6_EP1 "sourcemod.2.ep1" PLATFORM_EXT
#define FILENAME_1_7_L4D "sourcemod.2.l4d" PLATFORM_EXT
HINSTANCE g_hCore = NULL;
bool load_attempted = false;
@ -213,6 +214,11 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co
filename = FILENAME_1_6_EP1;
break;
}
case SOURCE_ENGINE_LEFT4DEAD:
{
filename = FILENAME_1_7_L4D;
break;
}
default:
{
return NULL;

View File

@ -473,8 +473,9 @@ native bool:GetConVarBool(Handle:convar);
/**
* Sets the boolean value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New boolean value.
@ -500,8 +501,9 @@ native GetConVarInt(Handle:convar);
/**
* Sets the integer value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New integer value.
@ -527,8 +529,9 @@ native Float:GetConVarFloat(Handle:convar);
/**
* Sets the floating point value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New floating point value.
@ -556,8 +559,9 @@ native GetConVarString(Handle:convar, String:value[], maxlength);
/**
* Sets the string value of a console variable.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New string value.
@ -574,8 +578,9 @@ native SetConVarString(Handle:convar, const String:value[], bool:replicate=false
/**
* Resets the console variable to its default value.
*
* Note: The replicate and notify params are ignored on the Episode 2/Orange Box engine.
* This engine automatically replicates and notifies as soon as the convar is changed.
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param replicate If set to true, the new convar value will be set on all clients.

View File

@ -38,7 +38,8 @@
#define SOURCE_SDK_UNKNOWN 0 /**< Could not determine the engine version */
#define SOURCE_SDK_ORIGINAL 10 /**< Original Source engine (still used by "The Ship") */
#define SOURCE_SDK_EPISODE1 20 /**< SDK+Engine released after Episode 1 */
#define SOURCE_SDK_EPISODE2 30 /**< Engine released after Episode 2 (no SDK yet) */
#define SOURCE_SDK_EPISODE2 30 /**< SDK+Engine released after Episode 2/Orange Box */
#define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
@ -51,7 +52,7 @@ enum DialogType
DialogType_Menu, /**< an options menu */
DialogType_Text, /**< a richtext dialog */
DialogType_Entry, /**< an entry box */
DialogType_AskConnect /**< ask the client to connect to a specified IP */
DialogType_AskConnect /**< ask the client to connect to a specified IP */
};
/**

View File

@ -32,7 +32,7 @@
#ifndef _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
#define _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
#if defined ORANGEBOX_BUILD
#if SOURCE_ENGINE >= SE_ORANGEBOX
#define CONVAR_REGISTER(object) ConVar_Register(0, object)
inline bool IsFlagSet(ConCommandBase *cmd, int flag)
@ -43,6 +43,14 @@
{
engine->InsertServerCommand(buf);
}
inline ConCommandBase *FindCommandBase(const char *name)
{
return icvar->FindCommandBase(name);
}
inline ConCommand *FindCommand(const char *name)
{
return icvar->FindCommand(name);
}
#else
class CCommand
{
@ -69,11 +77,71 @@
{
engine->InsertServerCommand(buf);
}
inline ConCommandBase *FindCommandBase(const char *name)
{
ConCommandBase *pBase = icvar->GetCommands();
while (pBase)
{
if (strcmp(pBase->GetName(), name) == 0)
{
if (pBase->IsCommand())
{
return NULL;
}
return pBase;
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
return NULL;
}
inline ConCommand *FindCommand(const char *name)
{
ConCommandBase *pBase = icvar->GetCommands();
while (pBase)
{
if (strcmp(pBase->GetName(), name) == 0)
{
if (!pBase->IsCommand())
{
return NULL;
}
return static_cast<ConCommand *>(pBase);
}
pBase = const_cast<ConCommandBase *>(pBase->GetNext());
}
return NULL;
}
#define CVAR_INTERFACE_VERSION VENGINE_CVAR_INTERFACE_VERSION
#define CONVAR_REGISTER(object) ConCommandBaseMgr::OneTimeInit(object)
typedef FnChangeCallback FnChangeCallback_t;
#endif //ORANGEBOX_BUILD
#endif //SOURCE_ENGINE >= SE_ORANGEBOX
#if SOURCE_ENGINE >= SE_LEFT4DEAD
inline int IndexOfEdict(const edict_t *pEdict)
{
return ((int)pEdict - (int)gpGlobals->baseEdict) >> 4;
}
inline edict_t *PEntityOfEntIndex(int iEntIndex)
{
if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
{
return (edict_t *)((int)gpGlobals->baseEdict + (iEntIndex << 4));
}
return NULL;
}
#else
inline int IndexOfEdict(const edict_t *pEdict)
{
return engine->IndexOfEdict(pEdict);
}
inline edict_t *PEntityOfEntIndex(int iEntIndex)
{
return engine->PEntityOfEntIndex(iEntIndex);
}
#endif //SOURCE_ENGINE >= SE_LEFT4DEAD
#endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_

View File

@ -5,8 +5,9 @@ SMSDK = ..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -29,8 +30,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -38,20 +40,32 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
LINK = vstdlib_i486.so tier0_i486.so -static-libgcc
INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK) -I$(SMSDK)/jit \
-I$(SMSDK)/jit/x86 -I$(SMSDK)/extensions -I$(SMSDK)/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK) -I$(SMSDK)/jit -I$(SMSDK)/jit/x86 \
-I$(SMSDK)/extensions -I$(SMSDK)/sourcepawn
CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
-D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
@ -91,7 +105,7 @@ all: check
check:
if [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -5,8 +5,9 @@ SMSDK = ../..
SRCDS_BASE = ~/srcds
HL2SDK_ORIG = ../../../hl2sdk
HL2SDK_OB = ../../../hl2sdk-ob
SOURCEMM14 = ../../../sourcemm-1.4
SOURCEMM16 = ../../../sourcemm-1.6
HL2SDK_L4D = ../../../hl2sdk-l4d
SOURCEMM14 = ../../../mmsource-legacy
SOURCEMM16 = ../../../mmsource
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###
@ -32,8 +33,9 @@ CPP = gcc-4.1
override ENGSET = false
ifeq "$(ENGINE)" "original"
HL2SDK = $(HL2SDK_ORIG)
HL2PUB = $(HL2SDK_ORIG)/public
HL2LIB = $(HL2SDK_ORIG)/linux_sdk
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/linux_sdk
CFLAGS += -DSOURCE_ENGINE=2
METAMOD = $(SOURCEMM14)
INCLUDE += -I$(HL2SDK)/public/dlls
SRCDS = $(SRCDS_BASE)
@ -41,14 +43,24 @@ ifeq "$(ENGINE)" "original"
endif
ifeq "$(ENGINE)" "orangebox"
HL2SDK = $(HL2SDK_OB)
HL2PUB = $(HL2SDK_OB)/public
HL2LIB = $(HL2SDK_OB)/lib/linux
CFLAGS += -DORANGEBOX_BUILD
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=3
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/orangebox
override ENGSET = true
endif
ifeq "$(ENGINE)" "left4dead"
HL2SDK = $(HL2SDK_L4D)
HL2PUB = $(HL2SDK)/public
HL2LIB = $(HL2SDK)/lib/linux
CFLAGS += -DSOURCE_ENGINE=4
METAMOD = $(SOURCEMM16)
INCLUDE += -I$(HL2SDK)/public/game/server
SRCDS = $(SRCDS_BASE)/l4d_demo
override ENGSET = true
endif
ifeq "$(USEMETA)" "true"
LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so
@ -56,8 +68,9 @@ ifeq "$(USEMETA)" "true"
LINK += $(LINK_HL2)
INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(METAMOD)/sourcemm -I$(SMSDK)/public \
-I$(SMSDK)/public/sourcepawn
-I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
CFLAGS += -DSE_EPISODEONE=2 -DSE_ORANGEBOX=3 -DSE_LEFT4DEAD=4
else
INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
endif
@ -108,7 +121,7 @@ all: check
check:
if [ "$(USEMETA)" == "true" ] && [ "$(ENGSET)" == "false" ]; then \
echo "You must supply ENGINE=orangebox or ENGINE=original"; \
echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \
exit 1; \
fi

View File

@ -2,7 +2,7 @@
# Makefile written by David "BAILOPAN" Anderson
SMSDK = ../..
SOURCEHOOK = ../../../sourcemm-1.6/sourcehook
SOURCEHOOK = ../../../mmsource/sourcehook
#####################################
### EDIT BELOW FOR OTHER PROJECTS ###

View File

@ -49,6 +49,10 @@ namespace builder
{
output_folder += ".original";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
output_folder += ".left4dead";
}
string binpath = Config.PathFormat("{0}/{1}/{2}",
path,
@ -74,6 +78,10 @@ namespace builder
{
makefile_args = "ENGINE=\"original\"";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
makefile_args = "ENGINE=\"left4dead\"";
}
/* Clean the project first */
info.WorkingDirectory = path;

View File

@ -13,7 +13,8 @@ namespace builder
BuildMode_Simple,
BuildMode_OldMetamod,
BuildMode_Episode1,
BuildMode_Episode2
BuildMode_Episode2,
BuildMode_Left4Dead
};
public class Library

View File

@ -67,6 +67,7 @@ namespace builder
folders.Add("addons/sourcemod/extensions/auto.1.ep1");
//folders.Add("addons/sourcemod/extensions/auto.2.ep1");
folders.Add("addons/sourcemod/extensions/auto.2.ep2");
folders.Add("addons/sourcemod/extensions/auto.2.l4d");
folders.Add("addons/sourcemod/scripting/playercommands");
folders.Add("addons/metamod");
@ -171,6 +172,14 @@ namespace builder
lib.build_mode = BuildMode.BuildMode_Episode2;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/bin";
lib.source_path = "core";
lib.binary_name = "sourcemod.2.l4d";
lib.vcproj_name = "sourcemod_mm";
lib.build_mode = BuildMode.BuildMode_Left4Dead;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/bin";
lib.source_path = "sourcepawn/jit";
@ -230,6 +239,14 @@ namespace builder
lib.build_mode = BuildMode.BuildMode_Episode2;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions/auto.2.l4d";
lib.source_path = "extensions/sdktools";
lib.binary_name = "sdktools.ext";
lib.vcproj_name = "sdktools";
lib.build_mode = BuildMode.BuildMode_Left4Dead;
libraries.Add(lib);
lib = new Library();
lib.package_path = "addons/sourcemod/extensions";
lib.source_path = "extensions/sqlite";

View File

@ -50,6 +50,10 @@ namespace builder
{
config_name = config_name + " - Old Metamod";
}
else if (lib.build_mode == BuildMode.BuildMode_Left4Dead)
{
config_name = config_name + " - Left 4 Dead";
}
string binpath = Config.PathFormat("{0}/{1}/{2}",
path,