Browse Source

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

pull/2/head
Alibek Omarov 4 years ago
parent
commit
4db2aaffc4
  1. 23
      engine/client/s_main.c
  2. 3
      engine/client/s_vox.c

23
engine/client/s_main.c

@ -1679,26 +1679,41 @@ void S_PlayVol_f( void )
S_StartLocalSound( Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), false ); 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 ) void S_Say_f( void )
{ {
if( Cmd_Argc() == 1 ) if( Cmd_Argc() == 1 )
{ {
Con_Printf( S_USAGE "speak <soundfile>\n" ); Con_Printf( S_USAGE "speak <vox sentence>\n" );
return; return;
} }
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, false ); S_Say( Cmd_Argv( 1 ), false );
} }
void S_SayReliable_f( void ) void S_SayReliable_f( void )
{ {
if( Cmd_Argc() == 1 ) if( Cmd_Argc() == 1 )
{ {
Con_Printf( S_USAGE "spk <soundfile>\n" ); Con_Printf( S_USAGE "spk <vox sentence>\n" );
return; return;
} }
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, true ); S_Say( Cmd_Argv( 1 ), true );
} }
/* /*

3
engine/client/s_vox.c

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

Loading…
Cancel
Save