1.1 --- a/sample_mm/engine_wrappers.h Mon Nov 24 07:50:01 2008 -0600
1.2 +++ b/sample_mm/engine_wrappers.h Mon Nov 24 12:03:02 2008 -0600
1.3 @@ -20,11 +20,12 @@
1.4 #include <eiface.h>
1.5
1.6 extern IVEngineServer *engine;
1.7 +extern CGlobalVars *gpGlobals;
1.8
1.9 /**
1.10 * For non-OrangeBox builds, we have to make wrappers.
1.11 */
1.12 -#if defined ENGINE_ORIGINAL
1.13 +#if SOURCE_ENGINE == SE_EPISODEONE
1.14
1.15 /**
1.16 * MM:S 1.4.x needs older API calls.
1.17 @@ -33,6 +34,7 @@
1.18 #define GetEngineFactory engineFactory
1.19 #define GetServerFactory serverFactory
1.20 #define MM_Format snprintf
1.21 +#define GetCGlobals pGlobals
1.22 #else
1.23 #error "Metamod:Source 1.6 is not supported on the old engine."
1.24 #endif
1.25 @@ -59,12 +61,43 @@
1.26 };
1.27
1.28 #define CVAR_INTERFACE_VERSION VENGINE_CVAR_INTERFACE_VERSION
1.29 -#define ENGINE_CALL(func) SH_CALL(m_EngineCC, func)
1.30 +#define ENGINE_CALL(func) SH_CALL(m_EngineCC, func)
1.31 +
1.32 +#elif SOURCE_ENGINE >= SE_ORANGEBOX
1.33 +
1.34 +#define ENGINE_CALL(func) SH_CALL(engine, func)
1.35 +#define MM_Format g_SMAPI->Format
1.36 +
1.37 +#endif
1.38 +
1.39 +/**
1.40 + * Left 4 Dead engine removed these from IVEngineServer.
1.41 + */
1.42 +#if SOURCE_ENGINE >= SE_LEFT4DEAD
1.43
1.44 -#elif defined ENGINE_ORANGEBOX
1.45 +inline int IndexOfEdict(const edict_t *pEdict)
1.46 +{
1.47 + return (int)(pEdict - gpGlobals->baseEdict);
1.48 +}
1.49 +inline edict_t *PEntityOfEntIndex(int iEntIndex)
1.50 +{
1.51 + if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
1.52 + {
1.53 + return (edict_t *)(gpGlobals->baseEdict + iEntIndex);
1.54 + }
1.55 + return NULL;
1.56 +}
1.57
1.58 -#define ENGINE_CALL(func) SH_CALL(engine, func)
1.59 -#define MM_Format g_SMAPI->Format
1.60 +#else
1.61 +
1.62 +inline int IndexOfEdict(const edict_t *pEdict)
1.63 +{
1.64 + return engine->IndexOfEdict(pEdict);
1.65 +}
1.66 +inline edict_t *PEntityOfEntIndex(int iEntIndex)
1.67 +{
1.68 + return engine->PEntityOfEntIndex(iEntIndex);
1.69 +}
1.70
1.71 #endif
1.72