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

@@ -95,6 +95,10 @@ BEGIN_DATADESC( CBaseFlex )
END_DATADESC()
BEGIN_ENT_SCRIPTDESC( CBaseFlex, CBaseAnimating, "Animated characters who have vertex flex capability." )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetOldestScene, "GetCurrentScene", "Returns the instance of the oldest active scene entity (if any)." )
DEFINE_SCRIPTFUNC_NAMED( ScriptGetSceneByIndex, "GetSceneByIndex", "Returns the instance of the scene entity at the specified index." )
END_SCRIPTDESC();
LINK_ENTITY_TO_CLASS( funCBaseFlex, CBaseFlex ); // meaningless independant class!!
@@ -421,7 +425,8 @@ void CBaseFlex::AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, CBaseEn
info.m_pEvent = event;
info.m_pScene = scene;
info.m_hTarget = pTarget;
info.m_bStarted = false;
info.m_bStarted = false;
info.m_hSceneEntity = pSceneEnt;
#ifdef MAPBASE
if (StartSceneEvent( &info, scene, event, actor, pTarget, pSceneEnt ))
@@ -2029,6 +2034,37 @@ float CBaseFlex::PlayAutoGeneratedSoundScene( const char *soundname )
#endif
//--------------------------------------------------------------------------------------------------
// Returns the script instance of the scene entity associated with our oldest ("top level") scene event
//--------------------------------------------------------------------------------------------------
HSCRIPT CBaseFlex::ScriptGetOldestScene( void )
{
if ( m_SceneEvents.Count() > 0 )
{
CSceneEventInfo curScene = m_SceneEvents.Head();
return ToHScript( (CBaseEntity*)(curScene.m_hSceneEntity.Get()) );
}
else
{
return NULL;
}
}
//--------------------------------------------------------------------------------------------------
// Returns the script instance of the scene at the specified index, or null if index >= count
//--------------------------------------------------------------------------------------------------
HSCRIPT CBaseFlex::ScriptGetSceneByIndex( int index )
{
if ( m_SceneEvents.IsValidIndex( index ) )
{
CSceneEventInfo curScene = m_SceneEvents.Element( index );
return ToHScript( (CBaseEntity*)(curScene.m_hSceneEntity.Get()) );
}
else
{
return NULL;
}
}
// FIXME: move to CBaseActor