1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-23 16:54:14 +01:00

Updated for latest hl2sdk-dota changes.

This commit is contained in:
Nicholas Hastings 2013-05-13 15:03:41 -04:00
parent 4844c42988
commit a4555a729c
5 changed files with 44 additions and 7 deletions

View File

@ -784,6 +784,20 @@ size_t MetamodSource::PathFormat(char *buffer, size_t len, const char *fmt, ...)
return mylen; return mylen;
} }
#if SOURCE_ENGINE == SE_DOTA
void MetamodSource::ClientConPrintf(int clientIndex, const char *fmt, ...)
{
va_list ap;
char buffer[2048];
va_start(ap, fmt);
UTIL_FormatArgs(buffer, sizeof(buffer), fmt, ap);
va_end(ap);
ClientConPrintf((edict_t *)(gpGlobals->pEdicts + clientIndex), "%s", buffer);
}
#endif
void MetamodSource::ClientConPrintf(edict_t *client, const char *fmt, ...) void MetamodSource::ClientConPrintf(edict_t *client, const char *fmt, ...)
{ {
va_list ap; va_list ap;

View File

@ -77,6 +77,10 @@ public:
void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret); void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
const char *GetBaseDir(); const char *GetBaseDir();
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...); size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
#if SOURCE_ENGINE == SE_DOTA
// Shim
void ClientConPrintf(int clientIndex, const char *fmt, ...);
#endif
void ClientConPrintf(edict_t *client, const char *fmt, ...); void ClientConPrintf(edict_t *client, const char *fmt, ...);
void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1); void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
void EnableVSPListener(); void EnableVSPListener();

View File

@ -659,7 +659,11 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
return true; return true;
} }
#if SOURCE_ENGINE == SE_DOTA
bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info)
#else
bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info) bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
#endif
{ {
const char *cmd = info->GetArg(0); const char *cmd = info->GetArg(0);

View File

@ -31,6 +31,10 @@
#include "metamod_provider.h" #include "metamod_provider.h"
bool Command_Meta(IMetamodSourceCommandInfo *info); bool Command_Meta(IMetamodSourceCommandInfo *info);
#if SOURCE_ENGINE == SE_DOTA
bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info);
#else
bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info); bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info);
#endif
#endif //_INCLUDE_CONCOMMANDS_H #endif //_INCLUDE_CONCOMMANDS_H

View File

@ -63,7 +63,7 @@ DLL_IMPORT ICommandLine *CommandLine();
void CacheUserMessages(); void CacheUserMessages();
void Detour_Error(const tchar *pMsg, ...); void Detour_Error(const tchar *pMsg, ...);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void ClientCommand(edict_t *pEdict, const CCommand &args); void ClientCommand(int client, const CCommand &args);
void LocalCommand_Meta(void *pUnknown, const CCommand &args); void LocalCommand_Meta(void *pUnknown, const CCommand &args);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void ClientCommand(edict_t *pEdict, const CCommand &args); void ClientCommand(edict_t *pEdict, const CCommand &args);
@ -88,7 +88,9 @@ IServerGameClients *gameclients = NULL;
IMetamodSourceProvider *provider = &g_Ep1Provider; IMetamodSourceProvider *provider = &g_Ep1Provider;
ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options"); ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options");
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &); SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
#else #else
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *); SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
@ -176,9 +178,14 @@ bool BaseProvider::IsRemotePrintingAvailable()
return true; return true;
} }
void BaseProvider::ClientConsolePrint(edict_t *client, const char *message) void BaseProvider::ClientConsolePrint(edict_t *pEdict, const char *message)
{ {
#if SOURCE_ENGINE == SE_DOTA
int client = (int)(pEdict - g_Metamod.GetCGlobals()->pEdicts);
engine->ClientPrintf(client, message); engine->ClientPrintf(client, message);
#else
engine->ClientPrintf(pEdict, message);
#endif
} }
void BaseProvider::ServerCommand(const char *cmd) void BaseProvider::ServerCommand(const char *cmd)
@ -517,18 +524,22 @@ void LocalCommand_Meta()
Command_Meta(&cmd); Command_Meta(&cmd);
} }
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE == SE_DOTA
void ClientCommand(edict_t *pEdict, const CCommand &_cmd) void ClientCommand(int client, const CCommand &_cmd)
{
GlobCommand cmd(&_cmd);
#elif SOURCE_ENGINE >= SE_ORANGEBOX
void ClientCommand(edict_t *client, const CCommand &_cmd)
{ {
GlobCommand cmd(&_cmd); GlobCommand cmd(&_cmd);
#else #else
void ClientCommand(edict_t *pEdict) void ClientCommand(edict_t *client)
{ {
GlobCommand cmd; GlobCommand cmd;
#endif #endif
if (strcmp(cmd.GetArg(0), "meta") == 0) if (strcmp(cmd.GetArg(0), "meta") == 0)
{ {
Command_ClientMeta(pEdict, &cmd); Command_ClientMeta(client, &cmd);
RETURN_META(MRES_SUPERCEDE); RETURN_META(MRES_SUPERCEDE);
} }