Added support for Alien Swarm (bug 4530, r=dvander).

This commit is contained in:
Scott Ehlert 2010-07-27 17:32:32 -05:00
parent b3144dd19a
commit dd44a0aaea
24 changed files with 1185 additions and 139 deletions

View File

@ -21,6 +21,8 @@ class SM:
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux']}
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
'name': 'DARKMESSIAH', 'platform': ['windows']}
self.sdkInfo['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '7',
'name': 'ALIENSWARM', 'platform': ['windows']}
if AMBuild.mode == 'config':
#Detect compilers
@ -41,6 +43,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:
@ -93,6 +96,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')
@ -253,7 +257,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)
@ -290,6 +297,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')

View File

@ -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_ */

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -360,13 +360,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();
}

View File

@ -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"

View File

@ -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);

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
* vim: set ts=4 sw=4 :
* =============================================================================
* 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
@ -145,6 +145,8 @@ static const char *get_source_engine_name()
return "left4dead";
#elif SOURCE_ENGINE == SE_LEFT4DEAD2
return "left4dead2";
#elif SOURCE_ENGINE == SE_ALIENSWARM
return "alienswarm";
#endif
}

View File

@ -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)
@ -1199,7 +1187,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;
@ -1207,21 +1195,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;
@ -1233,13 +1215,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)
{
@ -1253,7 +1228,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;
@ -1264,27 +1239,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);

View File

@ -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
@ -860,7 +860,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)
@ -1004,7 +1004,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:
@ -1093,7 +1093,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:
@ -1184,7 +1184,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:
@ -1253,7 +1253,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:
@ -1325,7 +1325,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:
@ -1393,7 +1393,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:
@ -1484,7 +1484,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:
@ -1560,7 +1560,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:
@ -1647,7 +1647,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:
@ -1726,7 +1726,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;
}

View File

@ -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

View File

@ -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"

View File

@ -330,7 +330,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;
}
@ -349,7 +349,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);

View File

@ -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

View File

@ -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
}

View File

@ -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;

View File

@ -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
@ -73,6 +73,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;
@ -239,6 +240,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;

View File

@ -42,7 +42,7 @@
#define SOURCE_SDK_EPISODE2 30 /**< SDK+Engine released after Episode 2/Orange Box */
#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_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 */

View File

@ -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_

View File

@ -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