Load music after mounting map
This commit is contained in:
@@ -32,21 +32,9 @@ namespace OpenRA.GameRules
|
|||||||
|
|
||||||
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
|
var ext = nd.ContainsKey("Extension") ? nd["Extension"].Value : "aud";
|
||||||
Filename = (nd.ContainsKey("Filename") ? nd["Filename"].Value : key) + "." + ext;
|
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))
|
if (!GlobalFileSystem.Exists(Filename))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ namespace OpenRA
|
|||||||
using (new Support.PerfTimer("Map.SequenceProvider.Preload"))
|
using (new Support.PerfTimer("Map.SequenceProvider.Preload"))
|
||||||
map.SequenceProvider.Preload();
|
map.SequenceProvider.Preload();
|
||||||
|
|
||||||
|
// Load music with map assets mounted
|
||||||
|
using (new Support.PerfTimer("Map.Music"))
|
||||||
|
foreach (var entry in map.Rules.Music)
|
||||||
|
entry.Value.Load();
|
||||||
|
|
||||||
VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
|
VoxelProvider.Initialize(Manifest.VoxelSequences, map.VoxelSequenceDefinitions);
|
||||||
VoxelLoader.Finish();
|
VoxelLoader.Finish();
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ Videos:
|
|||||||
Music:
|
Music:
|
||||||
rain: Rain (ambient)
|
rain: Rain (ambient)
|
||||||
Hidden: true
|
Hidden: true
|
||||||
Filename: ./mods/ra/maps/fort-lonestar/rain
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
Fog: True
|
Fog: True
|
||||||
|
|||||||
Reference in New Issue
Block a user