Allow pre-existing choreo game_text params to be overridden by VScript

This commit is contained in:
ALLEN-PC\acj30 2025-01-24 10:36:52 -06:00 committed by Blixibon
parent 496cbe7a06
commit fde0d4db6c
3 changed files with 18 additions and 6 deletions

View File

@ -922,7 +922,7 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *res
textParams.g1 = 255;
textParams.b1 = 255;
if (ai_speech_print_mode.GetBool() && GetOuter()->GetGameTextSpeechParams( textParams ))
if (ai_speech_print_mode.GetBool() && GetOuter()->DispatchGetGameTextSpeechParams( textParams ))
{
CRecipientFilter filter;
filter.AddAllPlayers();

View File

@ -816,7 +816,7 @@ bool CBaseFlex::StartSceneEvent( CSceneEventInfo *info, CChoreoScene *scene, CCh
textParams.g1 = 255;
textParams.b1 = 255;
if ( GetGameTextSpeechParams( textParams ) )
if ( DispatchGetGameTextSpeechParams( textParams ) )
{
CRecipientFilter filter;
filter.AddAllPlayers();
@ -2120,11 +2120,17 @@ float CBaseFlex::PlayAutoGeneratedSoundScene( const char *soundname )
//-----------------------------------------------------------------------------
// Purpose: Parameters for scene event AI_GameText
//-----------------------------------------------------------------------------
bool CBaseFlex::GetGameTextSpeechParams( hudtextparms_t &params )
bool CBaseFlex::DispatchGetGameTextSpeechParams( hudtextparms_t &params )
{
// First, get any default values overridden by this class
bool bReturn = GetGameTextSpeechParams( params );
// Allow VScript to override after
ScriptVariant_t varTable;
if (g_pScriptVM->GetValue(m_ScriptScope, "m_GameTextSpeechParams", &varTable) && varTable.m_type == FIELD_HSCRIPT)
if (g_pScriptVM->GetValue( m_ScriptScope, "m_GameTextSpeechParams", &varTable ) && varTable.m_type == FIELD_HSCRIPT)
{
bReturn = true;
int nIterator = -1;
ScriptVariant_t varKey, varValue;
while ((nIterator = g_pScriptVM->GetKeyValue( varTable.m_hScript, nIterator, &varKey, &varValue )) != -1)
@ -2161,13 +2167,18 @@ bool CBaseFlex::GetGameTextSpeechParams( hudtextparms_t &params )
{
params.fxTime = varValue.m_float;
}
else if (FStrEq( varKey.m_pszString, "disabled" ))
{
// Allow the params to disable game_text choreo if needed
bReturn = !(varValue.m_int > 0);
}
g_pScriptVM->ReleaseValue( varKey );
g_pScriptVM->ReleaseValue( varValue );
}
}
return true;
return bReturn;
}
#endif

View File

@ -142,7 +142,8 @@ public:
virtual int GetSpecialDSP( void ) { return 0; }
#ifdef MAPBASE
virtual bool GetGameTextSpeechParams( hudtextparms_t &params );
bool DispatchGetGameTextSpeechParams( hudtextparms_t &params );
virtual bool GetGameTextSpeechParams( hudtextparms_t &params ) { return true; }
#endif
protected: