Split TF2, DoD:S, HL2:DM, and ND to separate binaries (bug 5813, r=asherkin).

This commit is contained in:
Nicholas Hastings 2013-07-21 11:53:56 -04:00
parent 636c100b6b
commit a36c266e7d
32 changed files with 298 additions and 142 deletions

View File

@ -41,19 +41,28 @@ class SM:
self.possibleSdks['css'] = {'sdk': 'HL2SDKCSS', 'ext': '2.css', 'def': '6', self.possibleSdks['css'] = {'sdk': 'HL2SDKCSS', 'ext': '2.css', 'def': '6',
'name': 'CSS', 'platform': ['windows', 'linux', 'darwin'], 'name': 'CSS', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-css'} 'dir': 'hl2sdk-css'}
self.possibleSdks['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '7', self.possibleSdks['hl2dm'] = {'sdk': 'HL2SDKHL2DM', 'ext': '2.hl2dm', 'def': '7',
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin'], 'name': 'HL2DM', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-ob-valve'} 'dir': 'hl2sdk-hl2dm'}
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '8', self.possibleSdks['dods'] = {'sdk': 'HL2SDKDODS', 'ext': '2.dods', 'def': '8',
'name': 'DODS', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-dods'}
self.possibleSdks['tf2'] = {'sdk': 'HL2SDKTF2', 'ext': '2.tf2', 'def': '9',
'name': 'TF2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-tf2'}
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '10',
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin'], 'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d'} 'dir': 'hl2sdk-l4d'}
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '9', self.possibleSdks['nd'] = {'sdk': 'HL2SDKND', 'ext': '2.nd', 'def': '11',
'name': 'NUCLEARDAWN', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-nd'}
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '12',
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin'], 'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-l4d2'} 'dir': 'hl2sdk-l4d2'}
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2', self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH', 'platform': ['windows'], 'name': 'DARKMESSIAH', 'platform': ['windows'],
'dir': 'hl2sdk-darkm'} 'dir': 'hl2sdk-darkm'}
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '10', self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '13',
'name': 'ALIENSWARM', 'platform': ['windows'], 'name': 'ALIENSWARM', 'platform': ['windows'],
'dir': 'hl2sdk-swarm'} 'dir': 'hl2sdk-swarm'}
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4', self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
@ -62,13 +71,13 @@ class SM:
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5', self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
'name': 'EYE', 'platform': ['windows'], 'name': 'EYE', 'platform': ['windows'],
'dir': 'hl2sdk-eye'} 'dir': 'hl2sdk-eye'}
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '12', self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '15',
'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin'], 'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin'],
'dir': 'hl2sdk-csgo'} 'dir': 'hl2sdk-csgo'}
self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '13', self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '16',
'name': 'DOTA', 'platform': ['windows'], 'name': 'DOTA', 'platform': ['windows'],
'dir': 'hl2sdk-dota'} 'dir': 'hl2sdk-dota'}
# self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '11', # self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '14',
# 'name': 'PORTAL2', 'platform': ['windows'], # 'name': 'PORTAL2', 'platform': ['windows'],
# 'dir': 'hl2sdk-portal2'} # 'dir': 'hl2sdk-portal2'}
@ -312,7 +321,7 @@ class SM:
else: else:
staticLibs = os.path.join(sdkPath, 'lib', 'linux') staticLibs = os.path.join(sdkPath, 'lib', 'linux')
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder) workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
if sdk in ['ep2v', 'css', 'l4d2']: if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so'] libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
for lib in libs: for lib in libs:
link = os.path.join(workFolder, lib) link = os.path.join(workFolder, lib)
@ -321,7 +330,7 @@ class SM:
os.lstat(link) os.lstat(link)
except: except:
job.AddCommand(SymlinkCommand(link, target)) job.AddCommand(SymlinkCommand(link, target))
elif sdk in ['l4d', 'csgo']: elif sdk in ['l4d', 'nd', 'csgo']:
libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so'] libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']
if sdk == 'csgo': if sdk == 'csgo':
libs.append('interfaces_i486.a') libs.append('interfaces_i486.a')
@ -384,7 +393,7 @@ class SM:
# We don't build for Portal 2 (yet?, ever?), but using this define in code as # We don't build for Portal 2 (yet?, ever?), but using this define in code as
# it saves trouble if we ever need to # it saves trouble if we ever need to
compiler['CDEFINES'].append('SE_PORTAL2=11') compiler['CDEFINES'].append('SE_PORTAL2=14')
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'], paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
['public', 'tier0'], ['public', 'tier1']] ['public', 'tier0'], ['public', 'tier1']]
@ -423,10 +432,10 @@ class SM:
if not noLink: if not noLink:
if AMBuild.target['platform'] == 'linux': if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'][0:0] = ['-lm'] compiler['POSTLINKFLAGS'][0:0] = ['-lm']
if sdk in ['ep2v', 'css', 'l4d2']: if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so'] compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so'] compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
elif sdk in ['l4d', 'csgo']: elif sdk in ['l4d', 'nd', 'csgo']:
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so'] compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so'] compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
else: else:

View File

@ -58,7 +58,7 @@ typedef ICommandLine *(*FakeGetCommandLine)();
#define TIER0_NAME "libtier0.dylib" #define TIER0_NAME "libtier0.dylib"
#define VSTDLIB_NAME "libvstdlib.dylib" #define VSTDLIB_NAME "libvstdlib.dylib"
#elif defined __linux__ #elif defined __linux__
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2 #if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_LEFT4DEAD2
#define TIER0_NAME "libtier0_srv.so" #define TIER0_NAME "libtier0_srv.so"
#define VSTDLIB_NAME "libvstdlib_srv.so" #define VSTDLIB_NAME "libvstdlib_srv.so"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD #elif SOURCE_ENGINE >= SE_LEFT4DEAD

View File

@ -338,7 +338,7 @@ void BaseMenuStyle::ClientPressedKey(int client, unsigned int key_press)
#endif #endif
0, 0,
PITCH_NORM, PITCH_NORM,
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
0, 0,
#endif #endif
&pos); &pos);

View File

@ -266,7 +266,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
#endif #endif
{ {
static ConVar *tv_enable = icvar->FindVar("tv_enable"); static ConVar *tv_enable = icvar->FindVar("tv_enable");
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_TF2
static ConVar *replay_enable = icvar->FindVar("replay_enable"); static ConVar *replay_enable = icvar->FindVar("replay_enable");
#endif #endif
@ -276,7 +276,7 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
ICommandLine *commandLine = g_HL2.GetValveCommandLine(); ICommandLine *commandLine = g_HL2.GetValveCommandLine();
m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && (!commandLine || commandLine->FindParm("-nohltv") == 0)); m_bIsSourceTVActive = (tv_enable && tv_enable->GetBool() && (!commandLine || commandLine->FindParm("-nohltv") == 0));
m_bIsReplayActive = false; m_bIsReplayActive = false;
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_TF2
m_bIsReplayActive = (replay_enable && replay_enable->GetBool()); m_bIsReplayActive = (replay_enable && replay_enable->GetBool());
#endif #endif
m_PlayersSinceActive = 0; m_PlayersSinceActive = 0;
@ -634,17 +634,14 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
int newCount = m_PlayersSinceActive + 1; int newCount = m_PlayersSinceActive + 1;
int userId = GetPlayerUserId(pEntity); int userId = GetPlayerUserId(pEntity);
#if (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2) #if (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN || SOURCE_ENGINE == SE_LEFT4DEAD2)
static ConVar *tv_name = icvar->FindVar("tv_name"); static ConVar *tv_name = icvar->FindVar("tv_name");
#endif #endif
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_TF2
static ConVar *replay_name = icvar->FindVar("replay_name"); static ConVar *replay_name = icvar->FindVar("replay_name");
#endif #endif
#if SOURCE_ENGINE == SE_LEFT4DEAD2
static bool bIsNuclearDawn = (strcmp(g_SourceMod.GetGameFolderName(), "nucleardawn") == 0);
#endif
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_TF2
if (m_bIsReplayActive && newCount == 1 if (m_bIsReplayActive && newCount == 1
&& (m_ReplayUserId == userId && (m_ReplayUserId == userId
|| (replay_name && strcmp(playername, replay_name->GetString()) == 0) || (replay_name && replay_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0) || (replay_name && strcmp(playername, replay_name->GetString()) == 0) || (replay_name && replay_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
@ -662,15 +659,8 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
&& (m_SourceTVUserId == userId && (m_SourceTVUserId == userId
#if SOURCE_ENGINE == SE_CSGO #if SOURCE_ENGINE == SE_CSGO
|| strcmp(playername, "GOTV") == 0 || strcmp(playername, "GOTV") == 0
#elif (SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_LEFT4DEAD2) #elif (SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2 || SOURCE_ENGINE == SE_NUCLEARDAWN)
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|| (bIsNuclearDawn && ( true
#endif // SE_LEFT4DEAD2
|| (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0) || (tv_name && strcmp(playername, tv_name->GetString()) == 0) || (tv_name && tv_name->GetString()[0] == 0 && strcmp(playername, "unnamed") == 0)
#if SOURCE_ENGINE == SE_LEFT4DEAD2
))
|| (!bIsNuclearDawn && strcmp(playername, "SourceTV") == 0)
#endif // SE_LEFT4DEAD2
#else #else
|| strcmp(playername, "SourceTV") == 0 || strcmp(playername, "SourceTV") == 0
#endif #endif

View File

@ -386,7 +386,7 @@ public:
virtual void SetValue( const char *value ); virtual void SetValue( const char *value );
virtual void SetValue( float value ); virtual void SetValue( float value );
virtual void SetValue( int value ); virtual void SetValue( int value );
#if SOURCE_ENGINE >= SE_LEFT4DEAD2 #if SOURCE_ENGINE >= SE_NUCLEARDAWN
virtual void SetValue( Color value ); virtual void SetValue( Color value );
#endif #endif

View File

@ -84,6 +84,24 @@ CLocalExtension::CLocalExtension(const char *filename)
goto found; goto found;
} }
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
if (strcmp(smcore.gamesuffix, "2.tf2") == 0
|| strcmp(smcore.gamesuffix, "2.dods") == 0
|| strcmp(smcore.gamesuffix, "2.hl2dm") == 0
)
{
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s.2.ep2v." PLATFORM_LIB_EXT,
filename);
if (libsys->IsPathFile(path))
{
goto found;
}
}
/* First see if there is an engine specific build! */ /* First see if there is an engine specific build! */
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,

View File

@ -54,6 +54,7 @@ IGameConfig *g_pGameConf = NULL;
static char g_Game[256]; static char g_Game[256];
static char g_GameDesc[256] = {'!', '\0'}; static char g_GameDesc[256] = {'!', '\0'};
static char g_GameName[256] = {'$', '\0'}; static char g_GameName[256] = {'$', '\0'};
static const char *g_pParseEngine = NULL;
#define PSTATE_NONE 0 #define PSTATE_NONE 0
#define PSTATE_GAMES 1 #define PSTATE_GAMES 1
@ -112,10 +113,10 @@ static bool DoesGameMatch(const char *value)
static bool DoesEngineMatch(const char *value) static bool DoesEngineMatch(const char *value)
{ {
return strcmp(value, smcore.GetSourceEngineName()) == 0; return strcmp(value, g_pParseEngine) == 0;
} }
CGameConfig::CGameConfig(const char *file) CGameConfig::CGameConfig(const char *file, const char *engine)
{ {
strncopy(m_File, file, sizeof(m_File)); strncopy(m_File, file, sizeof(m_File));
m_pAddresses = new KTrie<AddressConf>(); m_pAddresses = new KTrie<AddressConf>();
@ -124,6 +125,16 @@ CGameConfig::CGameConfig(const char *file)
m_CustomLevel = 0; m_CustomLevel = 0;
m_CustomHandler = NULL; m_CustomHandler = NULL;
if (!engine)
m_pEngine = smcore.GetSourceEngineName();
else
m_pEngine = engine;
if (strcmp(m_pEngine, "css") == 0 || strcmp(m_pEngine, "dods") == 0 || strcmp(m_pEngine, "hl2dm") == 0 || strcmp(m_pEngine, "tf2") == 0)
this->SetBaseEngine("orangebox_valve");
else
this->SetBaseEngine(NULL);
} }
CGameConfig::~CGameConfig() CGameConfig::~CGameConfig()
@ -772,7 +783,16 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
SMCStates state = {0, 0}; SMCStates state = {0, 0};
List<String> fileList; List<String> fileList;
master_reader.fileList = &fileList; master_reader.fileList = &fileList;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
if (pEngine[iter] == NULL)
{
continue;
}
this->SetParseEngine(pEngine[iter]);
err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength); err = textparsers->ParseSMCFile(path, &master_reader, &state, error, maxlength);
if (err != SMCError_Okay) if (err != SMCError_Okay)
{ {
@ -786,6 +806,7 @@ bool CGameConfig::Reparse(char *error, size_t maxlength)
msg ? msg : "Unknown error"); msg ? msg : "Unknown error");
return false; return false;
} }
}
/* Go through each file we found and parse it. */ /* Go through each file we found and parse it. */
List<String>::iterator iter; List<String>::iterator iter;
@ -850,13 +871,20 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
m_IgnoreLevel = 0; m_IgnoreLevel = 0;
bShouldBeReadingDefault = true; bShouldBeReadingDefault = true;
m_ParseState = PSTATE_NONE; m_ParseState = PSTATE_NONE;
const char *pEngine[2] = { m_pBaseEngine, m_pEngine };
for (unsigned char iter = 0; iter < SM_ARRAYSIZE(pEngine); ++iter)
{
if (pEngine[iter] == NULL)
{
continue;
}
this->SetParseEngine(pEngine[iter]);
if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength)) if ((err=textparsers->ParseSMCFile(m_CurFile, this, &state, error, maxlength))
!= SMCError_Okay) != SMCError_Okay)
{ {
const char *msg; const char *msg = textparsers->GetSMCErrorString(err);
msg = textparsers->GetSMCErrorString(err);
smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile); smcore.LogError("[SM] Error parsing gameconfig file \"%s\":", m_CurFile);
smcore.LogError("[SM] Error %d on line %d, col %d: %s", smcore.LogError("[SM] Error %d on line %d, col %d: %s",
@ -875,10 +903,21 @@ bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
return false; return false;
} }
}
return true; return true;
} }
void CGameConfig::SetBaseEngine(const char *engine)
{
m_pBaseEngine = engine;
}
void CGameConfig::SetParseEngine(const char *engine)
{
g_pParseEngine = engine;
}
bool CGameConfig::GetOffset(const char *key, int *value) bool CGameConfig::GetOffset(const char *key, int *value)
{ {
int *pvalue; int *pvalue;

View File

@ -50,11 +50,13 @@ class CGameConfig :
{ {
friend class GameConfigManager; friend class GameConfigManager;
public: public:
CGameConfig(const char *file); CGameConfig(const char *file, const char *engine = NULL);
~CGameConfig(); ~CGameConfig();
public: public:
bool Reparse(char *error, size_t maxlength); bool Reparse(char *error, size_t maxlength);
bool EnterFile(const char *file, char *error, size_t maxlength); bool EnterFile(const char *file, char *error, size_t maxlength);
void SetBaseEngine(const char *engine);
void SetParseEngine(const char *engine);
public: //ITextListener_SMC public: //ITextListener_SMC
SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name); SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value); SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
@ -111,6 +113,8 @@ private:
int m_AddressReadCount; int m_AddressReadCount;
int m_AddressRead[8]; int m_AddressRead[8];
KTrie<AddressConf> *m_pAddresses; KTrie<AddressConf> *m_pAddresses;
const char *m_pEngine;
const char *m_pBaseEngine;
}; };
class GameConfigManager : class GameConfigManager :

