diff --git a/core/GameHooks.cpp b/core/GameHooks.cpp index 00320747..8c8be201 100644 --- a/core/GameHooks.cpp +++ b/core/GameHooks.cpp @@ -79,14 +79,8 @@ void GameHooks::OnVSPReceived() if (client_cvar_query_mode_ != ClientCvarQueryMode::Unavailable) return; - // For later MM:S versions, use the updated API, since it's cleaner. -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL || vsp_version < 2) return; -#else - if (g_HL2.IsOriginalEngine() || vsp_version < 2) - return; -#endif #if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA hooks_ += SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false); diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index e280b7be..cd8486a9 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -114,24 +114,10 @@ CHalfLife2::~CHalfLife2() CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL; #endif -#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 -bool is_original_engine = false; -#endif - void CHalfLife2::OnSourceModStartup(bool late) { #if SOURCE_ENGINE != SE_DARKMESSIAH - - /* The Ship currently is the only known game to use an older version of the engine */ -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 - if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL) -#else - if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0) -#endif - { - is_original_engine = true; - } - else if (g_pSharedChangeInfo == NULL) + if (g_SMAPI->GetSourceEngineBuild() != SOURCE_ENGINE_ORIGINAL && !g_pSharedChangeInfo) { g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo(); } @@ -238,7 +224,7 @@ void CHalfLife2::InitCommandLine() { char error[256]; #if SOURCE_ENGINE != SE_DARKMESSIAH - if (!is_original_engine) + if (g_SMAPI->GetSourceEngineBuild() != SOURCE_ENGINE_ORIGINAL) { ke::Ref lib = ke::SharedLib::Open(TIER0_NAME, error, sizeof(error)); if (!lib) { @@ -280,13 +266,6 @@ ICommandLine *CHalfLife2::GetValveCommandLine() return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))(); } -#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 -bool CHalfLife2::IsOriginalEngine() -{ - return is_original_engine; -} -#endif - #if SOURCE_ENGINE != SE_DARKMESSIAH IChangeInfoAccessor *CBaseEdict::GetChangeAccessor() { @@ -786,11 +765,7 @@ bool CHalfLife2::IsLANServer() bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID) { -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL) -#else - if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0) -#endif { Assert(filesystem); #ifdef _MSC_VER diff --git a/core/HalfLife2.h b/core/HalfLife2.h index 7756db49..b294053c 100644 --- a/core/HalfLife2.h +++ b/core/HalfLife2.h @@ -197,9 +197,6 @@ public: const char *CurrentCommandName(); void AddDelayedKick(int client, int userid, const char *msg); void ProcessDelayedKicks(); -#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11 - bool IsOriginalEngine(); -#endif private: void PushCommandStack(const ICommandArgs *cmd); void PopCommandStack(); diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index b32cb9e2..3f8b2944 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -482,7 +482,6 @@ static cell_t smn_IsPlayerAlive(IPluginContext *pContext, const cell_t *params) static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params) { -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 int version = g_SMAPI->GetSourceEngineBuild(); switch (version) @@ -492,7 +491,7 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params) case SOURCE_ENGINE_EPISODEONE: return 20; -# if defined METAMOD_PLAPI_VERSION +#if defined METAMOD_PLAPI_VERSION /* Newer games. */ case SOURCE_ENGINE_DARKMESSIAH: return 15; @@ -525,18 +524,8 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params) return 80; case SOURCE_ENGINE_DOTA: return 90; -# endif - } -#else - if (g_HL2.IsOriginalEngine()) - { - return 10; - } - else - { - return 20; - } #endif + } return 0; } diff --git a/core/sourcemm_api.cpp b/core/sourcemm_api.cpp index e3e5c4e2..7d787814 100644 --- a/core/sourcemm_api.cpp +++ b/core/sourcemm_api.cpp @@ -63,6 +63,10 @@ int vsp_version = 0; PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core); +#if !defined(METAMOD_PLAPI_VERSION) && PLAPI_VERSION < 11 +# error "SourceMod requires Metamod:Source 1.8 or higher." +#endif + ConVar sourcemod_version("sourcemod_version", SOURCEMOD_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "SourceMod Version"); bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) @@ -100,9 +104,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen ismm->AddListener(this, this); -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if ((vsp_interface = g_SMAPI->GetVSPInfo(&vsp_version)) == NULL) -#endif { g_SMAPI->EnableVSPListener(); } @@ -190,31 +192,15 @@ void SourceMod_Core::OnVSPListening(IServerPluginCallbacks *iface) return; } -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 if (vsp_version == 0) { g_SMAPI->GetVSPInfo(&vsp_version); } -#else - if (vsp_version == 0) - { - if (strcmp(g_SourceMod.GetGameFolderName(), "ship") == 0) - { - vsp_version = 1; - } - else - { - vsp_version = 2; - } - } -#endif /* Notify! */ sCoreProviderImpl.OnVSPReceived(); } -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 - void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand) { #if SOURCE_ENGINE < SE_ORANGEBOX @@ -222,15 +208,6 @@ void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pComman #endif } -#else - -void SourceMod_Core::OnPluginUnload(PluginId id) -{ - Global_OnUnlinkConCommandBase(NULL); -} - -#endif - void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret) { void *ptr = NULL; diff --git a/core/sourcemm_api.h b/core/sourcemm_api.h index c813f27e..ab434426 100644 --- a/core/sourcemm_api.h +++ b/core/sourcemm_api.h @@ -80,11 +80,7 @@ public: const char *GetLogTag(); public: void OnVSPListening(IServerPluginCallbacks *iface); -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand); -#else - void OnPluginUnload(PluginId id); -#endif void *OnMetamodQuery(const char *iface, int *ret); }; diff --git a/extensions/sdktools/vglobals.cpp b/extensions/sdktools/vglobals.cpp index ded75ef4..daa6aa07 100644 --- a/extensions/sdktools/vglobals.cpp +++ b/extensions/sdktools/vglobals.cpp @@ -242,24 +242,11 @@ void GetIServer() return; } -#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11 /* Get the CreateFakeClient function pointer */ if (!(vfunc=SH_GET_ORIG_VFNPTR_ENTRY(engine, &IVEngineServer::CreateFakeClient))) { return; } -#else - /* Get the interface manually */ - SourceHook::MemFuncInfo info = {true, -1, 0, 0}; - SourceHook::GetFuncInfo(&IVEngineServer::CreateFakeClient, info); - - vfunc = enginePatch->GetOrigFunc(info.vtbloffs, info.vtblindex); - if (!vfunc) - { - void **vtable = *reinterpret_cast(enginePatch->GetThisPtr() + info.thisptroffs + info.vtbloffs); - vfunc = vtable[info.vtblindex]; - } -#endif /* Get signature string for IVEngineServer::CreateFakeClient() */ sigstr = g_pGameConf->GetKeyValue(FAKECLIENT_KEY);