Eliminate need for s_pTempEnts gamedata on sdk2013 and soon css/dods/hl2dm (already on tf2).

This commit is contained in:
Nicholas Hastings 2014-10-30 19:24:53 -04:00
parent 0d69ce8b9a
commit b8e4510f7e

View File

@ -285,36 +285,46 @@ void TempEntityManager::Initialize()
int offset; int offset;
m_Loaded = false; m_Loaded = false;
#if SOURCE_ENGINE == SE_TF2 #if SOURCE_ENGINE == SE_TF2 \
m_ListHead = servertools->GetTempEntList(); || SOURCE_ENGINE == SE_DODS \
#else || SOURCE_ENGINE == SE_HL2DM \
/* || SOURCE_ENGINE == SE_CSS \
* First try to lookup s_pTempEntities directly for platforms with symbols. || SOURCE_ENGINE == SE_SDK2013
* If symbols aren't present (Windows or stripped Linux/Mac),
* attempt find via CBaseTempEntity ctor + offset
*/
/* Read our sigs and offsets from the config file */ if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr)
{ {
m_ListHead = servertools->GetTempEntList();
/* Store the head of the TE linked list */
m_ListHead = *(void **)addr;
} }
else if (g_pGameConf->GetMemSig("CBaseTempEntity", &addr) && addr) else
#endif
{ {
if (!g_pGameConf->GetOffset("s_pTempEntities", &offset)) /*
* First try to lookup s_pTempEntities directly for platforms with symbols.
* If symbols aren't present (Windows or stripped Linux/Mac),
* attempt find via CBaseTempEntity ctor + offset
*/
/* Read our sigs and offsets from the config file */
if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr)
{
/* Store the head of the TE linked list */
m_ListHead = *(void **) addr;
}
else if (g_pGameConf->GetMemSig("CBaseTempEntity", &addr) && addr)
{
if (!g_pGameConf->GetOffset("s_pTempEntities", &offset))
{
return;
}
/* Store the head of the TE linked list */
m_ListHead = **(void ***) ((unsigned char *) addr + offset);
}
else
{ {
return; return;
} }
/* Store the head of the TE linked list */
m_ListHead = **(void ***)((unsigned char *)addr + offset);
} }
else
{
return;
}
#endif // == TF2
if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs)) if (!g_pGameConf->GetOffset("GetTEName", &m_NameOffs))
{ {