Mute shellmap combat

This commit is contained in:
Paul Chote
2010-10-14 20:03:36 +13:00
parent 9c944924de
commit 4bdf675def
3 changed files with 19 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ namespace OpenRA
return; return;
var sound = sounds[name]; var sound = sounds[name];
soundEngine.Play2D(sound, false, true, float2.Zero, SoundVolume); soundEngine.Play2D(sound, false, true, float2.Zero, InternalSoundVolume);
} }
public static void Play(string name, float2 pos) public static void Play(string name, float2 pos)
@@ -63,7 +63,7 @@ namespace OpenRA
return; return;
var sound = sounds[name]; var sound = sounds[name];
soundEngine.Play2D(sound, false, false, pos, SoundVolume); soundEngine.Play2D(sound, false, false, pos, InternalSoundVolume);
} }
public static void PlayToPlayer(Player player, string name) public static void PlayToPlayer(Player player, string name)
@@ -81,7 +81,7 @@ namespace OpenRA
public static void PlayVideo(byte[] raw) public static void PlayVideo(byte[] raw)
{ {
rawSource = LoadSoundRaw(raw); rawSource = LoadSoundRaw(raw);
video = soundEngine.Play2D(rawSource, false, true, float2.Zero, SoundVolume); video = soundEngine.Play2D(rawSource, false, true, float2.Zero, InternalSoundVolume);
} }
public static void PlayVideo() public static void PlayVideo()
@@ -171,13 +171,25 @@ namespace OpenRA
set { soundEngine.Volume = value;} set { soundEngine.Volume = value;}
} }
static float soundVolumeModifier = 1.0f;
public static float SoundVolumeModifier
{
get { return soundVolumeModifier; }
set
{
soundVolumeModifier = value;
soundEngine.SetSoundVolume(InternalSoundVolume, music, video);
}
}
static float InternalSoundVolume { get { return SoundVolume*soundVolumeModifier; } }
public static float SoundVolume public static float SoundVolume
{ {
get { return Game.Settings.Sound.SoundVolume; } get { return Game.Settings.Sound.SoundVolume; }
set set
{ {
Game.Settings.Sound.SoundVolume = value; Game.Settings.Sound.SoundVolume = value;
soundEngine.SetSoundVolume(value, music, video); soundEngine.SetSoundVolume(InternalSoundVolume, music, video);
} }
} }

View File

@@ -111,7 +111,8 @@ namespace OpenRA
p.Stances[q] = Stance.Neutral; p.Stances[q] = Stance.Neutral;
PathFinder = new PathFinder(this); PathFinder = new PathFinder(this);
Sound.SoundVolumeModifier = 1.0f;
foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>()) foreach (var wlh in WorldActor.TraitsImplementing<IWorldLoaded>())
wlh.WorldLoaded(this); wlh.WorldLoaded(this);
} }

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
{ {
Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2()); Game.MoveViewport((.5f * (w.Map.TopLeft + w.Map.BottomRight).ToFloat2()).ToInt2());
Actors = w.WorldActor.Trait<SpawnMapActors>().Actors; Actors = w.WorldActor.Trait<SpawnMapActors>().Actors;
Sound.SoundVolumeModifier = 0f;
} }
int ticks = 0; int ticks = 0;