View File

@ -214,10 +214,16 @@ static const char *get_source_engine_name()
return "eye"; return "eye";
#elif SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS
return "css"; return "css";
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE #elif SOURCE_ENGINE == SE_HL2DM
return "orangebox_valve"; return "hl2dm";
#elif SOURCE_ENGINE == SE_DODS
return "dods";
#elif SOURCE_ENGINE == SE_TF2
return "tf2";
#elif SOURCE_ENGINE == SE_LEFT4DEAD #elif SOURCE_ENGINE == SE_LEFT4DEAD
return "left4dead"; return "left4dead";
#elif SOURCE_ENGINE == SE_NUCLEARDAWN
return "nucleardawn";
#elif SOURCE_ENGINE == SE_LEFT4DEAD2 #elif SOURCE_ENGINE == SE_LEFT4DEAD2
return "left4dead2"; return "left4dead2";
#elif SOURCE_ENGINE == SE_ALIENSWARM #elif SOURCE_ENGINE == SE_ALIENSWARM
@ -233,7 +239,7 @@ static const char *get_source_engine_name()
static bool symbols_are_hidden() static bool symbols_are_hidden()
{ {
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO) || (SOURCE_ENGINE == SE_DOTA) #if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_HL2DM) || (SOURCE_ENGINE == SE_DODS) || (SOURCE_ENGINE == SE_TF2) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_NUCLEARDAWN) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO) || (SOURCE_ENGINE == SE_DOTA)
return true; return true;
#else #else
return false; return false;
@ -321,8 +327,12 @@ void do_global_plugin_loads()
#define GAMEFIX "2.eye" #define GAMEFIX "2.eye"
#elif SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS
#define GAMEFIX "2.css" #define GAMEFIX "2.css"
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE #elif SOURCE_ENGINE == SE_HL2DM
#define GAMEFIX "2.ep2v" #define GAMEFIX "2.hl2dm"
#elif SOURCE_ENGINE == SE_DODS
#define GAMEFIX "2.dods"
#elif SOURCE_ENGINE == SE_TF2
#define GAMEFIX "2.tf2"
#elif SOURCE_ENGINE == SE_DARKMESSIAH #elif SOURCE_ENGINE == SE_DARKMESSIAH
#define GAMEFIX "2.darkm" #define GAMEFIX "2.darkm"
#elif SOURCE_ENGINE == SE_PORTAL2 #elif SOURCE_ENGINE == SE_PORTAL2

View File

@ -916,7 +916,7 @@ cell_t g_ServerCommandBufferLength;
bool g_ShouldCatchSpew = false; bool g_ShouldCatchSpew = false;
#if SOURCE_ENGINE < SE_LEFT4DEAD2 #if SOURCE_ENGINE < SE_NUCLEARDAWN
SpewOutputFunc_t g_OriginalSpewOutputFunc = NULL; SpewOutputFunc_t g_OriginalSpewOutputFunc = NULL;
SpewRetval_t SourcemodSpewOutputFunc(SpewType_t spewType, tchar const *pMsg) SpewRetval_t SourcemodSpewOutputFunc(SpewType_t spewType, tchar const *pMsg)
@ -955,7 +955,7 @@ CON_COMMAND(sm_conhook_start, "")
return; return;
} }
#if SOURCE_ENGINE < SE_LEFT4DEAD2 #if SOURCE_ENGINE < SE_NUCLEARDAWN
g_OriginalSpewOutputFunc = GetSpewOutputFunc(); g_OriginalSpewOutputFunc = GetSpewOutputFunc();
SpewOutputFunc(SourcemodSpewOutputFunc); SpewOutputFunc(SourcemodSpewOutputFunc);
#else #else
@ -976,7 +976,7 @@ CON_COMMAND(sm_conhook_stop, "")
return; return;
} }
#if SOURCE_ENGINE < SE_LEFT4DEAD2 #if SOURCE_ENGINE < SE_NUCLEARDAWN
SpewOutputFunc(g_OriginalSpewOutputFunc); SpewOutputFunc(g_OriginalSpewOutputFunc);
#else #else
LoggingSystem_PopLoggingState(false); LoggingSystem_PopLoggingState(false);

View File

