Merge pull request #9488 from atlimit8/MapMusic

Map Music
This commit is contained in:
abcdefg30
2015-10-18 17:47:26 +02:00
14 changed files with 27 additions and 21 deletions

View File

@@ -32,21 +32,9 @@ namespace OpenRA.GameRules
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
if (!GlobalFileSystem.Exists(Filename))
return;
Exists = true;
using (var s = GlobalFileSystem.Open(Filename))
{
if (Filename.ToLowerInvariant().EndsWith("wav"))
Length = (int)WavLoader.WaveLength(s);
else
Length = (int)AudLoader.SoundLength(s);
}
}
public void Reload()
public void Load()
{
if (!GlobalFileSystem.Exists(Filename))
return;

View File

@@ -80,7 +80,7 @@ namespace OpenRA
using (new PerfTimer("Music"))
music = LoadYamlRules(musicCache, m.Music,
NoMapRules,
map != null ? map.MusicDefinitions : NoMapRules,
(k, _) => new MusicInfo(k.Key, k.Value));
using (new PerfTimer("TileSets"))