diff --git a/.hgtags b/.hgtags index f70ea689..f6280ee3 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,4 @@ 54539fa4e51f98d7841c853c1370dff6ccd3cdf2 sourcemod-1.0.0 +e6ef5ecdf8d75740ca2685a709bf321f8873bc3b sourcemod-1.1.0 +e877885fac80be71822641f7a9122cebc9812521 sourcemod-1.1.1 +b3ffa8a4511c4eadaf533fc790aa6b14f7f0c6ea sourcemod-1.1.2 diff --git a/changelog.txt b/changelog.txt index c9a5d245..59932958 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/core/sm_version.h b/core/sm_version.h index b4e4e66f..f60ae58b 100644 --- a/core/sm_version.h +++ b/core/sm_version.h @@ -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 diff --git a/extensions/bintools/svn_version.h b/extensions/bintools/svn_version.h index be2ad203..e105e20e 100644 --- a/extensions/bintools/svn_version.h +++ b/extensions/bintools/svn_version.h @@ -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 diff --git a/extensions/clientprefs/svn_version.h b/extensions/clientprefs/svn_version.h index 2fb0d028..e5a06f5d 100644 --- a/extensions/clientprefs/svn_version.h +++ b/extensions/clientprefs/svn_version.h @@ -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_ diff --git a/extensions/cstrike/svn_version.h b/extensions/cstrike/svn_version.h index ce7a2251..92e803d6 100644 --- a/extensions/cstrike/svn_version.h +++ b/extensions/cstrike/svn_version.h @@ -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 diff --git a/extensions/geoip/svn_version.h b/extensions/geoip/svn_version.h index 32921324..c317ba01 100644 --- a/extensions/geoip/svn_version.h +++ b/extensions/geoip/svn_version.h @@ -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 diff --git a/extensions/mysql/svn_version.h b/extensions/mysql/svn_version.h index 37511c6b..0589a657 100644 --- a/extensions/mysql/svn_version.h +++ b/extensions/mysql/svn_version.h @@ -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 diff --git a/extensions/regex/svn_version.h b/extensions/regex/svn_version.h index 85db0632..e4a0af6c 100644 --- a/extensions/regex/svn_version.h +++ b/extensions/regex/svn_version.h @@ -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 diff --git a/extensions/sdktools/svn_version.h b/extensions/sdktools/svn_version.h index deb69f99..f99df582 100644 --- a/extensions/sdktools/svn_version.h +++ b/extensions/sdktools/svn_version.h @@ -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 diff --git a/extensions/sqlite/svn_version.h b/extensions/sqlite/svn_version.h index 6bf7f726..c9ef04fa 100644 --- a/extensions/sqlite/svn_version.h +++ b/extensions/sqlite/svn_version.h @@ -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 diff --git a/extensions/tf2/criticals.cpp b/extensions/tf2/criticals.cpp index 81312f08..7d6233e7 100644 --- a/extensions/tf2/criticals.cpp +++ b/extensions/tf2/criticals.cpp @@ -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 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; diff --git a/extensions/tf2/extension.cpp b/extensions/tf2/extension.cpp index 71cdc5a0..a7a5f09f 100644 --- a/extensions/tf2/extension.cpp +++ b/extensions/tf2/extension.cpp @@ -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"); diff --git a/extensions/tf2/extension.h b/extensions/tf2/extension.h index be9482d2..ac94d966 100644 --- a/extensions/tf2/extension.h +++ b/extensions/tf2/extension.h @@ -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 diff --git a/extensions/tf2/sdk/smsdk_config.h b/extensions/tf2/sdk/smsdk_config.h index a9d6638c..fe342bd2 100644 --- a/extensions/tf2/sdk/smsdk_config.h +++ b/extensions/tf2/sdk/smsdk_config.h @@ -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_ diff --git a/extensions/tf2/sdk/smsdk_ext.h b/extensions/tf2/sdk/smsdk_ext.h index 3d5a229d..a2fabeb9 100644 --- a/extensions/tf2/sdk/smsdk_ext.h +++ b/extensions/tf2/sdk/smsdk_ext.h @@ -76,6 +76,9 @@ #if defined SMEXT_ENABLE_USERMSGS #include #endif +#if defined SMEXT_ENABLE_PLUGINSYS +#include +#endif #if defined SMEXT_CONF_METAMOD #include @@ -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(); diff --git a/extensions/tf2/svn_version.h b/extensions/tf2/svn_version.h index 83fd8e2b..0733fce7 100644 --- a/extensions/tf2/svn_version.h +++ b/extensions/tf2/svn_version.h @@ -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 diff --git a/extensions/topmenus/svn_version.h b/extensions/topmenus/svn_version.h index 7f2b24d9..45b65612 100644 --- a/extensions/topmenus/svn_version.h +++ b/extensions/topmenus/svn_version.h @@ -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 diff --git a/loader/svn_version.h b/loader/svn_version.h index b4e4e66f..f60ae58b 100644 --- a/loader/svn_version.h +++ b/loader/svn_version.h @@ -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 diff --git a/plugins/include/version.inc b/plugins/include/version.inc index ac5d4080..6c53d3ee 100644 --- a/plugins/include/version.inc +++ b/plugins/include/version.inc @@ -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) */ diff --git a/sourcepawn/compiler/svn_version.h b/sourcepawn/compiler/svn_version.h index 62af601d..624aba28 100644 --- a/sourcepawn/compiler/svn_version.h +++ b/sourcepawn/compiler/svn_version.h @@ -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 diff --git a/sourcepawn/jit/jit_version.h b/sourcepawn/jit/jit_version.h index 8475f490..6a0f447f 100644 --- a/sourcepawn/jit/jit_version.h +++ b/sourcepawn/jit/jit_version.h @@ -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