@ -1208,7 +1208,7 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params)
is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED); is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED);
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (pProp->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
@ -1306,7 +1306,7 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
FIND_PROP_SEND(DPT_Int, "integer"); FIND_PROP_SEND(DPT_Int, "integer");
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (pProp->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
@ -2030,7 +2030,7 @@ static int32_t SDKEntFlagToSMEntFlag(int flag)
#if SOURCE_ENGINE == SE_ALIENSWARM #if SOURCE_ENGINE == SE_ALIENSWARM
case FL_FREEZING: case FL_FREEZING:
return ENTFLAG_FREEZING; return ENTFLAG_FREEZING;
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
case FL_EP2V_UNKNOWN: case FL_EP2V_UNKNOWN:
return ENTFLAG_EP2V_UNKNOWN1; return ENTFLAG_EP2V_UNKNOWN1;
#endif #endif
@ -2108,7 +2108,7 @@ static int32_t SMEntFlagToSDKEntFlag(int32_t flag)
#if SOURCE_ENGINE == SE_ALIENSWARM #if SOURCE_ENGINE == SE_ALIENSWARM
case ENTFLAG_FREEZING: case ENTFLAG_FREEZING:
return FL_FREEZING; return FL_FREEZING;
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
case ENTFLAG_EP2V_UNKNOWN1: case ENTFLAG_EP2V_UNKNOWN1:
return FL_EP2V_UNKNOWN; return FL_EP2V_UNKNOWN;
#endif #endif

View File

@ -72,7 +72,7 @@ static cell_t IsDedicatedServer(IPluginContext *pContext, const cell_t *params)
static cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params) static cell_t GetEngineTime(IPluginContext *pContext, const cell_t *params)
{ {
#if SOURCE_ENGINE >= SE_LEFT4DEAD2 #if SOURCE_ENGINE >= SE_NUCLEARDAWN
float fTime = Plat_FloatTime(); float fTime = Plat_FloatTime();
#else #else
float fTime = engine->Time(); float fTime = engine->Time();
@ -493,10 +493,13 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 33; return 33;
case SOURCE_ENGINE_CSS: case SOURCE_ENGINE_CSS:
return 34; return 34;
case SOURCE_ENGINE_ORANGEBOXVALVE: case SOURCE_ENGINE_HL2DM:
case SOURCE_ENGINE_DODS:
case SOURCE_ENGINE_TF2:
return 35; return 35;
case SOURCE_ENGINE_LEFT4DEAD: case SOURCE_ENGINE_LEFT4DEAD:
return 40; return 40;
case SOURCE_ENGINE_NUCLEARDAWN:
case SOURCE_ENGINE_LEFT4DEAD2: case SOURCE_ENGINE_LEFT4DEAD2:
return 50; return 50;
case SOURCE_ENGINE_ALIENSWARM: case SOURCE_ENGINE_ALIENSWARM:
@ -523,6 +526,11 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
return 0; return 0;
} }
static cell_t GetEngineVersion(IPluginContext *pContext, const cell_t *params)
{
return g_SMAPI->GetSourceEngineBuild();
}
static cell_t IndexToReference(IPluginContext *pContext, const cell_t *params) static cell_t IndexToReference(IPluginContext *pContext, const cell_t *params)
{ {
if (params[1] >= NUM_ENT_ENTRIES || params[1] < 0) if (params[1] >= NUM_ENT_ENTRIES || params[1] < 0)
@ -574,6 +582,7 @@ REGISTER_NATIVES(halflifeNatives)
{"ShowVGUIPanel", ShowVGUIPanel}, {"ShowVGUIPanel", ShowVGUIPanel},
{"IsPlayerAlive", smn_IsPlayerAlive}, {"IsPlayerAlive", smn_IsPlayerAlive},
{"GuessSDKVersion", GuessSDKVersion}, {"GuessSDKVersion", GuessSDKVersion},
{"GetEngineVersion", GetEngineVersion},
{"EntIndexToEntRef", IndexToReference}, {"EntIndexToEntRef", IndexToReference},
{"EntRefToEntIndex", ReferenceToIndex}, {"EntRefToEntIndex", ReferenceToIndex},
{"MakeCompatEntRef", ReferenceToBCompatRef}, {"MakeCompatEntRef", ReferenceToBCompatRef},

View File

@ -148,7 +148,7 @@ SH_DECL_MANUALHOOK0_void(Spawn, 0, 0, 0);
SH_DECL_MANUALHOOK1_void(StartTouch, 0, 0, 0, CBaseEntity *); SH_DECL_MANUALHOOK1_void(StartTouch, 0, 0, 0, CBaseEntity *);
SH_DECL_MANUALHOOK0_void(Think, 0, 0, 0); SH_DECL_MANUALHOOK0_void(Think, 0, 0, 0);
SH_DECL_MANUALHOOK1_void(Touch, 0, 0, 0, CBaseEntity *); SH_DECL_MANUALHOOK1_void(Touch, 0, 0, 0, CBaseEntity *);
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
SH_DECL_MANUALHOOK4_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *, void *); SH_DECL_MANUALHOOK4_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *, void *);
#else #else
SH_DECL_MANUALHOOK3_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *); SH_DECL_MANUALHOOK3_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *);
@ -1244,7 +1244,7 @@ void SDKHooks::Hook_TouchPost(CBaseEntity *pOther)
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK) void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK)
#else #else
void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr) void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr)
@ -1309,7 +1309,7 @@ void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir,
RETURN_META(MRES_IGNORED); RETURN_META(MRES_IGNORED);
} }
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK) void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK)
#else #else
void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr) void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr)

View File

@ -19,7 +19,7 @@
#if SOURCE_ENGINE >= SE_CSS && SOURCE_ENGINE != SE_LEFT4DEAD #if SOURCE_ENGINE >= SE_CSS && SOURCE_ENGINE != SE_LEFT4DEAD
#define GETMAXHEALTH_IS_VIRTUAL #define GETMAXHEALTH_IS_VIRTUAL
#endif #endif
#if SOURCE_ENGINE != SE_ORANGEBOXVALVE && SOURCE_ENGINE != SE_CSS && SOURCE_ENGINE != SE_LEFT4DEAD2 && SOURCE_ENGINE != SE_CSGO #if SOURCE_ENGINE != SE_HL2DM && SOURCE_ENGINE != SE_DODS && SOURCE_ENGINE != SE_CSS && SOURCE_ENGINE != SE_TF2 && SOURCE_ENGINE != SE_LEFT4DEAD2 && SOURCE_ENGINE != SE_CSGO && SOURCE_ENGINE != SE_NUCLEARDAWN
#define GAMEDESC_CAN_CHANGE #define GAMEDESC_CAN_CHANGE
#endif #endif
@ -264,7 +264,7 @@ public:
void Hook_ThinkPost(); void Hook_ThinkPost();
void Hook_Touch(CBaseEntity *pOther); void Hook_Touch(CBaseEntity *pOther);
void Hook_TouchPost(CBaseEntity *pOther); void Hook_TouchPost(CBaseEntity *pOther);
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_TF2
void Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK); void Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK);
void Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK); void Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK);
#else #else

