cl_dll/c_soundscape.cpp
294295296297298299300301302303
m_loopingSoundId = 0;
const char *mapname = MapName();
const char *mapSoundscapeFilename = NULL;
if ( mapname && *mapname )
{
mapSoundscapeFilename = VarArgs( "scripts/soundscapes_%s.txt", mapname );
}
KeyValues *manifest = new KeyValues( SOUNDSCAPE_MANIFEST_FILE );
294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
m_loopingSoundId = 0;
const char *mapname = MapName();
// Jon - 2/14/2007: new method
//const char *mapSoundscapeFilename = NULL;
char mapSoundscapeFilename[256] = {0};
char mapSoundscapeFilenameFF[256] = {0}; // for the FF method of using maps/mapname_soundscapes.txt
if ( mapname && *mapname )
{
// Jon - 2/14/2007: Let's support both methods.
//mapSoundscapeFilename = VarArgs( "scripts/soundscapes_%s.txt", mapname )
// Let's load map soundscape files without worrying about the manifest.
if (filesystem->FileExists( VarArgs( "scripts/soundscapes_%s.txt", mapname ) ))
{
Q_snprintf(mapSoundscapeFilename, sizeof(mapSoundscapeFilename), "scripts/soundscapes_%s.txt", mapname);
AddSoundScapeFile( mapSoundscapeFilename );
}
// I'd rather FF mappers use maps/mapname_soundscapes.txt to keep most map files together in the maps directory, like with the lua files.
if (filesystem->FileExists( VarArgs( "maps/%s_soundscapes.txt", mapname ) ))
{
Q_snprintf(mapSoundscapeFilenameFF, sizeof(mapSoundscapeFilenameFF), "maps/%s_soundscapes.txt", mapname);
// even though they could have completely different entries, warn them anyway so they can merge them together
if ( mapSoundscapeFilename[0] )
Warning( "C_SoundscapeSystem::Init: Both %s and %s exist! Potential duplicate soundscapes, so not loading %s. To get rid of this warning, merge one file into the other.\n", mapSoundscapeFilename, mapSoundscapeFilenameFF, mapSoundscapeFilenameFF );
else
AddSoundScapeFile( mapSoundscapeFilenameFF );
}
// NULL their ends just in case
mapSoundscapeFilename[255] = 0;
mapSoundscapeFilenameFF[255] = 0;
}
KeyValues *manifest = new KeyValues( SOUNDSCAPE_MANIFEST_FILE );
307308309310311312313314315316317318
{
if ( !Q_stricmp( sub->GetName(), "file" ) )
{
// Add
AddSoundScapeFile( sub->GetString() );
if ( mapSoundscapeFilename && FStrEq( sub->GetString(), mapSoundscapeFilename ) )
{
mapSoundscapeFilename = NULL; // we've already loaded the map's soundscape
}
continue;
}
335336337338339340341342343344345346347348349350351352353354355
{
if ( !Q_stricmp( sub->GetName(), "file" ) )
{
// Jon - 2/14/2007: don't load the map soundscapes file twice
if ( mapSoundscapeFilename[0] && FStrEq(sub->GetString(), mapSoundscapeFilename) )
continue;
if ( mapSoundscapeFilenameFF[0] && FStrEq(sub->GetString(), mapSoundscapeFilenameFF) )
continue;
// Add
AddSoundScapeFile( sub->GetString() );
// Jon - 2/14/2007: altered and moved up above
//if ( mapSoundscapeFilename && FStrEq( sub->GetString(), mapSoundscapeFilename ) )
//{
// mapSoundscapeFilename = NULL; // we've already loaded the map's soundscape
//}
continue;
}
320321322323324325326327328329
SOUNDSCAPE_MANIFEST_FILE, sub->GetName() );
}
if ( mapSoundscapeFilename && filesystem->FileExists( mapSoundscapeFilename ) )
{
AddSoundScapeFile( mapSoundscapeFilename );
}
}
else
{
357358359360361362363364365366367
SOUNDSCAPE_MANIFEST_FILE, sub->GetName() );
}
// Jon - 2/14/2007: altered and moved up above
//if ( mapSoundscapeFilename && filesystem->FileExists( mapSoundscapeFilename ) )
//{
// AddSoundScapeFile( mapSoundscapeFilename );
//}
}
else
{