add source-sdk-2013

This commit is contained in:
nillerusr
2022-03-01 23:00:42 +03:00
parent 88b8830e8b
commit edc8d6c584
3288 changed files with 3734 additions and 1062458 deletions

View File

@@ -548,11 +548,10 @@ void CAI_PlayerAlly::PrescheduleThink( void )
if ( m_flNextIdleSpeechTime && m_flNextIdleSpeechTime < gpGlobals->curtime )
{
AISpeechSelection_t selection;
if ( SelectNonCombatSpeech( &selection ) )
{
SetSpeechTarget( selection.hSpeechTarget );
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
}
else
@@ -594,23 +593,22 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
{
if ( IsAllowedToSpeak( concept ) )
{
bool result = SpeakFindResponse( pSelection->Response, concept, pszModifiers );
if ( result )
AI_Response *pResponse = SpeakFindResponse( concept, pszModifiers );
if ( pResponse )
{
pSelection->concept = concept;
pSelection->hSpeechTarget = pTarget;
pSelection->Set( concept, pResponse, pTarget );
return true;
}
}
return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response &Response )
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse )
{
m_PendingResponse = Response;
m_PendingResponse = *pResponse;
pResponse->Release();
m_PendingConcept = concept;
m_TimePendingSet = gpGlobals->curtime;
}
@@ -692,7 +690,7 @@ bool CAI_PlayerAlly::SelectInterjection()
if ( SelectIdleSpeech( &selection ) )
{
SetSpeechTarget( selection.hSpeechTarget );
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
return true;
}
}
@@ -891,8 +889,9 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
}
}
Assert( selection.pResponse );
SetSpeechTarget( selection.hSpeechTarget );
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
// Prevent idle speech for a while
DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() );
@@ -940,11 +939,11 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule()
if ( !HasPendingSpeech() )
{
AISpeechSelection_t selection;
if ( SelectNonCombatSpeech( &selection ) )
{
Assert( selection.pResponse );
SetSpeechTarget( selection.hSpeechTarget );
SetPendingSpeech( selection.concept.c_str(), selection.Response );
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
}
}
@@ -1019,14 +1018,14 @@ void CAI_PlayerAlly::StartTask( const Task_t *pTask )
case TASK_TALKER_SPEAK_PENDING:
if ( !m_PendingConcept.empty() )
{
SpeakDispatchResponse( m_PendingConcept.c_str(), m_PendingResponse );
AI_Response *pResponse = new AI_Response;
*pResponse = m_PendingResponse;
SpeakDispatchResponse( m_PendingConcept.c_str(), pResponse );
m_PendingConcept.erase();
TaskComplete();
}
else
{
TaskFail( FAIL_NO_SOUND );
}
break;
default:
@@ -1693,15 +1692,15 @@ bool CAI_PlayerAlly::RespondedTo( const char *ResponseConcept, bool bForce, bool
{
// We're being forced to respond to the event, probably because it's the
// player dying or something equally important.
AI_Response response;
bool result = SpeakFindResponse( response, ResponseConcept, NULL );
AI_Response *result = SpeakFindResponse( ResponseConcept, NULL );
if ( result )
{
// We've got something to say. Stop any scenes we're in, and speak the response.
if ( bCancelScene )
RemoveActorFromScriptedScenes( this, false );
return SpeakDispatchResponse( ResponseConcept, response );
bool spoke = SpeakDispatchResponse( ResponseConcept, result );
return spoke;
}
return false;