Compare commits

..
Author SHA1 Message Date
BotoX bf580a7134 reorder function calls 2019-09-02 23:15:08 +02:00
BotoX 2fdb11ef1e Fix wrong timeleft calculation 2019-09-02 19:43:39 +02:00
4 changed files with 33 additions and 25 deletions
-8
View File
@@ -36,11 +36,7 @@
#if SOURCE_ENGINE >= SE_ORANGEBOX #if SOURCE_ENGINE >= SE_ORANGEBOX
SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *); SH_DECL_HOOK1_void(ICvar, UnregisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
#if SOURCE_ENGINE == SE_CSGO
SH_DECL_HOOK2_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *, bool);
#else
SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *); SH_DECL_HOOK1_void(ICvar, RegisterConCommand, SH_NOATTRIB, 0, ConCommandBase *);
#endif
#else #else
SH_DECL_HOOK1_void(ICvar, RegisterConCommandBase, SH_NOATTRIB, 0, ConCommandBase *); SH_DECL_HOOK1_void(ICvar, RegisterConCommandBase, SH_NOATTRIB, 0, ConCommandBase *);
#endif #endif
@@ -82,11 +78,7 @@ public:
#endif #endif
} }
#if SOURCE_ENGINE == SE_CSGO
void LinkConCommandBase(ConCommandBase *pBase, bool unknown)
#else
void LinkConCommandBase(ConCommandBase *pBase) void LinkConCommandBase(ConCommandBase *pBase)
#endif
{ {
IConCommandLinkListener *listener = IConCommandLinkListener::head; IConCommandLinkListener *listener = IConCommandLinkListener::head;
while (listener) while (listener)
+17
View File
@@ -52,6 +52,7 @@ void EntityOutputManager::Shutdown()
return; return;
} }
EntityOutputs->Destroy();
ClassNames->Destroy(); ClassNames->Destroy();
fireOutputDetour->Destroy(); fireOutputDetour->Destroy();
} }
@@ -65,6 +66,7 @@ void EntityOutputManager::Init()
return; return;
} }
EntityOutputs = adtfactory->CreateBasicTrie();
ClassNames = adtfactory->CreateBasicTrie(); ClassNames = adtfactory->CreateBasicTrie();
} }
@@ -118,9 +120,17 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
return true; return true;
} }
char sOutput[20];
ke::SafeSprintf(sOutput, sizeof(sOutput), "%p", pOutput);
// attempt to directly lookup a hook using the pOutput pointer // attempt to directly lookup a hook using the pOutput pointer
OutputNameStruct *pOutputName = NULL; OutputNameStruct *pOutputName = NULL;
bool fastLookup = false;
// Fast lookup failed - check the slow way for hooks that haven't fired yet
if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false)
{
const char *classname = gamehelpers->GetEntityClassname(pCaller); const char *classname = gamehelpers->GetEntityClassname(pCaller);
if (!classname) if (!classname)
{ {
@@ -139,9 +149,16 @@ bool EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
{ {
return true; return true;
} }
}
if (!pOutputName->hooks.empty()) if (!pOutputName->hooks.empty())
{ {
if (!fastLookup)
{
// hook exists on this classname and output - map it into our quick find trie
EntityOutputs->Insert(sOutput, pOutputName);
}
SourceHook::List<omg_hooks *>::iterator _iter; SourceHook::List<omg_hooks *>::iterator _iter;
omg_hooks *hook; omg_hooks *hook;
+2
View File
@@ -121,6 +121,8 @@ private:
const char *FindOutputName(void *pOutput, CBaseEntity *pCaller); const char *FindOutputName(void *pOutput, CBaseEntity *pCaller);
//Maps CEntityOutput * to a OutputNameStruct
IBasicTrie *EntityOutputs;
// Maps classname to a ClassNameStruct // Maps classname to a ClassNameStruct
IBasicTrie *ClassNames; IBasicTrie *ClassNames;
+1 -4
View File
@@ -615,10 +615,7 @@ native int FormatNativeString(int out_param,
* *
* @param data Data passed to the RequestFrame native. * @param data Data passed to the RequestFrame native.
*/ */
typeset RequestFrameCallback { typedef RequestFrameCallback = function void (any data);
function void ();
function void (any data);
}
/** /**
* Creates a single use Next Frame hook. * Creates a single use Next Frame hook.