Remove support for Source 1 Dota 2. (#496)
This commit is contained in:
+2
-20
@@ -59,18 +59,11 @@ for sdk_name in SM.sdks:
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
|
||||
]
|
||||
elif sdk.name == 'dota':
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(sdk.path, 'common', 'protobuf-2.6.1', 'src'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf')
|
||||
]
|
||||
|
||||
if builder.target_platform == 'linux':
|
||||
compiler.postlink += ['-lpthread', '-lrt']
|
||||
|
||||
if sdk.name == 'csgo' or sdk.name == 'dota':
|
||||
if sdk.name == 'csgo':
|
||||
if builder.target_platform == 'linux':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
|
||||
elif builder.target_platform == 'mac':
|
||||
@@ -89,7 +82,7 @@ for sdk_name in SM.sdks:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs' + vs_year, 'libprotobuf.lib')
|
||||
compiler.linkflags.insert(0, binary.Dep(lib_path))
|
||||
|
||||
if sdk.name in ['csgo', 'dota']:
|
||||
if sdk.name == 'csgo':
|
||||
binary.sources += ['smn_protobuf.cpp']
|
||||
else:
|
||||
binary.sources += ['smn_bitbuffer.cpp']
|
||||
@@ -100,17 +93,6 @@ for sdk_name in SM.sdks:
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
|
||||
]
|
||||
elif sdk.name == 'dota':
|
||||
binary.sources += [
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'network_connection.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
|
||||
os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
|
||||
]
|
||||
|
||||
SM.binaries += builder.Add(project)
|
||||
|
||||
|
||||
@@ -44,11 +44,7 @@ public: //IRecipientFilter
|
||||
bool IsReliable() const;
|
||||
bool IsInitMessage() const;
|
||||
int GetRecipientCount() const;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CEntityIndex GetRecipientIndex(int slot) const;
|
||||
#else
|
||||
int GetRecipientIndex(int slot) const;
|
||||
#endif
|
||||
public:
|
||||
void Initialize(const cell_t *ptr, size_t count);
|
||||
void SetToReliable(bool isreliable);
|
||||
@@ -83,11 +79,7 @@ inline int CellRecipientFilter::GetRecipientCount() const
|
||||
return m_Size;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
inline CEntityIndex CellRecipientFilter::GetRecipientIndex(int slot) const
|
||||
#else
|
||||
inline int CellRecipientFilter::GetRecipientIndex(int slot) const
|
||||
#endif
|
||||
{
|
||||
int ret;
|
||||
if ((slot < 0) || (slot >= GetRecipientCount()))
|
||||
@@ -99,11 +91,7 @@ inline int CellRecipientFilter::GetRecipientIndex(int slot) const
|
||||
ret = static_cast<int>(m_Players[slot]);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return CEntityIndex(ret);
|
||||
#else
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CellRecipientFilter::SetToInit(bool isinitmsg)
|
||||
|
||||
@@ -295,11 +295,7 @@ bool ChatTriggers::OnSayCommand_Post(int client, const ICommandArgs *command)
|
||||
|
||||
/* Execute the cached command */
|
||||
unsigned int old = SetReplyTo(SM_REPLY_CHAT);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(client, "%s", m_ToExecute);
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(PEntityOfEntIndex(client), m_ToExecute);
|
||||
#endif
|
||||
SetReplyTo(old);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,9 +63,7 @@
|
||||
#endif
|
||||
|
||||
#if SH_IMPL_VERSION >= 5
|
||||
# if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
|
||||
# elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
# if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||
# else
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
@@ -131,9 +129,7 @@ class GenericCommandHooker : public IConCommandLinkListener
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void Dispatch(const CCommandContext &context, const CCommand& args)
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void Dispatch(const CCommand& args)
|
||||
#else
|
||||
void Dispatch()
|
||||
|
||||
+2
-7
@@ -67,10 +67,7 @@ ConVar *g_ServerCfgFile = NULL;
|
||||
|
||||
void CheckAndFinalizeConfigs();
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
|
||||
void Hook_ExecDispatchPre(const CCommandContext &context, const CCommand &cmd)
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||
void Hook_ExecDispatchPre(const CCommand &cmd)
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
@@ -94,9 +91,7 @@ void Hook_ExecDispatchPre()
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void Hook_ExecDispatchPost(const CCommandContext &context, const CCommand &cmd)
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void Hook_ExecDispatchPost(const CCommand &cmd)
|
||||
#else
|
||||
void Hook_ExecDispatchPost()
|
||||
|
||||
@@ -156,7 +156,7 @@ void EventManager::FireGameEvent(IGameEvent *pEvent)
|
||||
Just need to add ourselves as a listener to make our hook on IGameEventManager2::FireEvent work */
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int EventManager::GetEventDebugID()
|
||||
{
|
||||
return EVENT_DEBUG_ID_INIT;
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public: // IPluginsListener
|
||||
void OnPluginUnloaded(IPlugin *plugin);
|
||||
public: // IGameEventListener2
|
||||
void FireGameEvent(IGameEvent *pEvent);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int GetEventDebugID();
|
||||
#endif
|
||||
public:
|
||||
|
||||
+4
-19
@@ -36,17 +36,12 @@ SH_DECL_HOOK3_void(ICvar, CallGlobalChangeCallbacks, SH_NOATTRIB, false, ConVar
|
||||
SH_DECL_HOOK2_void(ICvar, CallGlobalChangeCallback, SH_NOATTRIB, false, ConVar *, const char *);
|
||||
#endif
|
||||
|
||||
#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
|
||||
#if 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(IServerPluginCallbacks, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t, edict_t *, EQueryCvarValueStatus, const char *, const char *);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_HOOK2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#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);
|
||||
@@ -88,7 +83,7 @@ void GameHooks::OnVSPReceived()
|
||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL || vsp_version < 2)
|
||||
return;
|
||||
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
hooks_ += SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false);
|
||||
client_cvar_query_mode_ = ClientCvarQueryMode::VSP;
|
||||
#endif
|
||||
@@ -116,19 +111,9 @@ void GameHooks::OnConVarChanged(ConVar *pConVar, const char *oldValue)
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
# if SOURCE_ENGINE == SE_DOTA
|
||||
void GameHooks::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result,
|
||||
const char *cvarName, const char *cvarValue)
|
||||
# else
|
||||
void GameHooks::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
||||
const char *cvarName, const char *cvarValue)
|
||||
# endif
|
||||
{
|
||||
# if SOURCE_ENGINE == SE_DOTA
|
||||
int client = player.Get();
|
||||
# else
|
||||
const char *cvarName, const char *cvarValue){
|
||||
int client = IndexOfEdict(pPlayer);
|
||||
# endif
|
||||
|
||||
# if SOURCE_ENGINE == SE_CSGO
|
||||
if (g_Players.HandleConVarQuery(cookie, client, result, cvarName, cvarValue))
|
||||
|
||||
+2
-8
@@ -40,10 +40,7 @@ class ConVar;
|
||||
class CCommand;
|
||||
struct CCommandContext;
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
# define DISPATCH_ARGS const CCommandContext &context, const CCommand &command
|
||||
# define DISPATCH_PROLOGUE
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
# define DISPATCH_ARGS const CCommand &command
|
||||
# define DISPATCH_PROLOGUE
|
||||
#else
|
||||
@@ -109,10 +106,7 @@ private:
|
||||
#endif
|
||||
|
||||
// Callback for when StartQueryCvarValue() has finished.
|
||||
#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
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
|
||||
const char *cvarName, const char *cvarValue);
|
||||
#endif
|
||||
|
||||
+7
-69
@@ -43,9 +43,7 @@
|
||||
#include <tier0/mem.h>
|
||||
#include <bridge/include/ILogger.h>
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
#include <game/shared/protobuf/usermessages.pb.h>
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <cstrike15_usermessages.pb.h>
|
||||
#endif
|
||||
|
||||
@@ -318,11 +316,7 @@ ICommandLine *CHalfLife2::GetValveCommandLine()
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return engine->GetChangeAccessor( IndexOfEdict((const edict_t *)this) );
|
||||
#else
|
||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -530,17 +524,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
char buffer[253];
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "%s\1\n", msg);
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_SayText *pMsg;
|
||||
if ((pMsg = (CUserMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_client(0);
|
||||
pMsg->set_text(buffer);
|
||||
pMsg->set_chat(false);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_SayText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_SayText *)g_UserMsgs.StartProtobufMessage(m_SayTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
@@ -567,16 +551,7 @@ bool CHalfLife2::TextMsg(int client, int dest, const char *msg)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_TextMsg *pMsg;
|
||||
if ((pMsg = (CUserMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_dest(dest);
|
||||
pMsg->add_param(msg);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_TextMsg *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_TextMsg *)g_UserMsgs.StartProtobufMessage(m_MsgTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
@@ -609,15 +584,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
{
|
||||
cell_t players[] = {client};
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_HintText *pMsg;
|
||||
if ((pMsg = (CUserMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_message(msg);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_HintText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
@@ -647,15 +614,7 @@ bool CHalfLife2::HintTextMsg(int client, const char *msg)
|
||||
|
||||
bool CHalfLife2::HintTextMsg(cell_t *players, int count, const char *msg)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_HintText *pMsg;
|
||||
if ((pMsg = (CUserMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pMsg->set_message(msg);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_HintText *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_HintText *)g_UserMsgs.StartProtobufMessage(m_HinTextMsg, players, count, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
@@ -690,13 +649,7 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
|
||||
int count = 0;
|
||||
cell_t players[] = {client};
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_VGUIMenu *pMsg;
|
||||
if ((pMsg = (CUserMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_VGUIMenu *pMsg;
|
||||
if ((pMsg = (CCSUsrMsg_VGUIMenu *)g_UserMsgs.StartProtobufMessage(m_VGUIMenu, players, 1, USERMSG_RELIABLE)) == NULL)
|
||||
{
|
||||
@@ -721,18 +674,7 @@ bool CHalfLife2::ShowVGUIMenu(int client, const char *name, KeyValues *data, boo
|
||||
SubKey = data->GetFirstSubKey();
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
pMsg->set_name(name);
|
||||
pMsg->set_show(show);
|
||||
|
||||
while (SubKey)
|
||||
{
|
||||
CUserMsg_VGUIMenu_Keys *key = pMsg->add_keys();
|
||||
key->set_name(SubKey->GetName());
|
||||
key->set_value(SubKey->GetString());
|
||||
SubKey = SubKey->GetNextKey();
|
||||
}
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
pMsg->set_name(name);
|
||||
pMsg->set_show(show);
|
||||
|
||||
@@ -788,11 +730,7 @@ void CHalfLife2::ProcessFakeCliCmdQueue()
|
||||
if (g_Players.GetClientOfUserId(pFake->userid) == pFake->client)
|
||||
{
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(pFake->client);
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(pPlayer->GetIndex(), "%s", pFake->cmd.c_str());
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(pPlayer->GetEdict(), pFake->cmd.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
m_CmdQueue.pop();
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public:
|
||||
int m_SerialNumber;
|
||||
CEntInfo *m_pPrev;
|
||||
CEntInfo *m_pNext;
|
||||
#if (SOURCE_ENGINE >= SE_PORTAL2) && (SOURCE_ENGINE != SE_DOTA)
|
||||
#if SOURCE_ENGINE >= SE_PORTAL2
|
||||
string_t m_iName;
|
||||
string_t m_iClassName;
|
||||
#endif
|
||||
|
||||
@@ -141,11 +141,7 @@ void CRadioStyle::OnSourceModShutdown()
|
||||
|
||||
bool CRadioStyle::IsSupported()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return false;
|
||||
#else
|
||||
return (g_ShowMenuId != -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CRadioStyle::OnClientCommand(int client, const char *cmdname, const CCommand &cmd)
|
||||
@@ -176,10 +172,9 @@ void CRadioStyle::OnUserMessage(int msg_id, protobuf::Message &msg, IRecipientFi
|
||||
void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFilter)
|
||||
#endif
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
int count = pFilter->GetRecipientCount();
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
int c = ((CCSUsrMsg_ShowMenu &)msg).display_time();
|
||||
#else
|
||||
bf_read br(bf->GetBasePointer(), 3);
|
||||
@@ -194,7 +189,6 @@ void CRadioStyle::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilter *pFil
|
||||
{
|
||||
g_last_clients[g_last_client_count++] = pFilter->GetRecipientIndex(i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRadioStyle::OnUserMessageSent(int msg_id)
|
||||
@@ -474,7 +468,6 @@ void CRadioMenuPlayer::Radio_Init(int keys, const char *title, const char *text)
|
||||
|
||||
void CRadioMenuPlayer::Radio_Refresh()
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
cell_t players[1] = { (cell_t)m_index };
|
||||
char *ptr = display_pkt;
|
||||
char save = 0;
|
||||
@@ -491,8 +484,7 @@ void CRadioMenuPlayer::Radio_Refresh()
|
||||
time = menuHoldTime - (unsigned int)(gpGlobals->curtime - menuStartTime);
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
// If or when we need to support multiple games per engine with this, we can switch to reflection
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
// TODO: find what happens past 240 on CS:GO
|
||||
CCSUsrMsg_ShowMenu *msg = (CCSUsrMsg_ShowMenu *)g_UserMsgs.StartProtobufMessage(g_ShowMenuId, players, 1, USERMSG_BLOCKHOOKS);
|
||||
msg->set_bits_valid_slots(display_keys);
|
||||
@@ -528,7 +520,6 @@ void CRadioMenuPlayer::Radio_Refresh()
|
||||
#endif
|
||||
|
||||
display_last_refresh = gpGlobals->curtime;
|
||||
#endif // !DOTA
|
||||
}
|
||||
|
||||
int CRadioDisplay::GetAmountRemaining()
|
||||
|
||||
@@ -65,20 +65,16 @@ bool ValveMenuStyle::OnClientCommand(int client, const char *cmdname, const CCom
|
||||
|
||||
void ValveMenuStyle::OnSourceModAllInitialized()
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
g_Players.AddClientListener(this);
|
||||
SH_ADD_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
||||
g_pSPHCC = SH_GET_CALLCLASS(serverpluginhelpers);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ValveMenuStyle::OnSourceModShutdown()
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
SH_RELEASE_CALLCLASS(g_pSPHCC);
|
||||
SH_REMOVE_HOOK(IServerPluginHelpers, CreateMessage, serverpluginhelpers, SH_MEMBER(this, &ValveMenuStyle::HookCreateMessage), false);
|
||||
g_Players.RemoveClientListener(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ValveMenuStyle::HookCreateMessage(edict_t *pEdict,
|
||||
|
||||
+2
-7
@@ -48,9 +48,7 @@ SH_DECL_HOOK2_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, co
|
||||
SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, const char *, const char *, bool);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
@@ -210,10 +208,7 @@ NextMapManager::NextMapManager()
|
||||
m_mapHistory = SourceHook::List<MapChangeData *>();
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command)
|
||||
{
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void CmdChangeLevelCallback(const CCommand &command)
|
||||
{
|
||||
#else
|
||||
|
||||
+2
-6
@@ -59,9 +59,7 @@ struct MapChangeData
|
||||
time_t startTime;
|
||||
};
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void CmdChangeLevelCallback(const CCommand &command);
|
||||
#else
|
||||
void CmdChangeLevelCallback();
|
||||
@@ -72,9 +70,7 @@ class NextMapManager : public SMGlobalClass
|
||||
public:
|
||||
NextMapManager();
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
friend void CmdChangeLevelCallback(const CCommandContext &context, const CCommand &command);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
friend void CmdChangeLevelCallback(const CCommand &command);
|
||||
#else
|
||||
friend void CmdChangeLevelCallback();
|
||||
|
||||
+28
-149
@@ -65,13 +65,6 @@ List<ICommandTargetProcessor *> target_processors;
|
||||
|
||||
ConVar sm_debug_connect("sm_debug_connect", "0", 0, "Log Debug information about potential connection issues.");
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
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, CEntityIndex, const char *);
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientDisconnect, SH_NOATTRIB, 0, CEntityIndex, int);
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CEntityIndex, const CCommand &);
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, CEntityIndex);
|
||||
#else
|
||||
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 *);
|
||||
@@ -81,26 +74,20 @@ SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *,
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *);
|
||||
#endif
|
||||
SH_DECL_HOOK1_void(IServerGameClients, ClientSettingsChanged, SH_NOATTRIB, 0, edict_t *);
|
||||
#endif // SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
SH_DECL_HOOK2_void(IServerGameClients, ClientCommandKeyValues, SH_NOATTRIB, 0, edict_t *, KeyValues *);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_HOOK0_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0);
|
||||
#else
|
||||
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
SH_DECL_HOOK1_void(IServerGameDLL, ServerHibernationUpdate, SH_NOATTRIB, 0, bool);
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox. +dota
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
||||
SH_DECL_HOOK1_void(IServerGameDLL, SetServerHibernation, SH_NOATTRIB, 0, bool);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
SH_DECL_EXTERN2_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommandContext &, const CCommand &);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
SH_DECL_EXTERN1_void(ConCommand, Dispatch, SH_NOATTRIB, false, const CCommand &);
|
||||
#elif SOURCE_ENGINE == SE_DARKMESSIAH
|
||||
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
|
||||
@@ -177,15 +164,15 @@ void PlayerManager::OnSourceModAllInitialized()
|
||||
SH_ADD_HOOK(IServerGameClients, ClientDisconnect, serverClients, SH_MEMBER(this, &PlayerManager::OnClientDisconnect), false);
|
||||
SH_ADD_HOOK(IServerGameClients, ClientDisconnect, serverClients, SH_MEMBER(this, &PlayerManager::OnClientDisconnect_Post), true);
|
||||
SH_ADD_HOOK(IServerGameClients, ClientCommand, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommand), false);
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
SH_ADD_HOOK(IServerGameClients, ClientCommandKeyValues, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommandKeyValues), false);
|
||||
SH_ADD_HOOK(IServerGameClients, ClientCommandKeyValues, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommandKeyValues_Post), true);
|
||||
#endif
|
||||
SH_ADD_HOOK(IServerGameClients, ClientSettingsChanged, serverClients, SH_MEMBER(this, &PlayerManager::OnClientSettingsChanged), true);
|
||||
SH_ADD_HOOK(IServerGameDLL, ServerActivate, gamedll, SH_MEMBER(this, &PlayerManager::OnServerActivate), true);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
SH_ADD_HOOK(IServerGameDLL, ServerHibernationUpdate, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox. +dota
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
||||
SH_ADD_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||
#endif
|
||||
|
||||
@@ -230,15 +217,15 @@ void PlayerManager::OnSourceModShutdown()
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientDisconnect, serverClients, SH_MEMBER(this, &PlayerManager::OnClientDisconnect), false);
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientDisconnect, serverClients, SH_MEMBER(this, &PlayerManager::OnClientDisconnect_Post), true);
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientCommand, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommand), false);
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientCommandKeyValues, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommandKeyValues), false);
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientCommandKeyValues, serverClients, SH_MEMBER(this, &PlayerManager::OnClientCommandKeyValues_Post), true);
|
||||
#endif
|
||||
SH_REMOVE_HOOK(IServerGameClients, ClientSettingsChanged, serverClients, SH_MEMBER(this, &PlayerManager::OnClientSettingsChanged), true);
|
||||
SH_REMOVE_HOOK(IServerGameDLL, ServerActivate, gamedll, SH_MEMBER(this, &PlayerManager::OnServerActivate), true);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
SH_REMOVE_HOOK(IServerGameDLL, ServerHibernationUpdate, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox. +dota
|
||||
#elif SOURCE_ENGINE > SE_EYE // 2013/orangebox, but not original orangebox.
|
||||
SH_REMOVE_HOOK(IServerGameDLL, SetServerHibernation, gamedll, SH_MEMBER(this, &PlayerManager::OnServerHibernationUpdate), true);
|
||||
#endif
|
||||
|
||||
@@ -307,11 +294,7 @@ ConfigResult PlayerManager::OnSourceModConfigChanged(const char *key,
|
||||
return ConfigResult_Ignore;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnServerActivate()
|
||||
#else
|
||||
void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
||||
#endif
|
||||
{
|
||||
static ConVar *tv_enable = icvar->FindVar("tv_enable");
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
@@ -329,11 +312,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
|
||||
g_OnMapStarted = true;
|
||||
m_bServerActivated = true;
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
extsys->CallOnCoreMapStart(gpGlobals->pEdicts, gpGlobals->maxEntities, gpGlobals->maxClients);
|
||||
#else
|
||||
extsys->CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
|
||||
#endif
|
||||
|
||||
m_onActivate->Execute(NULL);
|
||||
m_onActivate2->Execute(NULL);
|
||||
@@ -499,16 +478,9 @@ void PlayerManager::RunAuthChecks()
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
bool PlayerManager::OnClientConnect(CEntityIndex index, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
++m_PlayersSinceActive;
|
||||
|
||||
@@ -525,13 +497,8 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
logger->LogMessage("\"%s<%d><%s><>\" was already connected to the server.", pPlayer->GetName(), pPlayer->GetUserId(), pAuth);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
OnClientDisconnect(pPlayer->GetIndex(), 0);
|
||||
OnClientDisconnect_Post(pPlayer->GetIndex(), 0);
|
||||
#else
|
||||
OnClientDisconnect(pPlayer->GetEdict());
|
||||
OnClientDisconnect_Post(pPlayer->GetEdict());
|
||||
#endif
|
||||
}
|
||||
|
||||
pPlayer->Initialize(pszName, pszAddress, pEntity);
|
||||
@@ -578,7 +545,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
m_AuthQueue[++m_AuthQueue[0]] = client;
|
||||
}
|
||||
|
||||
m_UserIdLookUp[GetPlayerUserId(pEntity)] = client;
|
||||
m_UserIdLookUp[engine->GetPlayerUserId(pEntity)] = client;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -591,17 +558,9 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
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);
|
||||
#else
|
||||
bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
bool orig_value = META_RESULT_ORIG_RET(bool);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
@@ -638,18 +597,10 @@ bool PlayerManager::OnClientConnect_Post(edict_t *pEntity, const char *pszName,
|
||||
return true;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientPutInServer(CEntityIndex index, const char *playername)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
/* If they're not connected, they're a bot */
|
||||
@@ -682,7 +633,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
// This doesn't actually get incremented until OnClientConnect. Fake it to check.
|
||||
int newCount = m_PlayersSinceActive + 1;
|
||||
|
||||
int userId = GetPlayerUserId(pEntity);
|
||||
int userId = engine->GetPlayerUserId(pEntity);
|
||||
#if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_SDK2013 \
|
||||
|| SOURCE_ENGINE == SE_BMS || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
static ConVar *tv_name = icvar->FindVar("tv_name");
|
||||
@@ -722,11 +673,7 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
|
||||
m_SourceTVUserId = userId;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
if (!OnClientConnect(client, playername, "127.0.0.1", error, sizeof(error)))
|
||||
#else
|
||||
if (!OnClientConnect(pEntity, playername, "127.0.0.1", error, sizeof(error)))
|
||||
#endif
|
||||
{
|
||||
/* :TODO: kick the bot if it's rejected */
|
||||
return;
|
||||
@@ -808,13 +755,8 @@ void PlayerManager::OnSourceModLevelEnd()
|
||||
{
|
||||
if (m_Players[i].IsConnected())
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
OnClientDisconnect(m_Players[i].GetIndex(), 0);
|
||||
OnClientDisconnect_Post(m_Players[i].GetIndex(), 0);
|
||||
#else
|
||||
OnClientDisconnect(m_Players[i].GetEdict());
|
||||
OnClientDisconnect_Post(m_Players[i].GetEdict());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
m_PlayerCount = 0;
|
||||
@@ -838,30 +780,17 @@ void PlayerManager::OnServerHibernationUpdate(bool bHibernating)
|
||||
if (pPlayer->IsSourceTV() || pPlayer->IsReplay())
|
||||
continue;
|
||||
#endif
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
OnClientDisconnect(m_Players[i].GetIndex(), 0);
|
||||
OnClientDisconnect_Post(m_Players[i].GetIndex(), 0);
|
||||
#else
|
||||
OnClientDisconnect(m_Players[i].GetEdict());
|
||||
OnClientDisconnect_Post(m_Players[i].GetEdict());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientDisconnect(CEntityIndex index, int reason)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
if (pPlayer->IsConnected())
|
||||
@@ -889,16 +818,9 @@ void PlayerManager::OnClientDisconnect(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientDisconnect_Post(CEntityIndex index, int reason)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientDisconnect_Post(edict_t *pEntity)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
@@ -1114,24 +1036,17 @@ void ListPluginsToClient(CPlayer *player, const CCommand &args)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientCommand(CEntityIndex index, const CCommand &args)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#else
|
||||
void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
{
|
||||
CCommand args;
|
||||
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res = Pl_Continue;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
if (!pPlayer->IsConnected())
|
||||
@@ -1236,7 +1151,7 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
static bool s_LastCCKVAllowed = true;
|
||||
|
||||
void PlayerManager::OnClientCommandKeyValues(edict_t *pEntity, KeyValues *pCommand)
|
||||
@@ -1316,18 +1231,10 @@ void PlayerManager::OnClientCommandKeyValues_Post(edict_t *pEntity, KeyValues *p
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void PlayerManager::OnClientSettingsChanged(CEntityIndex index)
|
||||
{
|
||||
int client = index.Get();
|
||||
edict_t *pEntity = PEntityOfEntIndex(client);
|
||||
#else
|
||||
void PlayerManager::OnClientSettingsChanged(edict_t *pEntity)
|
||||
{
|
||||
int client = IndexOfEdict(pEntity);
|
||||
#endif
|
||||
|
||||
cell_t res;
|
||||
int client = IndexOfEdict(pEntity);
|
||||
CPlayer *pPlayer = &m_Players[client];
|
||||
|
||||
if (!pPlayer->IsConnected())
|
||||
@@ -1447,7 +1354,7 @@ int PlayerManager::GetClientOfUserId(int userid)
|
||||
CPlayer *player = GetPlayerByIndex(client);
|
||||
if (player && player->IsConnected())
|
||||
{
|
||||
int realUserId = GetPlayerUserId(player->GetEdict());
|
||||
int realUserId = engine->GetPlayerUserId(player->GetEdict());
|
||||
if (realUserId == userid)
|
||||
{
|
||||
return client;
|
||||
@@ -1464,7 +1371,7 @@ int PlayerManager::GetClientOfUserId(int userid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (GetPlayerUserId(player->GetEdict()) == userid)
|
||||
if (engine->GetPlayerUserId(player->GetEdict()) == userid)
|
||||
{
|
||||
m_UserIdLookUp[userid] = i;
|
||||
return i;
|
||||
@@ -1570,7 +1477,7 @@ void PlayerManager::InvalidatePlayer(CPlayer *pPlayer)
|
||||
}
|
||||
}
|
||||
|
||||
m_UserIdLookUp[GetPlayerUserId(pPlayer->m_pEdict)] = 0;
|
||||
m_UserIdLookUp[engine->GetPlayerUserId(pPlayer->m_pEdict)] = 0;
|
||||
pPlayer->Disconnect();
|
||||
}
|
||||
|
||||
@@ -1995,10 +1902,7 @@ int PlayerManager::GetClientFromSerial(unsigned int serial)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void CmdMaxplayersCallback(const CCommandContext &context, const CCommand &command)
|
||||
{
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void CmdMaxplayersCallback(const CCommand &command)
|
||||
{
|
||||
#else
|
||||
@@ -2108,13 +2012,7 @@ void CPlayer::UpdateAuthIds()
|
||||
}
|
||||
|
||||
// First cache engine networkid
|
||||
const char *authstr;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
authstr = engine->GetPlayerNetworkIDString(m_iIndex - 1);
|
||||
#else
|
||||
authstr = engine->GetPlayerNetworkIDString(m_pEdict);
|
||||
#endif
|
||||
|
||||
const char *authstr = engine->GetPlayerNetworkIDString(m_pEdict);
|
||||
if (!authstr)
|
||||
{
|
||||
// engine doesn't have the client's auth string just yet, we can't do anything
|
||||
@@ -2144,13 +2042,7 @@ void CPlayer::UpdateAuthIds()
|
||||
k_unSteamUserDesktopInstance, k_EUniversePublic, k_EAccountTypeIndividual);
|
||||
}
|
||||
#else
|
||||
const CSteamID *steamId;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
steamId = engine->GetClientSteamID(m_iIndex);
|
||||
#else
|
||||
steamId = engine->GetClientSteamID(m_pEdict);
|
||||
#endif
|
||||
|
||||
const CSteamID *steamId = engine->GetClientSteamID(m_pEdict);
|
||||
if (steamId)
|
||||
{
|
||||
m_SteamId = (*steamId);
|
||||
@@ -2348,11 +2240,7 @@ bool CPlayer::IsAuthStringValidated()
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
if (!IsFakeClient() && g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer())
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return engine->IsClientFullyAuthenticated(m_iIndex);
|
||||
#else
|
||||
return engine->IsClientFullyAuthenticated(m_pEdict);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2438,12 +2326,7 @@ void CPlayer::Kick(const char *str)
|
||||
else
|
||||
{
|
||||
IClient *pClient = static_cast<IClient *>(pNetChan->GetMsgHandler());
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
// Including network_connection.pb.h (and .cpp) is overkill for just this. -p
|
||||
// Copied from ENetworkDisconnectionReason enum
|
||||
const int NETWORK_DISCONNECT_KICKED = 39;
|
||||
pClient->Disconnect(NETWORK_DISCONNECT_KICKED);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
pClient->Disconnect(str);
|
||||
#else
|
||||
pClient->Disconnect("%s", str);
|
||||
@@ -2560,7 +2443,7 @@ void CPlayer::DoBasicAdminChecks()
|
||||
{
|
||||
if (!g_Players.CheckSetAdminName(client, this, id))
|
||||
{
|
||||
int userid = GetPlayerUserId(m_pEdict);
|
||||
int userid = engine->GetPlayerUserId(m_pEdict);
|
||||
g_Timers.CreateTimer(&s_KickPlayerTimer, 0.1f, (void *)userid, 0);
|
||||
}
|
||||
return;
|
||||
@@ -2599,7 +2482,7 @@ int CPlayer::GetUserId()
|
||||
{
|
||||
if (m_UserId == -1)
|
||||
{
|
||||
m_UserId = GetPlayerUserId(GetEdict());
|
||||
m_UserId = engine->GetPlayerUserId(GetEdict());
|
||||
}
|
||||
|
||||
return m_UserId;
|
||||
@@ -2675,9 +2558,5 @@ void CPlayer::PrintToConsole(const char *pMsg)
|
||||
return;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientPrintf(m_iIndex, pMsg);
|
||||
#else
|
||||
engine->ClientPrintf(m_pEdict, pMsg);
|
||||
#endif
|
||||
}
|
||||
|
||||
+2
-19
@@ -164,16 +164,6 @@ public:
|
||||
CPlayer *GetPlayerByIndex(int client) const;
|
||||
void RunAuthChecks();
|
||||
public:
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
bool OnClientConnect(CEntityIndex index, 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(CEntityIndex index, char const *playername);
|
||||
void OnClientDisconnect(CEntityIndex index, int reason);
|
||||
void OnClientDisconnect_Post(CEntityIndex index, int reason);
|
||||
void OnClientCommand(CEntityIndex index, const CCommand &args);
|
||||
void OnClientSettingsChanged(CEntityIndex index);
|
||||
//void OnClientSettingsChanged_Pre(CEntityIndex client);
|
||||
#else
|
||||
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);
|
||||
void OnClientPutInServer(edict_t *pEntity, char const *playername);
|
||||
@@ -181,7 +171,7 @@ public:
|
||||
void OnClientDisconnect_Post(edict_t *pEntity);
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void OnClientCommand(edict_t *pEntity, const CCommand &args);
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
void OnClientCommandKeyValues(edict_t *pEntity, KeyValues *pCommand);
|
||||
void OnClientCommandKeyValues_Post(edict_t *pEntity, KeyValues *pCommand);
|
||||
#endif
|
||||
@@ -190,7 +180,6 @@ public:
|
||||
#endif
|
||||
void OnClientSettingsChanged(edict_t *pEntity);
|
||||
//void OnClientSettingsChanged_Pre(edict_t *pEntity);
|
||||
#endif
|
||||
void OnServerHibernationUpdate(bool bHibernating);
|
||||
public: //IPlayerManager
|
||||
void AddClientListener(IClientListener *listener);
|
||||
@@ -236,11 +225,7 @@ public:
|
||||
bool HandleConVarQuery(QueryCvarCookie_t cookie, int client, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue);
|
||||
#endif
|
||||
private:
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void OnServerActivate();
|
||||
#else
|
||||
void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
|
||||
#endif
|
||||
void InvalidatePlayer(CPlayer *pPlayer);
|
||||
private:
|
||||
List<IClientListener *> m_hooks;
|
||||
@@ -275,9 +260,7 @@ private:
|
||||
bool m_bInCCKVHook;
|
||||
};
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
void CmdMaxplayersCallback(const CCommandContext &context, const CCommand &command);
|
||||
#elif SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
void CmdMaxplayersCallback(const CCommand &command);
|
||||
#else
|
||||
void CmdMaxplayersCallback();
|
||||
|
||||
+19
-32
@@ -33,16 +33,14 @@
|
||||
#include "sm_stringutil.h"
|
||||
#include "logic_bridge.h"
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
#include <dota_usermessage_helpers.h>
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <cstrike15_usermessage_helpers.h>
|
||||
#endif
|
||||
#include <amtl/am-string.h>
|
||||
|
||||
UserMessages g_UserMsgs;
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_DECL_HOOK3_void(IVEngineServer, SendUserMessage, SH_NOATTRIB, 0, IRecipientFilter &, int, const protobuf::Message &);
|
||||
#else
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
@@ -95,7 +93,7 @@ void UserMessages::OnSourceModAllShutdown()
|
||||
{
|
||||
if (m_HookCount)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
|
||||
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
|
||||
#else
|
||||
@@ -110,10 +108,7 @@ void UserMessages::OnSourceModAllShutdown()
|
||||
|
||||
int UserMessages::GetMessageIndex(const char *msg)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
// Can split this per engine and/or game later
|
||||
return g_DotaUsermessageHelpers.GetIndex(msg);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
// Can split this per engine and/or game later
|
||||
return g_Cstrike15UsermessageHelpers.GetIndex(msg);
|
||||
#else
|
||||
@@ -151,9 +146,7 @@ int UserMessages::GetMessageIndex(const char *msg)
|
||||
bool UserMessages::GetMessageName(int msgid, char *buffer, size_t maxlength) const
|
||||
{
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
const char *pszName = g_DotaUsermessageHelpers.GetName(msgid);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
const char *pszName = g_Cstrike15UsermessageHelpers.GetName(msgid);
|
||||
#endif
|
||||
if (!pszName)
|
||||
@@ -304,7 +297,7 @@ bool UserMessages::EndMessage()
|
||||
return false;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(m_CellRecFilter), m_CurId, *m_FakeEngineBuffer);
|
||||
@@ -334,7 +327,7 @@ bool UserMessages::EndMessage()
|
||||
} else {
|
||||
engine->MessageEnd();
|
||||
}
|
||||
#endif // SE_CSGO || SE_DOTA
|
||||
#endif // SE_CSGO
|
||||
|
||||
m_InExec = false;
|
||||
m_CurFlags = 0;
|
||||
@@ -419,7 +412,7 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene
|
||||
|
||||
if (!m_HookCount++)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
|
||||
SH_ADD_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
|
||||
#else
|
||||
@@ -443,9 +436,7 @@ bool UserMessages::InternalHook(int msg_id, IBitBufUserMessageListener *pListene
|
||||
#ifdef USE_PROTOBUF_USERMESSAGES
|
||||
const protobuf::Message *UserMessages::GetMessagePrototype(int msg_type)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return g_DotaUsermessageHelpers.GetPrototype(msg_type);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
return g_Cstrike15UsermessageHelpers.GetPrototype(msg_type);
|
||||
#endif
|
||||
}
|
||||
@@ -496,7 +487,7 @@ void UserMessages::_DecRefCounter()
|
||||
{
|
||||
if (--m_HookCount == 0)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Pre), false);
|
||||
SH_REMOVE_HOOK(IVEngineServer, SendUserMessage, engine, SH_MEMBER(this, &UserMessages::OnSendUserMessage_Post), true);
|
||||
#else
|
||||
@@ -508,12 +499,10 @@ void UserMessages::_DecRefCounter()
|
||||
}
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
OnStartMessage_Pre(&filter, msg_type, g_DotaUsermessageHelpers.GetName(msg_type));
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
OnStartMessage_Pre(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
|
||||
#endif
|
||||
if (m_FakeMetaRes == MRES_SUPERCEDE)
|
||||
@@ -528,9 +517,7 @@ void UserMessages::OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type,
|
||||
m_FakeEngineBuffer = &const_cast<protobuf::Message &>(msg);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
OnStartMessage_Post(&filter, msg_type, g_DotaUsermessageHelpers.GetName(msg_type));
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
OnStartMessage_Post(&filter, msg_type, g_Cstrike15UsermessageHelpers.GetName(msg_type));
|
||||
#endif
|
||||
|
||||
@@ -564,7 +551,7 @@ void UserMessages::OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type
|
||||
RETURN_META(res)
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
@@ -604,7 +591,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
UM_RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
@@ -769,7 +756,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
|
||||
if (!handled && intercepted)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
ENGINE_CALL(SendUserMessage)(static_cast<IRecipientFilter &>(*m_CurRecFilter), m_CurId, *m_InterceptBuffer);
|
||||
#else
|
||||
bf_write *engine_bfw;
|
||||
@@ -781,11 +768,11 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
m_ReadBuffer.StartReading(m_InterceptBuffer.GetBasePointer(), m_InterceptBuffer.GetNumBytesWritten());
|
||||
engine_bfw->WriteBitsFromBuffer(&m_ReadBuffer, m_InterceptBuffer.GetNumBitsWritten());
|
||||
ENGINE_CALL(MessageEnd)();
|
||||
#endif // SE_CSGO || SE_DOTA
|
||||
#endif // SE_CSGO
|
||||
}
|
||||
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
int size = m_OrigBuffer->ByteSize();
|
||||
uint8 *data = (uint8 *)stackalloc(size);
|
||||
m_OrigBuffer->SerializePartialToArray(data, size);
|
||||
@@ -815,7 +802,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
iter++;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
delete pTempMsg;
|
||||
#endif
|
||||
}
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@
|
||||
using namespace SourceHook;
|
||||
using namespace SourceMod;
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#define USE_PROTOBUF_USERMESSAGES
|
||||
#endif
|
||||
|
||||
@@ -102,12 +102,12 @@ public: //IUserMessages
|
||||
bool intercept=false);
|
||||
UserMessageType GetUserMessageType() const;
|
||||
public:
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
void OnSendUserMessage_Pre(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
|
||||
void OnSendUserMessage_Post(IRecipientFilter &filter, int msg_type, const protobuf::Message &msg);
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
protobuf::Message *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
protobuf::Message *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+3
-24
@@ -45,9 +45,7 @@
|
||||
#include "ConCmdManager.h"
|
||||
#include "IDBDriver.h"
|
||||
#include "provider.h"
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
# include "convar_sm_dota.h"
|
||||
#elif SOURCE_ENGINE >= SE_ALIENSWARM
|
||||
#if SOURCE_ENGINE >= SE_ALIENSWARM
|
||||
# include "convar_sm_swarm.h"
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
# include "convar_sm_l4d.h"
|
||||
@@ -116,19 +114,11 @@ public:
|
||||
}
|
||||
virtual void ClientCommand(edict_t *pEdict, const char *szCommand)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(IndexOfEdict(pEdict), "%s", szCommand);
|
||||
#else
|
||||
engine->ClientCommand(pEdict, "%s", szCommand);
|
||||
#endif
|
||||
}
|
||||
virtual void FakeClientCommand(edict_t *pEdict, const char *szCommand)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->ClientCommand(IndexOfEdict(pEdict), "%s", szCommand);
|
||||
#else
|
||||
serverpluginhelpers->ClientCommand(pEdict, szCommand);
|
||||
#endif
|
||||
}
|
||||
} engine_wrapper;
|
||||
|
||||
@@ -401,8 +391,6 @@ void UTIL_ConsolePrint(const char *fmt, ...)
|
||||
#define GAMEFIX "2.insurgency"
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#define GAMEFIX "2.csgo"
|
||||
#elif SOURCE_ENGINE == SE_DOTA
|
||||
#define GAMEFIX "2.dota"
|
||||
#elif SOURCE_ENGINE == SE_CONTAGION
|
||||
#define GAMEFIX "2.contagion"
|
||||
#else
|
||||
@@ -528,8 +516,6 @@ const char *CoreProviderImpl::GetSourceEngineName()
|
||||
return "insurgency";
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
return "csgo";
|
||||
#elif SOURCE_ENGINE == SE_DOTA
|
||||
return "dota";
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -546,8 +532,7 @@ bool CoreProviderImpl::SymbolsAreHidden()
|
||||
|| (SOURCE_ENGINE == SE_LEFT4DEAD2) \
|
||||
|| (SOURCE_ENGINE == SE_INSURGENCY) \
|
||||
|| (SOURCE_ENGINE == SE_BLADE) \
|
||||
|| (SOURCE_ENGINE == SE_CSGO) \
|
||||
|| (SOURCE_ENGINE == SE_DOTA)
|
||||
|| (SOURCE_ENGINE == SE_CSGO)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
@@ -605,7 +590,7 @@ bool CoreProviderImpl::DescribePlayer(int index, const char **namep, const char
|
||||
*authp = (auth && *auth) ? auth : "STEAM_ID_PENDING";
|
||||
}
|
||||
if (useridp)
|
||||
*useridp = GetPlayerUserId(player->GetEdict());
|
||||
*useridp = ::engine->GetPlayerUserId(player->GetEdict());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -655,15 +640,9 @@ int CoreProviderImpl::QueryClientConVar(int client, const char *cvar)
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
switch (hooks_.GetClientCvarQueryMode()) {
|
||||
case ClientCvarQueryMode::DLL:
|
||||
# if SOURCE_ENGINE == SE_DOTA
|
||||
return ::engine->StartQueryCvarValue(CEntityIndex(client), cvar);
|
||||
# else
|
||||
return ::engine->StartQueryCvarValue(PEntityOfEntIndex(client), cvar);
|
||||
# endif
|
||||
case ClientCvarQueryMode::VSP:
|
||||
# if SOURCE_ENGINE != SE_DOTA
|
||||
return serverpluginhelpers->StartQueryCvarValue(PEntityOfEntIndex(client), cvar);
|
||||
# endif
|
||||
default:
|
||||
return InvalidQueryCvarCookie;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#include <bridge/include/ILogger.h>
|
||||
#include <ITranslator.h>
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <netmessages.pb.h>
|
||||
#endif
|
||||
|
||||
@@ -977,7 +977,7 @@ static cell_t FakeClientCommandEx(IPluginContext *pContext, const cell_t *params
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_HL2.AddToFakeCliCmdQueue(params[1], GetPlayerUserId(pPlayer->GetEdict()), buffer);
|
||||
g_HL2.AddToFakeCliCmdQueue(params[1], engine->GetPlayerUserId(pPlayer->GetEdict()), buffer);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1164,7 +1164,7 @@ static cell_t SendConVarValue(IPluginContext *pContext, const cell_t *params)
|
||||
char data[256];
|
||||
bf_write buffer(data, sizeof(data));
|
||||
|
||||
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CNETMsg_SetConVar msg;
|
||||
CMsg_CVars_CVar *cvar = msg.mutable_convars()->add_cvars();
|
||||
|
||||
@@ -1259,7 +1259,7 @@ static cell_t ConVar_ReplicateToClient(IPluginContext *pContext, const cell_t *p
|
||||
|
||||
static cell_t FakeClientCommandKeyValues(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_EYE && SOURCE_ENGINE != SE_DOTA
|
||||
#if SOURCE_ENGINE >= SE_EYE
|
||||
int client = params[1];
|
||||
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||
|
||||
@@ -1583,11 +1583,9 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
case FIELD_CLASSPTR:
|
||||
type = PropEnt_Entity;
|
||||
break;
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
case FIELD_EDICT:
|
||||
type = PropEnt_Edict;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return pContext->ThrowNativeError("Data field %s is not an entity nor edict (%d)",
|
||||
prop,
|
||||
@@ -1678,13 +1676,11 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
case FIELD_CLASSPTR:
|
||||
type = PropEnt_Entity;
|
||||
break;
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
case FIELD_EDICT:
|
||||
type = PropEnt_Edict;
|
||||
if (!pEdict)
|
||||
return pContext->ThrowNativeError("Edict %d is invalid", params[1]);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return pContext->ThrowNativeError("Data field %s is not an entity nor edict (%d)",
|
||||
prop,
|
||||
|
||||
@@ -127,16 +127,6 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
pContext->LocalToString(params[1], &netname);
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
int index = engine->CreateFakeClient(netname).Get();
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return index;
|
||||
#else
|
||||
edict_t *pEdict = engine->CreateFakeClient(netname);
|
||||
|
||||
/* :TODO: does the engine fire forwards for us and whatnot? no idea... */
|
||||
@@ -147,7 +137,6 @@ static cell_t CreateFakeClient(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
|
||||
return IndexOfEdict(pEdict);
|
||||
#endif
|
||||
}
|
||||
|
||||
static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -174,11 +163,7 @@ static cell_t SetFakeClientConVar(IPluginContext *pContext, const cell_t *params
|
||||
pContext->LocalToString(params[2], &cvar);
|
||||
pContext->LocalToString(params[3], &value);
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
engine->SetFakeClientConVarValue(pPlayer->GetIndex(), cvar, value);
|
||||
#else
|
||||
engine->SetFakeClientConVarValue(pPlayer->GetEdict(), cvar, value);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -293,9 +278,6 @@ static cell_t IsSoundPrecached(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
return pContext->ThrowNativeError("CreateDialog is not supported on this game");
|
||||
#else
|
||||
KeyValues *pKV;
|
||||
HandleError herr;
|
||||
Handle_t hndl = static_cast<Handle_t>(params[2]);
|
||||
@@ -323,7 +305,6 @@ static cell_t smn_CreateDialog(IPluginContext *pContext, const cell_t *params)
|
||||
vsp_interface);
|
||||
|
||||
return 1;
|
||||
#endif // DOTA
|
||||
}
|
||||
|
||||
static cell_t PrintToChat(IPluginContext *pContext, const cell_t *params)
|
||||
@@ -535,8 +516,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||
return 70;
|
||||
case SOURCE_ENGINE_CSGO:
|
||||
return 80;
|
||||
case SOURCE_ENGINE_DOTA:
|
||||
return 90;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+2
-23
@@ -37,9 +37,7 @@
|
||||
#include "logic_bridge.h"
|
||||
#include "sourcemod.h"
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
#include <game/shared/protobuf/usermessages.pb.h>
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
#include <game/shared/csgo/protobuf/cstrike15_usermessages.pb.h>
|
||||
#endif
|
||||
|
||||
@@ -318,26 +316,7 @@ void UTIL_SendHudText(int client, const hud_text_parms &textparms, const char *p
|
||||
|
||||
players[0] = client;
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
CUserMsg_HudMsg *msg = (CUserMsg_HudMsg *)g_UserMsgs.StartProtobufMessage(g_HudMsgNum, players, 1, 0);
|
||||
msg->set_channel(textparms.channel & 0xFF);
|
||||
|
||||
msg->set_x(textparms.x);
|
||||
msg->set_y(textparms.y);
|
||||
|
||||
Color c1(textparms.r1, textparms.g1, textparms.b1, textparms.a1);
|
||||
msg->set_color1(c1.GetRawColor());
|
||||
|
||||
Color c2(textparms.r2, textparms.g2, textparms.b2, textparms.a2);
|
||||
msg->set_color2(c2.GetRawColor());
|
||||
|
||||
msg->set_effect(textparms.effect);
|
||||
msg->set_fade_in_time(textparms.fadeinTime);
|
||||
msg->set_fade_out_time(textparms.fadeoutTime);
|
||||
msg->set_hold_time(textparms.holdTime);
|
||||
msg->set_fx_time(textparms.fxTime);
|
||||
msg->set_message(pMessage);
|
||||
#elif SOURCE_ENGINE == SE_CSGO
|
||||
#if SOURCE_ENGINE == SE_CSGO
|
||||
CCSUsrMsg_HudMsg *msg = (CCSUsrMsg_HudMsg *)g_UserMsgs.StartProtobufMessage(g_HudMsgNum, players, 1, 0);
|
||||
msg->set_channel(textparms.channel & 0xFF);
|
||||
|
||||
|
||||
@@ -269,13 +269,7 @@ size_t MsgListenerWrapper::_FillInPlayers(int *pl_array, IRecipientFilter *pFilt
|
||||
|
||||
for (size_t i=0; i<size; i++)
|
||||
{
|
||||
int index;
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
index = pFilter->GetRecipientIndex(i).Get();
|
||||
#else
|
||||
index = pFilter->GetRecipientIndex(i);
|
||||
#endif
|
||||
pl_array[i] = index;
|
||||
pl_array[i] = pFilter->GetRecipientIndex(i);
|
||||
}
|
||||
|
||||
return size;
|
||||
|
||||
@@ -108,9 +108,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION);
|
||||
#endif
|
||||
#if SOURCE_ENGINE != SE_DOTA
|
||||
GET_V_IFACE_CURRENT(GetEngineFactory, serverpluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
|
||||
#endif
|
||||
|
||||
/* :TODO: Make this optional and... make it find earlier versions [?] */
|
||||
GET_V_IFACE_CURRENT(GetServerFactory, playerinfo, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);
|
||||
|
||||
+1
-3
@@ -32,9 +32,7 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
#define _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
|
||||
#if SOURCE_ENGINE == SE_DOTA
|
||||
#include "convar_sm_dota.h"
|
||||
#elif SOURCE_ENGINE >= SE_ALIENSWARM
|
||||
#if SOURCE_ENGINE >= SE_ALIENSWARM
|
||||
#include "convar_sm_swarm.h"
|
||||
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#include "convar_sm_l4d.h"
|
||||
|
||||
Reference in New Issue
Block a user