2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2025-01-09 18:05:05 +01:00

engine: client: try to prepend media/ if audio stream couldn't be opened

This commit is contained in:
Alibek Omarov 2024-01-14 10:00:16 +03:00
parent a8cc68f6b9
commit cee6862924
2 changed files with 13 additions and 3 deletions

View File

@ -96,6 +96,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
// open stream
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;

View File

@ -152,7 +152,7 @@ stream_t *FS_OpenStream( const char *filename )
string path, loadname;
qboolean anyformat = true;
const streamfmt_t *format;
stream_t *stream;
stream_t *stream = NULL;
Sound_Reset(); // clear old streaminfo
Q_strncpy( loadname, filename, sizeof( loadname ));
@ -188,9 +188,18 @@ stream_t *FS_OpenStream( const char *filename )
}
}
Con_Reportf( "FS_OpenStream: couldn't open \"%s\"\n", loadname );
// compatibility with original Xash3D, try media/ folder
if( Q_strncmp( filename, "media/", sizeof( "media/" ) - 1 ))
{
Q_snprintf( loadname, sizeof( loadname ), "media/%s", filename );
stream = FS_OpenStream( loadname );
}
else
{
Con_Reportf( "%s: couldn't open \"%s\" or \"%s\"\n", __func__, filename + 6, filename );
}
return NULL;
return stream;
}
/*