Integrating vscript interface code (based on Alien Swarm)

This commit is contained in:
James Mitchell
2020-05-04 16:25:15 +10:00
parent af85131deb
commit d840c57b4a
53 changed files with 5128 additions and 134 deletions

View File

@@ -1959,7 +1959,7 @@ extern "C" void Sys_Error( char *error, ... )
// *mapData - pointer a block of entity map data
// Output : -1 if the entity was not successfully created; 0 on success
//-----------------------------------------------------------------------------
int DispatchSpawn( CBaseEntity *pEntity )
int DispatchSpawn( CBaseEntity *pEntity, bool bRunVScripts )
{
if ( pEntity )
{
@@ -1974,6 +1974,12 @@ int DispatchSpawn( CBaseEntity *pEntity )
//pEntity->SetAbsMins( pEntity->GetOrigin() - Vector(1,1,1) );
//pEntity->SetAbsMaxs( pEntity->GetOrigin() + Vector(1,1,1) );
if (bRunVScripts)
{
pEntity->RunVScripts();
pEntity->RunPrecacheScripts();
}
#if defined(TRACK_ENTITY_MEMORY) && defined(USE_MEM_DEBUG)
const char *pszClassname = NULL;
int iClassname = ((CEntityFactoryDictionary*)EntityFactoryDictionary())->m_Factories.Find( pEntity->GetClassname() );
@@ -2040,6 +2046,11 @@ int DispatchSpawn( CBaseEntity *pEntity )
}
gEntList.NotifySpawn( pEntity );
if( bRunVScripts )
{
pEntity->RunOnPostSpawnScripts();
}
}
return 0;