Updated for latest hl2sdk-dota changes.
authorNicholas Hastings <skamonkey@gmail.com>
Mon May 13 15:03:41 2013 -0400 (2013-05-13)
changeset 839eab123e5ee23
parent 838 826391fe59b0
child 840 694761ade6c9
Updated for latest hl2sdk-dota changes.
core/metamod.cpp
core/metamod.h
core/metamod_console.cpp
core/metamod_console.h
core/provider/provider_ep2.cpp
     1.1 --- a/core/metamod.cpp	Mon May 13 14:17:17 2013 -0400
     1.2 +++ b/core/metamod.cpp	Mon May 13 15:03:41 2013 -0400
     1.3 @@ -784,6 +784,20 @@
     1.4  	return mylen;
     1.5  }
     1.6  
     1.7 +#if SOURCE_ENGINE == SE_DOTA
     1.8 +void MetamodSource::ClientConPrintf(int clientIndex, const char *fmt, ...)
     1.9 +{
    1.10 +	va_list ap;
    1.11 +	char buffer[2048];
    1.12 +
    1.13 +	va_start(ap, fmt);
    1.14 +	UTIL_FormatArgs(buffer, sizeof(buffer), fmt, ap);
    1.15 +	va_end(ap);
    1.16 +
    1.17 +	ClientConPrintf((edict_t *)(gpGlobals->pEdicts + clientIndex), "%s", buffer);
    1.18 +}
    1.19 +#endif
    1.20 +
    1.21  void MetamodSource::ClientConPrintf(edict_t *client, const char *fmt, ...)
    1.22  {
    1.23  	va_list ap;
     2.1 --- a/core/metamod.h	Mon May 13 14:17:17 2013 -0400
     2.2 +++ b/core/metamod.h	Mon May 13 15:03:41 2013 -0400
     2.3 @@ -77,6 +77,10 @@
     2.4  	void *InterfaceSearch(CreateInterfaceFn fn, const char *iface, int max, int *ret);
     2.5  	const char *GetBaseDir();
     2.6  	size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
     2.7 +#if SOURCE_ENGINE == SE_DOTA
     2.8 +	// Shim
     2.9 +	void ClientConPrintf(int clientIndex, const char *fmt, ...);
    2.10 +#endif
    2.11  	void ClientConPrintf(edict_t *client, const char *fmt, ...);
    2.12  	void *VInterfaceMatch(CreateInterfaceFn fn, const char *iface, int min=-1);
    2.13  	void EnableVSPListener();
     3.1 --- a/core/metamod_console.cpp	Mon May 13 14:17:17 2013 -0400
     3.2 +++ b/core/metamod_console.cpp	Mon May 13 15:03:41 2013 -0400
     3.3 @@ -659,7 +659,11 @@
     3.4  	return true;
     3.5  }
     3.6  
     3.7 +#if SOURCE_ENGINE == SE_DOTA
     3.8 +bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info)
     3.9 +#else
    3.10  bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
    3.11 +#endif
    3.12  {
    3.13  	const char *cmd = info->GetArg(0);
    3.14  
     4.1 --- a/core/metamod_console.h	Mon May 13 14:17:17 2013 -0400
     4.2 +++ b/core/metamod_console.h	Mon May 13 15:03:41 2013 -0400
     4.3 @@ -31,6 +31,10 @@
     4.4  #include "metamod_provider.h"
     4.5  
     4.6  bool Command_Meta(IMetamodSourceCommandInfo *info);
     4.7 +#if SOURCE_ENGINE == SE_DOTA
     4.8 +bool Command_ClientMeta(int client, IMetamodSourceCommandInfo *info);
     4.9 +#else
    4.10  bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info);
    4.11 +#endif
    4.12  
    4.13  #endif //_INCLUDE_CONCOMMANDS_H
     5.1 --- a/core/provider/provider_ep2.cpp	Mon May 13 14:17:17 2013 -0400
     5.2 +++ b/core/provider/provider_ep2.cpp	Mon May 13 15:03:41 2013 -0400
     5.3 @@ -63,7 +63,7 @@
     5.4  void CacheUserMessages();
     5.5  void Detour_Error(const tchar *pMsg, ...);
     5.6  #if SOURCE_ENGINE == SE_DOTA
     5.7 -void ClientCommand(edict_t *pEdict, const CCommand &args);
     5.8 +void ClientCommand(int client, const CCommand &args);
     5.9  void LocalCommand_Meta(void *pUnknown, const CCommand &args);
    5.10  #elif SOURCE_ENGINE >= SE_ORANGEBOX
    5.11  void ClientCommand(edict_t *pEdict, const CCommand &args);
    5.12 @@ -88,7 +88,9 @@
    5.13  IMetamodSourceProvider *provider = &g_Ep1Provider;
    5.14  ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options");
    5.15  
    5.16 -#if SOURCE_ENGINE >= SE_ORANGEBOX
    5.17 +#if SOURCE_ENGINE == SE_DOTA
    5.18 +SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &);
    5.19 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
    5.20  SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &);
    5.21  #else
    5.22  SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
    5.23 @@ -176,9 +178,14 @@
    5.24  	return true;
    5.25  }
    5.26  
    5.27 -void BaseProvider::ClientConsolePrint(edict_t *client, const char *message)
    5.28 +void BaseProvider::ClientConsolePrint(edict_t *pEdict, const char *message)
    5.29  {
    5.30 +#if SOURCE_ENGINE == SE_DOTA
    5.31 +	int client = (int)(pEdict - g_Metamod.GetCGlobals()->pEdicts);
    5.32  	engine->ClientPrintf(client, message);
    5.33 +#else
    5.34 +	engine->ClientPrintf(pEdict, message);
    5.35 +#endif
    5.36  }
    5.37  
    5.38  void BaseProvider::ServerCommand(const char *cmd)
    5.39 @@ -517,18 +524,22 @@
    5.40  	Command_Meta(&cmd);
    5.41  }
    5.42  
    5.43 -#if SOURCE_ENGINE >= SE_ORANGEBOX
    5.44 -void ClientCommand(edict_t *pEdict, const CCommand &_cmd)
    5.45 +#if SOURCE_ENGINE == SE_DOTA
    5.46 +void ClientCommand(int client, const CCommand &_cmd)
    5.47 +{
    5.48 +	GlobCommand cmd(&_cmd);
    5.49 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
    5.50 +void ClientCommand(edict_t *client, const CCommand &_cmd)
    5.51  {
    5.52  	GlobCommand cmd(&_cmd);
    5.53  #else
    5.54 -void ClientCommand(edict_t *pEdict)
    5.55 +void ClientCommand(edict_t *client)
    5.56  {
    5.57  	GlobCommand cmd;
    5.58  #endif
    5.59  	if (strcmp(cmd.GetArg(0), "meta") == 0)
    5.60  	{
    5.61 -		Command_ClientMeta(pEdict, &cmd);
    5.62 +		Command_ClientMeta(client, &cmd);
    5.63  		RETURN_META(MRES_SUPERCEDE);
    5.64  	}
    5.65