1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

Added support for Dota 2 (bug 5640).

This commit is contained in:
Nicholas Hastings 2013-03-04 10:38:17 -05:00
parent afa0fcaa74
commit 0f2d7aa234
6 changed files with 20 additions and 7 deletions

View File

@ -31,6 +31,8 @@ class MMS:
'name': 'EYE', 'platform': ['windows']}
self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '12',
'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin']}
self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '13',
'name': 'DOTA', 'platform': ['windows']}
# self.possibleSdks['portal2'] = {'sdk': 'HL2SDK-PORTAL2', 'ext': '2.portal2', 'def': '11',
# 'name': 'PORTAL2', 'platform': ['windows']}
@ -58,6 +60,7 @@ class MMS:
envvars['HL2SDK-SWARM'] = 'hl2sdk-swarm'
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
envvars['HL2SDK-DOTA'] = 'hl2sdk-dota'
# Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary`
def findDictByKey(dictionary, key, value):
@ -309,7 +312,7 @@ class MMS:
job.AddCommand(SymlinkCommand(link, target))
elif AMBuild.target['platform'] == 'windows':
libs = ['tier0', 'tier1', 'vstdlib']
if sdk in ['swarm', 'csgo']:
if sdk in ['swarm', 'csgo', 'dota']:
libs.append('interfaces')
for lib in libs:
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
@ -319,7 +322,7 @@ class MMS:
def PostSetupHL2Job(self, job, builder, sdk):
if AMBuild.target['platform'] in ['linux', 'darwin']:
builder.AddObjectFiles(['tier1_i486.a'])
if( sdk == 'csgo' ):
if( sdk in ['csgo', 'dota'] ):
builder.AddObjectFiles(['interfaces_i486.a'])
def DefaultHL2Compiler(self, path, sdk, noLink = False):
@ -351,7 +354,7 @@ class MMS:
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
if sdk in ['swarm', 'csgo']:
if sdk in ['swarm', 'csgo', 'dota']:
if AMBuild.target['platform'] == 'windows':
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
else:

View File

@ -56,6 +56,7 @@ enum
#define SOURCE_ENGINE_PORTAL2 11 /**< Portal 2 */
#define SOURCE_ENGINE_CSGO 12 /**< Counter-Strike: Global Offensive */
#define SOURCE_ENGINE_CSS 13 /**< Counter-Strike: Source (sometimes older version of Orange Box Valve) */
#define SOURCE_ENGINE_DOTA 14 /**< Dota 2 */
#define METAMOD_PLAPI_VERSION 15 /**< Version of this header file */
#define METAMOD_PLAPI_NAME "ISmmPlugin" /**< Name of the plugin interface */

View File

@ -133,6 +133,8 @@ bool Command_Meta(IMetamodSourceCommandInfo *info)
CONMSG(" Engine: Portal 2 (2011)\n");
#elif SOURCE_ENGINE == SE_CSGO
CONMSG(" Engine: Counter-Strike: Global Offensive (2012)\n");
#elif SOURCE_ENGINE == SE_DOTA
CONMSG(" Engine: Dota 2 (2013)\n");
#else
#error "SOURCE_ENGINE not defined to a known value"
#endif

View File

@ -315,7 +315,7 @@ void BaseProvider::UnregisterConCommandBase(ConCommandBase *pCommand)
int BaseProvider::GetUserMessageCount()
{
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
return -1;
#else
return (int)usermsgs_list.size();
@ -383,6 +383,8 @@ int BaseProvider::DetermineSourceEngine(const char *game)
return SOURCE_ENGINE_PORTAL2;
#elif SOURCE_ENGINE == SE_CSGO
return SOURCE_ENGINE_CSGO;
#elif SOURCE_ENGINE == SE_DOTA
return SOURCE_ENGINE_DOTA;
#else
#error "SOURCE_ENGINE not defined to a known value"
#endif
@ -526,7 +528,7 @@ void ClientCommand(edict_t *pEdict)
RETURN_META(MRES_IGNORED);
}
#if SOURCE_ENGINE == SE_CSGO
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
void CacheUserMessages()
{

View File

@ -81,7 +81,8 @@ static const char *backend_names[] =
"2.l4d2",
"2.swarm",
"2.portal2",
"2.csgo"
"2.csgo",
"2.dota",
};
#if defined _WIN32
@ -281,7 +282,10 @@ mm_DetermineBackend(QueryValveInterface engineFactory, const char *game_name)
/* Check for L4D */
if (engineFactory("VEngineServer023", NULL) != NULL)
{
return MMBackend_CSGO;
if (engineFactory("ISERVERPLUGINHELPERS001", NULL) != NULL)
return MMBackend_CSGO;
else
return MMBackend_DOTA;
}
else if (engineFactory("VEngineServer022", NULL) != NULL &&
engineFactory("VEngineCvar007", NULL) != NULL)

View File

@ -92,6 +92,7 @@ enum MetamodBackend
MMBackend_AlienSwarm,
MMBackend_Portal2,
MMBackend_CSGO,
MMBackend_DOTA,
MMBackend_UNKNOWN
};