From 398cec626e41896e0fd290081eaab7e2974d35b8 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 19 Apr 2023 17:54:28 +0300 Subject: [PATCH] engine: client: remove media/ prefix for CD tracks, add it while parsing cdaudio.txt for compatibility --- engine/client/cl_game.c | 11 ++++++++--- engine/client/s_stream.c | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 41b32711..afd1672a 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -200,7 +200,7 @@ CL_InitCDAudio Initialize CD playlist ==================== */ -void CL_InitCDAudio( const char *filename ) +static void CL_InitCDAudio( const char *filename ) { byte *afile; char *pfile; @@ -221,8 +221,13 @@ void CL_InitCDAudio( const char *filename ) // format: trackname\n [num] while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL ) { - if( !Q_stricmp( token, "blank" )) token[0] = '\0'; - Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] )); + if( !Q_stricmp( token, "blank" )) + clgame.cdtracks[c][0] = '\0'; + else + { + Q_snprintf( clgame.cdtracks[c], sizeof( clgame.cdtracks[c] ), + "media/%s", token ); + } if( ++c > MAX_CDTRACKS - 1 ) { diff --git a/engine/client/s_stream.c b/engine/client/s_stream.c index 10ed064a..1c19e7b9 100644 --- a/engine/client/s_stream.c +++ b/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 )); // 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 )); memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade s_bgTrack.source = cls.key_dest; @@ -242,7 +242,7 @@ void S_StreamBackgroundTrack( void ) if( s_bgTrack.loopName[0] ) { 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 )); if( !s_bgTrack.stream ) return;