client: add waveplaylen console command like in GoldSrc

This commit is contained in:
Alibek Omarov 2021-03-07 02:51:03 +03:00
parent fe2c4af8c2
commit 0a818f3f3f
3 changed files with 31 additions and 0 deletions

View File

@ -418,3 +418,32 @@ void SCR_Viewpos_f( void )
Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] );
Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] );
}
/*
=============
CL_WavePlayLen_f
=============
*/
void CL_WavePlayLen_f( void )
{
const char *name;
uint msecs;
if( Cmd_Argc() != 2 )
{
Con_Printf( "waveplaylen <wave file name>: returns approximate number of milliseconds a wave file will take to play.\n" );
return;
}
name = Cmd_Argv( 1 );
msecs = Sound_GetApproxWavePlayLen( name );
if( msecs == 0 )
{
Con_Printf( "Unable to read %s, file may be missing or incorrectly formatted.\n", name );
return;
}
Con_Printf( "Play time is approximately %dms\n", msecs );
}

View File

@ -2879,6 +2879,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("internetservers", CL_InternetServers_f, "collect info about internet servers" );
Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" );
Cmd_AddCommand ("mp3", CL_PlayCDTrack_f, "Play mp3-track (based on virtual cd-player)" );
Cmd_AddCommand ("waveplaylen", CL_WavePlayLen_f, "Get approximate length of wave file");
Cmd_AddCommand ("setinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of userinfo)" );
Cmd_AddCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" );

View File

@ -717,6 +717,7 @@ void CL_SaveShot_f( void );
void CL_LevelShot_f( void );
void CL_SetSky_f( void );
void SCR_Viewpos_f( void );
void CL_WavePlayLen_f( void );
//
// cl_custom.c