Updated for latest hl2sdk-dota changes.

This commit is contained in:
Nicholas Hastings 2013-07-12 02:31:41 -04:00
parent 2d65ed352e
commit c230cf5aab
22 changed files with 148 additions and 88 deletions

View File

@ -45,7 +45,7 @@ public: //IRecipientFilter
bool IsInitMessage() const; bool IsInitMessage() const;
int GetRecipientCount() const; int GetRecipientCount() const;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void GetRecipientIndex(int *clientIndex, int slot) const; CEntityIndex GetRecipientIndex(int slot) const;
#else #else
int GetRecipientIndex(int slot) const; int GetRecipientIndex(int slot) const;
#endif #endif
@ -84,7 +84,7 @@ inline int CellRecipientFilter::GetRecipientCount() const
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
inline void CellRecipientFilter::GetRecipientIndex(int *clientIndex, int slot) const inline CEntityIndex CellRecipientFilter::GetRecipientIndex(int slot) const
#else #else
inline int CellRecipientFilter::GetRecipientIndex(int slot) const inline int CellRecipientFilter::GetRecipientIndex(int slot) const
#endif #endif
@ -97,7 +97,7 @@ inline int CellRecipientFilter::GetRecipientIndex(int slot) const
ret = static_cast<int>(m_Players[slot]); ret = static_cast<int>(m_Players[slot]);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
*clientIndex = ret; return CEntityIndex(ret);
#else #else
return ret; return ret;
#endif #endif

View File

