Merge pull request #174 from alliedmodders/eliminate-more-gamedata
Eliminate the need for more gamedata on some games (r=asherkin).
This commit is contained in:
@@ -285,36 +285,46 @@ void TempEntityManager::Initialize()
|
||||
int offset;
|
||||
m_Loaded = false;
|
||||
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
m_ListHead = servertools->GetTempEntList();
|
||||
#else
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#if SOURCE_ENGINE == SE_TF2 \
|
||||
|| SOURCE_ENGINE == SE_DODS \
|
||||
|| SOURCE_ENGINE == SE_HL2DM \
|
||||
|| SOURCE_ENGINE == SE_CSS \
|
||||
|| SOURCE_ENGINE == SE_SDK2013
|
||||
|
||||
/* Read our sigs and offsets from the config file */
|
||||
if (g_pGameConf->GetMemSig("s_pTempEntities", &addr) && addr)
|
||||
if (g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr))
|
||||
{
|
||||
|
||||
/* Store the head of the TE linked list */
|
||||
m_ListHead = *(void **)addr;
|
||||
m_ListHead = servertools->GetTempEntList();
|
||||
}
|
||||
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;
|
||||
}
|
||||
/* 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))
|
||||
{
|
||||
|
||||
@@ -130,9 +130,19 @@ bool UTIL_VerifySignature(const void *addr, const char *sig, size_t len)
|
||||
|
||||
void GetIServer()
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
iserver = engine->GetIServer();
|
||||
#else
|
||||
#if SOURCE_ENGINE == SE_TF2 \
|
||||
|| SOURCE_ENGINE == SE_DODS \
|
||||
|| SOURCE_ENGINE == SE_HL2DM \
|
||||
|| SOURCE_ENGINE == SE_CSS \
|
||||
|| SOURCE_ENGINE == SE_SDK2013
|
||||
|
||||
if (g_SMAPI->GetEngineFactory(false)("VEngineServer022", nullptr))
|
||||
{
|
||||
iserver = engine->GetIServer();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void *addr;
|
||||
const char *sigstr;
|
||||
char sig[32];
|
||||
@@ -191,7 +201,6 @@ void GetIServer()
|
||||
|
||||
/* Finally we have the interface we were looking for */
|
||||
iserver = *reinterpret_cast<IServer **>(reinterpret_cast<unsigned char *>(vfunc) + offset);
|
||||
#endif // !TF2
|
||||
}
|
||||
|
||||
void GetResourceEntity()
|
||||
|
||||
@@ -714,7 +714,7 @@ static cell_t GetClientEyeAngles(IPluginContext *pContext, const cell_t *params)
|
||||
return got_angles ? 1 : 0;
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_TF2
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *searchname;
|
||||
@@ -793,25 +793,35 @@ static cell_t NativeFindEntityByClassname(IPluginContext *pContext, const cell_t
|
||||
|
||||
static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
#if SOURCE_ENGINE == SE_TF2
|
||||
CBaseEntity *pStartEnt = NULL;
|
||||
if (params[1] != -1)
|
||||
#if SOURCE_ENGINE == SE_TF2 \
|
||||
|| SOURCE_ENGINE == SE_DODS \
|
||||
|| SOURCE_ENGINE == SE_HL2DM \
|
||||
|| SOURCE_ENGINE == SE_CSS \
|
||||
|| SOURCE_ENGINE == SE_SDK2013
|
||||
|
||||
static bool bHasServerTools3 = !!g_SMAPI->GetServerFactory(false)("VSERVERTOOLS003", nullptr);
|
||||
if (bHasServerTools3)
|
||||
{
|
||||
pStartEnt = gamehelpers->ReferenceToEntity(params[1]);
|
||||
if (!pStartEnt)
|
||||
CBaseEntity *pStartEnt = NULL;
|
||||
if (params[1] != -1)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid",
|
||||
gamehelpers->ReferenceToIndex(params[1]),
|
||||
params[1]);
|
||||
pStartEnt = gamehelpers->ReferenceToEntity(params[1]);
|
||||
if (!pStartEnt)
|
||||
{
|
||||
return pContext->ThrowNativeError("Entity %d (%d) is invalid",
|
||||
gamehelpers->ReferenceToIndex(params[1]),
|
||||
params[1]);
|
||||
}
|
||||
}
|
||||
|
||||
char *searchname;
|
||||
pContext->LocalToString(params[2], &searchname);
|
||||
|
||||
CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname);
|
||||
return gamehelpers->EntityToBCompatRef(pEntity);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *searchname;
|
||||
pContext->LocalToString(params[2], &searchname);
|
||||
|
||||
CBaseEntity *pEntity = servertools->FindEntityByClassname(pStartEnt, searchname);
|
||||
return gamehelpers->EntityToBCompatRef(pEntity);
|
||||
#else
|
||||
static ValveCall *pCall = NULL;
|
||||
static bool bProbablyNoFEBC = false;
|
||||
|
||||
@@ -869,7 +879,6 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para
|
||||
FINISH_CALL_SIMPLE(&pEntity);
|
||||
|
||||
return gamehelpers->EntityToBCompatRef(pEntity);
|
||||
#endif // == TF2
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
|
||||
Reference in New Issue
Block a user