This commit is contained in:
David Anderson 2009-02-28 23:15:23 -05:00
commit eb25650e26
22 changed files with 171 additions and 63 deletions

View File

@ -1 +1,4 @@
54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0
e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0
e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1
b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2

View File

@ -2,6 +2,36 @@ SourceMod Changelog
----------------------------
SourceMod 1.1.2 [2009-02-26]
URL: http://wiki.alliedmods.net/SourceMod_1.1.2_Release_Notes
Changes:
- Fixed critical hits being permanently disabled (bug 2674)
----------------------------
SourceMod 1.1.1 [2009-02-25]
URL: http://wiki.alliedmods.net/SourceMod_1.1.1_Release_Notes
Changes:
- Added Age of Chivalry support (bug 3366, IceMatrix).
- Added Obsidian Conflict support (bug 2699, The DOO).
- Fixed compatibility issues with latest TF2 update.
- Fixed crash when an event handler fired an event of the same name (bug 3468).
- Fixed rare crash in the event manager on post hooks (bug 3548).
- Fixed formatting error with zero precision floats (bug 3447).
- Fixed various Insurgency offsets (bug 3544).
- Fixed admin menu (topmenu) categories being selectable when not usable (bug 3256).
- Fixed sm_sql_addgroup not working (bug 3578).
- Fixed memory leak when events were hooked as EventHookMode_Post.
- Fixed nextmap trigger showing wrong output with end-of-map voting disabled and sm_trigger_show set to zero (bug 3597, mr.e.unk).
----------------------------
SourceMod 1.1.0 [2008-12-28]
URL: http://wiki.alliedmods.net/SourceMod_1.1.0_Release_Notes

View File

@ -41,7 +41,7 @@
*/
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_BINTOOLS_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -36,7 +36,9 @@
#ifndef _INCLUDE_CLIENTPREFS_VERSION_H_
#define _INCLUDE_CLIENTPREFS_VERSION_H_
#define SVN_FULL_VERSION "1.1.0-svn"
#define SVN_FILE_VERSION 1,1,0,2230
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0
#endif //_INCLUDE_CLIENTPREFS_VERSION_H_

View File

@ -37,7 +37,7 @@
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_GEOIP_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_MYSQLEXT_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_REGEXEXT_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -39,6 +39,13 @@ CDetour *calcIsAttackCriticalKnifeDetour = NULL;
IForward *g_critForward = NULL;
enum DetourResult
{
Result_Ignore,
Result_NoCrit,
Result_Crit,
};
int CheckBaseHandle(CBaseHandle &hndl)
{
if (!hndl.IsValid())
@ -72,14 +79,14 @@ int CheckBaseHandle(CBaseHandle &hndl)
return index;
}
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
DetourResult DetourCallback(CBaseEntity *pEnt)
{
edict_t *pEdict = gameents->BaseEntityToEdict((CBaseEntity *)this);
edict_t *pEdict = gameents->BaseEntityToEdict((CBaseEntity *)pEnt);
if (!pEdict)
{
g_pSM->LogMessage(myself, "Entity Error");
return false;
return Result_Ignore;
}
sm_sendprop_info_t info;
@ -87,18 +94,18 @@ DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
if (!gamehelpers->FindSendPropInfo(pEdict->GetNetworkable()->GetServerClass()->GetName(), "m_hOwnerEntity", &info))
{
g_pSM->LogMessage(myself, "Offset Error");
return false;
return Result_Ignore;
}
if (!g_critForward)
{
g_pSM->LogMessage(myself, "Invalid Forward");
return false;
return Result_Ignore;
}
int returnValue=0;
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)this + info.actual_offset);
CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pEnt + info.actual_offset);
int index = CheckBaseHandle(hndl);
g_critForward->PushCell(index); //Client index
@ -112,20 +119,80 @@ DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
if (result)
{
return !!returnValue;
if (returnValue)
{
return Result_Crit;
}
else
{
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelper)();
return Result_NoCrit;
}
}
else
{
return Result_Ignore;
}
}
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperMelee, bool)
{
DetourResult result = DetourCallback((CBaseEntity *)this);
if (result == Result_Ignore)
{
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelperMelee)();
}
else if (result == Result_NoCrit)
{
return 0;
}
else
{
return 1;
}
}
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelperKnife, bool)
{
DetourResult result = DetourCallback((CBaseEntity *)this);
if (result == Result_Ignore)
{
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelperKnife)();
}
else if (result == Result_NoCrit)
{
return 0;
}
else
{
return 1;
}
}
DETOUR_DECL_MEMBER0(CalcIsAttackCriticalHelper, bool)
{
DetourResult result = DetourCallback((CBaseEntity *)this);
if (result == Result_Ignore)
{
return DETOUR_MEMBER_CALL(CalcIsAttackCriticalHelper)();
}
else if (result == Result_NoCrit)
{
return 0;
}
else
{
return 1;
}
}
void InitialiseDetours()
{
calcIsAttackCriticalDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCritical");
calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCriticalMelee");
calcIsAttackCriticalKnifeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelper, "CalcCriticalKnife");
calcIsAttackCriticalMeleeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperMelee, "CalcCriticalMelee");
calcIsAttackCriticalKnifeDetour = DETOUR_CREATE_MEMBER(CalcIsAttackCriticalHelperKnife, "CalcCriticalKnife");
bool HookCreated = false;

View File

