Browse Source

client: add waveplaylen console command like in GoldSrc

pull/2/head
Alibek Omarov 4 years ago
parent
commit
0a818f3f3f
  1. 29
      engine/client/cl_cmds.c
  2. 1
      engine/client/cl_main.c
  3. 1
      engine/client/client.h

29
engine/client/cl_cmds.c

@ -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( "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] ); 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 );
}

1
engine/client/cl_main.c

@ -2879,6 +2879,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("internetservers", CL_InternetServers_f, "collect info about internet servers" ); 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 ("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 ("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 ("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)" ); Cmd_AddCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" );

1
engine/client/client.h

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

Loading…
Cancel
Save