diff --git a/AMBuildScript b/AMBuildScript index f9e41021..08de5cbd 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -32,7 +32,6 @@ PossibleSDKs = { 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'), 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'), 'csgo': SDK('HL2SDKCSGO', '2.csgo', '20', 'CSGO', WinLinuxMac, 'csgo'), - 'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', [], 'dota'), 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'), 'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'), 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'), @@ -409,10 +408,10 @@ class SMConfig(object): # For everything after Swarm, this needs to be defined for entity networking # to work properly with sendprop value changes. - if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']: + if sdk.name in ['blade', 'insurgency', 'csgo']: compiler.defines += ['NETWORK_VARS_ENABLED'] - if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota']: + if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']: if builder.target_platform in ['linux', 'mac']: compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE'] @@ -447,7 +446,7 @@ class SMConfig(object): compiler.Dep(os.path.join(lib_folder, 'mathlib_i486.a')) ] - if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']: + if sdk.name in ['blade', 'insurgency', 'csgo']: compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))] self.AddVersioning(binary) @@ -456,7 +455,7 @@ class SMConfig(object): if builder.target_platform == 'linux': if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency']: dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so'] - elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo', 'dota']: + elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo']: dynamic_libs = ['libtier0.so', 'libvstdlib.so'] else: dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so'] @@ -465,7 +464,7 @@ class SMConfig(object): dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib'] elif builder.target_platform == 'windows': libs = ['tier0', 'tier1', 'vstdlib', 'mathlib'] - if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']: + if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo']: libs.append('interfaces') for lib in libs: lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib' diff --git a/core/AMBuilder b/core/AMBuilder index 7b25a9ce..e365744e 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -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) diff --git a/core/CellRecipientFilter.h b/core/CellRecipientFilter.h index a047a198..082d6cdb 100644 --- a/core/CellRecipientFilter.h +++ b/core/CellRecipientFilter.h @@ -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(m_Players[slot]); } -#if SOURCE_ENGINE == SE_DOTA - return CEntityIndex(ret); -#else return ret; -#endif } inline void CellRecipientFilter::SetToInit(bool isinitmsg) diff --git a/core/ChatTriggers.cpp b/core/ChatTriggers.cpp index 67ddcc98..4f50ade4 100644 --- a/core/ChatTriggers.cpp +++ b/core/ChatTriggers.cpp @@ -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); } diff --git a/core/ConsoleDetours.cpp b/core/ConsoleDetours.cpp index ff311327..4bed29d4 100644 --- a/core/ConsoleDetours.cpp +++ b/core/ConsoleDetours.cpp @@ -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() diff --git a/core/CoreConfig.cpp b/core/CoreConfig.cpp index dd97425b..bcc3b979 100644 --- a/core/CoreConfig.cpp +++ b/core/CoreConfig.cpp @@ -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() diff --git a/core/EventManager.cpp b/core/EventManager.cpp index d6d4eec6..bba9caf0 100644 --- a/core/EventManager.cpp +++ b/core/EventManager.cpp @@ -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; diff --git a/core/EventManager.h b/core/EventManager.h index 12d2e7d4..005b938f 100644 --- a/core/EventManager.h +++ b/core/EventManager.h @@ -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: diff --git a/core/GameHooks.cpp b/core/GameHooks.cpp index c462adce..5606932e 100644 --- a/core/GameHooks.cpp +++ b/core/GameHooks.cpp @@ -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)) diff --git a/core/GameHooks.h b/core/GameHooks.h index 58a92d15..38493cc5 100644 --- a/core/GameHooks.h +++ b/core/GameHooks.h @@ -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 diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 5ac08349..b0c5de53 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -43,9 +43,7 @@ #include #include -#if SOURCE_ENGINE == SE_DOTA -#include -#elif SOURCE_ENGINE == SE_CSGO +#if SOURCE_ENGINE == SE_CSGO #include #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(); diff --git a/core/HalfLife2.h b/core/HalfLife2.h index 79b8d563..63952827 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -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 diff --git a/core/MenuStyle_Radio.cpp b/core/MenuStyle_Radio.cpp index 4a40e607..c02bd879 100644 --- a/core/MenuStyle_Radio.cpp +++ b/core/MenuStyle_Radio.cpp @@ -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() diff --git a/core/MenuStyle_Valve.cpp b/core/MenuStyle_Valve.cpp index 5c4f9af8..89272098 100644 --- a/core/MenuStyle_Valve.cpp +++ b/core/MenuStyle_Valve.cpp @@ -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, diff --git a/core/NextMap.cpp b/core/NextMap.cpp index f5995da3..b9d1f749 100644 --- a/core/NextMap.cpp +++ b/core/NextMap.cpp @@ -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(); } -#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 diff --git a/core/NextMap.h b/core/NextMap.h index c98cd3d4..4a71bb00 100644 --- a/core/NextMap.h +++ b/core/NextMap.h @@ -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(); diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 27301fbe..26f09b09 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -65,13 +65,6 @@ List 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(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 } diff --git a/core/PlayerManager.h b/core/PlayerManager.h index 068d69f9..dc779cab 100644 --- a/core/PlayerManager.h +++ b/core/PlayerManager.h @@ -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 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(); diff --git a/core/UserMessages.cpp b/core/UserMessages.cpp index 7aadd9e9..a8b08631 100644 --- a/core/UserMessages.cpp +++ b/core/UserMessages.cpp @@ -33,16 +33,14 @@ #include "sm_stringutil.h" #include "logic_bridge.h" -#if SOURCE_ENGINE == SE_DOTA -#include -#elif SOURCE_ENGINE == SE_CSGO +#if SOURCE_ENGINE == SE_CSGO #include #endif #include 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(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(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(*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 } diff --git a/core/UserMessages.h b/core/UserMessages.h index c9f7fc24..4e68fe8e 100644 --- a/core/UserMessages.h +++ b/core/UserMessages.h @@ -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 diff --git a/core/convar_sm_dota.h b/core/convar_sm_dota.h deleted file mode 100644 index 4e3fd609..00000000 --- a/core/convar_sm_dota.h +++ /dev/null @@ -1,1061 +0,0 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// -// -// Purpose: -// -// $Workfile: $ -// $Date: $ -// -//----------------------------------------------------------------------------- -// $NoKeywords: $ -//===========================================================================// - -#ifndef CONVAR_H -#define CONVAR_H - -#if _WIN32 -#pragma once -#endif - -#include "tier0/dbg.h" -#include "tier1/iconvar.h" -#include "tier1/utlvector.h" -#include "tier1/utlstring.h" -#include "Color.h" -#include "icvar.h" - -#ifdef _WIN32 -#define FORCEINLINE_CVAR FORCEINLINE -#elif POSIX -#define FORCEINLINE_CVAR inline -#else -#error "implement me" -#endif - - -//----------------------------------------------------------------------------- -// Uncomment me to test for threading issues for material system convars -// NOTE: You want to disable all threading when you do this -// +host_thread_mode 0 +r_threaded_particles 0 +sv_parallel_packentities 0 +sv_disable_querycache 0 -//----------------------------------------------------------------------------- -//#define CONVAR_TEST_MATERIAL_THREAD_CONVARS 1 - - -//----------------------------------------------------------------------------- -// Forward declarations -//----------------------------------------------------------------------------- -class ConVar; -class CCommand; -class ConCommand; -class ConCommandBase; -struct characterset_t; - -struct CCommandContext -{ - CCommandContext( int index ) - { - _index = index; - } - - int Get() const - { - return _index; - } - -private: - int _index; -}; - - - -//----------------------------------------------------------------------------- -// Any executable that wants to use ConVars need to implement one of -// these to hook up access to console variables. -//----------------------------------------------------------------------------- -class IConCommandBaseAccessor -{ -public: - // Flags is a combination of FCVAR flags in cvar.h. - // hOut is filled in with a handle to the variable. - virtual bool RegisterConCommandBase( ConCommandBase *pVar ) = 0; -}; - - -//----------------------------------------------------------------------------- -// Helper method for console development -//----------------------------------------------------------------------------- -#if defined( _X360 ) -void ConVar_PublishToVXConsole(); -#endif - - -//----------------------------------------------------------------------------- -// Called when a ConCommand needs to execute -//----------------------------------------------------------------------------- -typedef void ( *FnCommandCallbackV1_t )( void ); -typedef void ( *FnCommandCallback_t )( const CCommandContext &context, const CCommand &command ); - -#define COMMAND_COMPLETION_MAXITEMS 64 -#define COMMAND_COMPLETION_ITEM_LENGTH 64 - -//----------------------------------------------------------------------------- -// Returns 0 to COMMAND_COMPLETION_MAXITEMS worth of completion strings -//----------------------------------------------------------------------------- -typedef int ( *FnCommandCompletionCallback )( const char *partial, char commands[ COMMAND_COMPLETION_MAXITEMS ][ COMMAND_COMPLETION_ITEM_LENGTH ] ); - - -//----------------------------------------------------------------------------- -// Interface version -//----------------------------------------------------------------------------- -class ICommandCallback -{ -public: - virtual void CommandCallback( const CCommand &command ) = 0; -}; - -class ICommandCallback2 -{ -public: - virtual void CommandCallback( const CCommandContext &context, const CCommand &command ) = 0; -}; - -class ICommandCompletionCallback -{ -public: - virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands ) = 0; -}; - -//----------------------------------------------------------------------------- -// Purpose: The base console invoked command/cvar interface -//----------------------------------------------------------------------------- -class ConCommandBase -{ - friend class CCvar; - friend class ConVar; - friend class ConCommand; - friend void ConVar_Register( int nCVarFlag, IConCommandBaseAccessor *pAccessor ); - friend void ConVar_PublishToVXConsole(); - - // FIXME: Remove when ConVar changes are done - friend class CDefaultCvar; - -public: - ConCommandBase( void ); - ConCommandBase( const char *pName, const char *pHelpString = 0, - int flags = 0 ); - - virtual ~ConCommandBase( void ); - - virtual bool IsCommand( void ) const; - - // Check flag - virtual bool IsFlagSet( int flag ) const; - // Set flag - virtual void AddFlags( int flags ); - // Clear flag - virtual void RemoveFlags( int flags ); - - virtual int GetFlags() const; - - // Return name of cvar - virtual const char *GetName( void ) const; - - // Return help text for cvar - virtual const char *GetHelpText( void ) const; - - // Deal with next pointer - const ConCommandBase *GetNext( void ) const; - ConCommandBase *GetNext( void ); - - virtual bool IsRegistered( void ) const; - - // Returns the DLL identifier - virtual CVarDLLIdentifier_t GetDLLIdentifier() const; - -protected: - virtual void Create( const char *pName, const char *pHelpString = 0, - int flags = 0 ); - - // Used internally by OneTimeInit to initialize/shutdown - virtual void Init(); - void Shutdown(); - - // Internal copy routine ( uses new operator from correct module ) - char *CopyString( const char *from ); - -private: - // Next ConVar in chain - // Prior to register, it points to the next convar in the DLL. - // Once registered, though, m_pNext is reset to point to the next - // convar in the global list - ConCommandBase *m_pNext; - - // Has the cvar been added to the global list? - bool m_bRegistered; - - // Static data - const char *m_pszName; - const char *m_pszHelpString; - - // ConVar flags - int m_nFlags; - -protected: - // ConVars add themselves to this list for the executable. - // Then ConVar_Register runs through all the console variables - // and registers them into a global list stored in vstdlib.dll - static ConCommandBase *s_pConCommandBases; - - // ConVars in this executable use this 'global' to access values. - static IConCommandBaseAccessor *s_pAccessor; -public: - inline void SetFlags(int flags) - { - m_nFlags = flags; - } -}; - - -//----------------------------------------------------------------------------- -// Command tokenizer -//----------------------------------------------------------------------------- -class CCommand -{ -public: - CCommand(); - CCommand( int nArgC, const char **ppArgV ); - bool Tokenize( const char *pCommand, characterset_t *pBreakSet = NULL ); - void Reset(); - - int ArgC() const; - const char **ArgV() const; - const char *ArgS() const; // All args that occur after the 0th arg, in string form - const char *GetCommandString() const; // The entire command in string form, including the 0th arg - const char *operator[]( int nIndex ) const; // Gets at arguments - const char *Arg( int nIndex ) const; // Gets at arguments - - // Helper functions to parse arguments to commands. - const char* FindArg( const char *pName ) const; - int FindArgInt( const char *pName, int nDefaultVal ) const; - - static int MaxCommandLength(); - static characterset_t* DefaultBreakSet(); - -private: - enum - { - COMMAND_MAX_ARGC = 64, - COMMAND_MAX_LENGTH = 512, - }; - - int m_nArgc; - int m_nArgv0Size; - char m_pArgSBuffer[ COMMAND_MAX_LENGTH ]; - char m_pArgvBuffer[ COMMAND_MAX_LENGTH ]; - const char* m_ppArgv[ COMMAND_MAX_ARGC ]; -}; - -inline int CCommand::MaxCommandLength() -{ - return COMMAND_MAX_LENGTH - 1; -} - -inline int CCommand::ArgC() const -{ - return m_nArgc; -} - -inline const char **CCommand::ArgV() const -{ - return m_nArgc ? (const char**)m_ppArgv : NULL; -} - -inline const char *CCommand::ArgS() const -{ - return m_nArgv0Size ? &m_pArgSBuffer[m_nArgv0Size] : ""; -} - -inline const char *CCommand::GetCommandString() const -{ - return m_nArgc ? m_pArgSBuffer : ""; -} - -inline const char *CCommand::Arg( int nIndex ) const -{ - // FIXME: Many command handlers appear to not be particularly careful - // about checking for valid argc range. For now, we're going to - // do the extra check and return an empty string if it's out of range - if ( nIndex < 0 || nIndex >= m_nArgc ) - return ""; - return m_ppArgv[nIndex]; -} - -inline const char *CCommand::operator[]( int nIndex ) const -{ - return Arg( nIndex ); -} - - -//----------------------------------------------------------------------------- -// Purpose: The console invoked command -//----------------------------------------------------------------------------- -class ConCommand : public ConCommandBase -{ -friend class CCvar; - -public: - typedef ConCommandBase BaseClass; - - ConCommand( const char *pName, FnCommandCallbackV1_t callback, - const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); - ConCommand( const char *pName, FnCommandCallback_t callback, - const char *pHelpString = 0, int flags = 0, FnCommandCompletionCallback completionFunc = 0 ); - ConCommand( const char *pName, ICommandCallback *pCallback, - const char *pHelpString = 0, int flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 ); - ConCommand( const char *pName, ICommandCallback2 *pCallback, - const char *pHelpString = 0, int flags = 0, ICommandCompletionCallback *pCommandCompletionCallback = 0 ); - - virtual ~ConCommand( void ); - - virtual bool IsCommand( void ) const; - - virtual int AutoCompleteSuggest( const char *partial, CUtlVector< CUtlString > &commands ); - - virtual bool CanAutoComplete( void ); - - // Invoke the function - virtual void Dispatch( const CCommandContext &context, const CCommand &command ); - -private: - // NOTE: To maintain backward compat, we have to be very careful: - // All public virtual methods must appear in the same order always - // since engine code will be calling into this code, which *does not match* - // in the mod code; it's using slightly different, but compatible versions - // of this class. Also: Be very careful about adding new fields to this class. - // Those fields will not exist in the version of this class that is instanced - // in mod code. - - // Call this function when executing the command - union - { - FnCommandCallbackV1_t m_fnCommandCallbackV1; - FnCommandCallback_t m_fnCommandCallback; - ICommandCallback *m_pCommandCallback; - ICommandCallback2 *m_pCommandCallback2; - }; - - union - { - FnCommandCompletionCallback m_fnCompletionCallback; - ICommandCompletionCallback *m_pCommandCompletionCallback; - }; - - bool m_bHasCompletionCallback : 1; - bool m_bUsingNewCommandCallback : 1; - bool m_bUsingCommandCallbackInterface : 1; - bool m_bUsingCommandCallbackInterface2 : 1; -public: - inline FnCommandCallback_t GetCallback() const - { - return m_fnCommandCallback; - } -}; - - -//----------------------------------------------------------------------------- -// Purpose: A console variable -//----------------------------------------------------------------------------- -class ConVar : public ConCommandBase, public IConVar -{ -friend class CCvar; -friend class ConVarRef; -friend class SplitScreenConVarRef; - -public: - typedef ConCommandBase BaseClass; - - ConVar( const char *pName, const char *pDefaultValue, int flags = 0); - - ConVar( const char *pName, const char *pDefaultValue, int flags, - const char *pHelpString ); - ConVar( const char *pName, const char *pDefaultValue, int flags, - const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax ); - ConVar( const char *pName, const char *pDefaultValue, int flags, - const char *pHelpString, FnChangeCallback_t callback ); - ConVar( const char *pName, const char *pDefaultValue, int flags, - const char *pHelpString, bool bMin, float fMin, bool bMax, float fMax, - FnChangeCallback_t callback ); - - virtual ~ConVar( void ); - - virtual bool IsFlagSet( int flag ) const; - virtual const char* GetHelpText( void ) const; - virtual bool IsRegistered( void ) const; - virtual const char *GetName( void ) const; - // Return name of command (usually == GetName(), except in case of FCVAR_SS_ADDED vars - virtual const char *GetBaseName( void ) const; - virtual int GetSplitScreenPlayerSlot() const; - - virtual void AddFlags( int flags ); - virtual int GetFlags() const; - virtual bool IsCommand( void ) const; - - // Install a change callback (there shouldn't already be one....) - void InstallChangeCallback( FnChangeCallback_t callback, bool bInvoke = true ); - void RemoveChangeCallback( FnChangeCallback_t callbackToRemove ); - - int GetChangeCallbackCount() const { return m_pParent->m_fnChangeCallbacks.Count(); } - FnChangeCallback_t GetChangeCallback( int slot ) const { return m_pParent->m_fnChangeCallbacks[ slot ]; } - - // Retrieve value - FORCEINLINE_CVAR float GetFloat( void ) const; - FORCEINLINE_CVAR int GetInt( void ) const; - FORCEINLINE_CVAR Color GetColor( void ) const; - FORCEINLINE_CVAR bool GetBool() const { return !!GetInt(); } - FORCEINLINE_CVAR char const *GetString( void ) const; - - // Compiler driven selection for template use - template T Get( void ) const; - template T Get( T * ) const; - - // Any function that allocates/frees memory needs to be virtual or else you'll have crashes - // from alloc/free across dll/exe boundaries. - - // These just call into the IConCommandBaseAccessor to check flags and set the var (which ends up calling InternalSetValue). - virtual void SetValue( const char *value ); - virtual void SetValue( float value ); - virtual void SetValue( int value ); - virtual void SetValue( Color value ); - - // Reset to default value - void Revert( void ); - - // True if it has a min/max setting - bool HasMin() const; - bool HasMax() const; - - bool GetMin( float& minVal ) const; - bool GetMax( float& maxVal ) const; - - float GetMinValue() const; - float GetMaxValue() const; - - const char *GetDefault( void ) const; - - // Value - struct CVValue_t - { - char *m_pszString; - int m_StringLength; - - // Values - float m_fValue; - int m_nValue; - }; - - FORCEINLINE_CVAR CVValue_t &GetRawValue() - { - return m_Value; - } - FORCEINLINE_CVAR const CVValue_t &GetRawValue() const - { - return m_Value; - } - -private: - bool InternalSetColorFromString( const char *value ); - // Called by CCvar when the value of a var is changing. - virtual void InternalSetValue(const char *value); - // For CVARs marked FCVAR_NEVER_AS_STRING - virtual void InternalSetFloatValue( float fNewValue ); - virtual void InternalSetIntValue( int nValue ); - virtual void InternalSetColorValue( Color value ); - - virtual bool ClampValue( float& value ); - virtual void ChangeStringValue( const char *tempVal, float flOldValue ); - - virtual void Create( const char *pName, const char *pDefaultValue, int flags = 0, - const char *pHelpString = 0, bool bMin = false, float fMin = 0.0, - bool bMax = false, float fMax = false, FnChangeCallback_t callback = 0 ); - - // Used internally by OneTimeInit to initialize. - virtual void Init(); - - - -protected: - - // This either points to "this" or it points to the original declaration of a ConVar. - // This allows ConVars to exist in separate modules, and they all use the first one to be declared. - // m_pParent->m_pParent must equal m_pParent (ie: m_pParent must be the root, or original, ConVar). - ConVar *m_pParent; - - // Static data - const char *m_pszDefaultValue; - - CVValue_t m_Value; - - // Min/Max values - bool m_bHasMin; - float m_fMinVal; - bool m_bHasMax; - float m_fMaxVal; - - // Call this function when ConVar changes - CUtlVector< FnChangeCallback_t > m_fnChangeCallbacks; -public: - inline void SetMin(bool set, float min=0.0) - { - m_bHasMin = set; - m_fMinVal = min; - } - inline void SetMax(bool set, float max=0.0) - { - m_bHasMax = set; - m_fMaxVal = max; - } -}; - - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a float -// Output : float -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR float ConVar::GetFloat( void ) const -{ -#ifdef CONVAR_TEST_MATERIAL_THREAD_CONVARS - Assert( ThreadInMainThread() || IsFlagSet( FCVAR_MATERIAL_THREAD_MASK | FCVAR_ACCESSIBLE_FROM_THREADS ) ); -#endif - return m_pParent->m_Value.m_fValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as an int -// Output : int -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR int ConVar::GetInt( void ) const -{ -#ifdef CONVAR_TEST_MATERIAL_THREAD_CONVARS - Assert( ThreadInMainThread() || IsFlagSet( FCVAR_MATERIAL_THREAD_MASK | FCVAR_ACCESSIBLE_FROM_THREADS ) ); -#endif - return m_pParent->m_Value.m_nValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a color -// Output : Color -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR Color ConVar::GetColor( void ) const -{ -#ifdef CONVAR_TEST_MATERIAL_THREAD_CONVARS - Assert( ThreadInMainThread() || IsFlagSet( FCVAR_MATERIAL_THREAD_MASK | FCVAR_ACCESSIBLE_FROM_THREADS ) ); -#endif - unsigned char *pColorElement = ((unsigned char *)&m_pParent->m_Value.m_nValue); - return Color( pColorElement[0], pColorElement[1], pColorElement[2], pColorElement[3] ); -} - - -//----------------------------------------------------------------------------- - -template <> FORCEINLINE_CVAR float ConVar::Get( void ) const { return GetFloat(); } -template <> FORCEINLINE_CVAR int ConVar::Get( void ) const { return GetInt(); } -template <> FORCEINLINE_CVAR bool ConVar::Get( void ) const { return GetBool(); } -template <> FORCEINLINE_CVAR const char * ConVar::Get( void ) const { return GetString(); } -template <> FORCEINLINE_CVAR float ConVar::Get( float *p ) const { return ( *p = GetFloat() ); } -template <> FORCEINLINE_CVAR int ConVar::Get( int *p ) const { return ( *p = GetInt() ); } -template <> FORCEINLINE_CVAR bool ConVar::Get( bool *p ) const { return ( *p = GetBool() ); } -template <> FORCEINLINE_CVAR const char * ConVar::Get( char const **p ) const { return ( *p = GetString() ); } - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc. -// Output : const char * -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR const char *ConVar::GetString( void ) const -{ -#ifdef CONVAR_TEST_MATERIAL_THREAD_CONVARS - Assert( ThreadInMainThread() || IsFlagSet( FCVAR_MATERIAL_THREAD_MASK | FCVAR_ACCESSIBLE_FROM_THREADS ) ); -#endif - if ( m_nFlags & FCVAR_NEVER_AS_STRING ) - return "FCVAR_NEVER_AS_STRING"; - - char const *str = m_pParent->m_Value.m_pszString; - return str ? str : ""; -} - -class CSplitScreenAddedConVar : public ConVar -{ - typedef ConVar BaseClass; -public: - CSplitScreenAddedConVar( int nSplitScreenSlot, const char *pName, const ConVar *pBaseVar ) : - BaseClass - ( - pName, - pBaseVar->GetDefault(), - // Keep basevar flags, except remove _SS and add _SS_ADDED instead - ( pBaseVar->GetFlags() & ~FCVAR_SS ) | FCVAR_SS_ADDED, - pBaseVar->GetHelpText(), - pBaseVar->HasMin(), - pBaseVar->GetMinValue(), - pBaseVar->HasMax(), - pBaseVar->GetMaxValue() - ), - m_pBaseVar( pBaseVar ), - m_nSplitScreenSlot( nSplitScreenSlot ) - { - for ( int i = 0; i < pBaseVar->GetChangeCallbackCount(); ++i ) - { - InstallChangeCallback( pBaseVar->GetChangeCallback( i ), false ); - } - Assert( nSplitScreenSlot >= 1 ); - Assert( nSplitScreenSlot < MAX_SPLITSCREEN_CLIENTS ); - Assert( m_pBaseVar ); - Assert( IsFlagSet( FCVAR_SS_ADDED ) ); - Assert( !IsFlagSet( FCVAR_SS ) ); - } - - const ConVar *GetBaseVar() const; - virtual const char *GetBaseName() const; - void SetSplitScreenPlayerSlot( int nSlot ); - virtual int GetSplitScreenPlayerSlot() const; - -protected: - - const ConVar *m_pBaseVar; - int m_nSplitScreenSlot; -}; - -FORCEINLINE_CVAR const ConVar *CSplitScreenAddedConVar::GetBaseVar() const -{ - Assert( m_pBaseVar ); - return m_pBaseVar; -} - -FORCEINLINE_CVAR const char *CSplitScreenAddedConVar::GetBaseName() const -{ - Assert( m_pBaseVar ); - return m_pBaseVar->GetName(); -} - -FORCEINLINE_CVAR void CSplitScreenAddedConVar::SetSplitScreenPlayerSlot( int nSlot ) -{ - m_nSplitScreenSlot = nSlot; -} - -FORCEINLINE_CVAR int CSplitScreenAddedConVar::GetSplitScreenPlayerSlot() const -{ - return m_nSplitScreenSlot; -} - -//----------------------------------------------------------------------------- -// Used to read/write convars that already exist (replaces the FindVar method) -//----------------------------------------------------------------------------- -class ConVarRef -{ -public: - ConVarRef( const char *pName ); - ConVarRef( const char *pName, bool bIgnoreMissing ); - ConVarRef( IConVar *pConVar ); - - void Init( const char *pName, bool bIgnoreMissing ); - bool IsValid() const; - bool IsFlagSet( int nFlags ) const; - IConVar *GetLinkedConVar(); - - // Get/Set value - float GetFloat( void ) const; - int GetInt( void ) const; - Color GetColor( void ) const; - bool GetBool() const { return !!GetInt(); } - const char *GetString( void ) const; - - void SetValue( const char *pValue ); - void SetValue( float flValue ); - void SetValue( int nValue ); - void SetValue( Color value ); - void SetValue( bool bValue ); - - const char *GetName() const; - - const char *GetDefault() const; - - const char *GetBaseName() const; - - int GetSplitScreenPlayerSlot() const; - -private: - // High-speed method to read convar data - IConVar *m_pConVar; - ConVar *m_pConVarState; -}; - - -//----------------------------------------------------------------------------- -// Did we find an existing convar of that name? -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR bool ConVarRef::IsFlagSet( int nFlags ) const -{ - return ( m_pConVar->IsFlagSet( nFlags ) != 0 ); -} - -FORCEINLINE_CVAR IConVar *ConVarRef::GetLinkedConVar() -{ - return m_pConVar; -} - -FORCEINLINE_CVAR const char *ConVarRef::GetName() const -{ - return m_pConVar->GetName(); -} - -FORCEINLINE_CVAR const char *ConVarRef::GetBaseName() const -{ - return m_pConVar->GetBaseName(); -} - -FORCEINLINE_CVAR int ConVarRef::GetSplitScreenPlayerSlot() const -{ - return m_pConVar->GetSplitScreenPlayerSlot(); -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a float -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR float ConVarRef::GetFloat( void ) const -{ - return m_pConVarState->m_Value.m_fValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as an int -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR int ConVarRef::GetInt( void ) const -{ - return m_pConVarState->m_Value.m_nValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a color -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR Color ConVarRef::GetColor( void ) const -{ - return m_pConVarState->GetColor(); -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc. -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR const char *ConVarRef::GetString( void ) const -{ - Assert( !IsFlagSet( FCVAR_NEVER_AS_STRING ) ); - return m_pConVarState->m_Value.m_pszString; -} - - -FORCEINLINE_CVAR void ConVarRef::SetValue( const char *pValue ) -{ - m_pConVar->SetValue( pValue ); -} - -FORCEINLINE_CVAR void ConVarRef::SetValue( float flValue ) -{ - m_pConVar->SetValue( flValue ); -} - -FORCEINLINE_CVAR void ConVarRef::SetValue( int nValue ) -{ - m_pConVar->SetValue( nValue ); -} - -FORCEINLINE_CVAR void ConVarRef::SetValue( Color value ) -{ - m_pConVar->SetValue( value ); -} - -FORCEINLINE_CVAR void ConVarRef::SetValue( bool bValue ) -{ - m_pConVar->SetValue( bValue ? 1 : 0 ); -} - -FORCEINLINE_CVAR const char *ConVarRef::GetDefault() const -{ - return m_pConVarState->m_pszDefaultValue; -} - -//----------------------------------------------------------------------------- -// Helper for referencing splitscreen convars (i.e., "name" and "name2") -//----------------------------------------------------------------------------- -class SplitScreenConVarRef -{ -public: - SplitScreenConVarRef( const char *pName ); - SplitScreenConVarRef( const char *pName, bool bIgnoreMissing ); - SplitScreenConVarRef( IConVar *pConVar ); - - void Init( const char *pName, bool bIgnoreMissing ); - bool IsValid() const; - bool IsFlagSet( int nFlags ) const; - - // Get/Set value - float GetFloat( int nSlot ) const; - int GetInt( int nSlot ) const; - Color GetColor( int nSlot ) const; - bool GetBool( int nSlot ) const { return !!GetInt( nSlot ); } - const char *GetString( int nSlot ) const; - - void SetValue( int nSlot, const char *pValue ); - void SetValue( int nSlot, float flValue ); - void SetValue( int nSlot, int nValue ); - void SetValue( int nSlot, Color value ); - void SetValue( int nSlot, bool bValue ); - - const char *GetName( int nSlot ) const; - - const char *GetDefault() const; - - const char *GetBaseName() const; - -private: - struct cv_t - { - IConVar *m_pConVar; - ConVar *m_pConVarState; - }; - - cv_t m_Info[ MAX_SPLITSCREEN_CLIENTS ]; -}; - -//----------------------------------------------------------------------------- -// Did we find an existing convar of that name? -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR bool SplitScreenConVarRef::IsFlagSet( int nFlags ) const -{ - return ( m_Info[ 0 ].m_pConVar->IsFlagSet( nFlags ) != 0 ); -} - -FORCEINLINE_CVAR const char *SplitScreenConVarRef::GetName( int nSlot ) const -{ - return m_Info[ nSlot ].m_pConVar->GetName(); -} - -FORCEINLINE_CVAR const char *SplitScreenConVarRef::GetBaseName() const -{ - return m_Info[ 0 ].m_pConVar->GetBaseName(); -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a float -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR float SplitScreenConVarRef::GetFloat( int nSlot ) const -{ - return m_Info[ nSlot ].m_pConVarState->m_Value.m_fValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as an int -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR int SplitScreenConVarRef::GetInt( int nSlot ) const -{ - return m_Info[ nSlot ].m_pConVarState->m_Value.m_nValue; -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as an int -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR Color SplitScreenConVarRef::GetColor( int nSlot ) const -{ - return m_Info[ nSlot ].m_pConVarState->GetColor(); -} - -//----------------------------------------------------------------------------- -// Purpose: Return ConVar value as a string, return "" for bogus string pointer, etc. -//----------------------------------------------------------------------------- -FORCEINLINE_CVAR const char *SplitScreenConVarRef::GetString( int nSlot ) const -{ - Assert( !IsFlagSet( FCVAR_NEVER_AS_STRING ) ); - return m_Info[ nSlot ].m_pConVarState->m_Value.m_pszString; -} - - -FORCEINLINE_CVAR void SplitScreenConVarRef::SetValue( int nSlot, const char *pValue ) -{ - m_Info[ nSlot ].m_pConVar->SetValue( pValue ); -} - -FORCEINLINE_CVAR void SplitScreenConVarRef::SetValue( int nSlot, float flValue ) -{ - m_Info[ nSlot ].m_pConVar->SetValue( flValue ); -} - -FORCEINLINE_CVAR void SplitScreenConVarRef::SetValue( int nSlot, int nValue ) -{ - m_Info[ nSlot ].m_pConVar->SetValue( nValue ); -} - -FORCEINLINE_CVAR void SplitScreenConVarRef::SetValue( int nSlot, Color value ) -{ - m_Info[ nSlot ].m_pConVar->SetValue( value ); -} - -FORCEINLINE_CVAR void SplitScreenConVarRef::SetValue( int nSlot, bool bValue ) -{ - m_Info[ nSlot ].m_pConVar->SetValue( bValue ? 1 : 0 ); -} - -FORCEINLINE_CVAR const char *SplitScreenConVarRef::GetDefault() const -{ - return m_Info[ 0 ].m_pConVarState->m_pszDefaultValue; -} - -//----------------------------------------------------------------------------- -// Called by the framework to register ConCommands with the ICVar -//----------------------------------------------------------------------------- -void ConVar_Register( int nCVarFlag = 0, IConCommandBaseAccessor *pAccessor = NULL ); -void ConVar_Unregister( ); - - -//----------------------------------------------------------------------------- -// Utility methods -//----------------------------------------------------------------------------- -void ConVar_PrintDescription( const ConCommandBase *pVar ); - - -//----------------------------------------------------------------------------- -// Purpose: Utility class to quickly allow ConCommands to call member methods -//----------------------------------------------------------------------------- -#ifdef _MSC_VER -#pragma warning (disable : 4355 ) -#endif - -template< class T > -class CConCommandMemberAccessor : public ConCommand, public ICommandCallback, public ICommandCompletionCallback -{ - typedef ConCommand BaseClass; - typedef void ( T::*FnMemberCommandCallback_t )( const CCommand &command ); - typedef int ( T::*FnMemberCommandCompletionCallback_t )( const char *pPartial, CUtlVector< CUtlString > &commands ); - -public: - CConCommandMemberAccessor( T* pOwner, const char *pName, FnMemberCommandCallback_t callback, const char *pHelpString = 0, - int flags = 0, FnMemberCommandCompletionCallback_t completionFunc = 0 ) : - BaseClass( pName, this, pHelpString, flags, ( completionFunc != 0 ) ? this : NULL ) - { - m_pOwner = pOwner; - m_Func = callback; - m_CompletionFunc = completionFunc; - } - - ~CConCommandMemberAccessor() - { - Shutdown(); - } - - void SetOwner( T* pOwner ) - { - m_pOwner = pOwner; - } - - virtual void CommandCallback( const CCommand &command ) - { - Assert( m_pOwner && m_Func ); - (m_pOwner->*m_Func)( command ); - } - - virtual int CommandCompletionCallback( const char *pPartial, CUtlVector< CUtlString > &commands ) - { - Assert( m_pOwner && m_CompletionFunc ); - return (m_pOwner->*m_CompletionFunc)( pPartial, commands ); - } - -private: - T* m_pOwner; - FnMemberCommandCallback_t m_Func; - FnMemberCommandCompletionCallback_t m_CompletionFunc; -}; - -#ifdef _MSC_VER -#pragma warning ( default : 4355 ) -#endif - -//----------------------------------------------------------------------------- -// Purpose: Utility macros to quicky generate a simple console command -//----------------------------------------------------------------------------- -#define CON_COMMAND( name, description ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description ); \ - static void name( const CCommandContext &context, const CCommand &args ) - -#ifdef CLIENT_DLL - #define CON_COMMAND_SHARED( name, description ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command_client( #name "_client", name, description ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#else - #define CON_COMMAND_SHARED( name, description ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#endif - - -#define CON_COMMAND_F( name, description, flags ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description, flags ); \ - static void name( const CCommandContext &context, const CCommand &args ) - -#ifdef CLIENT_DLL - #define CON_COMMAND_F_SHARED( name, description, flags ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command_client( #name "_client", name, description, flags ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#else - #define CON_COMMAND_F_SHARED( name, description, flags ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description, flags ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#endif - - -#define CON_COMMAND_F_COMPLETION( name, description, flags, completion ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description, flags, completion ); \ - static void name( const CCommandContext &context, const CCommand &args ) - -#ifdef CLIENT_DLL - #define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command_client( #name "_client", name, description, flags, completion ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#else - #define CON_COMMAND_F_COMPLETION_SHARED( name, description, flags, completion ) \ - static void name( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, name, description, flags, completion ); \ - static void name( const CCommandContext &context, const CCommand &args ) -#endif - - -#define CON_COMMAND_EXTERN( name, _funcname, description ) \ - void _funcname( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, _funcname, description ); \ - void _funcname( const CCommandContext &context, const CCommand &args ) - -#define CON_COMMAND_EXTERN_F( name, _funcname, description, flags ) \ - void _funcname( const CCommandContext &context, const CCommand &args ); \ - static ConCommand name##_command( #name, _funcname, description, flags ); \ - void _funcname( const CCommandContext &context, const CCommand &args ) - -#define CON_COMMAND_MEMBER_F( _thisclass, name, _funcname, description, flags ) \ - void _funcname( const CCommandContext &context, const CCommand &args ); \ - friend class CCommandMemberInitializer_##_funcname; \ - class CCommandMemberInitializer_##_funcname \ - { \ - public: \ - CCommandMemberInitializer_##_funcname() : m_ConCommandAccessor( NULL, name, &_thisclass::_funcname, description, flags ) \ - { \ - m_ConCommandAccessor.SetOwner( GET_OUTER( _thisclass, m_##_funcname##_register ) ); \ - } \ - private: \ - CConCommandMemberAccessor< _thisclass > m_ConCommandAccessor; \ - }; \ - \ - CCommandMemberInitializer_##_funcname m_##_funcname##_register; \ - - -#endif // CONVAR_H diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index 310bd11b..1666c91b 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -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; } diff --git a/core/smn_console.cpp b/core/smn_console.cpp index a156524c..0c5858a0 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -51,7 +51,7 @@ #include #include -#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA +#if SOURCE_ENGINE == SE_CSGO #include #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); diff --git a/core/smn_entities.cpp b/core/smn_entities.cpp index 3ef07b02..2302f5fa 100644 --- a/core/smn_entities.cpp +++ b/core/smn_entities.cpp @@ -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, diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index 6483a10e..b8c1898f 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -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(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 } diff --git a/core/smn_hudtext.cpp b/core/smn_hudtext.cpp index 1a1a2987..0f2d01ad 100644 --- a/core/smn_hudtext.cpp +++ b/core/smn_hudtext.cpp @@ -37,9 +37,7 @@ #include "logic_bridge.h" #include "sourcemod.h" -#if SOURCE_ENGINE == SE_DOTA -#include -#elif SOURCE_ENGINE == SE_CSGO +#if SOURCE_ENGINE == SE_CSGO #include #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); diff --git a/core/smn_usermsgs.cpp b/core/smn_usermsgs.cpp index f91f0d5f..72c5f055 100644 --- a/core/smn_usermsgs.cpp +++ b/core/smn_usermsgs.cpp @@ -269,13 +269,7 @@ size_t MsgListenerWrapper::_FillInPlayers(int *pl_array, IRecipientFilter *pFilt for (size_t i=0; iGetRecipientIndex(i).Get(); -#else - index = pFilter->GetRecipientIndex(i); -#endif - pl_array[i] = index; + pl_array[i] = pFilter->GetRecipientIndex(i); } return size; diff --git a/core/sourcemm_api.cpp b/core/sourcemm_api.cpp index 69945330..2582fa2d 100644 --- a/core/sourcemm_api.cpp +++ b/core/sourcemm_api.cpp @@ -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); diff --git a/core/sourcemm_api.h b/core/sourcemm_api.h index ab434426..c1f194b8 100644 --- a/core/sourcemm_api.h +++ b/core/sourcemm_api.h @@ -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" diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp index 9a2ee906..c3fbf456 100644 --- a/extensions/sdkhooks/extension.cpp +++ b/extensions/sdkhooks/extension.cpp @@ -179,11 +179,7 @@ SH_DECL_MANUALHOOK0_void(PostThink, 0, 0, 0); SH_DECL_MANUALHOOK0(Reload, 0, 0, 0, bool); SH_DECL_MANUALHOOK2_void(SetTransmit, 0, 0, 0, CCheckTransmitInfo *, bool); SH_DECL_MANUALHOOK2(ShouldCollide, 0, 0, 0, bool, int, int); -#if SOURCE_ENGINE == SE_DOTA -SH_DECL_MANUALHOOK1_void(Spawn, 0, 0, 0, CEntityKeyValues *); -#else SH_DECL_MANUALHOOK0_void(Spawn, 0, 0, 0); -#endif SH_DECL_MANUALHOOK1_void(StartTouch, 0, 0, 0, CBaseEntity *); SH_DECL_MANUALHOOK0_void(Think, 0, 0, 0); SH_DECL_MANUALHOOK1_void(Touch, 0, 0, 0, CBaseEntity *); @@ -1355,11 +1351,7 @@ bool SDKHooks::Hook_ShouldCollide(int collisionGroup, int contentsMask) RETURN_META_VALUE(MRES_IGNORED, true); } -#if SOURCE_ENGINE == SE_DOTA -void SDKHooks::Hook_Spawn(CEntityKeyValues *kv) -#else void SDKHooks::Hook_Spawn() -#endif { CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity); @@ -1393,11 +1385,7 @@ void SDKHooks::Hook_Spawn() RETURN_META(MRES_IGNORED); } -#if SOURCE_ENGINE == SE_DOTA -void SDKHooks::Hook_SpawnPost(CEntityKeyValues *kv) -#else void SDKHooks::Hook_SpawnPost() -#endif { Call(META_IFACEPTR(CBaseEntity), SDKHook_SpawnPost); } diff --git a/extensions/sdkhooks/extension.h b/extensions/sdkhooks/extension.h index 27916dfb..12507df7 100644 --- a/extensions/sdkhooks/extension.h +++ b/extensions/sdkhooks/extension.h @@ -31,10 +31,6 @@ #define GAMEDESC_CAN_CHANGE #endif -#if SOURCE_ENGINE == SE_DOTA -class CEntityKeyValues; -#endif - /** * Globals @@ -305,13 +301,8 @@ public: bool Hook_ReloadPost(); void Hook_SetTransmit(CCheckTransmitInfo *pInfo, bool bAlways); bool Hook_ShouldCollide(int collisonGroup, int contentsMask); -#if SOURCE_ENGINE == SE_DOTA - void Hook_Spawn(CEntityKeyValues *kv); - void Hook_SpawnPost(CEntityKeyValues *kv); -#else void Hook_Spawn(); void Hook_SpawnPost(); -#endif void Hook_StartTouch(CBaseEntity *pOther); void Hook_StartTouchPost(CBaseEntity *pOther); void Hook_Think(); diff --git a/extensions/sdktools/CellRecipientFilter.h b/extensions/sdktools/CellRecipientFilter.h index b6e87033..213443a5 100644 --- a/extensions/sdktools/CellRecipientFilter.h +++ b/extensions/sdktools/CellRecipientFilter.h @@ -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(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(m_Players[slot]); } -#if SOURCE_ENGINE == SE_DOTA - return CEntityIndex(ret); -#else return ret; -#endif } inline void CellRecipientFilter::SetToInit(bool isinitmsg) diff --git a/extensions/sdktools/extension.cpp b/extensions/sdktools/extension.cpp index c58cb290..7b3b7c0d 100644 --- a/extensions/sdktools/extension.cpp +++ b/extensions/sdktools/extension.cpp @@ -262,9 +262,7 @@ bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool GET_V_IFACE_ANY(GetEngineFactory, engsound, IEngineSound, IENGINESOUND_SERVER_INTERFACE_VERSION); GET_V_IFACE_ANY(GetEngineFactory, enginetrace, IEngineTrace, INTERFACEVERSION_ENGINETRACE_SERVER); GET_V_IFACE_ANY(GetEngineFactory, netstringtables, INetworkStringTableContainer, INTERFACENAME_NETWORKSTRINGTABLESERVER); -#if SOURCE_ENGINE != SE_DOTA GET_V_IFACE_ANY(GetEngineFactory, pluginhelpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS); -#endif GET_V_IFACE_ANY(GetServerFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS); GET_V_IFACE_ANY(GetEngineFactory, voiceserver, IVoiceServer, INTERFACEVERSION_VOICESERVER); GET_V_IFACE_ANY(GetServerFactory, playerinfomngr, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER); diff --git a/extensions/sdktools/extension.h b/extensions/sdktools/extension.h index 5a4a4c15..8aef2c30 100644 --- a/extensions/sdktools/extension.h +++ b/extensions/sdktools/extension.h @@ -95,9 +95,7 @@ public: //IClientListner public: // IVoiceServer bool OnSetClientListening(int iReceiver, int iSender, bool bListen); void VoiceInit(); -#if SOURCE_ENGINE == SE_DOTA - void OnClientCommand(CEntityIndex index, const CCommand &args); -#elif SOURCE_ENGINE >= SE_ORANGEBOX +#if SOURCE_ENGINE >= SE_ORANGEBOX void OnClientCommand(edict_t *pEntity, const CCommand &args); #else void OnClientCommand(edict_t *pEntity); diff --git a/extensions/sdktools/tenatives.cpp b/extensions/sdktools/tenatives.cpp index c245099a..4dc108d1 100644 --- a/extensions/sdktools/tenatives.cpp +++ b/extensions/sdktools/tenatives.cpp @@ -138,13 +138,7 @@ size_t TempEntHooks::_FillInPlayers(int *pl_array, IRecipientFilter *pFilter) for (size_t i=0; iGetRecipientIndex(i).Get(); -#else - index = pFilter->GetRecipientIndex(i); -#endif - pl_array[i] = index; + pl_array[i] = pFilter->GetRecipientIndex(i); } return size; diff --git a/extensions/sdktools/vhelpers.cpp b/extensions/sdktools/vhelpers.cpp index 9cba4386..170c8ed7 100644 --- a/extensions/sdktools/vhelpers.cpp +++ b/extensions/sdktools/vhelpers.cpp @@ -217,11 +217,7 @@ int GetClientAimTarget(edict_t *pEdict, bool only_players) QAngle eye_angles; /* Get the private information we need */ -#if SOURCE_ENGINE == SE_DOTA - serverClients->ClientEarPosition(IndexOfEdict(pEdict), &eye_position); -#else serverClients->ClientEarPosition(pEdict, &eye_position); -#endif if (!GetEyeAngles(pEntity, &eye_angles)) { diff --git a/extensions/sdktools/vnatives.cpp b/extensions/sdktools/vnatives.cpp index cccc47f6..f5022740 100644 --- a/extensions/sdktools/vnatives.cpp +++ b/extensions/sdktools/vnatives.cpp @@ -486,11 +486,7 @@ static cell_t SetClientViewEntity(IPluginContext *pContext, const cell_t *params return pContext->ThrowNativeError("Entity %d is not valid", params[2]); } -#if SOURCE_ENGINE == SE_DOTA - engine->SetView(params[1], params[2]); -#else engine->SetView(player->GetEdict(), pEdict); -#endif return 1; } @@ -683,11 +679,7 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params) /* Force suicide */ if (should_slay) { -#if SOURCE_ENGINE == SE_DOTA - engine->ClientCommand(params[1], "kill\n"); -#else pluginhelpers->ClientCommand(pEdict, "kill\n"); -#endif } if (s_frag_offs > 0) @@ -711,11 +703,7 @@ static cell_t GetClientEyePosition(IPluginContext *pContext, const cell_t *param } Vector pos; -#if SOURCE_ENGINE == SE_DOTA - serverClients->ClientEarPosition(params[1], &pos); -#else serverClients->ClientEarPosition(player->GetEdict(), &pos); -#endif cell_t *addr; pContext->LocalToPhysAddr(params[2], &addr); @@ -1362,11 +1350,7 @@ static cell_t SetClientName(IPluginContext *pContext, const cell_t *params) FINISH_CALL_SIMPLE(NULL); // Notify the server of the change. -#if SOURCE_ENGINE == SE_DOTA - serverClients->ClientSettingsChanged(player->GetIndex()); -#else serverClients->ClientSettingsChanged(player->GetEdict()); -#endif return 1; } diff --git a/extensions/sdktools/voice.cpp b/extensions/sdktools/voice.cpp index f21ea7e0..21a4280a 100644 --- a/extensions/sdktools/voice.cpp +++ b/extensions/sdktools/voice.cpp @@ -58,9 +58,7 @@ bool g_ClientMutes[SM_MAXPLAYERS+1][SM_MAXPLAYERS+1]; SH_DECL_HOOK3(IVoiceServer, SetClientListening, SH_NOATTRIB, 0, bool, int, int, bool); -#if SOURCE_ENGINE == SE_DOTA -SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, CEntityIndex, const CCommand &); -#elif SOURCE_ENGINE >= SE_ORANGEBOX +#if SOURCE_ENGINE >= SE_ORANGEBOX SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &); #else SH_DECL_HOOK1_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *); @@ -93,11 +91,7 @@ void SDKTools::VoiceInit() SH_ADD_HOOK(IServerGameClients, ClientCommand, serverClients, SH_MEMBER(this, &SDKTools::OnClientCommand), true); } -#if SOURCE_ENGINE == SE_DOTA -void SDKTools::OnClientCommand(CEntityIndex index, const CCommand &args) -{ - int client = index.Get(); -#elif SOURCE_ENGINE >= SE_ORANGEBOX +#if SOURCE_ENGINE >= SE_ORANGEBOX void SDKTools::OnClientCommand(edict_t *pEntity, const CCommand &args) { int client = IndexOfEdict(pEntity); diff --git a/extensions/sdktools/vsound.cpp b/extensions/sdktools/vsound.cpp index 0909118f..5777d466 100644 --- a/extensions/sdktools/vsound.cpp +++ b/extensions/sdktools/vsound.cpp @@ -32,11 +32,7 @@ #include "vsound.h" #include -#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); -#endif #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 *, bool, float, int); @@ -74,13 +70,7 @@ size_t SoundHooks::_FillInPlayers(int *pl_array, IRecipientFilter *pFilter) for (size_t i=0; iGetRecipientIndex(i).Get(); -#else - index = pFilter->GetRecipientIndex(i); -#endif - pl_array[i] = index; + pl_array[i] = pFilter->GetRecipientIndex(i); } return size; @@ -227,16 +217,9 @@ bool SoundHooks::RemoveHook(int type, IPluginFunction *pFunc) 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, soundlevel_t soundlevel, int fFlags, int pitch, float delay) { -#endif SoundHookIter iter; IPluginFunction *pFunc; cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; @@ -272,13 +255,8 @@ void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char vec2.x = sp_ctof(vec[0]); vec2.y = sp_ctof(vec[1]); vec2.z = sp_ctof(vec[2]); -#if SOURCE_ENGINE == SE_DOTA - 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)); -#endif } } } @@ -755,11 +733,7 @@ static cell_t FadeClientVolume(IPluginContext *pContext, const cell_t *params) } engine->FadeClientVolume( -#if SOURCE_ENGINE == SE_DOTA - player->GetIndex(), -#else player->GetEdict(), -#endif sp_ctof(params[2]), sp_ctof(params[3]), sp_ctof(params[4]), diff --git a/extensions/sdktools/vsound.h b/extensions/sdktools/vsound.h index 531e1fa5..d5ddc239 100644 --- a/extensions/sdktools/vsound.h +++ b/extensions/sdktools/vsound.h @@ -51,11 +51,7 @@ public: void AddHook(int type, IPluginFunction *pFunc); bool RemoveHook(int type, IPluginFunction *pFunc); -#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); -#endif #if SOURCE_ENGINE >= SE_PORTAL2 int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume, diff --git a/extensions/sdktools/vstringtable.cpp b/extensions/sdktools/vstringtable.cpp index 0a576990..357b8382 100644 --- a/extensions/sdktools/vstringtable.cpp +++ b/extensions/sdktools/vstringtable.cpp @@ -138,11 +138,7 @@ static cell_t ReadStringTable(IPluginContext *pContext, const cell_t *params) } stringidx = params[2]; -#if SOURCE_ENGINE == SE_DOTA - value = pTable->GetString(stringidx, false); -#else value = pTable->GetString(stringidx); -#endif if (!value) { diff --git a/gamedata/core.games/common.games.txt b/gamedata/core.games/common.games.txt index d634fb93..454a3721 100644 --- a/gamedata/core.games/common.games.txt +++ b/gamedata/core.games/common.games.txt @@ -97,7 +97,6 @@ "engine" "blade" "engine" "insurgency" "engine" "csgo" - "engine" "dota" "engine" "sdk2013" "engine" "contagion" "engine" "bms" diff --git a/gamedata/core.games/engine.dota.txt b/gamedata/core.games/engine.dota.txt deleted file mode 100644 index c81a786a..00000000 --- a/gamedata/core.games/engine.dota.txt +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Do not edit this file. Any changes will be overwritten by the gamedata - * updater or by upgrading your SourceMod install. - * - * To override data in this file, create a subdirectory named "custom" and - * place your own gamedata file(s) inside of it. Such files will be parsed - * after SM's own. - * - * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) - */ - -"Games" -{ - /* CGlobalEntityList */ - "#default" - { - "#supported" - { - "game" "dota" - } - - "Addresses" - { - "EntInfosPtr" - { - "windows" - { - "signature" "EntInfosFinder" - "read" "21" - } - } - } - - "Offsets" - { - "gEntList" - { - "linux" "18" - } - - "EntInfo" - { - "linux" "4" - "mac" "4" - } - } - - "Signatures" - { - "EntInfosFinder" - { - "library" "server" - "windows" "\x83\x2A\xFF\x74\x03\x0F\x2A\x2A\xC1\x2A\x04\x8B\x2A\x2A\x2A\x2A\x2A\xEB\x06\x8B" - } - - "LevelShutdown" - { - "library" "server" - "linux" "\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xC7\x2A\x2A\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xE8" - } - - "gEntList" - { - "library" "server" - "mac" "@gEntList" - } - } - } -} diff --git a/gamedata/core.games/master.games.txt b/gamedata/core.games/master.games.txt index 0bb61480..845898c2 100644 --- a/gamedata/core.games/master.games.txt +++ b/gamedata/core.games/master.games.txt @@ -85,11 +85,6 @@ "engine" "csgo" } - "engine.dota.txt" - { - "engine" "dota" - } - "engine.blade.txt" { "engine" "blade" diff --git a/gamedata/sdkhooks.games/engine.dota.txt b/gamedata/sdkhooks.games/engine.dota.txt deleted file mode 100644 index 8cc3dc5a..00000000 --- a/gamedata/sdkhooks.games/engine.dota.txt +++ /dev/null @@ -1,163 +0,0 @@ -"Games" -{ - "#default" - { - "Offsets" - { - "EndTouch" - { - "windows" "107" - "linux" "108" - "mac" "108" - } - "FireBullets" - { - "windows" "120" - "linux" "121" - "mac" "121" - } - "GetMaxHealth" - { - "windows" "124" - "linux" "125" - "mac" "125" - } - "OnTakeDamage" - { - "windows" "73" - "linux" "74" - "mac" "74" - } - "PreThink" - { - "windows" "363" - "linux" "364" - "mac" "364" - } - "PostThink" - { - "windows" "364" - "linux" "365" - "mac" "365" - } - "SetTransmit" - { - "windows" "22" - "linux" "23" - "mac" "23" - } - "ShouldCollide" - { - "windows" "17" - "linux" "18" - "mac" "18" - } - "Spawn" - { - "windows" "27" - "linux" "28" - "mac" "28" - } - "StartTouch" - { - "windows" "105" - "linux" "106" - "mac" "106" - } - "Think" - { - "windows" "54" - "linux" "55" - "mac" "55" - } - "Touch" - { - "windows" "106" - "linux" "107" - "mac" "107" - } - "TraceAttack" - { - "windows" "71" - "linux" "72" - "mac" "72" - } - "Use" - { - "windows" "104" - "linux" "105" - "mac" "105" - } - "VPhysicsUpdate" - { - "windows" "165" - "linux" "166" - "mac" "166" - } - "Weapon_CanSwitchTo" - { - "windows" "296" - "linux" "297" - "mac" "297" - } - "Weapon_CanUse" - { - "windows" "290" - "linux" "291" - "mac" "291" - } - "Weapon_Drop" - { - "windows" "293" - "linux" "294" - "mac" "294" - } - "Weapon_Equip" - { - "windows" "291" - "linux" "292" - "mac" "292" - } - "Weapon_Switch" - { - "windows" "294" - "linux" "295" - "mac" "295" - } - } - } - - "#default" - { - "Addresses" - { - "EntityListenersPtr" - { - "windows" - { - "signature" "EntityListenersFinder" - "read" "18" - } - } - } - - "Signatures" - { - // Find AddListenerEntity inlined in CPhysSaveRestoreBlockHandler::PreRestore (virtual) - "EntityListenersFinder" - { - "library" "server" - "windows" "\x55\x8B\xEC\x8B\x0D\x2A\x2A\x2A\x2A\x33\xC0\x56\x85\xC9\x7E\x32\x8B\x15" - } - } - - "Offsets" - { - "EntityListeners" - { - "linux" "131108" - "mac" "131108" - } - } - } -} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/master.games.txt b/gamedata/sdkhooks.games/master.games.txt index 43672378..d6864a9c 100644 --- a/gamedata/sdkhooks.games/master.games.txt +++ b/gamedata/sdkhooks.games/master.games.txt @@ -41,11 +41,6 @@ "engine" "csgo" } - "engine.dota.txt" - { - "engine" "dota" - } - "engine.ep2v.txt" { "engine" "orangebox_valve" diff --git a/gamedata/sdktools.games/engine.dota.txt b/gamedata/sdktools.games/engine.dota.txt deleted file mode 100644 index fa858e35..00000000 --- a/gamedata/sdktools.games/engine.dota.txt +++ /dev/null @@ -1,342 +0,0 @@ -/** - * Do not edit this file. Any changes will be overwritten by the gamedata - * updater or by upgrading your SourceMod install. - * - * To override data in this file, create a subdirectory named "custom" and - * place your own gamedata file(s) inside of it. Such files will be parsed - * after SM's own. - * - * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) - */ - -"Games" -{ - /* Sounds */ - "#default" - { - "Keys" - { - "SlapSoundCount" "7" - "SlapSound1" "vo/axe/axe_pain_01.mp3" - "SlapSound1" "vo/axe/axe_pain_02.mp3" - "SlapSound1" "vo/axe/axe_pain_03.mp3" - "SlapSound1" "vo/axe/axe_pain_04.mp3" - "SlapSound1" "vo/axe/axe_pain_05.mp3" - "SlapSound1" "vo/axe/axe_pain_06.mp3" - "SlapSound1" "vo/axe/axe_pain_07.mp3" - } - } - - /* General Temp Entities */ - "#default" - { - "Offsets" - { - //Offset into CBaseTempEntity constructor - "s_pTempEntities" - { - "windows" "7" - "linux" "9" - } - "GetTEName" - { - "windows" "4" - "linux" "4" - "mac" "4" - } - "GetTENext" - { - "windows" "8" - "linux" "8" - "mac" "8" - } - "TE_GetServerClass" - { - "windows" "0" - "linux" "0" - "mac" "0" - } - } - - "Signatures" - { - "CBaseTempEntity" - { - "library" "server" - "windows" "\xFF\x2A\x2A\x2A\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x89\x2A\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x8D" - "linux" "\x55\x89\xE5\x53\x83\xEC\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x85\xDB\x74\x2A\x8D\xB4\x26\x00\x00\x00\x00\x8B" - } - "s_pTempEntities" - { - "library" "server" - "mac" "@_ZN15CBaseTempEntity15s_pTempEntitiesE" - } - } - } - - /* CGlobalEntityList */ - "#default" - { - "Signatures" - { - /* Functions in CGlobalEntityList */ - "FindEntityByClassname" - { - "library" "server" - // Fallback to IServerTools method instead on Windows, lest we add custom logic since it's not a thiscall on Windows in Dota - "linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x1C\x8B\x45\x0C\x8B\x5D\x08\x8B\x7D\x10\x85\xC0\x74\x7A\x8B\x10\x89" - "mac" "@_ZN17CGlobalEntityList21FindEntityByClassnameEP11CBaseEntityPKc" - } - } - } - - /* General GameRules */ - "#default" - { - "Keys" - { - "GameRulesProxy" "CDOTAGamerulesProxy" - "GameRulesDataTable" "dota_gamerules_data" - } - } - - /* IServer interface pointer */ - "#default" - { - "Keys" - { - /* Signature for the beginning of IVEngineServer::CreateFakeClient. - * - * The engine binary is not actually scanned in order to look for - * this. SourceHook is used to used to determine the address of the - * function and this signature is used to verify that it contains - * the expected code. A pointer to sv (IServer interface) is used - * here. - */ - "CreateFakeClient_Windows" "\x55\x8B\xEC\x56\xFF\x75\x0C\xB9\x2A\x2A\x2A\x2A\xE8" - "CreateFakeClient_Linux" "\x55\x89\xE5\x83\xEC\x2A\x8B\x45\x10\x89\x5D\xF8\x89\x75\xFC\x8B\x5D\x08\xC7\x04\x24\x2A\x2A\x2A\x2A\x89" - } - - "Offsets" - { - /* Offset into IVEngineServer::CreateFakeClient */ - "sv" - { - "windows" "8" - "linux" "21" - } - } - - "Signatures" - { - /* CBaseServer object for IServer interface */ - "sv" - { - "library" "engine" - "mac" "@sv" - } - } - } - - /* Resource Entity override */ - "#default" - { - // Dota's player manager does not have DT_PlayerResource embedded, unlike most other games - "Keys" - { - "ResourceEntityClassname" "dota_player_manager" - } - } - - /* EntityFactoryDictionary function */ - "#default" - { - "Signatures" - { - "EntityFactory" - { - "library" "server" - "mac" "@_Z23EntityFactoryDictionaryv" - } - - "EntityFactoryFinder" - { - // EntityFactoryDictionary gets inlined on Windows in Dota 2. The pointer to the static factory becomes a global. - "library" "server" - "windows" "\xFF\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B\xC8\xC7" - } - - // EntityFactoryDictionary is difficult to find on Linux due to multiple matches. This finds a caller of it instead. - "EntityFactoryCaller" - { - "library" "server" - "linux" "\xA1\x2A\x2A\x2A\x2A\xC7\x2A\x2A\x00\x00\x00\x00\xC7\x2A\x2A\x00\x00\x00\x00\x85\xC0\x0F\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x8B\x2A\x2A\x89\x2A\x2A\x89\x2A\x2A\xE8" - } - } - - "Offsets" - { - "EntityFactoryOffset" - { - "windows" "4" - } - - // This is the offset into the address found by the EntityFactoryCaller signature. - "EntityFactoryCallOffset" - { - "linux" "41" - } - } - } - - /* CBaseEntityOutput::FireOutput */ - "#default" - { - "Signatures" - { - "FireOutput" - { - "library" "server" - "windows" "\x55\x8B\xEC\x83\xE4\xC0\x81\xEC\x2A\x2A\x2A\x2A\x8B\xC1\x53" - "linux" "\x55\x89\xE5\x57\x56\x53\x81\xEC\x2A\x2A\x2A\x2A\x8B\x55\x08\x8B\x75\x14\x8B\x5A\x14\x85\xDB\x0F" - "mac" "@_ZN17CBaseEntityOutput10FireOutputE9variant_tP11CBaseEntityS2_f" - } - } - } - - /* SetUserInfo data */ - "#default" - { - "Offsets" - { - /** - * CBaseClient::SetUserCVar(char const*,char const*); - * Linux offset straight from VTable dump. - * Windows offset is crazy. Found the windows SetName function using string "(%d)%-.*s" (aD_S in IDA) - * Cross referenced back to the vtable and counted manually (SetUserCvar is 1 higher, offsets start from 1) - */ - "SetUserCvar" - { - "windows" "26" - "linux" "63" - "mac" "63" - } - /** - * CBaseClient::SetName(char const*); - * Linux offset straight from VTable dump. - * Has string "(%d)%-0.*s" - */ - "SetClientName" - { - "windows" "25" - "linux" "62" - "mac" "62" - } - /** - * Offset into CBaseClient - Used by CBaseServer::UpdateUserSettings to determine when changes have been made. - * Find CBaseClient::UpdateUserSettings (strings "net_maxroutable", "cl_updaterate" etc) and the offset is set to 0 near the end. - * Linux: mov byte ptr [esi+0B0h], 0 - * Win: mov byte ptr [esi+0B0h], 0 - * - * L4D2: This has been moved into CBaseClient::UpdateUserSettings(), rest of the details are still relevant. - */ - "InfoChanged" - { - "windows" "212" - "linux" "212" - "mac" "212" - } - } - } - - "dota" - { - "Offsets" - { - "GiveNamedItem" - { - "windows" "438" - "linux" "439" - "mac" "439" - } - "RemovePlayerItem" - { - "windows" "300" - "linux" "301" - "mac" "301" - } - "Weapon_GetSlot" - { - "windows" "288" - "linux" "289" - "mac" "289" - } - "Ignite" - { - "windows" "226" - "linux" "227" - "mac" "227" - } - "Extinguish" - { - "windows" "229" - "linux" "230" - "mac" "230" - } - "Teleport" - { - "windows" "116" - "linux" "117" - "mac" "117" - } - "CommitSuicide" - { - "windows" "482" - "linux" "482" - "mac" "482" - } - "GetVelocity" - { - "windows" "149" - "linux" "150" - "mac" "150" - } - "EyeAngles" - { - "windows" "140" - "linux" "141" - "mac" "141" - } - "AcceptInput" - { - "windows" "43" - "linux" "44" - "mac" "44" - } - "SetEntityModel" - { - "windows" "28" - "linux" "29" - "mac" "29" - } - "WeaponEquip" - { - "windows" "291" - "linux" "292" - "mac" "292" - } - "Activate" - { - "windows" "39" - "linux" "40" - "mac" "40" - } - "PlayerRunCmd" - { - "windows" "458" - "linux" "459" - "mac" "459" - } - } - } -} diff --git a/gamedata/sdktools.games/master.games.txt b/gamedata/sdktools.games/master.games.txt index 664ce381..436c8d0a 100644 --- a/gamedata/sdktools.games/master.games.txt +++ b/gamedata/sdktools.games/master.games.txt @@ -80,11 +80,6 @@ "engine" "csgo" } - "engine.dota.txt" - { - "engine" "dota" - } - "engine.blade.txt" { "engine" "blade" diff --git a/loader/loader.cpp b/loader/loader.cpp index 66531929..45bd034d 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -83,7 +83,6 @@ #define FILENAME_1_6_SDK2013 "sourcemod.2.sdk2013" PLATFORM_EXT #define FILENAME_1_6_TF2 "sourcemod.2.tf2" PLATFORM_EXT #define FILENAME_1_6_ND "sourcemod.2.nd" PLATFORM_EXT -#define FILENAME_1_6_DOTA "sourcemod.2.dota" PLATFORM_EXT #define FILENAME_1_6_BLADE "sourcemod.2.blade" PLATFORM_EXT #define FILENAME_1_6_INSURGENCY "sourcemod.2.insurgency" PLATFORM_EXT #define FILENAME_1_6_CONTAGION "sourcemod.2.contagion" PLATFORM_EXT @@ -343,11 +342,6 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co } break; } - case SOURCE_ENGINE_DOTA: - { - filename = FILENAME_1_6_DOTA; - break; - } case SOURCE_ENGINE_BLADE: { filename = FILENAME_1_6_BLADE; diff --git a/plugins/nextmap.sp b/plugins/nextmap.sp index 77f1f678..02db94a7 100644 --- a/plugins/nextmap.sp +++ b/plugins/nextmap.sp @@ -63,7 +63,6 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max || StrEqual(game, "left4dead2", false) || StrEqual(game, "garrysmod", false) || StrEqual(game, "swarm", false) - || StrEqual(game, "dota", false) || StrEqual(game, "bms", false) || GetEngineVersion() == Engine_Insurgency) { diff --git a/public/compat_wrappers.h b/public/compat_wrappers.h index a7b2d005..5eaf232b 100644 --- a/public/compat_wrappers.h +++ b/public/compat_wrappers.h @@ -153,26 +153,4 @@ typedef int QueryCvarCookie_t; } #endif //SOURCE_ENGINE >= SE_LEFT4DEAD -#if SOURCE_ENGINE == SE_DOTA - inline int GetPlayerUserId(edict_t *pEdict) - { - return engine->GetPlayerUserId(IndexOfEdict(pEdict) - 1); - } - - inline int GetPlayerUserId(int client) - { - return engine->GetPlayerUserId(client - 1); - } -#else - inline int GetPlayerUserId(edict_t *pEdict) - { - return engine->GetPlayerUserId(pEdict); - } - - inline int GetPlayerUserId(int client) - { - return engine->GetPlayerUserId(PEntityOfEntIndex(client)); - } -#endif //SOURCE_ENGINE >= SE_DOTA - #endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_ diff --git a/tools/buildbot/PackageScript b/tools/buildbot/PackageScript index 1e121501..9b29f05b 100644 --- a/tools/buildbot/PackageScript +++ b/tools/buildbot/PackageScript @@ -143,7 +143,6 @@ CopyFiles('gamedata/sdkhooks.games', 'addons/sourcemod/gamedata/sdkhooks.games', 'engine.contagion.txt', 'engine.csgo.txt', 'engine.darkm.txt', - 'engine.dota.txt', 'engine.ep2v.txt', 'engine.insurgency.txt', 'engine.l4d.txt', @@ -184,7 +183,6 @@ CopyFiles('gamedata/sdktools.games', 'addons/sourcemod/gamedata/sdktools.games', 'engine.csgo.txt', 'engine.css.txt', 'engine.darkm.txt', - 'engine.dota.txt', 'engine.ep1.txt', 'engine.ep2.txt', 'engine.ep2valve.txt', @@ -243,7 +241,6 @@ CopyFiles('gamedata/core.games', 'addons/sourcemod/gamedata/core.games', 'engine.csgo.txt', 'engine.css.txt', 'engine.darkm.txt', - 'engine.dota.txt', 'engine.ep1.txt', 'engine.ep2.txt', 'engine.ep2valve.txt',