@ -102,12 +102,16 @@ bool TF2Tools::SDK_OnLoad(char *error, size_t maxlength, bool late)
sharesys->AddNatives(myself, g_TFNatives);
sharesys->RegisterLibrary(myself, "tf2");
plsys->AddPluginsListener(this);
playerhelpers->RegisterCommandTargetProcessor(this);
g_critForward = forwards->CreateForward("TF2_CalcIsAttackCritical", ET_Hook, 4, NULL, Param_Cell, Param_Cell, Param_String, Param_CellByRef);
g_pCVar = icvar;
m_DetoursEnabled = false;
return true;
}
@ -137,16 +141,14 @@ void TF2Tools::SDK_OnUnload()
gameconfs->CloseGameConfigFile(g_pGameConf);
playerhelpers->UnregisterCommandTargetProcessor(this);
forwards->ReleaseForward(g_critForward);
plsys->RemovePluginsListener(this);
RemoveDetours();
forwards->ReleaseForward(g_critForward);
}
void TF2Tools::SDK_OnAllLoaded()
{
SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools);
InitialiseDetours();
}
bool TF2Tools::RegisterConCommandBase(ConCommandBase *pVar)
@ -187,7 +189,6 @@ void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
g_resourceEntity = FindResourceEntity();
}
bool TF2Tools::ProcessCommandTarget(cmd_target_info_t *info)
{
int max_clients;
@ -283,6 +284,23 @@ bool TF2Tools::ProcessCommandTarget(cmd_target_info_t *info)
return true;
}
void TF2Tools::OnPluginLoaded(IPlugin *plugin)
{
if (!m_DetoursEnabled && g_critForward->GetFunctionCount())
{
InitialiseDetours();
m_DetoursEnabled = true;
}
}
void TF2Tools::OnPluginUnloaded(IPlugin *plugin)
{
if (m_DetoursEnabled && !g_critForward->GetFunctionCount())
{
RemoveDetours();
m_DetoursEnabled = false;
}
}
int FindResourceEntity()
{
return FindEntityByNetClass(-1, "CTFPlayerResource");

View File

@ -50,9 +50,10 @@ class TF2Tools :
public SDKExtension,
public ICommandTargetProcessor,
public IConCommandBaseAccessor,
public IGameEventListener2
public IGameEventListener2,
public IPluginsListener
{
public:
public: //SDKExtension
/**
* @brief This is called after the initial loading sequence has been processed.
*
@ -74,11 +75,6 @@ public:
*/
virtual void SDK_OnAllLoaded();
/**
* @brief Called when the pause state is changed.
*/
//virtual void SDK_OnPauseChange(bool paused);
/**
* @brief this is called when Core wants to know if your extension is working.
*
@ -90,12 +86,16 @@ public:
void NotifyInterfaceDrop(SMInterface *pInterface);
bool QueryInterfaceDrop(SMInterface *pInterface);
public:
public: //ICommandTargetProcessor
bool ProcessCommandTarget(cmd_target_info_t *info);
public: //IConCommandBaseAccessor
bool RegisterConCommandBase(ConCommandBase *pVar);
public: //IGameEventManager
IGameEventManager2 *m_GameEventManager;
void FireGameEvent( IGameEvent *event );
public: //IPluginsListener
void OnPluginLoaded(IPlugin *plugin);
void OnPluginUnloaded(IPlugin *plugin);
public:
#if defined SMEXT_CONF_METAMOD
/**
@ -107,28 +107,9 @@ public:
* @return True to succeed, false to fail.
*/
virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
/**
* @brief Called when Metamod is detaching, after the extension version is called.
* NOTE: By default this is blocked unless sent from SourceMod.
*
* @param error Error buffer.
* @param maxlength Maximum size of error buffer.
* @return True to succeed, false to fail.
*/
//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
/**
* @brief Called when Metamod's pause state is changing.
* NOTE: By default this is blocked unless sent from SourceMod.
*
* @param paused Pause state being set.
* @param error Error buffer.
* @param maxlength Maximum size of error buffer.
* @return True to succeed, false to fail.
*/
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
#endif
private:
bool m_DetoursEnabled;
};
enum TFClassType

View File

@ -72,5 +72,6 @@
//#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_LIBSYS
//#define SMEXT_ENABLE_USERMSGS
#define SMEXT_ENABLE_PLUGINSYS
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_

View File

@ -76,6 +76,9 @@
#if defined SMEXT_ENABLE_USERMSGS
#include <IUserMessages.h>
#endif
#if defined SMEXT_ENABLE_PLUGINSYS
#include <IPluginSys.h>
#endif
#if defined SMEXT_CONF_METAMOD
#include <ISmmPlugin.h>
@ -266,6 +269,9 @@ extern ILibrarySys *libsys;
#if defined SMEXT_ENABLE_USERMSGS
extern IUserMessages *usermsgs;
#endif
#if defined SMEXT_ENABLE_PLUGINSYS
extern IPluginManager *plsys;
#endif
#if defined SMEXT_CONF_METAMOD
PLUGIN_GLOBALVARS();

View File

@ -37,7 +37,7 @@
#define _INCLUDE_SDKTOOLS_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -37,7 +37,7 @@
#define _INCLUDE_SQLITEEXT_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -41,7 +41,7 @@
*/
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -39,4 +39,4 @@
#define SOURCEMOD_V_MINOR 2 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.2.0" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "1.2.0-dev" /**< SourceMod version string (major.minor.release.build) */

View File

@ -20,7 +20,7 @@
*/
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0

View File

@ -33,7 +33,7 @@
#define _INCLUDE_JIT_VERSION_H_
#define SM_BUILD_STRING "-dev"
#define SM_BUILD_UNIQUEID "2488:f7f1bbcc85e4" SM_BUILD_STRING
#define SM_BUILD_UNIQUEID "2617:253d6b4f15ab" SM_BUILD_STRING
#define SVN_FULL_VERSION "1.2.0" SM_BUILD_STRING
#define SVN_FILE_VERSION 1,2,0,0