Convert Sound.Play* to WPos.
This commit is contained in:
@@ -79,7 +79,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public static void SetListenerPosition(float2 position) { soundEngine.SetListenerPosition(position); }
|
public static void SetListenerPosition(float2 position) { soundEngine.SetListenerPosition(position); }
|
||||||
|
|
||||||
static ISound Play(Player player, string name, bool headRelative, PPos pos, float volumeModifier)
|
static ISound Play(Player player, string name, bool headRelative, WPos pos, float volumeModifier)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(name))
|
if (String.IsNullOrEmpty(name))
|
||||||
return null;
|
return null;
|
||||||
@@ -87,16 +87,16 @@ namespace OpenRA
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
return soundEngine.Play2D(sounds[name],
|
return soundEngine.Play2D(sounds[name],
|
||||||
false, headRelative, pos.ToFloat2(),
|
false, headRelative, PPos.FromWPosHackZ(pos).ToFloat2(),
|
||||||
InternalSoundVolume * volumeModifier, true);
|
InternalSoundVolume * volumeModifier, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ISound Play(string name) { return Play(null, name, true, PPos.Zero, 1); }
|
public static ISound Play(string name) { return Play(null, name, true, WPos.Zero, 1); }
|
||||||
public static ISound Play(string name, PPos pos) { return Play(null, name, false, pos, 1); }
|
public static ISound Play(string name, WPos pos) { return Play(null, name, false, pos, 1); }
|
||||||
public static ISound Play(string name, float volumeModifier) { return Play(null, name, true, PPos.Zero, volumeModifier); }
|
public static ISound Play(string name, float volumeModifier) { return Play(null, name, true, WPos.Zero, volumeModifier); }
|
||||||
public static ISound Play(string name, PPos pos, float volumeModifier) { return Play(null, name, false, pos, volumeModifier); }
|
public static ISound Play(string name, WPos pos, float volumeModifier) { return Play(null, name, false, pos, volumeModifier); }
|
||||||
public static ISound PlayToPlayer(Player player, string name) { return Play(player, name, true, PPos.Zero, 1); }
|
public static ISound PlayToPlayer(Player player, string name) { return Play(player, name, true, WPos.Zero, 1); }
|
||||||
public static ISound PlayToPlayer(Player player, string name, PPos pos) { return Play(player, name, false, pos, 1); }
|
public static ISound PlayToPlayer(Player player, string name, WPos pos) { return Play(player, name, false, pos, 1); }
|
||||||
|
|
||||||
public static void PlayVideo(byte[] raw)
|
public static void PlayVideo(byte[] raw)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
Sound.Play(Info.LaunchSound, order.TargetLocation.ToPPos());
|
Sound.Play(Info.LaunchSound, order.TargetLocation.CenterPosition);
|
||||||
w.Add(new IonCannon(self, w, order.TargetLocation));
|
w.Add(new IonCannon(self, w, order.TargetLocation));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
self.Trait<RenderInfantry>().Attacking(self, Target.FromActor(target));
|
self.Trait<RenderInfantry>().Attacking(self, Target.FromActor(target));
|
||||||
|
|
||||||
if (weapon.Report != null && weapon.Report.Any())
|
if (weapon.Report != null && weapon.Report.Any())
|
||||||
Sound.Play(weapon.Report.Random(self.World.SharedRandom), self.CenterLocation);
|
Sound.Play(weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
var bi = self.Info.Traits.GetOrDefault<BuildingInfo>();
|
var bi = self.Info.Traits.GetOrDefault<BuildingInfo>();
|
||||||
if (bi != null)
|
if (bi != null)
|
||||||
foreach (var s in bi.SellSounds)
|
foreach (var s in bi.SellSounds)
|
||||||
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
|
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||||
|
|
||||||
rb.PlayCustomAnimBackwards(self, "make", () => { OnComplete(); complete = true;});
|
rb.PlayCustomAnimBackwards(self, "make", () => { OnComplete(); complete = true;});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
Sound.Play("chrono2.aud", self.Location.ToPPos());
|
Sound.Play("chrono2.aud", self.CenterPosition);
|
||||||
Sound.Play("chrono2.aud", destination.ToPPos());
|
Sound.Play("chrono2.aud", destination.CenterPosition);
|
||||||
|
|
||||||
self.Trait<ITeleportable>().SetPosition(self, destination);
|
self.Trait<ITeleportable>().SetPosition(self, destination);
|
||||||
self.Generation++;
|
self.Generation++;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
self.Destroy();
|
self.Destroy();
|
||||||
foreach (var s in Sounds)
|
foreach (var s in Sounds)
|
||||||
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
|
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||||
|
|
||||||
var init = new TypeDictionary
|
var init = new TypeDictionary
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
|
|||||||
&& self.Owner.WinState != WinState.Lost)
|
&& self.Owner.WinState != WinState.Lost)
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Parachute(pilot, self.CenterPosition)));
|
self.World.AddFrameEndTask(w => w.Add(new Parachute(pilot, self.CenterPosition)));
|
||||||
Sound.Play(info.ChuteSound, self.CenterLocation);
|
Sound.Play(info.ChuteSound, self.CenterPosition);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pilot.Destroy();
|
pilot.Destroy();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.RA
|
|||||||
self.World.Add(projectile);
|
self.World.Add(projectile);
|
||||||
|
|
||||||
if (args.weapon.Report != null && args.weapon.Report.Any())
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom), self.CenterLocation);
|
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
public void DamageStateChanged(Actor self, AttackInfo e)
|
public void DamageStateChanged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.DamageState == DamageState.Dead)
|
if (e.DamageState == DamageState.Dead)
|
||||||
Sound.Play(Info.DestroyedSound, self.CenterLocation);
|
Sound.Play(Info.DestroyedSound, self.CenterPosition);
|
||||||
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
|
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
|
||||||
Sound.Play(Info.DamagedSound, self.CenterLocation);
|
Sound.Play(Info.DamagedSound, self.CenterPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
self.Kill(crusher);
|
self.Kill(crusher);
|
||||||
Sound.Play(info.CrushSound, self.CenterLocation);
|
Sound.Play(info.CrushSound, self.CenterPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.RA
|
|||||||
self.World.Add(args.weapon.Projectile.Create(args));
|
self.World.Add(args.weapon.Projectile.Create(args));
|
||||||
|
|
||||||
if (args.weapon.Report != null && args.weapon.Report.Any())
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom), self.CenterLocation);
|
Sound.Play(args.weapon.Report.Random(self.World.SharedRandom), self.CenterPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public void Uncloak(int time)
|
public void Uncloak(int time)
|
||||||
{
|
{
|
||||||
if (Cloaked)
|
if (Cloaked)
|
||||||
Sound.Play(info.UncloakSound, self.CenterLocation);
|
Sound.Play(info.UncloakSound, self.CenterPosition);
|
||||||
|
|
||||||
remainingTime = Math.Max(remainingTime, time);
|
remainingTime = Math.Max(remainingTime, time);
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
if (remainingTime > 0 && canCloak)
|
if (remainingTime > 0 && canCloak)
|
||||||
if (--remainingTime <= 0)
|
if (--remainingTime <= 0)
|
||||||
Sound.Play(info.CloakSound, self.CenterLocation);
|
Sound.Play(info.CloakSound, self.CenterPosition);
|
||||||
if (self.IsDisabled())
|
if (self.IsDisabled())
|
||||||
Uncloak();
|
Uncloak();
|
||||||
|
|
||||||
|
|||||||
@@ -43,11 +43,12 @@ namespace OpenRA.Mods.RA
|
|||||||
var isWater = args.destAltitude == 0 && world.GetTerrainInfo(targetTile).IsWater;
|
var isWater = args.destAltitude == 0 && world.GetTerrainInfo(targetTile).IsWater;
|
||||||
var explosionType = isWater ? warhead.WaterExplosion : warhead.Explosion;
|
var explosionType = isWater ? warhead.WaterExplosion : warhead.Explosion;
|
||||||
|
|
||||||
|
var dest = args.dest.ToWPos(args.destAltitude);
|
||||||
if (explosionType != null)
|
if (explosionType != null)
|
||||||
world.AddFrameEndTask(
|
world.AddFrameEndTask(
|
||||||
w => w.Add(new Explosion(w, args.dest.ToWPos(args.destAltitude), explosionType)));
|
w => w.Add(new Explosion(w, dest, explosionType)));
|
||||||
|
|
||||||
Sound.Play(GetImpactSound(warhead, isWater), args.dest);
|
Sound.Play(GetImpactSound(warhead, isWater), dest);
|
||||||
|
|
||||||
var smudgeLayers = world.WorldActor.TraitsImplementing<SmudgeLayer>().ToDictionary(x => x.Info.Type);
|
var smudgeLayers = world.WorldActor.TraitsImplementing<SmudgeLayer>().ToDictionary(x => x.Info.Type);
|
||||||
|
|
||||||
@@ -156,7 +157,7 @@ namespace OpenRA.Mods.RA
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (args.weapon.Report != null && args.weapon.Report.Any())
|
if (args.weapon.Report != null && args.weapon.Report.Any())
|
||||||
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom), pxPos);
|
Sound.Play(args.weapon.Report.Random(attacker.World.SharedRandom), pos);
|
||||||
|
|
||||||
DoImpacts(args);
|
DoImpacts(args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public void OnCrush(Actor crusher)
|
public void OnCrush(Actor crusher)
|
||||||
{
|
{
|
||||||
Sound.Play(Info.CrushSound, crusher.CenterLocation);
|
Sound.Play(Info.CrushSound, crusher.CenterPosition);
|
||||||
ri.SpawnCorpse(self, Info.CorpseSequence);
|
ri.SpawnCorpse(self, Info.CorpseSequence);
|
||||||
self.Kill(crusher);
|
self.Kill(crusher);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
var a = cargo.Unload(self);
|
var a = cargo.Unload(self);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Parachute(a, self.CenterPosition)));
|
self.World.AddFrameEndTask(w => w.Add(new Parachute(a, self.CenterPosition)));
|
||||||
Sound.Play(info.ChuteSound, self.CenterLocation);
|
Sound.Play(info.ChuteSound, self.CenterPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
if (playSounds)
|
if (playSounds)
|
||||||
foreach (var s in buildingInfo.BuildSounds)
|
foreach (var s in buildingInfo.BuildSounds)
|
||||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||||
playSounds = false;
|
playSounds = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA
|
|||||||
new OwnerInit( order.Player ),
|
new OwnerInit( order.Player ),
|
||||||
});
|
});
|
||||||
foreach (var s in buildingInfo.BuildSounds)
|
foreach (var s in buildingInfo.BuildSounds)
|
||||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayBuildAnim( self, unit );
|
PlayBuildAnim( self, unit );
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
|
|
||||||
public void PlayCharge(Actor self)
|
public void PlayCharge(Actor self)
|
||||||
{
|
{
|
||||||
Sound.Play(info.ChargeAudio, self.CenterLocation);
|
Sound.Play(info.ChargeAudio, self.CenterPosition);
|
||||||
anim.PlayThen(NormalizeSequence(self, "active"),
|
anim.PlayThen(NormalizeSequence(self, "active"),
|
||||||
() => anim.PlayRepeating(NormalizeSequence(self, "idle")));
|
() => anim.PlayRepeating(NormalizeSequence(self, "idle")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");
|
self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");
|
||||||
|
|
||||||
Sound.Play("ironcur9.aud", order.TargetLocation.ToPPos());
|
Sound.Play("ironcur9.aud", order.TargetLocation.CenterPosition);
|
||||||
|
|
||||||
foreach (var target in UnitsInRange(order.TargetLocation)
|
foreach (var target in UnitsInRange(order.TargetLocation)
|
||||||
.Where(a => a.Owner.Stances[self.Owner] == Stance.Ally))
|
.Where(a => a.Owner.Stances[self.Owner] == Stance.Ally))
|
||||||
|
|||||||
Reference in New Issue
Block a user