@ -38,7 +38,7 @@
#include "logic_bridge.h" #include "logic_bridge.h"
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#elif SOURCE_ENGINE == SE_DARKMESSIAH #elif SOURCE_ENGINE == SE_DARKMESSIAH
@ -148,7 +148,7 @@ void ChatTriggers::OnSourceModShutdown()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void ChatTriggers::OnSayCommand_Pre(void *pUnknown, const CCommand &command) void ChatTriggers::OnSayCommand_Pre(const CCommandContext &context, const CCommand &command)
{ {
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Pre(const CCommand &command) void ChatTriggers::OnSayCommand_Pre(const CCommand &command)
@ -268,7 +268,7 @@ void ChatTriggers::OnSayCommand_Pre()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void ChatTriggers::OnSayCommand_Post(void *pUnknown, const CCommand &command) void ChatTriggers::OnSayCommand_Post(const CCommandContext &context, const CCommand &command)
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void ChatTriggers::OnSayCommand_Post(const CCommand &command) void ChatTriggers::OnSayCommand_Post(const CCommand &command)
#else #else

View File

@ -55,8 +55,8 @@ public: //SMGlobalClass
size_t maxlength); size_t maxlength);
private: //ConCommand private: //ConCommand
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void OnSayCommand_Pre(void *pUnknown, const CCommand &command); void OnSayCommand_Pre(const CCommandContext &, const CCommand &command);
void OnSayCommand_Post(void *pUnknown, const CCommand &command); void OnSayCommand_Post(const CCommandContext &, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void OnSayCommand_Pre(const CCommand &command); void OnSayCommand_Pre(const CCommand &command);
void OnSayCommand_Post(const CCommand &command); void OnSayCommand_Post(const CCommand &command);

View File

@ -41,7 +41,7 @@
ConCmdManager g_ConCmds; ConCmdManager g_ConCmds;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_HOOK2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_HOOK1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#else #else
@ -209,7 +209,7 @@ void ConCmdManager::OnPluginDestroyed(IPlugin *plugin)
} }
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void CommandCallback(void *pUnknown, const CCommand &command) void CommandCallback(const CCommandContext &context, const CCommand &command)
{ {
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void CommandCallback(const CCommand &command) void CommandCallback(const CCommand &command)

View File

@ -99,7 +99,7 @@ class ConCmdManager :
public IConCommandTracker public IConCommandTracker
{ {
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
friend void CommandCallback(void *pUnknown, const CCommand &command); friend void CommandCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
friend void CommandCallback(const CCommand &command); friend void CommandCallback(const CCommand &command);
#else #else

View File

@ -44,7 +44,10 @@ SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallback, SH_NOATTRIB, false, ConVar *, const char *); SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallback, SH_NOATTRIB, false, ConVar *, const char *);
#endif #endif
#if SOURCE_ENGINE != SE_DARKMESSIAH #if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, CEntityIndex, EQueryCvarValueStatus, const char *, const char *);
SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, CEntityIndex, EQueryCvarValueStatus, const char *, const char *);
#elif SOURCE_ENGINE != SE_DARKMESSIAH
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *); 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 *); SH_DECL_HOOK5_void(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
#endif #endif
@ -185,7 +188,9 @@ void ConVarManager::OnSourceModShutdown()
} }
else if (m_bIsVSPQueryHooked) else if (m_bIsVSPQueryHooked)
{ {
#if SOURCE_ENGINE != SE_DOTA
SH_REMOVE_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false); SH_REMOVE_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
#endif
m_bIsVSPQueryHooked = false; m_bIsVSPQueryHooked = false;
} }
#endif #endif
@ -232,7 +237,7 @@ void ConVarManager::OnSourceModVSPReceived()
} }
#endif #endif
#if SOURCE_ENGINE != SE_DARKMESSIAH #if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false); SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &ConVarManager::OnQueryCvarValueFinished), false);
m_bIsVSPQueryHooked = true; m_bIsVSPQueryHooked = true;
#endif #endif
@ -612,7 +617,7 @@ QueryCvarCookie_t ConVarManager::QueryClientConVar(edict_t *pPlayer, const char
if (m_bIsDLLQueryHooked) if (m_bIsDLLQueryHooked)
{ {
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
cookie = engine->StartQueryCvarValue(IndexOfEdict(pPlayer), name); cookie = engine->StartQueryCvarValue(CEntityIndex(IndexOfEdict(pPlayer)), name);
#else #else
cookie = engine->StartQueryCvarValue(pPlayer, name); cookie = engine->StartQueryCvarValue(pPlayer, name);
#endif #endif
@ -727,7 +732,11 @@ bool ConVarManager::IsQueryingSupported()
} }
#if SOURCE_ENGINE != SE_DARKMESSIAH #if SOURCE_ENGINE != SE_DARKMESSIAH
#if SOURCE_ENGINE == SE_DOTA
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#else
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue) void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#endif // SE_DOTA
{ {
IPluginFunction *pCallback = NULL; IPluginFunction *pCallback = NULL;
cell_t value = 0; cell_t value = 0;
@ -749,7 +758,11 @@ void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *
cell_t ret; cell_t ret;
pCallback->PushCell(cookie); pCallback->PushCell(cookie);
#if SOURCE_ENGINE == SE_DOTA
pCallback->PushCell(player.Get());
#else
pCallback->PushCell(IndexOfEdict(pPlayer)); pCallback->PushCell(IndexOfEdict(pPlayer));
#endif
pCallback->PushCell(result); pCallback->PushCell(result);
pCallback->PushString(cvarName); pCallback->PushString(cvarName);

View File

@ -154,7 +154,10 @@ private:
/** /**
* Callback for when StartQueryCvarValue() has finished. * Callback for when StartQueryCvarValue() has finished.
*/ */
#if SOURCE_ENGINE != SE_DARKMESSIAH #if SOURCE_ENGINE == SE_DOTA
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result,
const char *cvarName, const char *cvarValue);
#elif SOURCE_ENGINE != SE_DARKMESSIAH
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
const char *cvarName, const char *cvarValue); const char *cvarName, const char *cvarValue);
#endif #endif

View File

@ -60,7 +60,7 @@
#if SH_IMPL_VERSION >= 5 #if SH_IMPL_VERSION >= 5
# if SOURCE_ENGINE == SE_DOTA # if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
# elif SOURCE_ENGINE >= SE_ORANGEBOX # elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
# else # else
@ -134,7 +134,7 @@ class GenericCommandHooker : public IConCommandLinkListener
} }
# if SOURCE_ENGINE == SE_DOTA # if SOURCE_ENGINE == SE_DOTA
void Dispatch(void *pUnknown, const CCommand& args) void Dispatch(const CCommandContext &context, const CCommand& args)
# elif SOURCE_ENGINE >= SE_ORANGEBOX # elif SOURCE_ENGINE >= SE_ORANGEBOX
void Dispatch(const CCommand& args) void Dispatch(const CCommand& args)
# else # else

View File

@ -62,8 +62,8 @@ ConVar *g_ServerCfgFile = NULL;
void CheckAndFinalizeConfigs(); void CheckAndFinalizeConfigs();
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
void Hook_ExecDispatchPre(void *pUnknown, const CCommand &cmd) void Hook_ExecDispatchPre(const CCommandContext &context, const CCommand &cmd)
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
void Hook_ExecDispatchPre(const CCommand &cmd) void Hook_ExecDispatchPre(const CCommand &cmd)
@ -93,7 +93,7 @@ void Hook_ExecDispatchPre()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void Hook_ExecDispatchPost(void *pUnknown, const CCommand &cmd) void Hook_ExecDispatchPost(const CCommandContext &context, const CCommand &cmd)
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void Hook_ExecDispatchPost(const CCommand &cmd) void Hook_ExecDispatchPost(const CCommand &cmd)
#else #else

