diff --git a/extension.cpp b/extension.cpp index c9cc725..df25a0b 100644 --- a/extension.cpp +++ b/extension.cpp @@ -94,6 +94,7 @@ CDetour *detourInputTestActivator = NULL; CDetour *detourPostConstructor = NULL; CDetour *detourFindUseEntity = NULL; CDetour *detourCTraceFilterSimple = NULL; +CDetour *detourMultiWaitOver = NULL; DETOUR_DECL_MEMBER1(InputTestActivator, void, inputdata_t *, inputdata) { @@ -139,6 +140,16 @@ DETOUR_DECL_MEMBER3(CTraceFilterSimple, void, const IHandleEntity *, passedict, *(uintptr_t *)this = g_CTraceFilterNoNPCsOrPlayer; } +DETOUR_DECL_MEMBER0(MultiWaitOver, void) +{ + CBaseEntity *pEntity = (CBaseEntity *)this; + edict_t *pEdict = gamehelpers->EdictOfIndex(gamehelpers->EntityToBCompatRef(pEntity)); + if(pEdict) + engine->TriggerMoved(pEdict, true); + + DETOUR_MEMBER_CALL(MultiWaitOver)(); +} + bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) { char conf_error[255] = ""; @@ -184,6 +195,14 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late) } detourCTraceFilterSimple->EnableDetour(); + detourMultiWaitOver = DETOUR_CREATE_MEMBER(MultiWaitOver, "CTriggerMultiple_MultiWaitOver"); + if(detourMultiWaitOver == NULL) + { + snprintf(error, maxlength, "Could not create detour for CTriggerMultiple_MultiWaitOver"); + return false; + } + detourMultiWaitOver->EnableDetour(); + // Find VTable for CTraceFilterNoNPCsOrPlayer uintptr_t pCTraceFilterNoNPCsOrPlayer; if(!g_pGameConf->GetMemSig("CTraceFilterNoNPCsOrPlayer", (void **)(&pCTraceFilterNoNPCsOrPlayer)) || !pCTraceFilterNoNPCsOrPlayer) @@ -268,6 +287,12 @@ void CSSFixes::SDK_OnUnload() detourCTraceFilterSimple = NULL; } + if(detourMultiWaitOver != NULL) + { + detourMultiWaitOver->Destroy(); + detourMultiWaitOver = NULL; + } + gameconfs->CloseGameConfigFile(g_pGameConf); // Revert all applied patches @@ -293,6 +318,7 @@ void CSSFixes::SDK_OnUnload() bool CSSFixes::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late) { + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); return true; } diff --git a/gamedata/CSSFixes.txt b/gamedata/CSSFixes.txt index 6b5e479..a8e4e4f 100644 --- a/gamedata/CSSFixes.txt +++ b/gamedata/CSSFixes.txt @@ -33,6 +33,12 @@ "library" "server" "linux" "@_ZTV26CTraceFilterNoNPCsOrPlayer" } + + "CTriggerMultiple_MultiWaitOver" + { + "library" "server" + "linux" "@_ZN16CTriggerMultiple13MultiWaitOverEv" + } } } } diff --git a/smsdk_config.h b/smsdk_config.h index 8b0bf55..fd728ab 100644 --- a/smsdk_config.h +++ b/smsdk_config.h @@ -40,7 +40,7 @@ /* Basic information exposed publicly */ #define SMEXT_CONF_NAME "CSSFixes" #define SMEXT_CONF_DESCRIPTION "Patches bugs in the CSS server binary." -#define SMEXT_CONF_VERSION "1.1" +#define SMEXT_CONF_VERSION "1.2" #define SMEXT_CONF_AUTHOR "BotoX" #define SMEXT_CONF_URL "" #define SMEXT_CONF_LOGTAG "CSSFIXES"