Update SDKTools entity output functions to use core's GetEntityClassname instead of own.
This commit is contained in:
parent
9d676ed440
commit
7e7544e036
@ -115,7 +115,7 @@ void EntityOutputManager::FireEventDetour(void *pOutput, CBaseEntity *pActivator
|
|||||||
// Fast lookup failed - check the slow way for hooks that haven't fired yet
|
// Fast lookup failed - check the slow way for hooks that haven't fired yet
|
||||||
if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false)
|
if ((fastLookup = EntityOutputs->Retrieve(sOutput, (void **)&pOutputName)) == false)
|
||||||
{
|
{
|
||||||
const char *classname = GetEntityClassname(pCaller);
|
const char *classname = gamehelpers->GetEntityClassname(pCaller);
|
||||||
if (!classname)
|
if (!classname)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -353,21 +353,3 @@ const char *EntityOutputManager::FindOutputName(void *pOutput, CBaseEntity *pCal
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *EntityOutputManager::GetEntityClassname(CBaseEntity *pEntity)
|
|
||||||
{
|
|
||||||
static int offset = -1;
|
|
||||||
if (offset == -1)
|
|
||||||
{
|
|
||||||
datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
|
|
||||||
sm_datatable_info_t info;
|
|
||||||
if (!gamehelpers->FindDataMapInfo(pMap, "m_iClassname", &info))
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset = info.actual_offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *(const char **)(((unsigned char *)pEntity) + offset);
|
|
||||||
}
|
|
||||||
|
@ -108,8 +108,6 @@ public:
|
|||||||
void OnHookAdded();
|
void OnHookAdded();
|
||||||
void OnHookRemoved();
|
void OnHookRemoved();
|
||||||
|
|
||||||
const char *GetEntityClassname(CBaseEntity *pEntity);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("Invalid Entity index %i (%i)", gamehelpers->ReferenceToIndex(params[1]), params[1]);
|
return pContext->ThrowNativeError("Invalid Entity index %i (%i)", gamehelpers->ReferenceToIndex(params[1]), params[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *classname = g_OutputManager.GetEntityClassname(pEntity);
|
const char *classname = gamehelpers->GetEntityClassname(pEntity);
|
||||||
|
|
||||||
char *outputname;
|
char *outputname;
|
||||||
pContext->LocalToString(params[2], &outputname);
|
pContext->LocalToString(params[2], &outputname);
|
||||||
@ -226,7 +226,7 @@ cell_t UnHookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("Invalid Entity index %i (%i)", gamehelpers->ReferenceToIndex(params[1]), params[1]);
|
return pContext->ThrowNativeError("Invalid Entity index %i (%i)", gamehelpers->ReferenceToIndex(params[1]), params[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *classname = g_OutputManager.GetEntityClassname(pEntity);
|
const char *classname = gamehelpers->GetEntityClassname(pEntity);
|
||||||
|
|
||||||
char *outputname;
|
char *outputname;
|
||||||
pContext->LocalToString(params[2], &outputname);
|
pContext->LocalToString(params[2], &outputname);
|
||||||
|
Loading…
Reference in New Issue
Block a user