mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-10 13:58:52 +03:00
Added misc. speech/choreo utilities
This commit is contained in:
parent
264ee2b04f
commit
f448be8c2b
@ -1153,6 +1153,32 @@ void CAI_Expresser::ClearSpokeConcept( AIConcept_t concept )
|
|||||||
m_ConceptHistories.Remove( concept );
|
m_ConceptHistories.Remove( concept );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//-------------------------------------
|
||||||
|
|
||||||
|
AIConcept_t CAI_Expresser::GetLastSpokeConcept( AIConcept_t excludeConcept /* = NULL */ )
|
||||||
|
{
|
||||||
|
int iLastSpokenIndex = m_ConceptHistories.InvalidIndex();
|
||||||
|
float flLast = 0.0f;
|
||||||
|
for ( int i = m_ConceptHistories.First(); i != m_ConceptHistories.InvalidIndex(); i = m_ConceptHistories.Next(i ) )
|
||||||
|
{
|
||||||
|
ConceptHistory_t *h = &m_ConceptHistories[ i ];
|
||||||
|
|
||||||
|
// If an 'exclude concept' was provided, skip over this entry in the history if it matches the exclude concept
|
||||||
|
if ( excludeConcept != NULL && FStrEq( m_ConceptHistories.GetElementName( i ), excludeConcept ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( h->timeSpoken >= flLast )
|
||||||
|
{
|
||||||
|
iLastSpokenIndex = i;
|
||||||
|
flLast = h->timeSpoken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return iLastSpokenIndex != m_ConceptHistories.InvalidIndex() ? m_ConceptHistories.GetElementName( iLastSpokenIndex ) : NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
void CAI_Expresser::DumpHistories()
|
void CAI_Expresser::DumpHistories()
|
||||||
|
@ -193,6 +193,10 @@ public:
|
|||||||
void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true );
|
void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true );
|
||||||
void ClearSpokeConcept( AIConcept_t concept );
|
void ClearSpokeConcept( AIConcept_t concept );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
AIConcept_t GetLastSpokeConcept( AIConcept_t excludeConcept = NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
|
||||||
void SetVoicePitch( int voicePitch ) { m_voicePitch = voicePitch; }
|
void SetVoicePitch( int voicePitch ) { m_voicePitch = voicePitch; }
|
||||||
|
@ -159,6 +159,7 @@ public:
|
|||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
bool IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes, const char *pszNotThisScene = NULL );
|
bool IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes, const char *pszNotThisScene = NULL );
|
||||||
|
bool IsTalkingInAScriptedScene( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false );
|
||||||
|
|
||||||
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList();
|
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList();
|
||||||
#endif
|
#endif
|
||||||
@ -485,6 +486,9 @@ public:
|
|||||||
|
|
||||||
bool HasUnplayedSpeech( void );
|
bool HasUnplayedSpeech( void );
|
||||||
bool HasFlexAnimation( void );
|
bool HasFlexAnimation( void );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool IsPlayingSpeech( void );
|
||||||
|
#endif
|
||||||
|
|
||||||
void SetCurrentTime( float t, bool forceClientSync );
|
void SetCurrentTime( float t, bool forceClientSync );
|
||||||
|
|
||||||
@ -1157,6 +1161,31 @@ bool CSceneEntity::HasFlexAnimation( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
// Output : Returns true on success, false on failure.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool CSceneEntity::IsPlayingSpeech( void )
|
||||||
|
{
|
||||||
|
if ( m_pScene )
|
||||||
|
{
|
||||||
|
float flTime = m_pScene->GetTime();
|
||||||
|
for ( int i = 0; i < m_pScene->GetNumEvents(); i++ )
|
||||||
|
{
|
||||||
|
CChoreoEvent *e = m_pScene->GetEvent( i );
|
||||||
|
if ( e->GetType() == CChoreoEvent::SPEAK )
|
||||||
|
{
|
||||||
|
if ( /*flTime >= e->GetStartTime() &&*/ flTime <= e->GetEndTime() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -2576,6 +2605,30 @@ bool CSceneEntity::CheckActors()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else if ( pTestActor->IsPlayer() )
|
||||||
|
{
|
||||||
|
// Blixibon - Player speech handling
|
||||||
|
CBasePlayer *pPlayer = static_cast<CBasePlayer*>(pTestActor);
|
||||||
|
bool bShouldWait = false;
|
||||||
|
if ( pPlayer->GetExpresser() && pPlayer->GetExpresser()->IsSpeaking() )
|
||||||
|
{
|
||||||
|
bShouldWait = true;
|
||||||
|
}
|
||||||
|
else if ( IsTalkingInAScriptedScene( pPlayer ) )
|
||||||
|
{
|
||||||
|
bShouldWait = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( bShouldWait )
|
||||||
|
{
|
||||||
|
// One of the actors for this scene is talking already.
|
||||||
|
// Try again next think.
|
||||||
|
m_bWaitingForActor = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if ( m_BusyActor == SCENE_BUSYACTOR_INTERRUPT || m_BusyActor == SCENE_BUSYACTOR_INTERRUPT_CANCEL )
|
else if ( m_BusyActor == SCENE_BUSYACTOR_INTERRUPT || m_BusyActor == SCENE_BUSYACTOR_INTERRUPT_CANCEL )
|
||||||
{
|
{
|
||||||
@ -5937,6 +5990,31 @@ bool CSceneManager::IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CSceneManager::IsTalkingInAScriptedScene( CBaseFlex *pActor, bool bIgnoreInstancedScenes )
|
||||||
|
{
|
||||||
|
int c = m_ActiveScenes.Count();
|
||||||
|
for ( int i = 0; i < c; i++ )
|
||||||
|
{
|
||||||
|
CSceneEntity *pScene = m_ActiveScenes[ i ].Get();
|
||||||
|
if ( !pScene ||
|
||||||
|
!pScene->IsPlayingBack() ||
|
||||||
|
pScene->IsPaused() ||
|
||||||
|
( bIgnoreInstancedScenes && dynamic_cast<CInstancedSceneEntity *>(pScene) != NULL )
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( pScene->InvolvesActor( pActor ) )
|
||||||
|
{
|
||||||
|
if ( pScene->IsPlayingSpeech() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CUtlVector< CHandle< CSceneEntity > > *CSceneManager::GetActiveSceneList()
|
CUtlVector< CHandle< CSceneEntity > > *CSceneManager::GetActiveSceneList()
|
||||||
{
|
{
|
||||||
return &m_ActiveScenes;
|
return &m_ActiveScenes;
|
||||||
@ -6035,6 +6113,11 @@ bool IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActor, bool bIgnore
|
|||||||
return GetSceneManager()->IsRunningScriptedSceneWithFlexAndNotPaused( pActor, bIgnoreInstancedScenes, pszNotThisScene );
|
return GetSceneManager()->IsRunningScriptedSceneWithFlexAndNotPaused( pActor, bIgnoreInstancedScenes, pszNotThisScene );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsTalkingInAScriptedScene( CBaseFlex *pActor, bool bIgnoreInstancedScenes )
|
||||||
|
{
|
||||||
|
return GetSceneManager()->IsTalkingInAScriptedScene( pActor, bIgnoreInstancedScenes );
|
||||||
|
}
|
||||||
|
|
||||||
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList()
|
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList()
|
||||||
{
|
{
|
||||||
return GetSceneManager()->GetActiveSceneList();
|
return GetSceneManager()->GetActiveSceneList();
|
||||||
|
@ -41,6 +41,7 @@ bool IsRunningScriptedSceneWithSpeech( CBaseFlex *pActor, bool bIgnoreInstancedS
|
|||||||
bool IsRunningScriptedSceneWithSpeechAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false );
|
bool IsRunningScriptedSceneWithSpeechAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false );
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
bool IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false, const char *pszNotThisScene = NULL );
|
bool IsRunningScriptedSceneWithFlexAndNotPaused( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false, const char *pszNotThisScene = NULL );
|
||||||
|
bool IsTalkingInAScriptedScene( CBaseFlex *pActor, bool bIgnoreInstancedScenes = false );
|
||||||
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList();
|
CUtlVector< CHandle< CSceneEntity > > *GetActiveSceneList();
|
||||||
#endif
|
#endif
|
||||||
float GetSceneDuration( char const *pszScene );
|
float GetSceneDuration( char const *pszScene );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user