fixed amb1379 with sweeping changes to the entity stuff. all prop stocks are now natives so they can properly compute everything quickly, as well as do type checks. Get/SetEntDataEnt are deprecated for being sucky, the new 2 versions do more checking and uses better values. lastly, there are functions/parameters for finding types and sizes of property.
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401853
This commit is contained in:
+52
-19
@@ -70,7 +70,6 @@ CHalfLife2::~CHalfLife2()
|
||||
for (iter=m_Tables.begin(); iter!=m_Tables.end(); iter++)
|
||||
{
|
||||
pInfo = (*iter);
|
||||
sm_trie_destroy(pInfo->lookup);
|
||||
delete pInfo;
|
||||
}
|
||||
|
||||
@@ -115,6 +114,8 @@ void CHalfLife2::OnSourceModAllInitialized()
|
||||
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
|
||||
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
|
||||
FindInSendTable("CTFPlayer", "m_nDisguiseClass");
|
||||
}
|
||||
|
||||
#if !defined METAMOD_PLAPI_VERSION
|
||||
@@ -129,7 +130,10 @@ IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||
return engine->GetChangeAccessor( (const edict_t *)this );
|
||||
}
|
||||
|
||||
SendProp *UTIL_FindInSendTable(SendTable *pTable, const char *name)
|
||||
bool UTIL_FindInSendTable(SendTable *pTable,
|
||||
const char *name,
|
||||
sm_sendprop_info_t *info,
|
||||
unsigned int offset)
|
||||
{
|
||||
const char *pname;
|
||||
int props = pTable->GetNumProps();
|
||||
@@ -141,13 +145,19 @@ SendProp *UTIL_FindInSendTable(SendTable *pTable, const char *name)
|
||||
pname = prop->GetName();
|
||||
if (pname && strcmp(name, pname) == 0)
|
||||
{
|
||||
return prop;
|
||||
info->prop = prop;
|
||||
info->actual_offset = offset + info->prop->GetOffset();
|
||||
return true;
|
||||
}
|
||||
if (prop->GetDataTable())
|
||||
{
|
||||
if ((prop=UTIL_FindInSendTable(prop->GetDataTable(), name)) != NULL)
|
||||
if (UTIL_FindInSendTable(prop->GetDataTable(),
|
||||
name,
|
||||
info,
|
||||
offset + prop->GetOffset())
|
||||
)
|
||||
{
|
||||
return prop;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,6 +197,7 @@ typedescription_t *UTIL_FindInDataMap(datamap_t *pMap, const char *name)
|
||||
ServerClass *CHalfLife2::FindServerClass(const char *classname)
|
||||
{
|
||||
DataTableInfo *pInfo = _FindServerClass(classname);
|
||||
|
||||
if (!pInfo)
|
||||
{
|
||||
return NULL;
|
||||
@@ -207,7 +218,6 @@ DataTableInfo *CHalfLife2::_FindServerClass(const char *classname)
|
||||
if (strcmp(classname, sc->GetName()) == 0)
|
||||
{
|
||||
pInfo = new DataTableInfo;
|
||||
pInfo->lookup = sm_trie_create();
|
||||
pInfo->sc = sc;
|
||||
sm_trie_insert(m_pClasses, classname, pInfo);
|
||||
m_Tables.push_back(pInfo);
|
||||
@@ -224,25 +234,46 @@ DataTableInfo *CHalfLife2::_FindServerClass(const char *classname)
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
bool CHalfLife2::FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info)
|
||||
{
|
||||
DataTableInfo *pInfo;
|
||||
sm_sendprop_info_t *prop;
|
||||
|
||||
if ((pInfo = _FindServerClass(classname)) == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((prop = pInfo->lookup.retrieve(offset)) == NULL)
|
||||
{
|
||||
sm_sendprop_info_t temp_info;
|
||||
|
||||
if (!UTIL_FindInSendTable(pInfo->sc->m_pTable, offset, &temp_info, 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pInfo->lookup.insert(offset, temp_info);
|
||||
*info = temp_info;
|
||||
}
|
||||
else
|
||||
{
|
||||
*info = *prop;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SendProp *CHalfLife2::FindInSendTable(const char *classname, const char *offset)
|
||||
{
|
||||
DataTableInfo *pInfo = _FindServerClass(classname);
|
||||
sm_sendprop_info_t info;
|
||||
|
||||
if (!pInfo)
|
||||
if (!FindSendPropInfo(classname, offset, &info))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SendProp *pProp = NULL;
|
||||
if (!sm_trie_retrieve(pInfo->lookup, offset, (void **)&pProp))
|
||||
{
|
||||
if ((pProp = UTIL_FindInSendTable(pInfo->sc->m_pTable, offset)) != NULL)
|
||||
{
|
||||
sm_trie_insert(pInfo->lookup, offset, pProp);
|
||||
}
|
||||
}
|
||||
|
||||
return pProp;
|
||||
return info.prop;
|
||||
}
|
||||
|
||||
typedescription_t *CHalfLife2::FindInDataMap(datamap_t *pMap, const char *offset)
|
||||
@@ -272,7 +303,9 @@ void CHalfLife2::SetEdictStateChanged(edict_t *pEdict, unsigned short offset)
|
||||
if (offset)
|
||||
{
|
||||
pEdict->StateChanged(offset);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
pEdict->StateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -35,6 +35,7 @@
|
||||
#include <sh_list.h>
|
||||
#include <sh_string.h>
|
||||
#include <sh_tinyhash.h>
|
||||
#include <sm_trie_tpl.h>
|
||||
#include "sm_trie.h"
|
||||
#include "sm_globals.h"
|
||||
#include "sm_queue.h"
|
||||
@@ -52,7 +53,7 @@ using namespace SourceMod;
|
||||
struct DataTableInfo
|
||||
{
|
||||
ServerClass *sc;
|
||||
Trie *lookup;
|
||||
KTrie<sm_sendprop_info_t> lookup;
|
||||
};
|
||||
|
||||
struct DataMapTrie
|
||||
@@ -89,6 +90,7 @@ public:
|
||||
/*void OnSourceModAllShutdown();*/
|
||||
public: //IGameHelpers
|
||||
SendProp *FindInSendTable(const char *classname, const char *offset);
|
||||
bool FindSendPropInfo(const char *classname, const char *offset, sm_sendprop_info_t *info);
|
||||
datamap_t *GetDataMap(CBaseEntity *pEntity);
|
||||
ServerClass *FindServerClass(const char *classname);
|
||||
typedescription_t *FindInDataMap(datamap_t *pMap, const char *offset);
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@@ -128,7 +128,7 @@
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@@ -288,7 +288,7 @@
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\dlls;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(HL2SDKOB)\tier1;$(SOURCEMM);$(SOURCEMM)\sourcemm;$(SOURCEMM)\sourcehook"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;ORANGEBOX_BUILD"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@@ -371,7 +371,7 @@
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@@ -453,7 +453,7 @@
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
@@ -534,7 +534,7 @@
|
||||
AdditionalIncludeDirectories="..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(HL2SDK)\tier1;$(SOURCEMM142);$(SOURCEMM142)\sourcemm;$(SOURCEMM142)\sourcehook"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER"
|
||||
RuntimeLibrary="0"
|
||||
EnableEnhancedInstructionSet="1"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
|
||||
+989
-43
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user