View File

@ -46,7 +46,7 @@ SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, co
#endif #endif
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#elif SOURCE_ENGINE == SE_DARKMESSIAH #elif SOURCE_ENGINE == SE_DARKMESSIAH
@ -208,7 +208,7 @@ NextMapManager::NextMapManager()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void CmdChangeLevelCallback(void *pUnknown, const CCommand &command) void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command)
{ {
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command) void CmdChangeLevelCallback(const CCommand &command)

View File

@ -59,7 +59,7 @@ struct MapChangeData
}; };
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void CmdChangeLevelCallback(void *pUnknown, const CCommand &command); void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdChangeLevelCallback(const CCommand &command); void CmdChangeLevelCallback(const CCommand &command);
#else #else
@ -72,7 +72,7 @@ public:
NextMapManager(); NextMapManager();
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
friend void CmdChangeLevelCallback(void *pUnknown, const CCommand &command); friend void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
friend void CmdChangeLevelCallback(const CCommand &command); friend void CmdChangeLevelCallback(const CCommand &command);
#else #else

View File

@ -59,11 +59,11 @@ int lifestate_offset = -1;
List<ICommandTargetProcessor *> target_processors; List<ICommandTargetProcessor *> target_processors;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, int, const char *, const char *, char *, int); SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, CEntityIndex, const char *, const char *, char *, int);
SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, int, const char *); SH_DECL_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, CEntityIndex, const char *);
SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, int); SH_DECL_HOOK1_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, CEntityIndex);
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &); SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CEntityIndex, const CCommand &);
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, int); SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, CEntityIndex);
#else #else
SH_DECL_HOOK5(IServerGameClients, ClientConnect, SH_NOATTRIB, 0, bool, edict_t *, const char *, const char *, char *, int); 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_HOOK2_void(IServerGameClients, ClientPutInServer, SH_NOATTRIB, 0, edict_t *, const char *);
@ -83,7 +83,7 @@ SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, in
#endif #endif
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, void *, const CCommand &); SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &); SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
#elif SOURCE_ENGINE == SE_DARKMESSIAH #elif SOURCE_ENGINE == SE_DARKMESSIAH
@ -470,8 +470,9 @@ void PlayerManager::RunAuthChecks()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
bool PlayerManager::OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) bool PlayerManager::OnClientConnect(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
@ -535,8 +536,9 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
bool PlayerManager::OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) bool PlayerManager::OnClientConnect_Post(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen) bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
@ -581,8 +583,9 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void PlayerManager::OnClientPutInServer(int client, const char *playername) void PlayerManager::OnClientPutInServer(CEntityIndex index, const char *playername)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername) void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
@ -763,8 +766,9 @@ void PlayerManager::OnSourceModLevelEnd()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void PlayerManager::OnClientDisconnect(int client) void PlayerManager::OnClientDisconnect(CEntityIndex index)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
void PlayerManager::OnClientDisconnect(edict_t *pEntity) void PlayerManager::OnClientDisconnect(edict_t *pEntity)
@ -808,8 +812,9 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void PlayerManager::OnClientDisconnect_Post(int client) void PlayerManager::OnClientDisconnect_Post(CEntityIndex index)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity) void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
@ -850,7 +855,7 @@ void ClientConsolePrint(edict_t *e, const char *fmt, ...)
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
engine->ClientPrintf(IndexOfEdict(e), buffer); engine->ClientPrintf(CEntityIndex(IndexOfEdict(e)), buffer);
#else #else
engine->ClientPrintf(e, buffer); engine->ClientPrintf(e, buffer);
#endif #endif
@ -1017,8 +1022,9 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void PlayerManager::OnClientCommand(int client, const CCommand &args) void PlayerManager::OnClientCommand(CEntityIndex index, const CCommand &args)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args) void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
@ -1141,8 +1147,9 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void PlayerManager::OnClientSettingsChanged(int client) void PlayerManager::OnClientSettingsChanged(CEntityIndex index)
{ {
int client = index.Get();
edict_t *pEntity = PEntityOfEntIndex(client); edict_t *pEntity = PEntityOfEntIndex(client);
#else #else
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity) void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
@ -1805,7 +1812,7 @@ int PlayerManager::GetClientFromSerial(unsigned int serial)
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void CmdMaxplayersCallback(void *pUnknown, const CCommand &command) void CmdMaxplayersCallback(const CCommandContext &context, const CCommand &command)
{ {
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdMaxplayersCallback(const CCommand &command) void CmdMaxplayersCallback(const CCommand &command)

View File

@ -152,14 +152,14 @@ public:
void ClearAllAdmins(); void ClearAllAdmins();
public: public:
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
bool OnClientConnect(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen); bool OnClientConnect(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
bool OnClientConnect_Post(int client, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen); bool OnClientConnect_Post(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
void OnClientPutInServer(int client, char const *playername); void OnClientPutInServer(CEntityIndex index, char const *playername);
void OnClientDisconnect(int client); void OnClientDisconnect(CEntityIndex index);
void OnClientDisconnect_Post(int client); void OnClientDisconnect_Post(CEntityIndex index);
void OnClientCommand(int client, const CCommand &args); void OnClientCommand(CEntityIndex index, const CCommand &args);
void OnClientSettingsChanged(int client); void OnClientSettingsChanged(CEntityIndex index);
//void OnClientSettingsChanged_Pre(int client); //void OnClientSettingsChanged_Pre(CEntityIndex client);
#else #else
bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen); bool OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
bool OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen); bool OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen);
@ -247,7 +247,7 @@ private:
}; };
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void CmdMaxplayersCallback(void *, const CCommand &command); void CmdMaxplayersCallback(const CCommandContext &context, const CCommand &command);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void CmdMaxplayersCallback(const CCommand &command); void CmdMaxplayersCallback(const CCommand &command);
#else #else

