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); }
|
||||
|
||||
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))
|
||||
return null;
|
||||
@@ -87,16 +87,16 @@ namespace OpenRA
|
||||
return null;
|
||||
|
||||
return soundEngine.Play2D(sounds[name],
|
||||
false, headRelative, pos.ToFloat2(),
|
||||
false, headRelative, PPos.FromWPosHackZ(pos).ToFloat2(),
|
||||
InternalSoundVolume * volumeModifier, true);
|
||||
}
|
||||
|
||||
public static ISound Play(string name) { return Play(null, name, true, PPos.Zero, 1); }
|
||||
public static ISound Play(string name, PPos 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, PPos 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, PPos pos) { return Play(player, name, false, pos, 1); }
|
||||
public static ISound Play(string name) { return Play(null, name, true, WPos.Zero, 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, WPos.Zero, 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, WPos.Zero, 1); }
|
||||
public static ISound PlayToPlayer(Player player, string name, WPos pos) { return Play(player, name, false, pos, 1); }
|
||||
|
||||
public static void PlayVideo(byte[] raw)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc
|
||||
{
|
||||
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));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
self.Trait<RenderInfantry>().Attacking(self, Target.FromActor(target));
|
||||
|
||||
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)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
var bi = self.Info.Traits.GetOrDefault<BuildingInfo>();
|
||||
if (bi != null)
|
||||
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;});
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
Sound.Play("chrono2.aud", self.Location.ToPPos());
|
||||
Sound.Play("chrono2.aud", destination.ToPPos());
|
||||
Sound.Play("chrono2.aud", self.CenterPosition);
|
||||
Sound.Play("chrono2.aud", destination.CenterPosition);
|
||||
|
||||
self.Trait<ITeleportable>().SetPosition(self, destination);
|
||||
self.Generation++;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.RA.Activities
|
||||
|
||||
self.Destroy();
|
||||
foreach (var s in Sounds)
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
|
||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||
|
||||
var init = new TypeDictionary
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
|
||||
&& self.Owner.WinState != WinState.Lost)
|
||||
{
|
||||
self.World.AddFrameEndTask(w => w.Add(new Parachute(pilot, self.CenterPosition)));
|
||||
Sound.Play(info.ChuteSound, self.CenterLocation);
|
||||
Sound.Play(info.ChuteSound, self.CenterPosition);
|
||||
}
|
||||
else
|
||||
pilot.Destroy();
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace OpenRA.Mods.RA
|
||||
self.World.Add(projectile);
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
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)
|
||||
{
|
||||
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));
|
||||
|
||||
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)
|
||||
{
|
||||
if (Cloaked)
|
||||
Sound.Play(info.UncloakSound, self.CenterLocation);
|
||||
Sound.Play(info.UncloakSound, self.CenterPosition);
|
||||
|
||||
remainingTime = Math.Max(remainingTime, time);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
if (remainingTime > 0 && canCloak)
|
||||
if (--remainingTime <= 0)
|
||||
Sound.Play(info.CloakSound, self.CenterLocation);
|
||||
Sound.Play(info.CloakSound, self.CenterPosition);
|
||||
if (self.IsDisabled())
|
||||
Uncloak();
|
||||
|
||||
|
||||
@@ -43,11 +43,12 @@ namespace OpenRA.Mods.RA
|
||||
var isWater = args.destAltitude == 0 && world.GetTerrainInfo(targetTile).IsWater;
|
||||
var explosionType = isWater ? warhead.WaterExplosion : warhead.Explosion;
|
||||
|
||||
var dest = args.dest.ToWPos(args.destAltitude);
|
||||
if (explosionType != null)
|
||||
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);
|
||||
|
||||
@@ -156,7 +157,7 @@ namespace OpenRA.Mods.RA
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void OnCrush(Actor crusher)
|
||||
{
|
||||
Sound.Play(Info.CrushSound, crusher.CenterLocation);
|
||||
Sound.Play(Info.CrushSound, crusher.CenterPosition);
|
||||
ri.SpawnCorpse(self, Info.CorpseSequence);
|
||||
self.Kill(crusher);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
var a = cargo.Unload(self);
|
||||
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)
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
playSounds = false;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA
|
||||
new OwnerInit( order.Player ),
|
||||
});
|
||||
foreach (var s in buildingInfo.BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||
Sound.PlayToPlayer(order.Player, s, building.CenterPosition);
|
||||
}
|
||||
|
||||
PlayBuildAnim( self, unit );
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public void PlayCharge(Actor self)
|
||||
{
|
||||
Sound.Play(info.ChargeAudio, self.CenterLocation);
|
||||
Sound.Play(info.ChargeAudio, self.CenterPosition);
|
||||
anim.PlayThen(NormalizeSequence(self, "active"),
|
||||
() => anim.PlayRepeating(NormalizeSequence(self, "idle")));
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
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)
|
||||
.Where(a => a.Owner.Stances[self.Owner] == Stance.Ally))
|
||||
|
||||
Reference in New Issue
Block a user