Added support for Alien Swarm (bug 4530, r=dvander).
This commit is contained in:
parent
6cae738f1c
commit
f3fb84d1d0
@ -22,6 +22,8 @@ class SM:
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||
'name': 'DARKMESSIAH'}
|
||||
self.sdkInfo['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '7',
|
||||
'name': 'ALIENSWARM'}
|
||||
|
||||
if AMBuild.mode == 'config':
|
||||
#Detect compilers
|
||||
@ -40,6 +42,7 @@ class SM:
|
||||
#Dark Messiah is Windows-only
|
||||
if AMBuild.target['platform'] == 'windows':
|
||||
envvars['HL2SDK-DARKM'] = 'hl2sdk-darkm'
|
||||
envvars['HL2SDK-SWARM'] = 'hl2sdk-swarm'
|
||||
|
||||
#Must have a path for each envvar (file a bug if you don't like this)
|
||||
for i in envvars:
|
||||
@ -91,6 +94,7 @@ class SM:
|
||||
self.vendor = 'msvc'
|
||||
if AMBuild.options.debug == '1':
|
||||
self.compiler.AddToListVar('CFLAGS', '/MTd')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/NODEFAULTLIB:libcmt')
|
||||
else:
|
||||
self.compiler.AddToListVar('CFLAGS', '/MT')
|
||||
self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
|
||||
@ -124,8 +128,9 @@ class SM:
|
||||
if self.vendor == 'gcc':
|
||||
self.compiler.AddToListVar('CFLAGS', '-O3')
|
||||
elif self.vendor == 'msvc':
|
||||
self.compiler.AddToListVar('CFLAGS', '/Ot')
|
||||
self.compiler.AddToListVar('CFLAGS', '/Ox')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:REF')
|
||||
|
||||
#Debugging
|
||||
if AMBuild.options.debug == '1':
|
||||
@ -217,7 +222,10 @@ class SM:
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
if sdk == 'swarm':
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
|
||||
builder.RebuildIfNewer(libPath)
|
||||
builder['POSTLINKFLAGS'].append(libPath)
|
||||
@ -238,7 +246,8 @@ class SM:
|
||||
|
||||
info = self.sdkInfo
|
||||
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
|
||||
compiler['CDEFINES'].append('SE_DARKMESSIAH=2')
|
||||
if AMBuild.target['platform'] != 'windows':
|
||||
compiler['CDEFINES'].extend(['SE_DARKMESSIAH=2', 'SE_ALIENSWARM=7'])
|
||||
|
||||
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
|
||||
['public', 'tier0'], ['public', 'tier1']]
|
||||
@ -255,6 +264,9 @@ class SM:
|
||||
|
||||
compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
|
||||
|
||||
if sdk == 'swarm' and AMBuild.target['platform'] == 'windows':
|
||||
compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
|
||||
|
||||
if sdk == 'ep1':
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
staticLibs = os.path.join(sdkPath, 'linux_sdk')
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -31,59 +31,59 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
#define _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *cvarIter;
|
||||
#else
|
||||
ConCommandBase *cvarIter;
|
||||
#endif
|
||||
|
||||
public:
|
||||
ConCommandBaseIterator()
|
||||
inline ConCommandBaseIterator() : iter(icvar)
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
#else
|
||||
cvarIter = icvar->GetCommands();
|
||||
#endif
|
||||
}
|
||||
|
||||
~ConCommandBaseIterator()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
g_pMemAlloc->Free(cvarIter);
|
||||
#endif
|
||||
iter.SetFirst();
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->IsValid();
|
||||
#else
|
||||
return cvarIter != NULL;
|
||||
#endif
|
||||
return iter.IsValid();
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
cvarIter->Next();
|
||||
#else
|
||||
cvarIter = const_cast<ConCommandBase*>(cvarIter->GetNext());
|
||||
#endif
|
||||
iter.Next();
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
return cvarIter->Get();
|
||||
#else
|
||||
return cvarIter;
|
||||
#endif
|
||||
return iter.Get();
|
||||
}
|
||||
private:
|
||||
ICvar::Iterator iter;
|
||||
};
|
||||
#else
|
||||
class ConCommandBaseIterator
|
||||
{
|
||||
public:
|
||||
inline ConCommandBaseIterator()
|
||||
{
|
||||
iter = icvar->GetCommands();
|
||||
}
|
||||
|
||||
inline bool IsValid()
|
||||
{
|
||||
return iter != NULL;
|
||||
}
|
||||
|
||||
inline void Next()
|
||||
{
|
||||
iter = const_cast<ConCommandBase *>(iter->GetNext());
|
||||
}
|
||||
|
||||
inline ConCommandBase *Get()
|
||||
{
|
||||
return iter;
|
||||
}
|
||||
private:
|
||||
ConCommandBase *iter;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_SOURCEMOD_CON_COMMAND_BASE_ITERATOR_H_ */
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -161,6 +161,13 @@ void EventManager::FireGameEvent(IGameEvent *pEvent)
|
||||
Just need to add ourselves as a listener to make our hook on IGameEventManager2::FireEvent work */
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int EventManager::GetEventDebugID()
|
||||
{
|
||||
return EVENT_DEBUG_ID_INIT;
|
||||
}
|
||||
#endif
|
||||
|
||||
EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunction, EventHookMode mode)
|
||||
{
|
||||
EventHook *pHook;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -105,6 +105,9 @@ public: // IPluginsListener
|
||||
void OnPluginUnloaded(IPlugin *plugin);
|
||||
public: // IGameEventListener2
|
||||
void FireGameEvent(IGameEvent *pEvent);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
int GetEventDebugID();
|
||||
#endif
|
||||
public:
|
||||
/**
|
||||
* Get the 'GameEvent' handle type ID.
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -65,6 +65,8 @@ CRemoteExtension::CRemoteExtension(IExtensionInterface *pAPI, const char *filena
|
||||
#define GAMEFIX "2.l4d"
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#define GAMEFIX "2.l4d2"
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#define GAMEFIX "2.swarm"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOX
|
||||
#define GAMEFIX "2.ep2"
|
||||
#elif SOURCE_ENGINE == SE_ORANGEBOXVALVE
|
||||
|
@ -117,6 +117,8 @@ static bool DoesEngineMatch(const char *value)
|
||||
if (strcmp(value, "left4dead") == 0)
|
||||
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
if (strcmp(value, "left4dead2") == 0)
|
||||
#elif SOURCE_ENGINE == SE_ALIENSWARM
|
||||
if (strcmp(value, "alienswarm") == 0)
|
||||
#else
|
||||
#error "Unknown engine type"
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -359,13 +359,11 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||
if (g_pSharedChangeInfo != NULL)
|
||||
{
|
||||
#if SOURCE_ENGINE != SE_LEFT4DEAD2
|
||||
if (offset)
|
||||
{
|
||||
pEdict->StateChanged(offset);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pEdict->StateChanged();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -47,7 +47,9 @@
|
||||
#include "sm_trie.h"
|
||||
#include "sourcemod.h"
|
||||
#include <IRootConsoleMenu.h>
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#include "convar_sm_swarm.h"
|
||||
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -34,7 +34,7 @@
|
||||
|
||||
UserMessages g_UserMsgs;
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
SH_DECL_HOOK3(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int, const char *);
|
||||
#else
|
||||
SH_DECL_HOOK2(IVEngineServer, UserMessageBegin, SH_NOATTRIB, 0, bf_write *, IRecipientFilter *, int);
|
||||
@ -168,13 +168,13 @@ bf_write *UserMessages::StartMessage(int msg_id, const cell_t players[], unsigne
|
||||
|
||||
if (m_CurFlags & USERMSG_BLOCKHOOKS)
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = ENGINE_CALL(UserMessageBegin)(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
#endif
|
||||
} else {
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id, g_SMAPI->GetUserMessage(msg_id));
|
||||
#else
|
||||
buffer = engine->UserMessageBegin(static_cast<IRecipientFilter *>(&m_CellRecFilter), msg_id);
|
||||
@ -316,7 +316,7 @@ void UserMessages::_DecRefCounter()
|
||||
}
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_type)
|
||||
@ -346,7 +346,7 @@ bf_write *UserMessages::OnStartMessage_Pre(IRecipientFilter *filter, int msg_typ
|
||||
RETURN_META_VALUE(MRES_IGNORED, NULL);
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name)
|
||||
#else
|
||||
bf_write *UserMessages::OnStartMessage_Post(IRecipientFilter *filter, int msg_type)
|
||||
@ -500,7 +500,7 @@ void UserMessages::OnMessageEnd_Pre()
|
||||
{
|
||||
bf_write *engine_bfw;
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId, g_SMAPI->GetUserMessage(m_CurId));
|
||||
#else
|
||||
engine_bfw = ENGINE_CALL(UserMessageBegin)(m_CurRecFilter, m_CurId);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -79,7 +79,7 @@ public: //IUserMessages
|
||||
IUserMessageListener *pListener,
|
||||
bool intercept=false);
|
||||
public:
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type, const char *msg_name);
|
||||
#else
|
||||
|
@ -386,7 +386,7 @@ public:
|
||||
virtual void SetValue( const char *value );
|
||||
virtual void SetValue( float value );
|
||||
virtual void SetValue( int value );
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
virtual void SetValue( Color value );
|
||||
#endif
|
||||
|
||||
@ -404,6 +404,9 @@ private:
|
||||
// For CVARs marked FCVAR_NEVER_AS_STRING
|
||||
virtual void InternalSetFloatValue( float fNewValue );
|
||||
virtual void InternalSetIntValue( int nValue );
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
virtual void InternalSetColorValue( Color value );
|
||||
#endif
|
||||
|
||||
virtual bool ClampValue( float& value );
|
||||
virtual void ChangeStringValue( const char *tempVal, float flOldValue );
|
||||
|
1032
core/convar_sm_swarm.h
Normal file
1032
core/convar_sm_swarm.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -45,6 +45,7 @@
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "Logger.h"
|
||||
#include "ConsoleDetours.h"
|
||||
#include "ConCommandBaseIterator.h"
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOXVALVE
|
||||
#define NETMSG_BITS 6
|
||||
@ -52,7 +53,7 @@
|
||||
#define NETMSG_BITS 5
|
||||
#endif
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
#define NET_SETCONVAR 6
|
||||
#else
|
||||
#define NET_SETCONVAR 5
|
||||
@ -73,15 +74,6 @@ struct GlobCmdIter
|
||||
List<ConCmdInfo *>::iterator iter;
|
||||
};
|
||||
|
||||
struct ConCmdIter
|
||||
{
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *pLast;
|
||||
#else
|
||||
const ConCommandBase *pLast;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ConsoleHelpers :
|
||||
public SMGlobalClass,
|
||||
public IHandleTypeDispatch
|
||||
@ -108,11 +100,7 @@ public:
|
||||
}
|
||||
else if (type == htConCmdIter)
|
||||
{
|
||||
ConCmdIter *iter = (ConCmdIter * )object;
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
// ICvarIteratorInternal has no virtual destructor
|
||||
g_pMemAlloc->Free(iter->pLast);
|
||||
#endif
|
||||
ConCommandBaseIterator *iter = (ConCommandBaseIterator * )object;
|
||||
delete iter;
|
||||
}
|
||||
}
|
||||
@ -120,7 +108,7 @@ public:
|
||||
{
|
||||
if (type == htConCmdIter)
|
||||
{
|
||||
*pSize = sizeof(ConCmdIter);
|
||||
*pSize = sizeof(ConCommandBaseIterator);
|
||||
return true;
|
||||
}
|
||||
else if (type == hCmdIterType)
|
||||
@ -1202,7 +1190,7 @@ static cell_t GetCommandFlags(IPluginContext *pContext, const cell_t *params)
|
||||
static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
Handle_t hndl;
|
||||
ConCmdIter *pIter;
|
||||
ConCommandBaseIterator *pIter;
|
||||
cell_t *pIsCmd, *pFlags;
|
||||
const ConCommandBase *pConCmd;
|
||||
const char *desc;
|
||||
@ -1210,21 +1198,15 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
||||
pContext->LocalToPhysAddr(params[3], &pIsCmd);
|
||||
pContext->LocalToPhysAddr(params[4], &pFlags);
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *cvarIter = icvar->FactoryInternalIterator();
|
||||
cvarIter->SetFirst();
|
||||
if (!cvarIter->IsValid())
|
||||
pIter = new ConCommandBaseIterator();
|
||||
|
||||
if (!pIter->IsValid())
|
||||
{
|
||||
delete pIter;
|
||||
return BAD_HANDLE;
|
||||
}
|
||||
pConCmd = cvarIter->Get();
|
||||
#else
|
||||
pConCmd = icvar->GetCommands();
|
||||
if (pConCmd == NULL)
|
||||
{
|
||||
return BAD_HANDLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
pConCmd = pIter->Get();
|
||||
|
||||
pContext->StringToLocalUTF8(params[1], params[2], pConCmd->GetName(), NULL);
|
||||
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
|
||||
@ -1236,13 +1218,6 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
||||
pContext->StringToLocalUTF8(params[5], params[6], (desc && desc[0]) ? desc : "", NULL);
|
||||
}
|
||||
|
||||
pIter = new ConCmdIter;
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
pIter->pLast = cvarIter;
|
||||
#else
|
||||
pIter->pLast = pConCmd;
|
||||
#endif
|
||||
|
||||
if ((hndl = g_HandleSys.CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
|
||||
== BAD_HANDLE)
|
||||
{
|
||||
@ -1256,7 +1231,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
|
||||
static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
HandleError err;
|
||||
ConCmdIter *pIter;
|
||||
ConCommandBaseIterator *pIter;
|
||||
cell_t *pIsCmd, *pFlags;
|
||||
const char *desc;
|
||||
const ConCommandBase *pConCmd;
|
||||
@ -1267,27 +1242,17 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", params[1], err);
|
||||
}
|
||||
|
||||
if (pIter->pLast == NULL)
|
||||
if (!pIter->IsValid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
ICvarIteratorInternal *cvarIter = pIter->pLast;
|
||||
cvarIter->Next();
|
||||
if (!cvarIter->IsValid())
|
||||
pIter->Next();
|
||||
if (!pIter->IsValid())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pConCmd = cvarIter->Get();
|
||||
#else
|
||||
pConCmd = pIter->pLast->GetNext();
|
||||
if (pConCmd == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pIter->pLast = pConCmd;
|
||||
#endif
|
||||
pConCmd = pIter->Get();
|
||||
|
||||
pContext->LocalToPhysAddr(params[4], &pIsCmd);
|
||||
pContext->LocalToPhysAddr(params[5], &pFlags);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -859,7 +859,7 @@ static cell_t FindDataMapOffs(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
}
|
||||
|
||||
return td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
return GetTypeDescOffs(td);
|
||||
}
|
||||
|
||||
static cell_t GetEntDataString(IPluginContext *pContext, const cell_t *params)
|
||||
@ -1003,7 +1003,7 @@ static cell_t GetEntProp(IPluginContext *pContext, const cell_t *params)
|
||||
td->fieldType);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1092,7 +1092,7 @@ static cell_t SetEntProp(IPluginContext *pContext, const cell_t *params)
|
||||
td->fieldType);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1183,7 +1183,7 @@ static cell_t GetEntPropFloat(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_TIME);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1252,7 +1252,7 @@ static cell_t SetEntPropFloat(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_TIME);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1324,7 +1324,7 @@ static cell_t GetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_EHANDLE);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1392,7 +1392,7 @@ static cell_t SetEntPropEnt(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_EHANDLE);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1483,7 +1483,7 @@ static cell_t GetEntPropVector(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_POSITION_VECTOR);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1559,7 +1559,7 @@ static cell_t SetEntPropVector(IPluginContext *pContext, const cell_t *params)
|
||||
FIELD_POSITION_VECTOR);
|
||||
}
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1646,7 +1646,7 @@ static cell_t GetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
bIsStringIndex = (td->fieldType != FIELD_CHARACTER);
|
||||
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
break;
|
||||
}
|
||||
case Prop_Send:
|
||||
@ -1725,7 +1725,7 @@ static cell_t SetEntPropString(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
return pContext->ThrowNativeError("Property \"%s\" is not a valid string", prop);
|
||||
}
|
||||
offset = td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(td);
|
||||
maxlen = td->fieldSize;
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -73,7 +73,7 @@ static cell_t IsDedicatedServer(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_LEFT4DEAD2
|
||||
float fTime = Plat_FloatTime();
|
||||
#else
|
||||
float fTime = engine->Time();
|
||||
@ -465,6 +465,8 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||
return 40;
|
||||
case SOURCE_ENGINE_LEFT4DEAD2:
|
||||
return 50;
|
||||
case SOURCE_ENGINE_ALIENSWARM:
|
||||
return 60;
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -32,7 +32,9 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
#define _INCLUDE_SOURCEMOD_MM_API_H_
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE == SE_ALIENSWARM
|
||||
#include "convar_sm_swarm.h"
|
||||
#elif (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#include "convar_sm_l4d.h"
|
||||
#elif (SOURCE_ENGINE == SE_ORANGEBOX) || (SOURCE_ENGINE == SE_ORANGEBOXVALVE)
|
||||
#include "convar_sm_ob.h"
|
||||
|
@ -438,7 +438,7 @@ const char *EntityOutputManager::FindOutputName(void *pOutput, CBaseEntity *pCal
|
||||
{
|
||||
if (pMap->dataDesc[i].flags & FTYPEDESC_OUTPUT)
|
||||
{
|
||||
if ((char *)pCaller + pMap->dataDesc[i].fieldOffset[0] == pOutput)
|
||||
if ((char *)pCaller + GetTypeDescOffs(&pMap->dataDesc[i]) == pOutput)
|
||||
{
|
||||
return pMap->dataDesc[i].externalName;
|
||||
}
|
||||
@ -457,7 +457,7 @@ const char *EntityOutputManager::GetEntityClassname(CBaseEntity *pEntity)
|
||||
{
|
||||
datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
||||
typedescription_t *pDesc = gamehelpers->FindInDataMap(pMap, "m_iClassname");
|
||||
offset = pDesc->fieldOffset[TD_OFFSET_NORMAL];
|
||||
offset = GetTypeDescOffs(pDesc);
|
||||
}
|
||||
|
||||
return *(const char **)(((unsigned char *)pEntity) + offset);
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SDKTools Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -530,8 +530,8 @@ static cell_t smn_TRGetPointContents(IPluginContext *pContext, const cell_t *par
|
||||
{
|
||||
mask = enginetrace->GetPointContents(pos);
|
||||
} else {
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
mask = enginetrace->GetPointContents(pos, 0, &hentity);
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
mask = enginetrace->GetPointContents(pos, MASK_ALL, &hentity);
|
||||
#else
|
||||
mask = enginetrace->GetPointContents(pos, &hentity);
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SDKTools Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -600,7 +600,7 @@ CON_COMMAND(sm_dump_classes, "Dumps the class list as a text file")
|
||||
fprintf(fp,"%s - %s\n",sclass->GetName(), dict->m_Factories.GetElementName(i));
|
||||
|
||||
typedescription_t *datamap = gamehelpers->FindInDataMap(gamehelpers->GetDataMap(entity->GetBaseEntity()), "m_iEFlags");
|
||||
int *eflags = (int *)((char *)entity->GetBaseEntity() + datamap->fieldOffset[TD_OFFSET_NORMAL]);
|
||||
int *eflags = (int *)((char *)entity->GetBaseEntity() + GetTypeDescOffs(datamap));
|
||||
*eflags |= (1<<0); // EFL_KILLME
|
||||
}
|
||||
|
||||
@ -816,7 +816,7 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
|
||||
continue;
|
||||
}
|
||||
|
||||
int *eflags = (int *)((char *)entity->GetBaseEntity() + datamap->fieldOffset[TD_OFFSET_NORMAL]);
|
||||
int *eflags = (int *)((char *)entity->GetBaseEntity() + GetTypeDescOffs(datamap));
|
||||
*eflags |= (1<<0); // EFL_KILLME
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod SDKTools Extension
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -541,7 +541,7 @@ static cell_t SlapPlayer(IPluginContext *pContext, const cell_t *params)
|
||||
typedescription_t *pType = gamehelpers->FindInDataMap(pMap, frag_prop);
|
||||
if (pType != NULL)
|
||||
{
|
||||
s_frag_offs = pType->fieldOffset[TD_OFFSET_NORMAL];
|
||||
s_frag_offs = GetTypeDescOffs(pType);
|
||||
}
|
||||
}
|
||||
if (!s_frag_offs)
|
||||
@ -657,7 +657,7 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
|
||||
return gamehelpers->EntityToBCompatRef(pEntity);
|
||||
}
|
||||
|
||||
#if (SOURCE_ENGINE == SE_LEFT4DEAD) || (SOURCE_ENGINE == SE_LEFT4DEAD2)
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
static ValveCall *pCall = NULL;
|
||||
@ -713,7 +713,7 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SOURCE_ENGINE == SE_LEFT4DEAD2
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD2
|
||||
static cell_t DispatchSpawn(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
static ValveCall *pCall = NULL;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 sw=4 tw=99 noet :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -69,6 +69,7 @@
|
||||
#define FILENAME_1_6_L4D "sourcemod.2.l4d" PLATFORM_EXT
|
||||
#define FILENAME_1_6_DARKM "sourcemod.2.darkm" PLATFORM_EXT
|
||||
#define FILENAME_1_6_L4D2 "sourcemod.2.l4d2" PLATFORM_EXT
|
||||
#define FILENAME_1_6_SWARM "sourcemod.2.swarm" PLATFORM_EXT
|
||||
|
||||
HINSTANCE g_hCore = NULL;
|
||||
bool load_attempted = false;
|
||||
@ -235,6 +236,11 @@ DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, co
|
||||
filename = FILENAME_1_6_L4D2;
|
||||
break;
|
||||
}
|
||||
case SOURCE_ENGINE_ALIENSWARM:
|
||||
{
|
||||
filename = FILENAME_1_6_SWARM;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return NULL;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#define SOURCE_SDK_EPISODE2VALVE 35 /**< SDK+Engine released after Episode 2/Orange Box */
|
||||
#define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */
|
||||
#define SOURCE_SDK_LEFT4DEAD2 50 /**< Engine released after Left 4 Dead 2 (no SDK yet) */
|
||||
#define SOURCE_SDK_ALIENSWARM 60 /**< SDK+Engine released after Alien Swarm */
|
||||
|
||||
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
|
||||
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -32,6 +32,8 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
|
||||
#define _INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
|
||||
|
||||
#include <datamap.h>
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
#define CONVAR_REGISTER(object) ConVar_Register(0, object)
|
||||
|
||||
@ -123,16 +125,20 @@
|
||||
#if SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
inline int IndexOfEdict(const edict_t *pEdict)
|
||||
{
|
||||
return (int)(pEdict - gpGlobals->baseEdict);
|
||||
return (int)(pEdict - gpGlobals->pEdicts);
|
||||
}
|
||||
inline edict_t *PEntityOfEntIndex(int iEntIndex)
|
||||
{
|
||||
if (iEntIndex >= 0 && iEntIndex < gpGlobals->maxEntities)
|
||||
{
|
||||
return (edict_t *)(gpGlobals->baseEdict + iEntIndex);
|
||||
return (edict_t *)(gpGlobals->pEdicts + iEntIndex);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
inline int GetTypeDescOffs(typedescription_t *td)
|
||||
{
|
||||
return td->fieldOffset;
|
||||
}
|
||||
#else
|
||||
inline int IndexOfEdict(const edict_t *pEdict)
|
||||
{
|
||||
@ -142,6 +148,10 @@
|
||||
{
|
||||
return engine->PEntityOfEntIndex(iEntIndex);
|
||||
}
|
||||
inline int GetTypeDescOffs(typedescription_t *td)
|
||||
{
|
||||
return td->fieldOffset[TD_OFFSET_NORMAL];
|
||||
}
|
||||
#endif //SOURCE_ENGINE >= SE_LEFT4DEAD
|
||||
|
||||
#endif //_INCLUDE_SOURCEMOD_COMPAT_WRAPPERS_H_
|
||||
|
@ -2,7 +2,7 @@
|
||||
* vim: set ts=4 :
|
||||
* =============================================================================
|
||||
* SourceMod
|
||||
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
|
||||
* Copyright (C) 2004-2010 AlliedModders LLC. All rights reserved.
|
||||
* =============================================================================
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
@ -38,7 +38,9 @@
|
||||
*/
|
||||
|
||||
#if defined WIN32 || defined WIN64
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
#define PLATFORM_WINDOWS
|
||||
#endif
|
||||
#if !defined WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user