mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-30 05:59:20 +00:00
upload "kind" alien swarm
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#undef sprintf
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "sceneentity.h"
|
||||
@@ -138,6 +136,8 @@ bool ConceptStringLessFunc( const string_t &lhs, const string_t &rhs )
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if AI_CONCEPTS_ARE_STRINGS
|
||||
|
||||
class CConceptInfoMap : public CUtlMap<AIConcept_t, ConceptInfo_t *> {
|
||||
public:
|
||||
CConceptInfoMap() :
|
||||
@@ -150,6 +150,27 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
bool ConceptIDLessFunc( const AIConcept_t::tGenericId &lhs, const AIConcept_t::tGenericId &rhs )
|
||||
{
|
||||
return CaselessStringLessThan( CAI_Concept::GetStringForGenericId(lhs), CAI_Concept::GetStringForGenericId(rhs) );
|
||||
}
|
||||
|
||||
class CConceptInfoMap : public CUtlMap<AIConcept_t::tGenericId, ConceptInfo_t *> {
|
||||
public:
|
||||
CConceptInfoMap() :
|
||||
CUtlMap<AIConcept_t::tGenericId, ConceptInfo_t *>( ConceptIDLessFunc )
|
||||
{
|
||||
for ( int i = 0; i < ARRAYSIZE(g_ConceptInfos); i++ )
|
||||
{
|
||||
Insert( g_ConceptInfos[i].concept, &g_ConceptInfos[i] );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static CConceptInfoMap g_ConceptInfoMap;
|
||||
|
||||
CAI_AllySpeechManager::CAI_AllySpeechManager()
|
||||
@@ -380,7 +401,8 @@ void CAI_PlayerAlly::DisplayDeathMessage( void )
|
||||
|
||||
if ( pReload )
|
||||
{
|
||||
pReload->SetRenderColor( 0, 0, 0, 255 );
|
||||
pReload->SetRenderColor( 0, 0, 0 );
|
||||
pReload->SetRenderAlpha( 255 );
|
||||
|
||||
g_EventQueue.AddEvent( pReload, "Reload", 1.5f, pReload, pReload );
|
||||
}
|
||||
@@ -553,7 +575,7 @@ void CAI_PlayerAlly::PrescheduleThink( void )
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), &selection.response );
|
||||
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
|
||||
}
|
||||
else
|
||||
@@ -595,12 +617,23 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
|
||||
{
|
||||
if ( IsAllowedToSpeak( concept ) )
|
||||
{
|
||||
AI_Response *pResponse = SpeakFindResponse( concept, pszModifiers );
|
||||
if ( pResponse )
|
||||
AI_CriteriaSet criteria;
|
||||
GatherCriteria(&criteria, concept, pszModifiers);
|
||||
|
||||
if ( FindResponse(pSelection->response, concept, &criteria) )
|
||||
{
|
||||
pSelection->Set( concept, pResponse, pTarget );
|
||||
pSelection->Set(concept, pTarget);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
AI_Response response;
|
||||
if ( FindResponse( response, concept, &criteria ) )
|
||||
{
|
||||
pSelection->Set( concept, &response, pTarget );
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -610,7 +643,7 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
|
||||
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse )
|
||||
{
|
||||
m_PendingResponse = *pResponse;
|
||||
pResponse->Release();
|
||||
// pResponse->Release();
|
||||
m_PendingConcept = concept;
|
||||
m_TimePendingSet = gpGlobals->curtime;
|
||||
}
|
||||
@@ -692,7 +725,7 @@ bool CAI_PlayerAlly::SelectInterjection()
|
||||
if ( SelectIdleSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -891,9 +924,9 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
|
||||
}
|
||||
}
|
||||
|
||||
Assert( selection.pResponse );
|
||||
Assert( !selection.response.IsEmpty() );
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), &selection.response, NULL );
|
||||
|
||||
// Prevent idle speech for a while
|
||||
DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() );
|
||||
@@ -943,9 +976,9 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule()
|
||||
AISpeechSelection_t selection;
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
Assert( selection.pResponse );
|
||||
Assert( !selection.response.IsEmpty() );
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
|
||||
SetPendingSpeech( selection.concept.c_str(), &selection.response );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1020,9 +1053,8 @@ void CAI_PlayerAlly::StartTask( const Task_t *pTask )
|
||||
case TASK_TALKER_SPEAK_PENDING:
|
||||
if ( !m_PendingConcept.empty() )
|
||||
{
|
||||
AI_Response *pResponse = new AI_Response;
|
||||
*pResponse = m_PendingResponse;
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), pResponse );
|
||||
AI_Response response(m_PendingResponse);
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), &response, NULL );
|
||||
m_PendingConcept.erase();
|
||||
TaskComplete();
|
||||
}
|
||||
@@ -1095,7 +1127,7 @@ void CAI_PlayerAlly::OnKilledNPC( CBaseCombatCharacter *pKilled )
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_PlayerAlly::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator )
|
||||
void CAI_PlayerAlly::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
|
||||
{
|
||||
const char *pszHitLocCriterion = NULL;
|
||||
|
||||
@@ -1117,7 +1149,7 @@ void CAI_PlayerAlly::TraceAttack( const CTakeDamageInfo &info, const Vector &vec
|
||||
|
||||
SpeakIfAllowed( TLK_SHOT, modifiers );
|
||||
|
||||
BaseClass::TraceAttack( info, vecDir, ptr, pAccumulator );
|
||||
BaseClass::TraceAttack( info, vecDir, ptr );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1666,10 +1698,6 @@ void CAI_PlayerAlly::InputDisableSpeakWhileScripting( inputdata_t &inputdata )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAI_PlayerAlly::SpeakMapmakerInterruptConcept( string_t iszConcept )
|
||||
{
|
||||
// Let behaviors override
|
||||
if ( BaseClass::SpeakMapmakerInterruptConcept(iszConcept) )
|
||||
return false;
|
||||
|
||||
if (!IsOkToSpeakInResponseToPlayer())
|
||||
return false;
|
||||
|
||||
@@ -1694,14 +1722,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 *result = SpeakFindResponse( ResponseConcept, NULL );
|
||||
if ( result )
|
||||
AI_Response result;
|
||||
AIConcept_t tempConcept( ResponseConcept );
|
||||
if ( FindResponse( result, tempConcept, NULL ) )
|
||||
{
|
||||
// We've got something to say. Stop any scenes we're in, and speak the response.
|
||||
if ( bCancelScene )
|
||||
RemoveActorFromScriptedScenes( this, false );
|
||||
|
||||
bool spoke = SpeakDispatchResponse( ResponseConcept, result );
|
||||
bool spoke = SpeakDispatchResponse( tempConcept, &result, NULL );
|
||||
return spoke;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user