mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-27 07:15:31 +03:00
Fix gcc build errors & warnings
This commit is contained in:
parent
5eda2f692f
commit
dddcf642aa
@ -225,7 +225,7 @@ static CResponseQueue::CFollowupTargetSpec_t ResolveFollowupTargetToEntity( AICo
|
|||||||
|
|
||||||
ConVar chet_debug_idle( "chet_debug_idle", "0", FCVAR_ARCHIVE, "If set one, many debug prints to help track down the TLK_IDLE issue. Set two for super verbose info" );
|
ConVar chet_debug_idle( "chet_debug_idle", "0", FCVAR_ARCHIVE, "If set one, many debug prints to help track down the TLK_IDLE issue. Set two for super verbose info" );
|
||||||
// extern ConVar chet_debug_idle;
|
// extern ConVar chet_debug_idle;
|
||||||
bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
bool CAI_ExpresserWithFollowup::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
||||||
{
|
{
|
||||||
VPROF("CAI_Expresser::Speak");
|
VPROF("CAI_Expresser::Speak");
|
||||||
if ( IsSpeechGloballySuppressed() )
|
if ( IsSpeechGloballySuppressed() )
|
||||||
@ -261,7 +261,7 @@ bool CAI_ExpresserWithFollowup::Speak( AIConcept_t &concept, const char *modifie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime );
|
SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime );
|
||||||
// Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" );
|
// Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" );
|
||||||
|
|
||||||
bool spoke = SpeakDispatchResponse( concept, &result, &criteria, filter );
|
bool spoke = SpeakDispatchResponse( concept, &result, &criteria, filter );
|
||||||
@ -297,7 +297,7 @@ static float GetSpeechDurationForResponse( const AI_Response * RESTRICT response
|
|||||||
// Purpose: Dispatches the result
|
// Purpose: Dispatches the result
|
||||||
// Input : *response -
|
// Input : *response -
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter )
|
bool CAI_ExpresserWithFollowup::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter )
|
||||||
{
|
{
|
||||||
// This gives the chance for the other bot to respond.
|
// This gives the chance for the other bot to respond.
|
||||||
if ( !concept.GetSpeaker().IsValid() )
|
if ( !concept.GetSpeaker().IsValid() )
|
||||||
|
@ -792,11 +792,11 @@ void CAI_PlayerAlly::PostSpeakDispatchResponse( AIConcept_t concept, AI_Response
|
|||||||
{
|
{
|
||||||
if ( bSaidHelloToNPC )
|
if ( bSaidHelloToNPC )
|
||||||
{
|
{
|
||||||
Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept );
|
Warning("Q&A: '%s' said Hello to '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)concept );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), concept );
|
Warning("Q&A: '%s' questioned '%s' (concept %s)\n", GetDebugName(), GetSpeechTarget()->GetDebugName(), (const char*)concept );
|
||||||
}
|
}
|
||||||
NDebugOverlay::HorzArrow( GetAbsOrigin(), GetSpeechTarget()->GetAbsOrigin(), 8, 0, 255, 0, 64, true, duration );
|
NDebugOverlay::HorzArrow( GetAbsOrigin(), GetSpeechTarget()->GetAbsOrigin(), 8, 0, 255, 0, 64, true, duration );
|
||||||
}
|
}
|
||||||
@ -1022,11 +1022,11 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert( selection.pResponse );
|
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
#ifdef NEW_RESPONSE_SYSTEM
|
#ifdef NEW_RESPONSE_SYSTEM
|
||||||
SpeakDispatchResponse( selection.concept.c_str(), &selection.Response );
|
SpeakDispatchResponse( selection.concept.c_str(), &selection.Response );
|
||||||
#else
|
#else
|
||||||
|
Assert( selection.pResponse );
|
||||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1078,11 +1078,11 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule()
|
|||||||
AISpeechSelection_t selection;
|
AISpeechSelection_t selection;
|
||||||
if ( SelectNonCombatSpeech( &selection ) )
|
if ( SelectNonCombatSpeech( &selection ) )
|
||||||
{
|
{
|
||||||
Assert( selection.pResponse );
|
|
||||||
SetSpeechTarget( selection.hSpeechTarget );
|
SetSpeechTarget( selection.hSpeechTarget );
|
||||||
#ifdef NEW_RESPONSE_SYSTEM
|
#ifdef NEW_RESPONSE_SYSTEM
|
||||||
SetPendingSpeech( selection.concept.c_str(), &selection.Response );
|
SetPendingSpeech( selection.concept.c_str(), &selection.Response );
|
||||||
#else
|
#else
|
||||||
|
Assert( selection.pResponse );
|
||||||
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
|
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "ai_speech.h"
|
#include "ai_speech.h"
|
||||||
|
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "engine/ienginesound.h"
|
#include "engine/IEngineSound.h"
|
||||||
#include "keyvalues.h"
|
#include "KeyValues.h"
|
||||||
#include "ai_basenpc.h"
|
#include "ai_basenpc.h"
|
||||||
#include "ai_criteria.h"
|
#include "AI_Criteria.h"
|
||||||
#include "isaverestore.h"
|
#include "isaverestore.h"
|
||||||
#include "sceneentity.h"
|
#include "sceneentity.h"
|
||||||
#include "ai_speechqueue.h"
|
#include "ai_speechqueue.h"
|
||||||
@ -575,7 +575,7 @@ void CAI_Expresser::GatherCriteria( AI_CriteriaSet * RESTRICT outputSet, const A
|
|||||||
// Output : AI_Response
|
// Output : AI_Response
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
// AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||||
bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria )
|
bool CAI_Expresser::FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria )
|
||||||
{
|
{
|
||||||
VPROF("CAI_Expresser::FindResponse");
|
VPROF("CAI_Expresser::FindResponse");
|
||||||
IResponseSystem *rs = GetOuter()->GetResponseSystem();
|
IResponseSystem *rs = GetOuter()->GetResponseSystem();
|
||||||
@ -703,7 +703,7 @@ bool CAI_Expresser::FindResponse( AI_Response &outResponse, AIConcept_t &concept
|
|||||||
// NULL -
|
// NULL -
|
||||||
// Output : bool : true on success, false on fail
|
// Output : bool : true on success, false on fail
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t &concept, AI_CriteriaSet *criteria )
|
AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, const AIConcept_t &concept, AI_CriteriaSet *criteria )
|
||||||
{
|
{
|
||||||
Assert(response);
|
Assert(response);
|
||||||
|
|
||||||
@ -808,7 +808,7 @@ AI_Response *CAI_Expresser::SpeakFindResponse( AI_Response *result, AIConcept_t
|
|||||||
// Purpose: Dispatches the result
|
// Purpose: Dispatches the result
|
||||||
// Input : *response -
|
// Input : *response -
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t &concept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ )
|
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, AI_CriteriaSet *criteria, IRecipientFilter *filter /* = NULL */ )
|
||||||
{
|
{
|
||||||
char response[ 256 ];
|
char response[ 256 ];
|
||||||
result->GetResponse( response, sizeof( response ) );
|
result->GetResponse( response, sizeof( response ) );
|
||||||
@ -1068,21 +1068,21 @@ bool CAI_Expresser::FireEntIOFromResponse( char *response, CBaseEntity *pInitiat
|
|||||||
char *pszParam;
|
char *pszParam;
|
||||||
char *strtokContext;
|
char *strtokContext;
|
||||||
|
|
||||||
pszEntname = strtok_s( response, " ", &strtokContext );
|
pszEntname = V_strtok_s( response, " ", &strtokContext );
|
||||||
if ( !pszEntname )
|
if ( !pszEntname )
|
||||||
{
|
{
|
||||||
Warning( "Response was entityio but had bad value %s\n", response );
|
Warning( "Response was entityio but had bad value %s\n", response );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pszInput = strtok_s( NULL, " ", &strtokContext );
|
pszInput = V_strtok_s( NULL, " ", &strtokContext );
|
||||||
if ( !pszInput )
|
if ( !pszInput )
|
||||||
{
|
{
|
||||||
Warning( "Response was entityio but had bad value %s\n", response );
|
Warning( "Response was entityio but had bad value %s\n", response );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pszParam = strtok_s( NULL, " ", &strtokContext );
|
pszParam = V_strtok_s( NULL, " ", &strtokContext );
|
||||||
|
|
||||||
// poke entity io
|
// poke entity io
|
||||||
CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, pszEntname, pInitiator );
|
CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, pszEntname, pInitiator );
|
||||||
@ -1231,7 +1231,7 @@ void CAI_Expresser::MarkResponseAsUsed( AI_Response *response )
|
|||||||
// Input : concept -
|
// Input : concept -
|
||||||
// Output : Returns true on success, false on failure.
|
// Output : Returns true on success, false on failure.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
||||||
{
|
{
|
||||||
concept.SetSpeaker(GetOuter());
|
concept.SetSpeaker(GetOuter());
|
||||||
AI_CriteriaSet criteria;
|
AI_CriteriaSet criteria;
|
||||||
@ -1245,7 +1245,7 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, const char *modifiers /*= NULL*
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter )
|
bool CAI_Expresser::Speak( const AIConcept_t &concept, AI_CriteriaSet * RESTRICT criteria, char *pszOutResponseChosen , size_t bufsize , IRecipientFilter *filter )
|
||||||
{
|
{
|
||||||
VPROF("CAI_Expresser::Speak");
|
VPROF("CAI_Expresser::Speak");
|
||||||
if ( IsSpeechGloballySuppressed() )
|
if ( IsSpeechGloballySuppressed() )
|
||||||
@ -1260,7 +1260,7 @@ bool CAI_Expresser::Speak( AIConcept_t &concept, AI_CriteriaSet * RESTRICT crite
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpeechMsg( GetOuter(), "%s (%x) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime );
|
SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)", STRING(GetOuter()->GetEntityName()), GetOuter(), (const char*)concept, gpGlobals->curtime );
|
||||||
// Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" );
|
// Msg( "%s:%s to %s:%s\n", GetOuter()->GetDebugName(), concept.GetStringConcept(), criteria.GetValue(criteria.FindCriterionIndex("Subject")), pTarget ? pTarget->GetDebugName() : "none" );
|
||||||
|
|
||||||
bool spoke = SpeakDispatchResponse( concept, &result, criteria, filter );
|
bool spoke = SpeakDispatchResponse( concept, &result, criteria, filter );
|
||||||
@ -1447,7 +1447,7 @@ bool CAI_Expresser::CanSpeakAfterMyself()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept )
|
bool CAI_Expresser::CanSpeakConcept( const AIConcept_t &concept )
|
||||||
{
|
{
|
||||||
// Not in history?
|
// Not in history?
|
||||||
int iter = m_ConceptHistories.Find( concept );
|
int iter = m_ConceptHistories.Find( concept );
|
||||||
@ -1479,14 +1479,14 @@ bool CAI_Expresser::CanSpeakConcept( AIConcept_t concept )
|
|||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
bool CAI_Expresser::SpokeConcept( AIConcept_t concept )
|
bool CAI_Expresser::SpokeConcept( const AIConcept_t &concept )
|
||||||
{
|
{
|
||||||
return GetTimeSpokeConcept( concept ) != -1.f;
|
return GetTimeSpokeConcept( concept ) != -1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept )
|
float CAI_Expresser::GetTimeSpokeConcept( const AIConcept_t &concept )
|
||||||
{
|
{
|
||||||
int iter = m_ConceptHistories.Find( concept );
|
int iter = m_ConceptHistories.Find( concept );
|
||||||
if ( iter == m_ConceptHistories.InvalidIndex() )
|
if ( iter == m_ConceptHistories.InvalidIndex() )
|
||||||
@ -1498,7 +1498,7 @@ float CAI_Expresser::GetTimeSpokeConcept( AIConcept_t concept )
|
|||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback )
|
void CAI_Expresser::SetSpokeConcept( const AIConcept_t &concept, AI_Response *response, bool bCallback )
|
||||||
{
|
{
|
||||||
int idx = m_ConceptHistories.Find( concept );
|
int idx = m_ConceptHistories.Find( concept );
|
||||||
if ( idx == m_ConceptHistories.InvalidIndex() )
|
if ( idx == m_ConceptHistories.InvalidIndex() )
|
||||||
@ -1523,7 +1523,7 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response,
|
|||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
|
||||||
void CAI_Expresser::ClearSpokeConcept( AIConcept_t concept )
|
void CAI_Expresser::ClearSpokeConcept( const AIConcept_t &concept )
|
||||||
{
|
{
|
||||||
m_ConceptHistories.Remove( concept );
|
m_ConceptHistories.Remove( concept );
|
||||||
}
|
}
|
||||||
@ -1560,7 +1560,7 @@ bool CAI_Expresser::IsValidResponse( ResponseType_t type, const char *pszValue )
|
|||||||
CAI_TimedSemaphore *CAI_Expresser::GetMySpeechSemaphore( CBaseEntity *pNpc )
|
CAI_TimedSemaphore *CAI_Expresser::GetMySpeechSemaphore( CBaseEntity *pNpc )
|
||||||
{
|
{
|
||||||
if ( !pNpc->MyNPCPointer() )
|
if ( !pNpc->MyNPCPointer() )
|
||||||
return false;
|
return NULL;
|
||||||
|
|
||||||
return (pNpc->MyNPCPointer()->IsPlayerAlly() ? &g_AIFriendliesTalkSemaphore : &g_AIFoesTalkSemaphore );
|
return (pNpc->MyNPCPointer()->IsPlayerAlly() ? &g_AIFriendliesTalkSemaphore : &g_AIFoesTalkSemaphore );
|
||||||
}
|
}
|
||||||
@ -1573,16 +1573,23 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
|
|||||||
if ( !DebuggingSpeech() )
|
if ( !DebuggingSpeech() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
va_list arg_ptr;
|
||||||
|
|
||||||
|
va_start(arg_ptr, pszFormat);
|
||||||
|
CFmtStr formatted;
|
||||||
|
formatted.sprintf_argv(pszFormat, arg_ptr);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
|
||||||
if ( pFlex->MyNPCPointer() )
|
if ( pFlex->MyNPCPointer() )
|
||||||
{
|
{
|
||||||
|
|
||||||
DevMsg( pFlex->MyNPCPointer(), CFmtStr( &pszFormat ) );
|
DevMsg( pFlex->MyNPCPointer(), "%s", formatted.Get() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CGMsg( 1, CON_GROUP_SPEECH_AI, CFmtStr( &pszFormat ) );
|
CGMsg( 1, CON_GROUP_SPEECH_AI, "%s", formatted.Get() );
|
||||||
}
|
}
|
||||||
UTIL_LogPrintf( (char *) ( (const char *) CFmtStr( &pszFormat ) ) );
|
UTIL_LogPrintf( "%s", formatted.Get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "soundflags.h"
|
#include "soundflags.h"
|
||||||
#include "AI_Criteria.h"
|
#include "AI_Criteria.h"
|
||||||
#include "ai_responsesystem.h"
|
#include "AI_ResponseSystem.h"
|
||||||
#include "utldict.h"
|
#include "utldict.h"
|
||||||
#include "ai_speechconcept.h"
|
#include "ai_speechconcept.h"
|
||||||
|
|
||||||
@ -162,8 +162,8 @@ public:
|
|||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
|
||||||
bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
bool Speak( AIConcept_t &concept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
bool Speak( const AIConcept_t &concept, AI_CriteriaSet *criteria, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
|
|
||||||
// Given modifiers (which are colon-delimited strings), fill out a criteria set including this
|
// Given modifiers (which are colon-delimited strings), fill out a criteria set including this
|
||||||
// character's contexts and the ones in the modifier. This lets us hang on to them after a call
|
// character's contexts and the ones in the modifier. This lets us hang on to them after a call
|
||||||
@ -174,8 +174,8 @@ public:
|
|||||||
// AI_Response *SpeakFindResponse( AIConcept_t &concept, AI_CriteriaSet *criteria );
|
// AI_Response *SpeakFindResponse( AIConcept_t &concept, AI_CriteriaSet *criteria );
|
||||||
// Find the appropriate response for the given concept. Return false if none found.
|
// Find the appropriate response for the given concept. Return false if none found.
|
||||||
// Fills out the response object that you provide.
|
// Fills out the response object that you provide.
|
||||||
bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *modifiers = NULL );
|
bool FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *modifiers = NULL );
|
||||||
virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL );
|
virtual bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL );
|
||||||
float GetResponseDuration( AI_Response *response );
|
float GetResponseDuration( AI_Response *response );
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
@ -206,11 +206,11 @@ public:
|
|||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
|
||||||
bool CanSpeakConcept( AIConcept_t concept );
|
bool CanSpeakConcept( const AIConcept_t &concept );
|
||||||
bool SpokeConcept( AIConcept_t concept );
|
bool SpokeConcept( const AIConcept_t &concept );
|
||||||
float GetTimeSpokeConcept( AIConcept_t concept ); // returns -1 if never
|
float GetTimeSpokeConcept( const AIConcept_t &concept ); // returns -1 if never
|
||||||
void SetSpokeConcept( AIConcept_t concept, AI_Response *response, bool bCallback = true );
|
void SetSpokeConcept( const AIConcept_t &concept, AI_Response *response, bool bCallback = true );
|
||||||
void ClearSpokeConcept( AIConcept_t concept );
|
void ClearSpokeConcept( const AIConcept_t &concept );
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ public:
|
|||||||
bool ScriptSpeakRawScene( char const *soundname, float delay ) { return SpeakRawScene( soundname, delay, NULL ); }
|
bool ScriptSpeakRawScene( char const *soundname, float delay ) { return SpeakRawScene( soundname, delay, NULL ); }
|
||||||
bool ScriptSpeakAutoGeneratedScene( char const *soundname, float delay ) { return SpeakAutoGeneratedScene( soundname, delay ); }
|
bool ScriptSpeakAutoGeneratedScene( char const *soundname, float delay ) { return SpeakAutoGeneratedScene( soundname, delay ); }
|
||||||
int ScriptSpeakRawSentence( char const *pszSentence, float delay ) { return SpeakRawSentence( pszSentence, delay ); }
|
int ScriptSpeakRawSentence( char const *pszSentence, float delay ) { return SpeakRawSentence( pszSentence, delay ); }
|
||||||
bool ScriptSpeak( char const *concept, const char *modifiers ) { return Speak( CAI_Concept( concept ), modifiers[0] != '\0' ? modifiers : NULL ); }
|
bool ScriptSpeak( char const *concept, const char *modifiers ) { return Speak( concept, modifiers[0] != '\0' ? modifiers : NULL ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// helper used in dealing with RESPONSE_ENTITYIO
|
// helper used in dealing with RESPONSE_ENTITYIO
|
||||||
@ -249,7 +249,7 @@ protected:
|
|||||||
|
|
||||||
void DumpHistories();
|
void DumpHistories();
|
||||||
|
|
||||||
void SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... );
|
void SpeechMsg( CBaseEntity *pFlex, PRINTF_FORMAT_STRING const char *pszFormat, ... ) FMTFUNCTION(3, 4);
|
||||||
|
|
||||||
// --------------------------------
|
// --------------------------------
|
||||||
|
|
||||||
@ -321,15 +321,15 @@ public:
|
|||||||
// These two methods allow looking up a response and dispatching it to be two different steps
|
// These two methods allow looking up a response and dispatching it to be two different steps
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
//AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers );
|
//AI_Response *SpeakFindResponse( AIConcept_t concept, const AI_CriteriaSet& modifiers );
|
||||||
inline bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, AI_CriteriaSet *criteria = NULL ) { return SpeakDispatchResponse( concept, &response, criteria ); }
|
inline bool SpeakDispatchResponse( const AIConcept_t &concept, AI_Response &response, AI_CriteriaSet *criteria = NULL ) { return SpeakDispatchResponse( concept, &response, criteria ); }
|
||||||
#endif
|
#endif
|
||||||
bool SpeakFindResponse( AI_Response& outResponse, AIConcept_t concept, const char *modifiers = NULL );
|
bool SpeakFindResponse( AI_Response& outResponse, const AIConcept_t &concept, const char *modifiers = NULL );
|
||||||
// AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
// AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
||||||
// AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria );
|
// AI_Response *SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria );
|
||||||
// AI_Response *SpeakFindResponse( AIConcept_t concept );
|
// AI_Response *SpeakFindResponse( AIConcept_t concept );
|
||||||
// Find the appropriate response for the given concept. Return false if none found.
|
// Find the appropriate response for the given concept. Return false if none found.
|
||||||
// Fills out the response object that you provide.
|
// Fills out the response object that you provide.
|
||||||
bool FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria = NULL );
|
bool FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria = NULL );
|
||||||
|
|
||||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria = NULL );
|
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria = NULL );
|
||||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
|
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
|
||||||
@ -436,7 +436,7 @@ inline void CAI_ExpresserHost<BASE_NPC>::GatherCriteria( AI_CriteriaSet *outputC
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse(AI_Response& outResponse, AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse(AI_Response& outResponse, const AIConcept_t &concept, const char *modifiers /*= NULL*/ )
|
||||||
{
|
{
|
||||||
AI_CriteriaSet criteria;
|
AI_CriteriaSet criteria;
|
||||||
GatherCriteria(&criteria, concept, modifiers);
|
GatherCriteria(&criteria, concept, modifiers);
|
||||||
@ -446,7 +446,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse(AI_Response& outRespo
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( const AIConcept_t &concept, const char *modifiers /*= NULL*/ )
|
||||||
{
|
{
|
||||||
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
|
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, AI_CriteriaSet *criteria /*= NULL*/ )
|
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( const AIConcept_t &concept, AI_CriteriaSet *criteria /*= NULL*/ )
|
||||||
{
|
{
|
||||||
return this->GetExpresser()->SpeakFindResponse( concept, criteria );
|
return this->GetExpresser()->SpeakFindResponse( concept, criteria );
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t
|
|||||||
// class that generates a one off.
|
// class that generates a one off.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline AI_Response * CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept )
|
inline AI_Response * CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( const AIConcept_t &concept )
|
||||||
{
|
{
|
||||||
AI_CriteriaSet criteria;
|
AI_CriteriaSet criteria;
|
||||||
GatherCriteria( &criteria, concept, NULL );
|
GatherCriteria( &criteria, concept, NULL );
|
||||||
@ -479,7 +479,7 @@ inline AI_Response * CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline bool CAI_ExpresserHost<BASE_NPC>::FindResponse( AI_Response &outResponse, AIConcept_t &concept, AI_CriteriaSet *criteria )
|
inline bool CAI_ExpresserHost<BASE_NPC>::FindResponse( AI_Response &outResponse, const AIConcept_t &concept, AI_CriteriaSet *criteria )
|
||||||
{
|
{
|
||||||
return this->GetExpresser()->FindResponse( outResponse, concept, criteria );
|
return this->GetExpresser()->FindResponse( outResponse, concept, criteria );
|
||||||
}
|
}
|
||||||
@ -512,9 +512,9 @@ inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response *resp
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
template <class BASE_NPC>
|
template <class BASE_NPC>
|
||||||
inline void CAI_ExpresserHost<BASE_NPC>::DispatchResponse( const char *conceptName )
|
inline void CAI_ExpresserHost<BASE_NPC>::DispatchResponse( const char *conceptName )
|
||||||
{
|
{
|
||||||
Speak( (AIConcept_t)conceptName );
|
Speak( AIConcept_t( conceptName ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ inline void CAI_ExpresserHost<BASE_NPC>::DispatchResponse( const char *conceptNa
|
|||||||
template <class BASE_NPC, class EXPRESSER_TYPE>
|
template <class BASE_NPC, class EXPRESSER_TYPE>
|
||||||
class CAI_ExpresserHostWithData : public CAI_ExpresserHost<BASE_NPC>
|
class CAI_ExpresserHostWithData : public CAI_ExpresserHost<BASE_NPC>
|
||||||
{
|
{
|
||||||
DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost );
|
DECLARE_CLASS_NOFRIEND( CAI_ExpresserHostWithData, CAI_ExpresserHost<BASE_NPC> );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAI_ExpresserHostWithData( ) : m_pExpresser(NULL) {};
|
CAI_ExpresserHostWithData( ) : m_pExpresser(NULL) {};
|
||||||
@ -545,11 +545,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
EXPRESSER_TYPE *CreateExpresser( void )
|
EXPRESSER_TYPE *CreateExpresser( void )
|
||||||
{
|
{
|
||||||
AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", GetDebugName() );
|
AssertMsg1( m_pExpresser == NULL, "Tried to double-initialize expresser in %s\n", this->GetDebugName() );
|
||||||
m_pExpresser = new EXPRESSER_TYPE(this);
|
m_pExpresser = new EXPRESSER_TYPE(this);
|
||||||
if ( !m_pExpresser)
|
if ( !m_pExpresser)
|
||||||
{
|
{
|
||||||
AssertMsg1( false, "Creating an expresser failed in %s\n", GetDebugName() );
|
AssertMsg1( false, "Creating an expresser failed in %s\n", this->GetDebugName() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,8 +667,8 @@ public:
|
|||||||
CAI_ExpresserWithFollowup( CBaseFlex *pOuter = NULL ) : CAI_Expresser(pOuter),
|
CAI_ExpresserWithFollowup( CBaseFlex *pOuter = NULL ) : CAI_Expresser(pOuter),
|
||||||
m_pPostponedFollowup(NULL)
|
m_pPostponedFollowup(NULL)
|
||||||
{};
|
{};
|
||||||
virtual bool Speak( AIConcept_t &concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||||
virtual bool SpeakDispatchResponse( AIConcept_t &concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL );
|
virtual bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, AI_CriteriaSet *criteria, IRecipientFilter *filter = NULL );
|
||||||
virtual void SpeakDispatchFollowup( AI_ResponseFollowup &followup );
|
virtual void SpeakDispatchFollowup( AI_ResponseFollowup &followup );
|
||||||
|
|
||||||
virtual void OnSpeechFinished();
|
virtual void OnSpeechFinished();
|
||||||
|
@ -277,7 +277,8 @@ bool CGenericActorCustom::KeyValue( const char *szKeyName, const char *szValue )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CGenericActorCustom::SpeakIfAllowed( const char *concept, AI_CriteriaSet *modifiers )
|
void CGenericActorCustom::SpeakIfAllowed( const char *concept, AI_CriteriaSet *modifiers )
|
||||||
{
|
{
|
||||||
Speak( concept, modifiers ? *modifiers : AI_CriteriaSet() );
|
AI_CriteriaSet empty;
|
||||||
|
Speak( concept, modifiers ? *modifiers : empty );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1263,7 +1263,8 @@ void CZombieCustom::AttackSound( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CZombieCustom::SpeakIfAllowed(const char *concept, AI_CriteriaSet *modifiers)
|
void CZombieCustom::SpeakIfAllowed(const char *concept, AI_CriteriaSet *modifiers)
|
||||||
{
|
{
|
||||||
Speak( concept, modifiers ? *modifiers : AI_CriteriaSet() );
|
AI_CriteriaSet empty;
|
||||||
|
Speak( concept, modifiers ? *modifiers : empty );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
//
|
//
|
||||||
//===========================================================================//
|
//===========================================================================//
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
#include "ai_criteria.h"
|
#include "AI_Criteria.h"
|
||||||
|
|
||||||
#ifdef GAME_DLL
|
#ifdef GAME_DLL
|
||||||
#include "ai_speech.h"
|
#include "ai_speech.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <keyvalues.h>
|
#include <KeyValues.h>
|
||||||
#include "engine/ienginesound.h"
|
#include "engine/IEngineSound.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include <tier0/memdbgon.h>
|
#include <tier0/memdbgon.h>
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
#include "soundemittersystem/isoundemittersystembase.h"
|
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
||||||
#include "ai_responsesystem.h"
|
#include "AI_ResponseSystem.h"
|
||||||
#include "igamesystem.h"
|
#include "igamesystem.h"
|
||||||
#include "ai_criteria.h"
|
#include "AI_Criteria.h"
|
||||||
#include <keyvalues.h>
|
#include <KeyValues.h>
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "utldict.h"
|
#include "utldict.h"
|
||||||
#ifdef GAME_DLL
|
#ifdef GAME_DLL
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ai_criteria.h"
|
#include "AI_Criteria.h"
|
||||||
#include "../../public/responserules/response_types.h"
|
#include "../../public/responserules/response_types.h"
|
||||||
|
|
||||||
// using ResponseRules::IResponseFilter;
|
// using ResponseRules::IResponseFilter;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../public/responserules/response_types.h"
|
#include "responserules/response_types.h"
|
||||||
|
|
||||||
class CAI_Concept : public ResponseRules::CRR_Concept
|
class CAI_Concept : public ResponseRules::CRR_Concept
|
||||||
{
|
{
|
||||||
|
@ -470,6 +470,16 @@ inline void V_wcscat( INOUT_Z_CAP(cchDest) wchar_t *dest, const wchar_t *src, in
|
|||||||
V_wcsncat( dest, src, cchDest, COPY_ALL_CHARACTERS );
|
V_wcsncat( dest, src, cchDest, COPY_ALL_CHARACTERS );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reentrant strtok
|
||||||
|
inline static char* V_strtok_s( char *str, const char *delimiters, char **context )
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return strtok_s( str, delimiters, context );
|
||||||
|
#elif POSIX
|
||||||
|
return strtok_r( str, delimiters, context );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// generic unique name helper functions
|
// generic unique name helper functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -366,6 +366,7 @@ namespace ResponseRules
|
|||||||
|
|
||||||
I Insert( const char *pName, const T &element )
|
I Insert( const char *pName, const T &element )
|
||||||
{
|
{
|
||||||
|
extern const char *ResponseCopyString( const char *in );
|
||||||
char const *pString = ResponseCopyString( pName );
|
char const *pString = ResponseCopyString( pName );
|
||||||
unsigned int hash = RR_HASH( pString );
|
unsigned int hash = RR_HASH( pString );
|
||||||
m_ReverseMap.Insert( hash, pString );
|
m_ReverseMap.Insert( hash, pString );
|
||||||
@ -374,6 +375,7 @@ namespace ResponseRules
|
|||||||
|
|
||||||
I Insert( const char *pName )
|
I Insert( const char *pName )
|
||||||
{
|
{
|
||||||
|
extern const char *ResponseCopyString( const char *in );
|
||||||
char const *pString = ResponseCopyString( pName );
|
char const *pString = ResponseCopyString( pName );
|
||||||
unsigned int hash = RR_HASH( pString );
|
unsigned int hash = RR_HASH( pString );
|
||||||
m_ReverseMap.Insert( hash, pString );
|
m_ReverseMap.Insert( hash, pString );
|
||||||
@ -388,7 +390,7 @@ namespace ResponseRules
|
|||||||
|
|
||||||
const char *GetElementName( I i )
|
const char *GetElementName( I i )
|
||||||
{
|
{
|
||||||
int k = Key( i );
|
int k = this->Key( i );
|
||||||
int slot = m_ReverseMap.Find( k );
|
int slot = m_ReverseMap.Find( k );
|
||||||
if ( slot == m_ReverseMap.InvalidIndex() )
|
if ( slot == m_ReverseMap.InvalidIndex() )
|
||||||
return "";
|
return "";
|
||||||
@ -397,7 +399,7 @@ namespace ResponseRules
|
|||||||
|
|
||||||
const char *GetElementName( I i ) const
|
const char *GetElementName( I i ) const
|
||||||
{
|
{
|
||||||
int k = Key( i );
|
int k = this->Key( i );
|
||||||
int slot = m_ReverseMap.Find( k );
|
int slot = m_ReverseMap.Find( k );
|
||||||
if ( slot == m_ReverseMap.InvalidIndex() )
|
if ( slot == m_ReverseMap.InvalidIndex() )
|
||||||
return "";
|
return "";
|
||||||
|
@ -594,7 +594,7 @@ void ConCommand::Dispatch( const CCommand &command )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Command without callback!!!
|
// Command without callback!!!
|
||||||
AssertMsg( 0, ( "Encountered ConCommand '%s' without a callback!\n", GetName() ) );
|
AssertMsg( 0, "Encountered ConCommand '%s' without a callback!\n", GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user