Added misc. speech/choreo utilities to ai_speech_new

This commit is contained in:
Blixibon 2022-01-17 16:49:52 -06:00
parent ef19f1455d
commit ed21bb3d1d
2 changed files with 30 additions and 0 deletions

View File

@ -1528,6 +1528,32 @@ void CAI_Expresser::ClearSpokeConcept( const AIConcept_t &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()

View File

@ -211,6 +211,10 @@ public:
float GetTimeSpokeConcept( const AIConcept_t &concept ); // returns -1 if never
void SetSpokeConcept( const AIConcept_t &concept, AI_Response *response, bool bCallback = true );
void ClearSpokeConcept( const AIConcept_t &concept );
#ifdef MAPBASE
AIConcept_t GetLastSpokeConcept( AIConcept_t excludeConcept = NULL );
#endif
// --------------------------------