Use newer MM:S api for Ep1/Original engine. (#548)

* Use newer MM:S api for Ep1/Original engine.

* Remove doubled FILENAME_1_6_EP1 define.
This commit is contained in:
Nicholas Hastings
2017-01-11 21:25:00 -05:00
committed by GitHub
parent d9312799c3
commit ad3588d0aa
12 changed files with 10 additions and 142 deletions
+2 -8
View File
@@ -62,16 +62,10 @@
# include <unistd.h>
#endif
#if SH_IMPL_VERSION >= 5
# if 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);
# endif
#else
extern int __SourceHook_FHVPAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>,bool);
extern int __SourceHook_FHAddConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
extern bool __SourceHook_FHRemoveConCommandDispatch(void *, bool, class fastdelegate::FastDelegate0<void>);
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
#endif
class GenericCommandHooker : public IConCommandLinkListener
+1 -5
View File
@@ -70,12 +70,8 @@ void CheckAndFinalizeConfigs();
#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
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
void Hook_ExecDispatchPre()
#else
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
void Hook_ExecDispatchPre()
#endif
{
+1 -4
View File
@@ -50,11 +50,8 @@ SH_DECL_HOOK4_void(IVEngineServer, ChangeLevel, SH_NOATTRIB, 0, const char *, co
#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);
#else
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
#endif
ConCommand *changeLevelCmd = NULL;
+1 -4
View File
@@ -90,11 +90,8 @@ SH_DECL_HOOK1_void(IServerGameDLL, SetServerHibernation, SH_NOATTRIB, 0, bool);
#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);
#else
extern int __SourceHook_FHAddConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
extern bool __SourceHook_FHRemoveConCommandDispatch(void *,bool,class fastdelegate::FastDelegate0<void>);
SH_DECL_EXTERN0_void(ConCommand, Dispatch, SH_NOATTRIB, false);
#endif
ConCommand *maxplayersCmd = NULL;
+2 -17
View File
@@ -354,7 +354,6 @@ void UTIL_ConsolePrint(const char *fmt, ...)
va_end(ap);
}
#if defined METAMOD_PLAPI_VERSION
#if SOURCE_ENGINE == SE_LEFT4DEAD
#define GAMEFIX "2.l4d"
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
@@ -395,10 +394,7 @@ void UTIL_ConsolePrint(const char *fmt, ...)
#define GAMEFIX "2.contagion"
#else
#define GAMEFIX "2.ep1"
#endif //(SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
#else //METAMOD_PLAPI_VERSION
#define GAMEFIX "1.ep1"
#endif //METAMOD_PLAPI_VERSION
#endif
static ServerGlobals serverGlobals;
@@ -601,18 +597,7 @@ int CoreProviderImpl::LoadMMSPlugin(const char *file, bool *ok, char *error, siz
Pl_Status status;
#ifndef METAMOD_PLAPI_VERSION
const char *filep;
PluginId source;
#endif
if (!id || (
#ifndef METAMOD_PLAPI_VERSION
g_pMMPlugins->Query(id, filep, status, source)
#else
g_pMMPlugins->Query(id, NULL, &status, NULL)
#endif
&& status < Pl_Paused))
if (!id || (g_pMMPlugins->Query(id, NULL, &status, NULL) && status < Pl_Paused))
{
*ok = false;
}
-6
View File
@@ -484,9 +484,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 10;
case SOURCE_ENGINE_EPISODEONE:
return 20;
#if defined METAMOD_PLAPI_VERSION
/* Newer games. */
case SOURCE_ENGINE_DARKMESSIAH:
return 15;
case SOURCE_ENGINE_ORANGEBOX:
@@ -516,7 +513,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 70;
case SOURCE_ENGINE_CSGO:
return 80;
#endif
}
return 0;
@@ -525,7 +521,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
static cell_t GetEngineVersion(IPluginContext *pContext, const cell_t *params)
{
int engineVer = g_SMAPI->GetSourceEngineBuild();
#if defined METAMOD_PLAPI_VERSION
if (engineVer == SOURCE_ENGINE_ORANGEBOXVALVE_DEPRECATED)
{
const char *gamedir = g_SourceMod.GetGameFolderName();
@@ -538,7 +533,6 @@ static cell_t GetEngineVersion(IPluginContext *pContext, const cell_t *params)
else if (strcmp(gamedir, "hl2mp") == 0)
return SOURCE_ENGINE_HL2DM;
}
#endif
return engineVer;
}
-7
View File
@@ -63,13 +63,6 @@ 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
#if SH_IMPL_VERSION < 4
# error "SourceMod requires a newer version of SourceHook."
#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)
-4
View File
@@ -49,10 +49,6 @@
#include <IEngineSound.h>
#include <toolframework/itoolentity.h>
#ifndef METAMOD_PLAPI_VERSION
#include <metamod_wrappers.h>
#endif
/**
* @file Contains wrappers around required Metamod:Source API exports
*/