Make trigger_multiple run full physics code after every wait cycle to work around engine limitation.

This commit is contained in:
BotoX 2016-12-04 14:08:20 +01:00
parent fb39ae0f3c
commit 04b749e985
3 changed files with 33 additions and 1 deletions

View File

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

View File

@ -33,6 +33,12 @@
"library" "server"
"linux" "@_ZTV26CTraceFilterNoNPCsOrPlayer"
}
"CTriggerMultiple_MultiWaitOver"
{
"library" "server"
"linux" "@_ZN16CTriggerMultiple13MultiWaitOverEv"
}
}
}
}

View File

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