Browse Source

engine: client: remove media/ prefix for CD tracks, add it while parsing cdaudio.txt for compatibility

pull/2/head
Alibek Omarov 2 years ago
parent
commit
398cec626e
  1. 11
      engine/client/cl_game.c
  2. 4
      engine/client/s_stream.c

11
engine/client/cl_game.c

@ -200,7 +200,7 @@ CL_InitCDAudio
Initialize CD playlist Initialize CD playlist
==================== ====================
*/ */
void CL_InitCDAudio( const char *filename ) static void CL_InitCDAudio( const char *filename )
{ {
byte *afile; byte *afile;
char *pfile; char *pfile;
@ -221,8 +221,13 @@ void CL_InitCDAudio( const char *filename )
// format: trackname\n [num] // format: trackname\n [num]
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
{ {
if( !Q_stricmp( token, "blank" )) token[0] = '\0'; if( !Q_stricmp( token, "blank" ))
Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] )); clgame.cdtracks[c][0] = '\0';
else
{
Q_snprintf( clgame.cdtracks[c], sizeof( clgame.cdtracks[c] ),
"media/%s", token );
}
if( ++c > MAX_CDTRACKS - 1 ) if( ++c > MAX_CDTRACKS - 1 )
{ {

4
engine/client/s_stream.c

@ -95,7 +95,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
else Q_strncpy( s_bgTrack.loopName, mainTrack, sizeof( s_bgTrack.loopName )); else Q_strncpy( s_bgTrack.loopName, mainTrack, sizeof( s_bgTrack.loopName ));
// open stream // open stream
s_bgTrack.stream = FS_OpenStream( va( "media/%s", introTrack )); s_bgTrack.stream = FS_OpenStream( introTrack );
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current )); Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
s_bgTrack.source = cls.key_dest; s_bgTrack.source = cls.key_dest;
@ -242,7 +242,7 @@ void S_StreamBackgroundTrack( void )
if( s_bgTrack.loopName[0] ) if( s_bgTrack.loopName[0] )
{ {
FS_FreeStream( s_bgTrack.stream ); FS_FreeStream( s_bgTrack.stream );
s_bgTrack.stream = FS_OpenStream( va( "media/%s", s_bgTrack.loopName )); s_bgTrack.stream = FS_OpenStream( s_bgTrack.loopName );
Q_strncpy( s_bgTrack.current, s_bgTrack.loopName, sizeof( s_bgTrack.current )); Q_strncpy( s_bgTrack.current, s_bgTrack.loopName, sizeof( s_bgTrack.current ));
if( !s_bgTrack.stream ) return; if( !s_bgTrack.stream ) return;

Loading…
Cancel
Save