View File

@ -62,7 +62,7 @@ CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *
m_vecReportedPosition = vec3_origin; m_vecReportedPosition = vec3_origin;
m_iAmmoType = -1; m_iAmmoType = -1;
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
m_iDamagedOtherPlayers = 0; m_iDamagedOtherPlayers = 0;
m_iPlayerPenetrateCount = 0; m_iPlayerPenetrateCount = 0;
m_flUnknown = 0.0f; m_flUnknown = 0.0f;

View File

@ -174,7 +174,7 @@ static cell_t GameRules_GetProp(IPluginContext *pContext, const cell_t *params)
is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED); is_unsigned = ((pProp->GetFlags() & SPROP_UNSIGNED) == SPROP_UNSIGNED);
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later // This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (pProp->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;
@ -243,8 +243,7 @@ static cell_t GameRules_SetProp(IPluginContext *pContext, const cell_t *params)
FIND_PROP_SEND(DPT_Int, "integer"); FIND_PROP_SEND(DPT_Int, "integer");
// This isn't in CS:S yet, but will be, doesn't hurt to add now, and will save us a build later #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
#if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_ORANGEBOXVALVE
if (pProp->GetFlags() & SPROP_VARINT) if (pProp->GetFlags() & SPROP_VARINT)
{ {
bit_count = sizeof(int) * 8; bit_count = sizeof(int) * 8;

View File

@ -129,7 +129,7 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p
{ {
return 0; return 0;
} }
#if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_CSGO) #if (SOURCE_ENGINE == SE_CSS) || (SOURCE_ENGINE == SE_HL2DM) || (SOURCE_ENGINE == SE_DODS) || (SOURCE_ENGINE == SE_TF2) || (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2) || (SOURCE_ENGINE == SE_NUCLEARDAWN) || (SOURCE_ENGINE == SE_CSGO)
s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); s_call_addr = memutils->ResolveSymbol(handle, &sig[1]);
#else #else
s_call_addr = dlsym(handle, &sig[1]); s_call_addr = dlsym(handle, &sig[1]);

View File

@ -532,7 +532,7 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
CellRecipientFilter rf; CellRecipientFilter rf;
rf.SetToReliable(true); rf.SetToReliable(true);
rf.Initialize(player_list, total_players); rf.Initialize(player_list, total_players);
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, 0, &pos); engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, 0, &pos);
#elif SOURCE_ENGINE < SE_PORTAL2 #elif SOURCE_ENGINE < SE_PORTAL2
engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, &pos); engsound->EmitSound(rf, params[1], CHAN_AUTO, sound_name, VOL_NORM, ATTN_NORM, 0, PITCH_NORM, &pos);

View File

@ -41,7 +41,7 @@ SH_DECL_HOOK8_void(IVEngineServer, EmitAmbientSound, SH_NOATTRIB, 0, int, const
#if SOURCE_ENGINE >= SE_PORTAL2 #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<Vector> *, bool, float, int); 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<Vector> *, bool, float, int);
SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK17(IEngineSound, EmitSound, SH_NOATTRIB, 1, int, IRecipientFilter &, int, int, const char *, unsigned int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 0, IRecipientFilter &, int, int, const char *, float, float, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int); SH_DECL_HOOK15_void(IEngineSound, EmitSound, SH_NOATTRIB, 1, IRecipientFilter &, int, int, const char *, float, soundlevel_t, int, int, int, const Vector *, const Vector *, CUtlVector<Vector> *, bool, float, int);
#else #else
@ -288,7 +288,7 @@ int SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChanne
float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, float flVolume, soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity) float soundtime, int speakerentity)
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample, void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin, float flVolume, soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
@ -349,7 +349,7 @@ void SoundHooks::OnEmitSound(IRecipientFilter &filter, int iEntIndex, int iChann
(crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, iSoundlevel, nSeed, iFlags, iPitch, pOrigin, (crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, iSoundlevel, nSeed, iFlags, iPitch, pOrigin,
pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity) pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
); );
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
RETURN_META_NEWPARAMS( RETURN_META_NEWPARAMS(
MRES_IGNORED, MRES_IGNORED,
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t, static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char*, float, soundlevel_t,
@ -380,7 +380,7 @@ int SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChann
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity) float soundtime, int speakerentity)
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample, void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSample,
float flVolume, float flAttenuation, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin, float flVolume, float flAttenuation, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
@ -442,7 +442,7 @@ void SoundHooks::OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChan
(crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)), (crf, iEntIndex, iChannel, buffer, -1, buffer, flVolume, SNDLVL_TO_ATTN(static_cast<soundlevel_t>(sndlevel)),
nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity) nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity)
); );
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
RETURN_META_NEWPARAMS( RETURN_META_NEWPARAMS(
MRES_IGNORED, MRES_IGNORED,
static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char *, float, float, static_cast<void (IEngineSound::*)(IRecipientFilter &, int, int, const char *, float, float,
@ -711,7 +711,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
soundtime, soundtime,
speakerentity); speakerentity);
} }
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (g_InSoundHook) if (g_InSoundHook)
{ {
SH_CALL(enginesoundPatch, SH_CALL(enginesoundPatch,
@ -839,7 +839,7 @@ static cell_t EmitSound(IPluginContext *pContext, const cell_t *params)
soundtime, soundtime,
speakerentity); speakerentity);
} }
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #elif SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
if (g_InSoundHook) if (g_InSoundHook)
{ {
SH_CALL(enginesoundPatch, SH_CALL(enginesoundPatch,
@ -1012,7 +1012,7 @@ static cell_t EmitSentence(IPluginContext *pContext, const cell_t *params)
#endif #endif
flags, flags,
pitch, pitch,
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
0, 0,
#endif #endif
pOrigin, pOrigin,

View File

@ -67,7 +67,7 @@ public:
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity); float soundtime, int speakerentity);
#else #else
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #if SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume,
soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin, soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin,
@ -86,7 +86,7 @@ public:
float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin,
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions,
float soundtime, int speakerentity); float soundtime, int speakerentity);
#endif // SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #endif // SOURCE_ENGINE == SE_CSS || SOURCE_ENGINE == SE_HL2DM || SOURCE_ENGINE == SE_DODS || SOURCE_ENGINE == SE_TF2
#endif // SOURCE_ENGINE >= SE_PORTAL2 #endif // SOURCE_ENGINE >= SE_PORTAL2
private: private:
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter); size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter);