View File

@ -49,6 +49,22 @@ class ConCommand;
class ConCommandBase; class ConCommandBase;
struct characterset_t; struct characterset_t;
struct CCommandContext
{
CCommandContext( int index )
{
_index = index;
}
int Get() const
{
return _index;
}
private:
int _index;
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -76,7 +92,7 @@ void ConVar_PublishToVXConsole();
// Called when a ConCommand needs to execute // Called when a ConCommand needs to execute
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
typedef void ( *FnCommandCallbackV1_t )( void ); typedef void ( *FnCommandCallbackV1_t )( void );
typedef void ( *FnCommandCallback_t )( void *pUnknown, const CCommand &command ); typedef void ( *FnCommandCallback_t )( const CCommandContext &context, const CCommand &command );
#define COMMAND_COMPLETION_MAXITEMS 64 #define COMMAND_COMPLETION_MAXITEMS 64
#define COMMAND_COMPLETION_ITEM_LENGTH 64 #define COMMAND_COMPLETION_ITEM_LENGTH 64
@ -99,7 +115,7 @@ public:
class ICommandCallback2 class ICommandCallback2
{ {
public: public:
virtual void CommandCallback( void *pUnknown, const CCommand &command ) = 0; virtual void CommandCallback( const CCommandContext &context, const CCommand &command ) = 0;
}; };
class ICommandCompletionCallback class ICommandCompletionCallback
@ -307,7 +323,7 @@ public:
virtual bool CanAutoComplete( void ); virtual bool CanAutoComplete( void );
// Invoke the function // Invoke the function
virtual void Dispatch( void *pUnknown, const CCommand &command ); virtual void Dispatch( const CCommandContext &context, const CCommand &command );
private: private:
// NOTE: To maintain backward compat, we have to be very careful: // NOTE: To maintain backward compat, we have to be very careful:
@ -962,71 +978,71 @@ private:
// Purpose: Utility macros to quicky generate a simple console command // Purpose: Utility macros to quicky generate a simple console command
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define CON_COMMAND( name, description ) \ #define CON_COMMAND( name, description ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description ); \ static ConCommand name##_command( #name, name, description ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
#define CON_COMMAND_SHARED( name, description ) \ #define CON_COMMAND_SHARED( name, description ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command_client( #name "_client", name, description ); \ static ConCommand name##_command_client( #name "_client", name, description ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#else #else
#define CON_COMMAND_SHARED( name, description ) \ #define CON_COMMAND_SHARED( name, description ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description ); \ static ConCommand name##_command( #name, name, description ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#endif #endif
#define CON_COMMAND_F( name, description, flags ) \ #define CON_COMMAND_F( name, description, flags ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags ); \ static ConCommand name##_command( #name, name, description, flags ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
#define CON_COMMAND_F_SHARED( name, description, flags ) \ #define CON_COMMAND_F_SHARED( name, description, flags ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command_client( #name "_client", name, description, flags ); \ static ConCommand name##_command_client( #name "_client", name, description, flags ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#else #else
#define CON_COMMAND_F_SHARED( name, description, flags ) \ #define CON_COMMAND_F_SHARED( name, description, flags ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags ); \ static ConCommand name##_command( #name, name, description, flags ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#endif #endif
#define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \ #define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags, completion ); \ static ConCommand name##_command( #name, name, description, flags, completion ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#ifdef CLIENT_DLL #ifdef CLIENT_DLL
#define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \ #define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command_client( #name "_client", name, description, flags, completion ); \ static ConCommand name##_command_client( #name "_client", name, description, flags, completion ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#else #else
#define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \ #define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \
static void name( void *pUnknown, const CCommand &args ); \ static void name( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, name, description, flags, completion ); \ static ConCommand name##_command( #name, name, description, flags, completion ); \
static void name( void *pUnknown, const CCommand &args ) static void name( const CCommandContext &context, const CCommand &args )
#endif #endif
#define CON_COMMAND_EXTERN( name, _funcname, description ) \ #define CON_COMMAND_EXTERN( name, _funcname, description ) \
void _funcname( void *pUnknown, const CCommand &args ); \ void _funcname( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, _funcname, description ); \ static ConCommand name##_command( #name, _funcname, description ); \
void _funcname( void *pUnknown, const CCommand &args ) void _funcname( const CCommandContext &context, const CCommand &args )
#define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \ #define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \
void _funcname( void *pUnknown, const CCommand &args ); \ void _funcname( const CCommandContext &context, const CCommand &args ); \
static ConCommand name##_command( #name, _funcname, description, flags ); \ static ConCommand name##_command( #name, _funcname, description, flags ); \
void _funcname( void *pUnknown, const CCommand &args ) void _funcname( const CCommandContext &context, const CCommand &args )
#define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \ #define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \
void _funcname( void *pUnknown, const CCommand &args ); \ void _funcname( const CCommandContext &context, const CCommand &args ); \
friend class CCommandMemberInitializer_##_funcname; \ friend class CCommandMemberInitializer_##_funcname; \
class CCommandMemberInitializer_##_funcname \ class CCommandMemberInitializer_##_funcname \
{ \ { \

View File

@ -103,8 +103,7 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[1], &netname); pContext->LocalToString(params[1], &netname);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
int index; int index = engine->CreateFakeClient(netname).Get();
engine->CreateFakeClient(&index, netname);
if (index == -1) if (index == -1)
{ {

View File

@ -270,7 +270,7 @@ size_t MsgListenerWrapper::_FillInPlayers(int *pl_array, IRecipientFilter *pFilt
{ {
int index; int index;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
pFilter->GetRecipientIndex(&index, i); index = pFilter->GetRecipientIndex(i).Get();
#else #else
index = pFilter->GetRecipientIndex(i); index = pFilter->GetRecipientIndex(i);
#endif #endif

View File

@ -45,7 +45,7 @@ public: //IRecipientFilter
bool IsInitMessage() const; bool IsInitMessage() const;
int GetRecipientCount() const; int GetRecipientCount() const;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void GetRecipientIndex(int *clientIndex, int slot) const; CEntityIndex GetRecipientIndex(int slot) const;
#else #else
int GetRecipientIndex(int slot) const; int GetRecipientIndex(int slot) const;
#endif #endif
@ -84,7 +84,7 @@ inline int CellRecipientFilter::GetRecipientCount() const
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
inline void CellRecipientFilter::GetRecipientIndex(int *clientIndex, int slot) const inline CEntityIndex CellRecipientFilter::GetRecipientIndex(int slot) const
#else #else
inline int CellRecipientFilter::GetRecipientIndex(int slot) const inline int CellRecipientFilter::GetRecipientIndex(int slot) const
#endif #endif
@ -97,7 +97,7 @@ inline int CellRecipientFilter::GetRecipientIndex(int slot) const
ret = static_cast<int>(m_Players[slot]); ret = static_cast<int>(m_Players[slot]);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
*clientIndex = ret; return CEntityIndex(ret);
#else #else
return ret; return ret;
#endif #endif

View File

@ -94,7 +94,7 @@ public: // IVoiceServer
bool OnSetClientListening(int iReceiver, int iSender, bool bListen); bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
void VoiceInit(); void VoiceInit();
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void OnClientCommand(int client, const CCommand &args); void OnClientCommand(CEntityIndex index, const CCommand &args);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void OnClientCommand(edict_t *pEntity, const CCommand &args); void OnClientCommand(edict_t *pEntity, const CCommand &args);
#else #else

View File

@ -140,7 +140,7 @@ size_t TempEntHooks::_FillInPlayers(int *pl_array, IRecipientFilter *pFilter)
{ {
int index; int index;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
pFilter->GetRecipientIndex(&index, i); index = pFilter->GetRecipientIndex(i).Get();
#else #else
index = pFilter->GetRecipientIndex(i); index = pFilter->GetRecipientIndex(i);
#endif #endif

View File

@ -59,7 +59,7 @@ bool g_ClientMutes[65][65];
SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool); SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool);
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, int, const CCommand &); SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CEntityIndex, const CCommand &);
#elif SOURCE_ENGINE >= SE_ORANGEBOX #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
@ -94,8 +94,9 @@ void SDKTools::VoiceInit()
} }
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
void SDKTools::OnClientCommand(int client, const CCommand &args) void SDKTools::OnClientCommand(CEntityIndex index, const CCommand &args)
{ {
int client = index.Get();
#elif SOURCE_ENGINE >= SE_ORANGEBOX #elif SOURCE_ENGINE >= SE_ORANGEBOX
void SDKTools::OnClientCommand(edict_t *pEntity, const CCommand &args) void SDKTools::OnClientCommand(edict_t *pEntity, const CCommand &args)
{ {

View File

@ -32,7 +32,12 @@
#include "vsound.h" #include "vsound.h"
#include <IForwardSys.h> #include <IForwardSys.h>
#if SOURCE_ENGINE == SE_DOTA
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, CEntityIndex, const Vector &, const char *, float, soundlevel_t, int, int, float);
#else
SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float); SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const Vector &, const char *, float, soundlevel_t, int, int, float);
#endif
#if SOURCE_ENGINE >= SE_PORTAL2 #if SOURCE_ENGINE >= SE_PORTAL2
SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 0, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
@ -70,7 +75,7 @@ size_t SoundHooks::_FillInPlayers(int *pl_array, IRecipientFilter *pFilter)
{ {
int index; int index;
#if SOURCE_ENGINE == SE_DOTA #if SOURCE_ENGINE == SE_DOTA
pFilter->GetRecipientIndex(&index, i); index = pFilter->GetRecipientIndex(i).Get();
#else #else
index = pFilter->GetRecipientIndex(i); index = pFilter->GetRecipientIndex(i);
#endif #endif
@ -221,9 +226,16 @@ bool SoundHooks::RemoveHook(int type, IPluginFunction *pFunc)
return false; return false;
} }
#if SOURCE_ENGINE == SE_DOTA
void SoundHooks::OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol,
soundlevel_t soundlevel, int fFlags, int pitch, float delay)
{
int entindex = index.Get();
#else
void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol,
soundlevel_t soundlevel, int fFlags, int pitch, float delay) soundlevel_t soundlevel, int fFlags, int pitch, float delay)
{ {
#endif
SoundHookIter iter; SoundHookIter iter;
IPluginFunction *pFunc; IPluginFunction *pFunc;
cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)};
@ -259,8 +271,13 @@ void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char
vec2.x = sp_ctof(vec[0]); vec2.x = sp_ctof(vec[0]);
vec2.y = sp_ctof(vec[1]); vec2.y = sp_ctof(vec[1]);
vec2.z = sp_ctof(vec[2]); vec2.z = sp_ctof(vec[2]);
#if SOURCE_ENGINE == SE_DOTA
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound,
(CEntityIndex(entindex), vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
#else
RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound,
(entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay)); (entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay));
#endif
} }
} }
} }

View File

@ -50,8 +50,14 @@ public:
void Shutdown(); void Shutdown();
void AddHook(int type, IPluginFunction *pFunc); void AddHook(int type, IPluginFunction *pFunc);
bool RemoveHook(int type, IPluginFunction *pFunc); bool RemoveHook(int type, IPluginFunction *pFunc);
#if SOURCE_ENGINE >= SE_PORTAL2
#if SOURCE_ENGINE == SE_DOTA
void OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay);
#else
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay); void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay);
#endif
#if SOURCE_ENGINE >= SE_PORTAL2
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume, int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume,
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
@ -61,8 +67,6 @@ public:
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity); float soundtime, int speakerentity);
#else #else
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol,
soundlevel_t soundlevel, int fFlags, int pitch, float delay);
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS
void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume,