client: port fix of spk/speak commands from old engine

This commit is contained in:
Alibek Omarov 2021-03-09 23:34:12 +03:00
parent 155eb1ba58
commit 4db2aaffc4
2 changed files with 23 additions and 5 deletions

View File

@ -1679,26 +1679,41 @@ void S_PlayVol_f( void )
S_StartLocalSound( Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), false );
}
static void S_Say( const char *name, qboolean reliable )
{
char sentence[1024];
// predefined vox sentence
if( name[0] == '!' )
{
S_StartLocalSound( name, 1.0f, reliable );
return;
}
Q_snprintf( sentence, sizeof( sentence ), "!#%s", name );
S_StartLocalSound( sentence, 1.0f, reliable );
}
void S_Say_f( void )
{
if( Cmd_Argc() == 1 )
{
Con_Printf( S_USAGE "speak <soundfile>\n" );
Con_Printf( S_USAGE "speak <vox sentence>\n" );
return;
}
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, false );
S_Say( Cmd_Argv( 1 ), false );
}
void S_SayReliable_f( void )
{
if( Cmd_Argc() == 1 )
{
Con_Printf( S_USAGE "spk <soundfile>\n" );
Con_Printf( S_USAGE "spk <vox sentence>\n" );
return;
}
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, true );
S_Say( Cmd_Argv( 1 ), true );
}
/*

View File

@ -469,7 +469,10 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
// lookup actual string in g_Sentences,
// set pointer to string data
psz = VOX_LookupString( pszin, NULL );
if( pszin[0] == '#' )
psz = (char *)pszin + 1;
else
psz = VOX_LookupString( pszin, NULL );
if( !psz )
{