View File

@ -1,13 +1,13 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python: # vim: set ts=2 sw=2 tw=99 noet ft=python:
import os import os
if 'ep2v' in SM.sdkInfo: if 'tf2' in SM.sdkInfo:
sdk = SM.sdkInfo['ep2v'] sdk = SM.sdkInfo['tf2']
compiler = SM.DefaultHL2Compiler('extensions/tf2', 'ep2v') compiler = SM.DefaultHL2Compiler('extensions/tf2', 'tf2')
name = 'game.tf2.ext.' + sdk['ext'] name = 'game.tf2.ext.' + sdk['ext']
extension = AMBuild.AddJob(name) extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler) binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, 'ep2v') SM.PreSetupHL2Job(extension, binary, 'tf2')
binary.AddSourceFiles('extensions/tf2', [ binary.AddSourceFiles('extensions/tf2', [
'extension.cpp', 'extension.cpp',
'natives.cpp', 'natives.cpp',
@ -22,7 +22,7 @@ if 'ep2v' in SM.sdkInfo:
'sdk/smsdk_ext.cpp', 'sdk/smsdk_ext.cpp',
'asm/asm.c' 'asm/asm.c'
]) ])
SM.PostSetupHL2Job(extension, binary, 'ep2v') SM.PostSetupHL2Job(extension, binary, 'tf2')
SM.AutoVersion('extensions/tf2', binary) SM.AutoVersion('extensions/tf2', binary)
SM.ExtractDebugInfo(extension, binary) SM.ExtractDebugInfo(extension, binary)
binary.SendToJob() binary.SendToJob()

View File

@ -68,7 +68,6 @@
#define METAMOD_API_MAJOR 2 #define METAMOD_API_MAJOR 2
#define FILENAME_1_4_EP1 "sourcemod.1.ep1" PLATFORM_EXT #define FILENAME_1_4_EP1 "sourcemod.1.ep1" PLATFORM_EXT
#define FILENAME_1_6_EP2 "sourcemod.2.ep2" PLATFORM_EXT #define FILENAME_1_6_EP2 "sourcemod.2.ep2" PLATFORM_EXT
#define FILENAME_1_6_EP2VALVE "sourcemod.2.ep2v" PLATFORM_EXT
#define FILENAME_1_6_EP1 "sourcemod.2.ep1" PLATFORM_EXT #define FILENAME_1_6_EP1 "sourcemod.2.ep1" PLATFORM_EXT
#define FILENAME_1_6_L4D "sourcemod.2.l4d" PLATFORM_EXT #define FILENAME_1_6_L4D "sourcemod.2.l4d" PLATFORM_EXT
#define FILENAME_1_6_DARKM "sourcemod.2.darkm" PLATFORM_EXT #define FILENAME_1_6_DARKM "sourcemod.2.darkm" PLATFORM_EXT
@ -79,6 +78,10 @@
#define FILENAME_1_6_PORTAL2 "sourcemod.2.portal2" PLATFORM_EXT #define FILENAME_1_6_PORTAL2 "sourcemod.2.portal2" PLATFORM_EXT
#define FILENAME_1_6_CSGO "sourcemod.2.csgo" PLATFORM_EXT #define FILENAME_1_6_CSGO "sourcemod.2.csgo" PLATFORM_EXT
#define FILENAME_1_6_CSS "sourcemod.2.css" PLATFORM_EXT #define FILENAME_1_6_CSS "sourcemod.2.css" PLATFORM_EXT
#define FILENAME_1_6_HL2DM "sourcemod.2.hl2dm" PLATFORM_EXT
#define FILENAME_1_6_DODS "sourcemod.2.dods" 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_DOTA "sourcemod.2.dota" PLATFORM_EXT
HINSTANCE g_hCore = NULL; HINSTANCE g_hCore = NULL;
@ -236,16 +239,16 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co
filename = FILENAME_1_6_DARKM; filename = FILENAME_1_6_DARKM;
break; break;
} }
case SOURCE_ENGINE_ORANGEBOXVALVE:
{
filename = FILENAME_1_6_EP2VALVE;
break;
}
case SOURCE_ENGINE_LEFT4DEAD2: case SOURCE_ENGINE_LEFT4DEAD2:
{ {
filename = FILENAME_1_6_L4D2; filename = FILENAME_1_6_L4D2;
break; break;
} }
case SOURCE_ENGINE_NUCLEARDAWN:
{
filename = FILENAME_1_6_ND;
break;
}
case SOURCE_ENGINE_ALIENSWARM: case SOURCE_ENGINE_ALIENSWARM:
{ {
filename = FILENAME_1_6_SWARM; filename = FILENAME_1_6_SWARM;
@ -276,6 +279,42 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co
filename = FILENAME_1_6_CSS; filename = FILENAME_1_6_CSS;
break; break;
} }
case SOURCE_ENGINE_HL2DM:
{
filename = FILENAME_1_6_HL2DM;
break;
}
case SOURCE_ENGINE_DODS:
{
filename = FILENAME_1_6_DODS;
break;
}
case SOURCE_ENGINE_TF2:
{
filename = FILENAME_1_6_TF2;
break;
}
case SOURCE_ENGINE_ORANGEBOXVALVE_DEPRECATED:
{
const char *gamedir = mvi->GetGameDir();
if (strcmp(gamedir, "tf") == 0)
{
filename = FILENAME_1_6_TF2;
}
else if (strcmp(gamedir, "dod") == 0)
{
filename = FILENAME_1_6_DODS;
}
else if (strcmp(gamedir, "hl2mp") == 0)
{
filename = FILENAME_1_6_HL2DM;
}
else
{
return NULL;
}
break;
}
case SOURCE_ENGINE_DOTA: case SOURCE_ENGINE_DOTA:
{ {
filename = FILENAME_1_6_DOTA; filename = FILENAME_1_6_DOTA;

View File

@ -51,13 +51,13 @@ new g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{
new Handle:g_Cvar_Chatmode = INVALID_HANDLE; new Handle:g_Cvar_Chatmode = INVALID_HANDLE;
new g_GameEngine = SOURCE_SDK_UNKNOWN; new EngineVersion:g_GameEngine = Engine_Unknown;
public OnPluginStart() public OnPluginStart()
{ {
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
g_GameEngine = GuessSDKVersion(); g_GameEngine = GetEngineVersion();
g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0); g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0);
@ -67,7 +67,7 @@ public OnPluginStart()
RegAdminCmd("sm_csay", Command_SmCsay, ADMFLAG_CHAT, "sm_csay <message> - sends centered message to all players"); RegAdminCmd("sm_csay", Command_SmCsay, ADMFLAG_CHAT, "sm_csay <message> - sends centered message to all players");
/* HintText does not work on Dark Messiah */ /* HintText does not work on Dark Messiah */
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH) if (g_GameEngine != Engine_DarkMessiah)
{ {
RegAdminCmd("sm_hsay", Command_SmHsay, ADMFLAG_CHAT, "sm_hsay <message> - sends hint message to all players"); RegAdminCmd("sm_hsay", Command_SmHsay, ADMFLAG_CHAT, "sm_hsay <message> - sends hint message to all players");
} }

View File

@ -78,7 +78,7 @@ new UserMsg:g_FadeUserMsgId;
// Serial Generator for Timer Safety // Serial Generator for Timer Safety
new g_Serial_Gen = 0; new g_Serial_Gen = 0;
new g_GameEngine = SOURCE_SDK_UNKNOWN; new EngineVersion:g_GameEngine = Engine_Unknown;
// Flags used in various timers // Flags used in various timers
#define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE #define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE
@ -102,7 +102,7 @@ public OnPluginStart()
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
LoadTranslations("funcommands.phrases"); LoadTranslations("funcommands.phrases");
g_GameEngine = GuessSDKVersion(); g_GameEngine = GetEngineVersion();
g_FadeUserMsgId = GetUserMessageId("Fade"); g_FadeUserMsgId = GetUserMessageId("Fade");
RegisterCvars( ); RegisterCvars( );
@ -185,25 +185,26 @@ public OnMapStart()
PrecacheSound(SOUND_BOOM, true); PrecacheSound(SOUND_BOOM, true);
PrecacheSound(SOUND_FREEZE, true); PrecacheSound(SOUND_FREEZE, true);
new sdkversion = GuessSDKVersion(); new EngineVersion:sdkversion = GetEngineVersion();
if (sdkversion >= SOURCE_SDK_LEFT4DEAD) if (sdkversion == Engine_Left4Dead || sdkversion == Engine_Left4Dead2
|| sdkversion == Engine_AlienSwarm || sdkversion == Engine_CSGO)
{ {
g_BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt"); g_BeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
g_HaloSprite = PrecacheModel("materials/sprites/glow01.vmt"); g_HaloSprite = PrecacheModel("materials/sprites/glow01.vmt");
// l4d, l4d2, and csgo have this. swarm does not. // l4d, l4d2, and csgo have this. swarm does not.
if (sdkversion != SOURCE_SDK_ALIENSWARM) if (sdkversion != Engine_AlienSwarm)
{ {
g_BeamSprite2 = PrecacheModel("materials/sprites/physbeam.vmt"); g_BeamSprite2 = PrecacheModel("materials/sprites/physbeam.vmt");
} }
g_GlowSprite = PrecacheModel("materials/sprites/blueflare1.vmt"); g_GlowSprite = PrecacheModel("materials/sprites/blueflare1.vmt");
if (sdkversion == SOURCE_SDK_LEFT4DEAD || sdkversion == SOURCE_SDK_LEFT4DEAD2) if (sdkversion == Engine_Left4Dead || sdkversion == Engine_Left4Dead2)
{ {
g_ExplosionSprite = PrecacheModel("sprites/floorfire4_.vmt"); g_ExplosionSprite = PrecacheModel("sprites/floorfire4_.vmt");
} }
else if (sdkversion == SOURCE_SDK_ALIENSWARM) else if (sdkversion == Engine_AlienSwarm)
{ {
g_ExplosionSprite = PrecacheModel("sprites/flamelet1.vmt"); g_ExplosionSprite = PrecacheModel("sprites/flamelet1.vmt");
} }

View File

@ -157,7 +157,7 @@ public Action:Timer_Freeze(Handle:timer, any:value)
UnfreezeClient(client); UnfreezeClient(client);
/* HintText doesn't work on Dark Messiah */ /* HintText doesn't work on Dark Messiah */
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH) if (g_GameEngine != Engine_DarkMessiah)
{ {
PrintHintText(client, "%t", "Unfrozen"); PrintHintText(client, "%t", "Unfrozen");
} }
@ -169,7 +169,7 @@ public Action:Timer_Freeze(Handle:timer, any:value)
return Plugin_Stop; return Plugin_Stop;
} }
if (g_GameEngine != SOURCE_SDK_DARKMESSIAH) if (g_GameEngine != Engine_DarkMessiah)
{ {
PrintHintText(client, "%t", "You will be unfrozen", g_FreezeTime[client]); PrintHintText(client, "%t", "You will be unfrozen", g_FreezeTime[client]);
} }

View File

@ -64,6 +64,28 @@ enum DialogType
DialogType_AskConnect /**< ask the client to connect to a specified IP */ DialogType_AskConnect /**< ask the client to connect to a specified IP */
}; };
enum EngineVersion
{
Engine_Unknown, /**< Could not determine the engine version */
Engine_Original, /**< Original Source Engine (used by The Ship) */
Engine_SourceSDK2006, /**< Episode 1 Source Engine (second major SDK) */
Engine_SourceSDK2007, /**< Orange Box Source Engine (third major SDK) */
Engine_Left4Dead, /**< Left 4 Dead */
Engine_DarkMessiah, /**< Dark Messiah Multiplayer (based on original engine) */
Engine_Left4Dead2 = 7, /**< Left 4 Dead 2 */
Engine_AlienSwarm, /**< Alien Swarm (and Alien Swarm SDK) */
Engine_BloodyGoodTime, /**< Bloody Good Time */
Engine_EYE, /**< E.Y.E Divine Cybermancy */
Engine_Portal2, /**< Portal 2 */
Engine_CSGO, /**< Counter-Strike: Global Offensive */
Engine_CSS, /**< Counter-Strike: Source */
Engine_DOTA, /**< Dota 2 */
Engine_HL2DM, /**< Half-Life 2 Deathmatch */
Engine_DODS, /**< Day of Defeat: Source */
Engine_TF2, /**< Team Fortress 2 */
Engine_NuclearDawn /**< Nuclear Dawn */
};
#define INVALID_ENT_REFERENCE 0xFFFFFFFF #define INVALID_ENT_REFERENCE 0xFFFFFFFF
/** /**
@ -264,8 +286,19 @@ native CreateDialog(client, Handle:kv, DialogType:type);
* *
* @return SOURCE_SDK version code. * @return SOURCE_SDK version code.
*/ */
#pragma deprecated See GetEngineVersion()
native GuessSDKVersion(); native GuessSDKVersion();
/**
* Gets the engine version that the currently-loaded SM core was compiled against.
*
* The engine version values are not guaranteed to be in any particular order,
* and should only be compared by (in)equality.
*
* @return An EngineVersion value.
*/
native EngineVersion:GetEngineVersion();
/** /**
* Prints a message to a specific client in the chat area. * Prints a message to a specific client in the chat area.
* *

View File

@ -51,7 +51,7 @@ new Handle:hTopMenu = INVALID_HANDLE;
/* Used to get the SDK / Engine version. */ /* Used to get the SDK / Engine version. */
/* This is used in sm_rename and sm_changeteam */ /* This is used in sm_rename and sm_changeteam */
new g_ModVersion = 0; new EngineVersion:g_ModVersion = Engine_Unknown;
#include "playercommands/slay.sp" #include "playercommands/slay.sp"
#include "playercommands/slap.sp" #include "playercommands/slap.sp"
@ -66,7 +66,7 @@ public OnPluginStart()
RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>"); RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
RegAdminCmd("sm_rename", Command_Rename, ADMFLAG_SLAY, "sm_rename <#userid|name>"); RegAdminCmd("sm_rename", Command_Rename, ADMFLAG_SLAY, "sm_rename <#userid|name>");
g_ModVersion = GuessSDKVersion(); g_ModVersion = GetEngineVersion();
/* Account for late loading */ /* Account for late loading */
new Handle:topmenu; new Handle:topmenu;

View File

@ -38,7 +38,7 @@ PerformRename(client, target)
LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]); LogAction(client, target, "\"%L\" renamed \"%L\" to \"%s\")", client, target, g_NewName[target]);
/* Used on OB / L4D engine */ /* Used on OB / L4D engine */
if (g_ModVersion > SOURCE_SDK_EPISODE1) if (g_ModVersion != Engine_SourceSDK2006)
{ {
SetClientInfo(target, "name", g_NewName[target]); SetClientInfo(target, "name", g_NewName[target]);
} }

View File

@ -55,7 +55,7 @@ new Handle:sm_reserve_type;
new Handle:sm_reserve_maxadmins; new Handle:sm_reserve_maxadmins;
new Handle:sm_reserve_kicktype; new Handle:sm_reserve_kicktype;
new g_SDKVersion; new bool:g_BotsSubtractFromMax;
new g_SourceTV = -1; new g_SourceTV = -1;
new g_Replay = -1; new g_Replay = -1;
@ -80,9 +80,10 @@ public OnPluginStart()
HookConVarChange(sm_reserved_slots, SlotCountChanged); HookConVarChange(sm_reserved_slots, SlotCountChanged);
HookConVarChange(sm_hide_slots, SlotHideChanged); HookConVarChange(sm_hide_slots, SlotHideChanged);
g_SDKVersion = GuessSDKVersion(); new EngineVersion:engineVersion = GetEngineVersion();
g_BotsSubtractFromMax = engineVersion == Engine_TF2 || engineVersion == Engine_CSS || engineVersion == Engine_DODS || engineVersion == Engine_HL2DM;
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE) if (g_BotsSubtractFromMax)
{ {
for (new i = 1; i <= MaxClients; i++) for (new i = 1; i <= MaxClients; i++)
{ {
@ -142,7 +143,7 @@ public Action:OnTimedKick(Handle:timer, any:client)
public OnClientPostAdminCheck(client) public OnClientPostAdminCheck(client)
{ {
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE) if (g_BotsSubtractFromMax)
{ {
if (IsClientSourceTV(client)) if (IsClientSourceTV(client))
{ {
@ -234,7 +235,7 @@ public OnClientPostAdminCheck(client)
public OnClientDisconnect_Post(client) public OnClientDisconnect_Post(client)
{ {
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE) if (g_BotsSubtractFromMax)
{ {
if (client == g_SourceTV) if (client == g_SourceTV)
{ {
@ -296,7 +297,7 @@ SetVisibleMaxSlots(clients, limit)
num = limit; num = limit;
} }
if (g_SDKVersion == SOURCE_SDK_EPISODE2VALVE) if (g_BotsSubtractFromMax)
{ {
if (g_SourceTV > -1) if (g_SourceTV > -1)
{ {

View File

@ -37,7 +37,7 @@ public Action:set_mvps( client, argc )
public Action:get_score( client, argc ) public Action:get_score( client, argc )
{ {
if( GuessSDKVersion() != SOURCE_SDK_CSGO ) if( GetEngineVersion() != Engine_CSGO )
{ {
ReplyToCommand( client, "This command is only intended for CS:GO" ); ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled; return Plugin_Handled;
@ -50,7 +50,7 @@ public Action:get_score( client, argc )
public Action:set_score( client, argc ) public Action:set_score( client, argc )
{ {
if( GuessSDKVersion() != SOURCE_SDK_CSGO ) if( GetEngineVersion() != Engine_CSGO )
{ {
ReplyToCommand( client, "This command is only intended for CS:GO" ); ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled; return Plugin_Handled;
@ -66,7 +66,7 @@ public Action:set_score( client, argc )
public Action:get_assists( client, argc ) public Action:get_assists( client, argc )
{ {
if( GuessSDKVersion() != SOURCE_SDK_CSGO ) if( GetEngineVersion() != Engine_CSGO )
{ {
ReplyToCommand( client, "This command is only intended for CS:GO" ); ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled; return Plugin_Handled;
@ -79,7 +79,7 @@ public Action:get_assists( client, argc )
public Action:set_assists( client, argc ) public Action:set_assists( client, argc )
{ {
if( GuessSDKVersion() != SOURCE_SDK_CSGO ) if( GetEngineVersion() != Engine_CSGO )
{ {
ReplyToCommand( client, "This command is only intended for CS:GO" ); ReplyToCommand( client, "This command is only intended for CS:GO" );
return Plugin_Handled; return Plugin_Handled;

View File

@ -91,5 +91,9 @@
#define SOURCEMOD_BUILD #define SOURCEMOD_BUILD
#endif #endif
#if !defined SM_ARRAYSIZE
#define SM_ARRAYSIZE(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
#endif
#endif //_INCLUDE_SOURCEMOD_PLATFORM_H_ #endif //_INCLUDE_SOURCEMOD_PLATFORM_H_

View File

@ -240,8 +240,8 @@ if 'css' in SM.sdkInfo:
if 'csgo' in SM.sdkInfo: if 'csgo' in SM.sdkInfo:
AddNormalLibrary('game.cstrike.ext.2.csgo', 'extensions') AddNormalLibrary('game.cstrike.ext.2.csgo', 'extensions')
if 'ep2v' in SM.sdkInfo: if 'tf2' in SM.sdkInfo:
AddNormalLibrary('game.tf2.ext.2.ep2v', 'extensions') AddNormalLibrary('game.tf2.ext.2.tf2', 'extensions')
AddNormalLibrary('topmenus.ext', 'extensions') AddNormalLibrary('topmenus.ext', 'extensions')
AddNormalLibrary('regex.ext', 'extensions') AddNormalLibrary('regex.ext', 'extensions')