Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choreography-driven sentence system #317

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions sp/src/game/server/ai_speech_new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "sceneentity.h"
#include "ai_speechqueue.h"
#ifdef MAPBASE
#include "mapbase/choreosentence.h"
#include "ai_squad.h"
#endif

Expand Down Expand Up @@ -846,6 +847,9 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
case ResponseRules::RESPONSE_NONE:
break;

#ifdef MAPBASE
case ResponseRules::RESPONSE_CHOREOSENTENCE:
#endif
case ResponseRules::RESPONSE_SPEAK:
{
if ( !result->ShouldntUseScene() )
Expand Down Expand Up @@ -1194,6 +1198,15 @@ float CAI_Expresser::GetResponseDuration( AI_Response *result )
case ResponseRules::RESPONSE_NONE:
case ResponseRules::RESPONSE_ENTITYIO:
return 0.0f;
#ifdef MAPBASE
case ResponseRules::RESPONSE_CHOREOSENTENCE:
{
const ChoreoSentence_t *pSentence = LookupChoreoSentence( GetOuter(), response );
if (pSentence)
return GetChoreoSentenceDuration( GetOuter(), *pSentence );
}
break;
#endif
}

return 0.0f;
Expand Down
8 changes: 8 additions & 0 deletions sp/src/game/server/baseflex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,8 +2093,16 @@ float CBaseFlex::PlayScene( const char *pszScene, float flDelay, AI_Response *re
#ifdef MAPBASE
float CBaseFlex::PlayAutoGeneratedSoundScene( const char *soundname, float flDelay, AI_Response *response, IRecipientFilter *filter )
{
if (response && response->GetType() == ResponseRules::RESPONSE_CHOREOSENTENCE)
return InstancedChoreoSentenceScene( this, soundname, NULL, flDelay, false, response, false, filter );

return InstancedAutoGeneratedSoundScene( this, soundname, NULL, flDelay, false, response, false, filter );
}

float CBaseFlex::PlayChoreoSentenceScene( const char *pszSentence, float flDelay, AI_Response *response, IRecipientFilter *filter )
{
return InstancedChoreoSentenceScene( this, pszSentence, NULL, flDelay, false, response, false, filter );
}
#else
float CBaseFlex::PlayAutoGeneratedSoundScene( const char *soundname )
{
Expand Down
1 change: 1 addition & 0 deletions sp/src/game/server/baseflex.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class CBaseFlex : public CBaseAnimatingOverlay

virtual float PlayScene( const char *pszScene, float flDelay = 0.0f, AI_Response *response = NULL, IRecipientFilter *filter = NULL );
#ifdef MAPBASE
virtual float PlayChoreoSentenceScene( const char *pszSentenceName, float flDelay = 0.0f, AI_Response *response = NULL, IRecipientFilter *filter = NULL );
virtual float PlayAutoGeneratedSoundScene( const char *soundname, float flDelay = 0.0f, AI_Response *response = NULL, IRecipientFilter *filter = NULL );
#else
virtual float PlayAutoGeneratedSoundScene( const char *soundname );
Expand Down
13 changes: 13 additions & 0 deletions sp/src/game/server/hl2/env_speaker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,19 @@ void CSpeaker::DispatchResponse( const char *conceptName )
CAI_Expresser::RunScriptResponse( pTarget, response, &set, true );
break;
}
#endif
#ifdef MAPBASE
case ResponseRules::RESPONSE_CHOREOSENTENCE:
{
CBaseFlex *pFlex = NULL;
if (pTarget != this)
{
// Attempt to get flex on the target
pFlex = dynamic_cast<CBaseFlex*>(pTarget);
}
InstancedAutoGeneratedSoundScene(pFlex, response);
break;
}
#endif
default:
break;
Expand Down
Loading
Loading