From 9ddfdc45b35599f4091044d614d11b542affa026 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 10 Dec 2016 17:38:44 +0000 Subject: [PATCH 1/5] Introduce SoundType enum. --- OpenRA.Game/Sound/Sound.cs | 24 ++++++++++--------- OpenRA.Mods.Cnc/Projectiles/IonCannon.cs | 2 +- .../Traits/SupportPowers/IonCannonPower.cs | 2 +- OpenRA.Mods.Common/Activities/Air/HeliFly.cs | 2 +- OpenRA.Mods.Common/Activities/Air/HeliLand.cs | 2 +- OpenRA.Mods.Common/Activities/Rearm.cs | 2 +- OpenRA.Mods.Common/Activities/Transform.cs | 2 +- OpenRA.Mods.Common/Projectiles/NukeLaunch.cs | 2 +- .../Scripting/Global/MediaGlobal.cs | 3 ++- OpenRA.Mods.Common/Traits/Armament.cs | 2 +- .../Traits/Attack/AttackCharge.cs | 2 +- .../Traits/Buildings/Building.cs | 2 +- OpenRA.Mods.Common/Traits/Buildings/Gate.cs | 4 ++-- OpenRA.Mods.Common/Traits/Cloak.cs | 4 ++-- .../Traits/Crates/CrateAction.cs | 2 +- OpenRA.Mods.Common/Traits/Crushable.cs | 2 +- OpenRA.Mods.Common/Traits/EjectOnDeath.cs | 2 +- OpenRA.Mods.Common/Traits/Explodes.cs | 2 +- OpenRA.Mods.Common/Traits/ParaDrop.cs | 2 +- OpenRA.Mods.Common/Traits/Parachutable.cs | 2 +- .../Traits/Player/PlaceBuilding.cs | 6 ++--- .../Traits/ProductionParadrop.cs | 2 +- OpenRA.Mods.Common/Traits/Sellable.cs | 2 +- .../Traits/Sound/AmbientSound.cs | 8 +++---- .../Traits/Sound/AttackSounds.cs | 2 +- .../Traits/Sound/SoundOnDamageTransition.cs | 4 ++-- .../GrantExternalConditionPower.cs | 4 ++-- .../Traits/SupportPowers/SpawnActorPower.cs | 2 +- .../Traits/SupportPowers/SupportPower.cs | 8 +++---- OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs | 2 +- OpenRA.Mods.Common/Traits/Transforms.cs | 2 +- .../Upgrades/GrantConditionOnDamageState.cs | 4 ++-- .../Traits/Upgrades/GrantConditionOnDeploy.cs | 4 ++-- .../Upgrades/ProximityExternalCondition.cs | 2 +- OpenRA.Mods.Common/Traits/Voiced.cs | 4 ++-- .../Warheads/CreateEffectWarhead.cs | 2 +- .../Widgets/ChatDisplayWidget.cs | 2 +- .../Widgets/ProductionPaletteWidget.cs | 12 +++++----- OpenRA.Mods.Common/Widgets/RadarWidget.cs | 2 +- .../Widgets/SupportPowersWidget.cs | 2 +- OpenRA.Mods.D2k/Activities/SwallowActor.cs | 2 +- OpenRA.Mods.D2k/Traits/SpiceBloom.cs | 2 +- OpenRA.Mods.RA/Activities/Leap.cs | 2 +- OpenRA.Mods.RA/Activities/Teleport.cs | 4 ++-- OpenRA.Mods.RA/Traits/MadTank.cs | 4 ++-- .../Traits/SupportPowers/ChronoshiftPower.cs | 2 +- .../Traits/SupportPowers/GpsPower.cs | 2 +- .../Traits/SupportPowers/AttackOrderPower.cs | 2 +- 48 files changed, 83 insertions(+), 80 deletions(-) diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index dac136810c..d61a5ac692 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -32,6 +32,8 @@ namespace OpenRA Stream GetPCMInputStream(); } + public enum SoundType { World, UI } + public sealed class Sound : IDisposable { readonly ISoundEngine soundEngine; @@ -92,7 +94,7 @@ namespace OpenRA soundEngine.SetListenerPosition(position); } - ISound Play(Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false) + ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false) { if (string.IsNullOrEmpty(name)) return null; @@ -119,14 +121,14 @@ namespace OpenRA soundEngine.Volume = 1f; } - public ISound Play(string name) { return Play(null, name, true, WPos.Zero, 1f); } - public ISound Play(string name, WPos pos) { return Play(null, name, false, pos, 1f); } - public ISound Play(string name, float volumeModifier) { return Play(null, name, true, WPos.Zero, volumeModifier); } - public ISound Play(string name, WPos pos, float volumeModifier) { return Play(null, name, false, pos, volumeModifier); } - public ISound PlayToPlayer(Player player, string name) { return Play(player, name, true, WPos.Zero, 1f); } - public ISound PlayToPlayer(Player player, string name, WPos pos) { return Play(player, name, false, pos, 1f); } - public ISound PlayLooped(string name) { return PlayLooped(name, WPos.Zero); } - public ISound PlayLooped(string name, WPos pos) { return Play(null, name, true, pos, 1f, true); } + public ISound Play(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f); } + public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); } + public ISound Play(SoundType type, string name, float volumeModifier) { return Play(type, null, name, true, WPos.Zero, volumeModifier); } + public ISound Play(SoundType type, string name, WPos pos, float volumeModifier) { return Play(type, null, name, false, pos, volumeModifier); } + public ISound PlayToPlayer(SoundType type, Player player, string name) { return Play(type, player, name, true, WPos.Zero, 1f); } + public ISound PlayToPlayer(SoundType type, Player player, string name, WPos pos) { return Play(type, player, name, false, pos, 1f); } + public ISound PlayLooped(SoundType type, string name) { return PlayLooped(type, name, WPos.Zero); } + public ISound PlayLooped(SoundType type, string name, WPos pos) { return Play(type, null, name, true, pos, 1f, true); } public void PlayVideo(byte[] raw, int channels, int sampleBits, int sampleRate) { @@ -300,7 +302,7 @@ namespace OpenRA } // Returns true if played successfully - public bool PlayPredefined(Ruleset ruleset, Player p, Actor voicedActor, string type, string definition, string variant, + public bool PlayPredefined(SoundType soundType, Ruleset ruleset, Player p, Actor voicedActor, string type, string definition, string variant, bool relative, WPos pos, float volumeModifier, bool attenuateVolume) { if (ruleset == null) @@ -375,7 +377,7 @@ namespace OpenRA if (type == null || notification == null) return false; - return PlayPredefined(rules, player, null, type.ToLowerInvariant(), notification, variant, true, WPos.Zero, 1f, false); + return PlayPredefined(SoundType.UI, rules, player, null, type.ToLowerInvariant(), notification, variant, true, WPos.Zero, 1f, false); } public void Dispose() diff --git a/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs b/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs index cd1f938058..96dac28b53 100644 --- a/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Projectiles/IonCannon.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Cnc.Effects anim.PlayThen(sequence, () => Finish(world)); if (weapon.Report != null && weapon.Report.Any()) - Game.Sound.Play(weapon.Report.Random(firedBy.World.SharedRandom), launchPos); + Game.Sound.Play(SoundType.World, weapon.Report.Random(firedBy.World.SharedRandom), launchPos); } public void Tick(World world) diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs index 03cc029aaf..0c0e64e2f9 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/IonCannonPower.cs @@ -71,7 +71,7 @@ namespace OpenRA.Mods.Cnc.Traits self.World.AddFrameEndTask(w => { PlayLaunchSounds(); - Game.Sound.Play(info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation)); + Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation)); w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, self.CenterPosition, order.TargetLocation, info.Effect, info.EffectSequence, info.EffectPalette, info.WeaponDelay)); diff --git a/OpenRA.Mods.Common/Activities/Air/HeliFly.cs b/OpenRA.Mods.Common/Activities/Air/HeliFly.cs index 6f584e2fb4..c5a57c5ba4 100644 --- a/OpenRA.Mods.Common/Activities/Air/HeliFly.cs +++ b/OpenRA.Mods.Common/Activities/Air/HeliFly.cs @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Activities if (!playedSound && helicopter.Info.TakeoffSound != null && self.IsAtGroundLevel()) { - Game.Sound.Play(helicopter.Info.TakeoffSound); + Game.Sound.Play(SoundType.World, helicopter.Info.TakeoffSound); playedSound = true; } diff --git a/OpenRA.Mods.Common/Activities/Air/HeliLand.cs b/OpenRA.Mods.Common/Activities/Air/HeliLand.cs index 727f1dfe45..8012cfba0d 100644 --- a/OpenRA.Mods.Common/Activities/Air/HeliLand.cs +++ b/OpenRA.Mods.Common/Activities/Air/HeliLand.cs @@ -42,7 +42,7 @@ namespace OpenRA.Mods.Common.Activities if (!playedSound && helicopter.Info.LandingSound != null && !self.IsAtGroundLevel()) { - Game.Sound.Play(helicopter.Info.LandingSound); + Game.Sound.Play(SoundType.World, helicopter.Info.LandingSound); playedSound = true; } diff --git a/OpenRA.Mods.Common/Activities/Rearm.cs b/OpenRA.Mods.Common/Activities/Rearm.cs index 173f3e47b5..b15bea3146 100644 --- a/OpenRA.Mods.Common/Activities/Rearm.cs +++ b/OpenRA.Mods.Common/Activities/Rearm.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Activities var sound = pool.Info.RearmSound; if (sound != null) - Game.Sound.PlayToPlayer(self.Owner, sound, self.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, self.Owner, sound, self.CenterPosition); ammoPoolsReloadTimes[pool] = pool.Info.ReloadDelay; } diff --git a/OpenRA.Mods.Common/Activities/Transform.cs b/OpenRA.Mods.Common/Activities/Transform.cs index 3fde4c1799..46ca3cad08 100644 --- a/OpenRA.Mods.Common/Activities/Transform.cs +++ b/OpenRA.Mods.Common/Activities/Transform.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Activities self.Dispose(); foreach (var s in Sounds) - Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, self.Owner, s, self.CenterPosition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Notification, self.Owner.Faction.InternalName); diff --git a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs index f8f0ce1be3..c9ada19373 100644 --- a/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs +++ b/OpenRA.Mods.Common/Projectiles/NukeLaunch.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.Common.Effects pos = launchPos; if (weapon.Report != null && weapon.Report.Any()) - Game.Sound.Play(weapon.Report.Random(firedBy.World.SharedRandom), pos); + Game.Sound.Play(SoundType.World, weapon.Report.Random(firedBy.World.SharedRandom), pos); if (skipAscent) ticks = turn; diff --git a/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs b/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs index e7dd34b189..dfc7e6765e 100644 --- a/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs +++ b/OpenRA.Mods.Common/Scripting/Global/MediaGlobal.cs @@ -52,7 +52,8 @@ namespace OpenRA.Mods.Common.Scripting [Desc("Play a sound file")] public void PlaySound(string file) { - Game.Sound.Play(file); + // TODO: Investigate how scripts use this function, and think about exposing the UI vs World distinction if needed + Game.Sound.Play(SoundType.World, file); } [Desc("Play track defined in music.yaml or map.yaml, or keep track empty for playing a random song.")] diff --git a/OpenRA.Mods.Common/Traits/Armament.cs b/OpenRA.Mods.Common/Traits/Armament.cs index 06f493fc13..a3af586e38 100644 --- a/OpenRA.Mods.Common/Traits/Armament.cs +++ b/OpenRA.Mods.Common/Traits/Armament.cs @@ -245,7 +245,7 @@ namespace OpenRA.Mods.Common.Traits self.World.Add(projectile); if (args.Weapon.Report != null && args.Weapon.Report.Any()) - Game.Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); foreach (var na in self.TraitsImplementing()) na.Attacking(self, target, this, barrel); diff --git a/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs b/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs index 6c7582ac19..1938155b3d 100644 --- a/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs +++ b/OpenRA.Mods.Common/Traits/Attack/AttackCharge.cs @@ -100,7 +100,7 @@ namespace OpenRA.Mods.Common.Traits notify.Charging(self, target); if (!string.IsNullOrEmpty(attack.info.ChargeAudio)) - Game.Sound.Play(attack.info.ChargeAudio, self.CenterPosition); + Game.Sound.Play(SoundType.World, attack.info.ChargeAudio, self.CenterPosition); return ActivityUtils.SequenceActivities(new Wait(attack.info.InitialChargeDelay), new ChargeFire(attack, target), this); } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 34c49e7bd9..be480f8d25 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -236,7 +236,7 @@ namespace OpenRA.Mods.Common.Traits RemoveSmudges(); foreach (var s in Info.UndeploySounds) - Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, self.Owner, s, self.CenterPosition); } void INotifyTransform.OnTransform(Actor self) { } diff --git a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs index 898bd85a85..4ba1ca58cc 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Gate.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Gate.cs @@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Traits // Gate was fully open if (Position == OpenPosition) { - Game.Sound.Play(info.ClosingSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.ClosingSound, self.CenterPosition); self.World.ActorMap.AddInfluence(self, this); } @@ -72,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits { // Gate was fully closed if (Position == 0) - Game.Sound.Play(info.OpeningSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.OpeningSound, self.CenterPosition); Position++; diff --git a/OpenRA.Mods.Common/Traits/Cloak.cs b/OpenRA.Mods.Common/Traits/Cloak.cs index 3e5706a8b8..2ddfab5bcf 100644 --- a/OpenRA.Mods.Common/Traits/Cloak.cs +++ b/OpenRA.Mods.Common/Traits/Cloak.cs @@ -148,7 +148,7 @@ namespace OpenRA.Mods.Common.Traits cloakedToken = upgradeManager.GrantCondition(self, Info.CloakedCondition); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) - Game.Sound.Play(Info.CloakSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, Info.CloakSound, self.CenterPosition); } else if (!isCloaked && wasCloaked) { @@ -156,7 +156,7 @@ namespace OpenRA.Mods.Common.Traits cloakedToken = upgradeManager.RevokeCondition(self, cloakedToken); if (!self.TraitsImplementing().Any(a => a != this && a.Cloaked)) - Game.Sound.Play(Info.UncloakSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, Info.UncloakSound, self.CenterPosition); } wasCloaked = isCloaked; diff --git a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs index 2d55f69fe3..3b302c0a78 100644 --- a/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs +++ b/OpenRA.Mods.Common/Traits/Crates/CrateAction.cs @@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.Traits public virtual void Activate(Actor collector) { - Game.Sound.PlayToPlayer(collector.Owner, info.Notification); + Game.Sound.PlayToPlayer(SoundType.World, collector.Owner, info.Notification); if (info.Effect != null) collector.World.AddFrameEndTask(w => w.Add(new CrateEffect(collector, info.Effect, info.Palette))); diff --git a/OpenRA.Mods.Common/Traits/Crushable.cs b/OpenRA.Mods.Common/Traits/Crushable.cs index 23c44f10ac..def92d8b5d 100644 --- a/OpenRA.Mods.Common/Traits/Crushable.cs +++ b/OpenRA.Mods.Common/Traits/Crushable.cs @@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits if (!CrushableInner(crushClasses, crusher.Owner)) return; - Game.Sound.Play(info.CrushSound, crusher.CenterPosition); + Game.Sound.Play(SoundType.World, info.CrushSound, crusher.CenterPosition); self.Kill(crusher); } diff --git a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs index 1f9d99434a..b04bbaa52b 100644 --- a/OpenRA.Mods.Common/Traits/EjectOnDeath.cs +++ b/OpenRA.Mods.Common/Traits/EjectOnDeath.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Traits w.Add(pilot); pilot.QueueActivity(new Parachute(pilot, cp)); }); - Game.Sound.Play(info.ChuteSound, cp); + Game.Sound.Play(SoundType.World, info.ChuteSound, cp); } else { diff --git a/OpenRA.Mods.Common/Traits/Explodes.cs b/OpenRA.Mods.Common/Traits/Explodes.cs index 3fd58b3dd3..8173e72b45 100644 --- a/OpenRA.Mods.Common/Traits/Explodes.cs +++ b/OpenRA.Mods.Common/Traits/Explodes.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits return; if (weapon.Report != null && weapon.Report.Any()) - Game.Sound.Play(weapon.Report.Random(e.Attacker.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, weapon.Report.Random(e.Attacker.World.SharedRandom), self.CenterPosition); if (info.Type == ExplosionType.Footprint && buildingInfo != null) { diff --git a/OpenRA.Mods.Common/Traits/ParaDrop.cs b/OpenRA.Mods.Common/Traits/ParaDrop.cs index 68e1c99a75..30f2ae4ce3 100644 --- a/OpenRA.Mods.Common/Traits/ParaDrop.cs +++ b/OpenRA.Mods.Common/Traits/ParaDrop.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits w.Add(a); a.QueueActivity(new Parachute(a, self.CenterPosition)); }); - Game.Sound.Play(info.ChuteSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.ChuteSound, self.CenterPosition); } static bool IsSuitableCell(Actor actorToDrop, CPos p) diff --git a/OpenRA.Mods.Common/Traits/Parachutable.cs b/OpenRA.Mods.Common/Traits/Parachutable.cs index 7301c197ef..4d705f8b90 100644 --- a/OpenRA.Mods.Common/Traits/Parachutable.cs +++ b/OpenRA.Mods.Common/Traits/Parachutable.cs @@ -88,7 +88,7 @@ namespace OpenRA.Mods.Common.Traits var onWater = info.WaterTerrainTypes.Contains(self.World.Map.GetTerrainInfo(cell).Type); var sound = onWater ? info.WaterImpactSound : info.GroundImpactSound; - Game.Sound.Play(sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); var sequence = onWater ? info.WaterCorpseSequence : info.GroundCorpseSequence; var palette = onWater ? info.WaterCorpsePalette : info.GroundCorpsePalette; diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 0ca7bf6fe8..ea80e3001b 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits if (playSounds) foreach (var s in buildingInfo.BuildSounds) - Game.Sound.PlayToPlayer(order.Player, s, building.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, order.Player, s, building.CenterPosition); playSounds = false; } @@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Traits pluggable.EnablePlug(host, plugInfo.Type); foreach (var s in buildingInfo.BuildSounds) - Game.Sound.PlayToPlayer(order.Player, s, host.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, order.Player, s, host.CenterPosition); } else { @@ -126,7 +126,7 @@ namespace OpenRA.Mods.Common.Traits }); foreach (var s in buildingInfo.BuildSounds) - Game.Sound.PlayToPlayer(order.Player, s, building.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.World, order.Player, s, building.CenterPosition); } if (producer.Actor != null) diff --git a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs index 73a93a38c1..060ba6cfa0 100644 --- a/OpenRA.Mods.Common/Traits/ProductionParadrop.cs +++ b/OpenRA.Mods.Common/Traits/ProductionParadrop.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits cargo.Delivered(self); self.World.AddFrameEndTask(ww => DoProduction(self, producee, exit, factionVariant)); - Game.Sound.Play(info.ChuteSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.ChuteSound, self.CenterPosition); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName); })); diff --git a/OpenRA.Mods.Common/Traits/Sellable.cs b/OpenRA.Mods.Common/Traits/Sellable.cs index f31ac98497..a50cc69c66 100644 --- a/OpenRA.Mods.Common/Traits/Sellable.cs +++ b/OpenRA.Mods.Common/Traits/Sellable.cs @@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Traits self.CancelActivity(); foreach (var s in info.SellSounds) - Game.Sound.PlayToPlayer(self.Owner, s, self.CenterPosition); + Game.Sound.PlayToPlayer(SoundType.UI, self.Owner, s, self.CenterPosition); foreach (var ns in self.TraitsImplementing()) ns.Selling(self); diff --git a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs index ecc872432d..1aba3c51db 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs @@ -50,9 +50,9 @@ namespace OpenRA.Mods.Common.Traits.Sound if (wasDisabled && Info.Interval <= 0) { if (self.OccupiesSpace != null) - currentSound = Game.Sound.PlayLooped(Info.SoundFile, self.CenterPosition); + currentSound = Game.Sound.PlayLooped(SoundType.World, Info.SoundFile, self.CenterPosition); else - currentSound = Game.Sound.PlayLooped(Info.SoundFile); + currentSound = Game.Sound.PlayLooped(SoundType.World, Info.SoundFile); } wasDisabled = false; @@ -66,9 +66,9 @@ namespace OpenRA.Mods.Common.Traits.Sound interval = Info.Interval; if (self.OccupiesSpace != null) - Game.Sound.Play(Info.SoundFile, self.CenterPosition); + Game.Sound.Play(SoundType.World, Info.SoundFile, self.CenterPosition); else - Game.Sound.Play(Info.SoundFile); + Game.Sound.Play(SoundType.World, Info.SoundFile); } } } diff --git a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs index 9e4e81339c..bf6fede1de 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AttackSounds.cs @@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Sound void PlaySound(Actor self) { if (info.Sounds.Any()) - Game.Sound.Play(info.Sounds.Random(self.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, info.Sounds.Random(self.World.SharedRandom), self.CenterPosition); } void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel) diff --git a/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs b/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs index 6c2e1050a2..3aad4a72f1 100644 --- a/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs +++ b/OpenRA.Mods.Common/Traits/Sound/SoundOnDamageTransition.cs @@ -40,12 +40,12 @@ namespace OpenRA.Mods.Common.Traits.Sound if (e.DamageState == DamageState.Dead) { var sound = info.DestroyedSounds.RandomOrDefault(rand); - Game.Sound.Play(sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); } else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy) { var sound = info.DamagedSounds.RandomOrDefault(rand); - Game.Sound.Play(sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); } } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index 74575a64dd..b0098a2deb 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayToPlayer(SoundType.World, manager.Self.Owner, Info.SelectTargetSound); self.World.OrderGenerator = new SelectUpgradeTarget(Self.World, order, manager, this); } @@ -65,7 +65,7 @@ namespace OpenRA.Mods.Common.Traits if (wsb != null && wsb.DefaultAnimation.HasSequence(info.Sequence)) wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self)); - Game.Sound.Play(info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation)); + Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation)); foreach (var a in UnitsInRange(order.TargetLocation)) { diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs index 323c950f5e..9cfb0db453 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits { var location = self.World.Map.CenterOfCell(order.TargetLocation); - Game.Sound.Play(info.DeploySound, location); + Game.Sound.Play(SoundType.World, info.DeploySound, location); if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette)) w.Add(new SpriteEffect(location, w, info.EffectImage, info.EffectSequence, info.EffectPalette)); diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 48ec944a29..130a07aa9a 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -89,21 +89,21 @@ namespace OpenRA.Mods.Common.Traits public virtual void Charging(Actor self, string key) { - Game.Sound.PlayToPlayer(self.Owner, Info.BeginChargeSound); + Game.Sound.PlayToPlayer(SoundType.UI, self.Owner, Info.BeginChargeSound); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BeginChargeSpeechNotification, self.Owner.Faction.InternalName); } public virtual void Charged(Actor self, string key) { - Game.Sound.PlayToPlayer(self.Owner, Info.EndChargeSound); + Game.Sound.PlayToPlayer(SoundType.UI, self.Owner, Info.EndChargeSound); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.EndChargeSpeechNotification, self.Owner.Faction.InternalName); } public virtual void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.SelectTargetSpeechNotification, self.Owner.Faction.InternalName); self.World.OrderGenerator = new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left); @@ -125,7 +125,7 @@ namespace OpenRA.Mods.Common.Traits { var renderPlayer = Self.World.RenderPlayer; var isAllied = Self.Owner.IsAlliedWith(renderPlayer); - Game.Sound.Play(isAllied ? Info.LaunchSound : Info.IncomingSound); + Game.Sound.Play(SoundType.UI, isAllied ? Info.LaunchSound : Info.IncomingSound); // IsAlliedWith returns true if renderPlayer is null, so we are safe here. var toPlayer = isAllied ? renderPlayer ?? Self.Owner : renderPlayer; diff --git a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs index 628ffdff76..8e5a5277a1 100644 --- a/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs +++ b/OpenRA.Mods.Common/Traits/ThrowsShrapnel.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits self.World.Add(projectile); if (args.Weapon.Report != null && args.Weapon.Report.Any()) - Game.Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); } }); } diff --git a/OpenRA.Mods.Common/Traits/Transforms.cs b/OpenRA.Mods.Common/Traits/Transforms.cs index 68f9ea2708..c85938a798 100644 --- a/OpenRA.Mods.Common/Traits/Transforms.cs +++ b/OpenRA.Mods.Common/Traits/Transforms.cs @@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Traits // Only play the "Cannot deploy here" audio // for non-queued orders foreach (var s in info.NoTransformSounds) - Game.Sound.PlayToPlayer(self.Owner, s); + Game.Sound.PlayToPlayer(SoundType.World, self.Owner, s); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.NoTransformNotification, self.Owner.Faction.InternalName); diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs index 630d5d372d..85520d5e3e 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDamageState.cs @@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits conditionToken = manager.GrantCondition(self, info.Condition); var sound = info.EnabledSounds.RandomOrDefault(Game.CosmeticRandom); - Game.Sound.Play(sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); } void INotifyDamageStateChanged.DamageStateChanged(Actor self, AttackInfo e) @@ -80,7 +80,7 @@ namespace OpenRA.Mods.Common.Traits conditionToken = manager.RevokeCondition(self, conditionToken); var sound = info.DisabledSounds.RandomOrDefault(Game.CosmeticRandom); - Game.Sound.Play(sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); } } } diff --git a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs index 3272deeb24..e0c6eb11f6 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/GrantConditionOnDeploy.cs @@ -204,7 +204,7 @@ namespace OpenRA.Mods.Common.Traits return; if (!string.IsNullOrEmpty(info.DeploySound)) - Game.Sound.Play(info.DeploySound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.DeploySound, self.CenterPosition); // Revoke upgrades that are used while undeployed. if (!init) @@ -227,7 +227,7 @@ namespace OpenRA.Mods.Common.Traits return; if (!string.IsNullOrEmpty(info.UndeploySound)) - Game.Sound.Play(info.UndeploySound, self.CenterPosition); + Game.Sound.Play(SoundType.World, info.UndeploySound, self.CenterPosition); if (!init) OnUndeployStarted(); diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs index 3bfea5b832..4cfba835c3 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ProximityExternalCondition.cs @@ -81,7 +81,7 @@ namespace OpenRA.Mods.Common.Traits if (cachedDisabled != disabled) { - Game.Sound.Play(disabled ? info.DisableSound : info.EnableSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, disabled ? info.DisableSound : info.EnableSound, self.CenterPosition); desiredRange = disabled ? WDist.Zero : info.Range; desiredVRange = disabled ? WDist.Zero : info.MaximumVerticalOffset; cachedDisabled = disabled; diff --git a/OpenRA.Mods.Common/Traits/Voiced.cs b/OpenRA.Mods.Common/Traits/Voiced.cs index 88e27d2ff5..55a04554c2 100644 --- a/OpenRA.Mods.Common/Traits/Voiced.cs +++ b/OpenRA.Mods.Common/Traits/Voiced.cs @@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits var type = Info.VoiceSet.ToLowerInvariant(); var volume = Info.Volume; - return Game.Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, true, WPos.Zero, volume, true); + return Game.Sound.PlayPredefined(SoundType.World, self.World.Map.Rules, null, self, type, phrase, variant, true, WPos.Zero, volume, true); } public bool PlayVoiceLocal(Actor self, string phrase, string variant, float volume) @@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits return false; var type = Info.VoiceSet.ToLowerInvariant(); - return Game.Sound.PlayPredefined(self.World.Map.Rules, null, self, type, phrase, variant, false, self.CenterPosition, volume, true); + return Game.Sound.PlayPredefined(SoundType.World, self.World.Map.Rules, null, self, type, phrase, variant, false, self.CenterPosition, volume, true); } public bool HasVoice(Actor self, string voice) diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index 62a0b76e5f..1c0650744d 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Warheads var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom); if (impactSound != null) - Game.Sound.Play(impactSound, pos); + Game.Sound.Play(SoundType.World, impactSound, pos); } public bool IsValidImpact(WPos pos, Actor firedBy) diff --git a/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs b/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs index 24b7064ea5..cb5e25fe90 100644 --- a/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ChatDisplayWidget.cs @@ -87,7 +87,7 @@ namespace OpenRA.Mods.Common.Widgets recentLines.Add(new ChatLine(from, text, Game.LocalTick + RemoveTime, c)); if (Notification != null) - Game.Sound.Play(Notification); + Game.Sound.Play(SoundType.UI, Notification); while (recentLines.Count > LogLength) recentLines.RemoveAt(0); diff --git a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs index 4831991b0d..a61bb2a50e 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionPaletteWidget.cs @@ -218,14 +218,14 @@ namespace OpenRA.Mods.Common.Widgets { if (PickUpCompletedBuildingIcon(icon, item)) { - Game.Sound.Play(TabClick); + Game.Sound.Play(SoundType.UI, TabClick); return true; } if (item != null && item.Paused) { // Resume a paused item - Game.Sound.Play(TabClick); + Game.Sound.Play(SoundType.UI, TabClick); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return true; } @@ -233,7 +233,7 @@ namespace OpenRA.Mods.Common.Widgets if (CurrentQueue.BuildableItems().Any(a => a.Name == icon.Name)) { // Queue a new item - Game.Sound.Play(TabClick); + Game.Sound.Play(SoundType.UI, TabClick); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount)); return true; @@ -247,7 +247,7 @@ namespace OpenRA.Mods.Common.Widgets if (item == null) return false; - Game.Sound.Play(TabClick); + Game.Sound.Play(SoundType.UI, TabClick); if (item.Paused || item.Done || item.TotalCost == item.RemainingCost) { @@ -271,7 +271,7 @@ namespace OpenRA.Mods.Common.Widgets return false; // Directly cancel, skipping "on-hold" - Game.Sound.Play(TabClick); + Game.Sound.Play(SoundType.UI, TabClick); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, handleCount)); @@ -289,7 +289,7 @@ namespace OpenRA.Mods.Common.Widgets : false; if (!handled) - Game.Sound.Play(DisabledTabClick); + Game.Sound.Play(SoundType.UI, DisabledTabClick); return true; } diff --git a/OpenRA.Mods.Common/Widgets/RadarWidget.cs b/OpenRA.Mods.Common/Widgets/RadarWidget.cs index 010a13ca2c..e516f601fb 100644 --- a/OpenRA.Mods.Common/Widgets/RadarWidget.cs +++ b/OpenRA.Mods.Common/Widgets/RadarWidget.cs @@ -333,7 +333,7 @@ namespace OpenRA.Mods.Common.Widgets // Enable/Disable the radar var enabled = IsEnabled(); if (enabled != cachedEnabled) - Game.Sound.Play(enabled ? RadarOnlineSound : RadarOfflineSound); + Game.Sound.Play(SoundType.UI, enabled ? RadarOnlineSound : RadarOfflineSound); cachedEnabled = enabled; if (enabled) diff --git a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs index 2819ab21f5..dd40499c22 100644 --- a/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs +++ b/OpenRA.Mods.Common/Widgets/SupportPowersWidget.cs @@ -115,7 +115,7 @@ namespace OpenRA.Mods.Common.Widgets { if (!clicked.Power.Active) { - Game.Sound.PlayToPlayer(spm.Self.Owner, clicked.Power.Info.InsufficientPowerSound); + Game.Sound.PlayToPlayer(SoundType.UI, spm.Self.Owner, clicked.Power.Info.InsufficientPowerSound); Game.Sound.PlayNotification(spm.Self.World.Map.Rules, spm.Self.Owner, "Speech", clicked.Power.Info.InsufficientPowerSpeechNotification, spm.Self.Owner.Faction.InternalName); } diff --git a/OpenRA.Mods.D2k/Activities/SwallowActor.cs b/OpenRA.Mods.D2k/Activities/SwallowActor.cs index a5f220c772..39a1cd36e0 100644 --- a/OpenRA.Mods.D2k/Activities/SwallowActor.cs +++ b/OpenRA.Mods.D2k/Activities/SwallowActor.cs @@ -76,7 +76,7 @@ namespace OpenRA.Mods.D2k.Activities var attackPosition = self.CenterPosition; var affectedPlayers = targets.Select(x => x.Owner).Distinct().ToList(); - Game.Sound.Play(swallow.Info.WormAttackSound, self.CenterPosition); + Game.Sound.Play(SoundType.World, swallow.Info.WormAttackSound, self.CenterPosition); Game.RunAfterDelay(1000, () => { diff --git a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs index e14f46ac9f..f38d8ac402 100644 --- a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs +++ b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs @@ -152,7 +152,7 @@ namespace OpenRA.Mods.D2k.Traits self.World.Add(projectile); if (args.Weapon.Report != null && args.Weapon.Report.Any()) - Game.Sound.Play(args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, args.Weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); } }); } diff --git a/OpenRA.Mods.RA/Activities/Leap.cs b/OpenRA.Mods.RA/Activities/Leap.cs index 39b548296b..7f8a90865d 100644 --- a/OpenRA.Mods.RA/Activities/Leap.cs +++ b/OpenRA.Mods.RA/Activities/Leap.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA.Activities self.Trait().Attacking(self, Target.FromActor(target), a); if (weapon.Report != null && weapon.Report.Any()) - Game.Sound.Play(weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); + Game.Sound.Play(SoundType.World, weapon.Report.Random(self.World.SharedRandom), self.CenterPosition); } public override Activity Tick(Actor self) diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index 3f58bf1309..2806374b7d 100644 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -60,8 +60,8 @@ namespace OpenRA.Mods.RA.Activities destination = bestCell.Value; - Game.Sound.Play(sound, self.CenterPosition); - Game.Sound.Play(sound, self.World.Map.CenterOfCell(destination)); + Game.Sound.Play(SoundType.World, sound, self.CenterPosition); + Game.Sound.Play(SoundType.World, sound, self.World.Map.CenterOfCell(destination)); self.Trait().SetPosition(self, destination); self.Generation++; diff --git a/OpenRA.Mods.RA/Traits/MadTank.cs b/OpenRA.Mods.RA/Traits/MadTank.cs index 271e6c7929..431aafd19c 100644 --- a/OpenRA.Mods.RA/Traits/MadTank.cs +++ b/OpenRA.Mods.RA/Traits/MadTank.cs @@ -159,9 +159,9 @@ namespace OpenRA.Mods.RA.Traits wfsb.PlayCustomAnimationRepeating(self, info.ThumpSequence); deployed = true; self.QueueActivity(new Wait(info.ChargeDelay, false)); - self.QueueActivity(new CallFunc(() => Game.Sound.Play(info.ChargeSound, self.CenterPosition))); + self.QueueActivity(new CallFunc(() => Game.Sound.Play(SoundType.World, info.ChargeSound, self.CenterPosition))); self.QueueActivity(new Wait(info.DetonationDelay, false)); - self.QueueActivity(new CallFunc(() => Game.Sound.Play(info.DetonationSound, self.CenterPosition))); + self.QueueActivity(new CallFunc(() => Game.Sound.Play(SoundType.World, info.DetonationSound, self.CenterPosition))); self.QueueActivity(new CallFunc(Detonate)); } diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs index ab5ddddb1d..29f08a6bc7 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ChronoshiftPower.cs @@ -55,7 +55,7 @@ namespace OpenRA.Mods.RA.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); self.World.OrderGenerator = new SelectChronoshiftTarget(Self.World, order, manager, this); } diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs index e3dcbe80a2..27c425341d 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/GpsPower.cs @@ -74,7 +74,7 @@ namespace OpenRA.Mods.RA.Traits self.World.AddFrameEndTask(w => { - Game.Sound.PlayToPlayer(self.Owner, Info.LaunchSound); + Game.Sound.PlayToPlayer(SoundType.World, self.Owner, Info.LaunchSound); Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.LaunchSpeechNotification, self.Owner.Faction.InternalName); diff --git a/OpenRA.Mods.TS/Traits/SupportPowers/AttackOrderPower.cs b/OpenRA.Mods.TS/Traits/SupportPowers/AttackOrderPower.cs index 5b6160b4e8..d348496745 100644 --- a/OpenRA.Mods.TS/Traits/SupportPowers/AttackOrderPower.cs +++ b/OpenRA.Mods.TS/Traits/SupportPowers/AttackOrderPower.cs @@ -37,7 +37,7 @@ namespace OpenRA.Mods.TS.Traits public override void SelectTarget(Actor self, string order, SupportPowerManager manager) { - Game.Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound); + Game.Sound.PlayToPlayer(SoundType.UI, manager.Self.Owner, Info.SelectTargetSound); self.World.OrderGenerator = new SelectAttackPowerTarget(self, order, manager, info.Cursor, MouseButton.Left, attack); } From 443c3ee72d42d19d2870394779b199c7529271e0 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 10 Dec 2016 17:50:46 +0000 Subject: [PATCH 2/5] Disable sound on the shell maps. --- OpenRA.Game/Sound/Sound.cs | 6 ++++-- OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs | 8 ++++++++ mods/cnc/maps/shellmap/rules.yaml | 1 + mods/d2k/maps/shellmap/rules.yaml | 1 + mods/ra/maps/desert-shellmap/rules.yaml | 1 + mods/ts/maps/fields-of-green/map.yaml | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index d61a5ac692..aab58260ab 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -96,8 +96,9 @@ namespace OpenRA ISound Play(SoundType type, Player player, string name, bool headRelative, WPos pos, float volumeModifier = 1f, bool loop = false) { - if (string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name) || (DisableWorldSounds && type == SoundType.World)) return null; + if (player != null && player != player.World.LocalPlayer) return null; @@ -121,6 +122,7 @@ namespace OpenRA soundEngine.Volume = 1f; } + public bool DisableWorldSounds { get; set; } public ISound Play(SoundType type, string name) { return Play(type, null, name, true, WPos.Zero, 1f); } public ISound Play(SoundType type, string name, WPos pos) { return Play(type, null, name, false, pos, 1f); } public ISound Play(SoundType type, string name, float volumeModifier) { return Play(type, null, name, true, WPos.Zero, volumeModifier); } @@ -308,7 +310,7 @@ namespace OpenRA if (ruleset == null) throw new ArgumentNullException("ruleset"); - if (definition == null) + if (definition == null || (DisableWorldSounds && soundType == SoundType.World)) return false; if (ruleset.Voices == null || ruleset.Notifications == null) diff --git a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs index 3510b733b8..3cda83ef79 100644 --- a/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs +++ b/OpenRA.Mods.Common/Traits/World/MusicPlaylist.cs @@ -32,6 +32,9 @@ namespace OpenRA.Mods.Common.Traits "It cannot be paused, but can be overridden by selecting a new track.")] public readonly string BackgroundMusic = null; + [Desc("Disable all world sounds (combat etc).")] + public readonly bool DisableWorldSounds = false; + public object Create(ActorInitializer init) { return new MusicPlaylist(init.World, this); } } @@ -55,6 +58,9 @@ namespace OpenRA.Mods.Common.Traits this.info = info; this.world = world; + if (info.DisableWorldSounds) + Game.Sound.DisableWorldSounds = true; + IsMusicInstalled = world.Map.Rules.InstalledMusic.Any(); if (!IsMusicInstalled) return; @@ -220,6 +226,8 @@ namespace OpenRA.Mods.Common.Traits { if (currentSong != null) Game.Sound.StopMusic(); + + Game.Sound.DisableWorldSounds = false; } } } diff --git a/mods/cnc/maps/shellmap/rules.yaml b/mods/cnc/maps/shellmap/rules.yaml index dd30591281..dcd2b78e81 100644 --- a/mods/cnc/maps/shellmap/rules.yaml +++ b/mods/cnc/maps/shellmap/rules.yaml @@ -8,6 +8,7 @@ World: Scripts: shellmap.lua MusicPlaylist: BackgroundMusic: map1 + DisableWorldSounds: true LST: Mobile: diff --git a/mods/d2k/maps/shellmap/rules.yaml b/mods/d2k/maps/shellmap/rules.yaml index 27a52e0df1..59a89e5d9e 100644 --- a/mods/d2k/maps/shellmap/rules.yaml +++ b/mods/d2k/maps/shellmap/rules.yaml @@ -13,6 +13,7 @@ World: Maximum: 3 MusicPlaylist: BackgroundMusic: options + DisableWorldSounds: true LuaScript: Scripts: d2k-shellmap.lua diff --git a/mods/ra/maps/desert-shellmap/rules.yaml b/mods/ra/maps/desert-shellmap/rules.yaml index 96760317c5..63f2a7a1cb 100644 --- a/mods/ra/maps/desert-shellmap/rules.yaml +++ b/mods/ra/maps/desert-shellmap/rules.yaml @@ -7,6 +7,7 @@ World: -MPStartLocations: MusicPlaylist: BackgroundMusic: intro + DisableWorldSounds: true ResourceType@ore: ValuePerUnit: 0 LuaScript: diff --git a/mods/ts/maps/fields-of-green/map.yaml b/mods/ts/maps/fields-of-green/map.yaml index 88c2c68da3..c7c0017e0d 100644 --- a/mods/ts/maps/fields-of-green/map.yaml +++ b/mods/ts/maps/fields-of-green/map.yaml @@ -1433,6 +1433,7 @@ Rules: ValuePerUnit: 0 MusicPlaylist: BackgroundMusic: intro + DisableWorldSounds: true GlobalLightingPaletteEffect: Blue: 0.7 Ambient: 0.7 From 55f76c02d6572a387c84a343f6aa3105ed58aa8a Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 10 Dec 2016 18:41:31 +0000 Subject: [PATCH 3/5] Disable world sounds when the ingame menu is open. --- .../Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs | 7 +++++++ OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs | 1 + mods/cnc/chrome/ingame.yaml | 2 ++ mods/d2k/chrome/ingame-observer.yaml | 1 + mods/d2k/chrome/ingame-player.yaml | 2 ++ mods/ra/chrome/ingame-observer.yaml | 1 + mods/ra/chrome/ingame-player.yaml | 2 ++ mods/ts/chrome/ingame-player.yaml | 2 ++ 8 files changed, 18 insertions(+) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs index de41ecf354..f4951ab4e4 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/MenuButtonsChromeLogic.cs @@ -105,12 +105,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (button.Pause && world.LobbyInfo.IsSinglePlayer) world.SetPauseState(true); + var cachedDisableWorldSounds = Game.Sound.DisableWorldSounds; + if (button.DisableWorldSounds) + Game.Sound.DisableWorldSounds = true; + widgetArgs = widgetArgs ?? new WidgetArgs(); widgetArgs.Add("onExit", () => { if (button.HideIngameUI) worldRoot.IsVisible = () => true; + if (button.DisableWorldSounds) + Game.Sound.DisableWorldSounds = cachedDisableWorldSounds; + if (button.Pause && world.LobbyInfo.IsSinglePlayer) world.SetPauseState(cachedPause); diff --git a/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs b/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs index 140fcc4fca..ce4e151e4b 100644 --- a/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs +++ b/OpenRA.Mods.Common/Widgets/MenuButtonWidget.cs @@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Widgets public readonly string MenuContainer = "INGAME_MENU"; public readonly bool Pause = true; public readonly bool HideIngameUI = true; + public readonly bool DisableWorldSounds = false; [ObjectCreator.UseCtor] public MenuButtonWidget(ModData modData) diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index 8b0d861e32..95ec3ca692 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -91,6 +91,7 @@ Container@OBSERVER_WIDGETS: Height: 25 TooltipText: Menu TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true Children: Image: X: 7 @@ -275,6 +276,7 @@ Container@PLAYER_WIDGETS: Font: Bold TooltipText: Menu TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true Children: Image@ICON: X: 7 diff --git a/mods/d2k/chrome/ingame-observer.yaml b/mods/d2k/chrome/ingame-observer.yaml index c57c1140f4..ea88067bf6 100644 --- a/mods/d2k/chrome/ingame-observer.yaml +++ b/mods/d2k/chrome/ingame-observer.yaml @@ -7,6 +7,7 @@ Container@OBSERVER_WIDGETS: Text: Options (Esc) Font: Bold Key: escape + DisableWorldSounds: true MenuButton@OBSERVER_STATS_BUTTON: MenuContainer: INGAME_OBSERVERSTATS_BG HideIngameUI: False diff --git a/mods/d2k/chrome/ingame-player.yaml b/mods/d2k/chrome/ingame-player.yaml index 659a51d73a..d81993e30f 100644 --- a/mods/d2k/chrome/ingame-player.yaml +++ b/mods/d2k/chrome/ingame-player.yaml @@ -49,6 +49,7 @@ Container@PLAYER_WIDGETS: Background: TooltipText: Debug Menu TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: @@ -121,6 +122,7 @@ Container@PLAYER_WIDGETS: Background: TooltipText: Options TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: diff --git a/mods/ra/chrome/ingame-observer.yaml b/mods/ra/chrome/ingame-observer.yaml index 96a12da0b6..21191e2e96 100644 --- a/mods/ra/chrome/ingame-observer.yaml +++ b/mods/ra/chrome/ingame-observer.yaml @@ -60,6 +60,7 @@ Container@OBSERVER_WIDGETS: Background: sidebar-button-observer TooltipText: Options TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml index f1ac520c14..c5245b459c 100644 --- a/mods/ra/chrome/ingame-player.yaml +++ b/mods/ra/chrome/ingame-player.yaml @@ -111,6 +111,7 @@ Container@PLAYER_WIDGETS: Background: sidebar-button TooltipText: Debug Menu TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: @@ -127,6 +128,7 @@ Container@PLAYER_WIDGETS: Background: sidebar-button TooltipText: Options TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: diff --git a/mods/ts/chrome/ingame-player.yaml b/mods/ts/chrome/ingame-player.yaml index f4892cfec4..e70784c33d 100644 --- a/mods/ts/chrome/ingame-player.yaml +++ b/mods/ts/chrome/ingame-player.yaml @@ -53,6 +53,7 @@ Container@PLAYER_WIDGETS: Background: sidebar-button TooltipText: Debug Menu TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: @@ -130,6 +131,7 @@ Container@PLAYER_WIDGETS: Background: sidebar-button TooltipText: Options TooltipContainer: TOOLTIP_CONTAINER + DisableWorldSounds: true VisualHeight: 0 Children: Image@ICON: From a16344d347327d1e07389d58feebb6469768f063 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 10 Dec 2016 18:02:00 +0000 Subject: [PATCH 4/5] Remove "Show Shellmap" setting. --- OpenRA.Game/Game.cs | 46 ++++++++----------- OpenRA.Game/Graphics/WorldRenderer.cs | 3 -- OpenRA.Game/Settings.cs | 2 - OpenRA.Game/World.cs | 1 - .../Widgets/Logic/CncMainMenuLogic.cs | 5 +- .../Widgets/Logic/SettingsLogic.cs | 5 -- mods/cnc/chrome/mainmenu.yaml | 1 + mods/cnc/chrome/settings.yaml | 13 ++---- mods/ra/chrome/settings.yaml | 13 ++---- 9 files changed, 28 insertions(+), 61 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 27662a7158..c05208bc4f 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -533,38 +533,32 @@ namespace OpenRA if (world == null) return; - // Don't tick when the shellmap is disabled - if (world.ShouldTick) + var isNetTick = LocalTick % NetTickScale == 0; + + if (!isNetTick || orderManager.IsReadyForNextFrame) { - var isNetTick = LocalTick % NetTickScale == 0; + ++orderManager.LocalFrameNumber; - if (!isNetTick || orderManager.IsReadyForNextFrame) + Log.Write("debug", "--Tick: {0} ({1})", LocalTick, isNetTick ? "net" : "local"); + + if (BenchmarkMode) + Log.Write("cpu", "{0};{1}".F(LocalTick, PerfHistory.Items["tick_time"].LastValue)); + + if (isNetTick) + orderManager.Tick(); + + Sync.CheckSyncUnchanged(world, () => { - ++orderManager.LocalFrameNumber; + world.OrderGenerator.Tick(world); + world.Selection.Tick(world); + }); - Log.Write("debug", "--Tick: {0} ({1})", LocalTick, isNetTick ? "net" : "local"); + world.Tick(); - if (BenchmarkMode) - Log.Write("cpu", "{0};{1}".F(LocalTick, PerfHistory.Items["tick_time"].LastValue)); - - if (isNetTick) - orderManager.Tick(); - - Sync.CheckSyncUnchanged(world, () => - { - world.OrderGenerator.Tick(world); - world.Selection.Tick(world); - }); - - world.Tick(); - - PerfHistory.Tick(); - } - else if (orderManager.NetFrameNumber == 0) - orderManager.LastTickTime = RunTime; - } - else PerfHistory.Tick(); + } + else if (orderManager.NetFrameNumber == 0) + orderManager.LastTickTime = RunTime; // Wait until we have done our first world Tick before TickRendering if (orderManager.LocalFrameNumber > 0) diff --git a/OpenRA.Game/Graphics/WorldRenderer.cs b/OpenRA.Game/Graphics/WorldRenderer.cs index 009acc4382..d8734021b1 100644 --- a/OpenRA.Game/Graphics/WorldRenderer.cs +++ b/OpenRA.Game/Graphics/WorldRenderer.cs @@ -132,9 +132,6 @@ namespace OpenRA.Graphics RefreshPalette(); - if (World.Type == WorldType.Shellmap && !Game.Settings.Game.ShowShellmap) - return; - var renderables = GenerateRenderables(); var bounds = Viewport.GetScissorBounds(World.Type != WorldType.Editor); Game.Renderer.EnableScissor(bounds); diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index db8f32ecaf..b6147fd195 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -158,8 +158,6 @@ namespace OpenRA public string Platform = "Default"; - public bool ShowShellmap = true; - public bool ViewportEdgeScroll = true; public bool LockMouseWindow = false; public MouseScrollType MiddleMouseScroll = MouseScrollType.Standard; diff --git a/OpenRA.Game/World.cs b/OpenRA.Game/World.cs index f9608dfd77..f78c4d4721 100644 --- a/OpenRA.Game/World.cs +++ b/OpenRA.Game/World.cs @@ -307,7 +307,6 @@ namespace OpenRA public event Action ActorAdded = _ => { }; public event Action ActorRemoved = _ => { }; - public bool ShouldTick { get { return Type != WorldType.Shellmap || Game.Settings.Game.ShowShellmap; } } public bool Paused { get; internal set; } public bool PredictedPaused { get; internal set; } public bool PauseStateLocked { get; set; } diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs index c068bb9114..5821754de8 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs @@ -22,11 +22,8 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic : base(widget, world, modData) { var shellmapDecorations = widget.Get("SHELLMAP_DECORATIONS"); - shellmapDecorations.IsVisible = () => menuType != MenuType.None && Game.Settings.Game.ShowShellmap; + shellmapDecorations.IsVisible = () => menuType != MenuType.None; shellmapDecorations.Get("RECBLOCK").IsVisible = () => world.WorldTick / 25 % 2 == 0; - - var shellmapDisabledDecorations = widget.Get("SHELLMAP_DISABLED_DECORATIONS"); - shellmapDisabledDecorations.IsVisible = () => !Game.Settings.Game.ShowShellmap; } } } diff --git a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs index c39265cabf..3654697830 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs @@ -154,7 +154,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic BindCheckboxPref(panel, "PIXELDOUBLE_CHECKBOX", ds, "PixelDouble"); BindCheckboxPref(panel, "CURSORDOUBLE_CHECKBOX", ds, "CursorDouble"); BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate"); - BindCheckboxPref(panel, "SHOW_SHELLMAP", gs, "ShowShellmap"); BindCheckboxPref(panel, "DISPLAY_TARGET_LINES_CHECKBOX", gs, "DrawTargetLine"); BindCheckboxPref(panel, "PLAYER_STANCE_COLORS_CHECKBOX", gs, "UsePlayerStanceColors"); @@ -278,15 +277,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic Action ResetDisplayPanel(Widget panel) { var ds = Game.Settings.Graphics; - var gs = Game.Settings.Game; var ps = Game.Settings.Player; var dds = new GraphicSettings(); - var dgs = new GameSettings(); var dps = new PlayerSettings(); return () => { - gs.ShowShellmap = dgs.ShowShellmap; - ds.CapFramerate = dds.CapFramerate; ds.MaxFramerate = dds.MaxFramerate; ds.Language = dds.Language; diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index daf4f8eecb..6c646725b3 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -30,6 +30,7 @@ Container@MENU_BACKGROUND: ImageCollection: shellmapbits ImageName: record Container@SHELLMAP_DISABLED_DECORATIONS: + Visible: false Children: Image@NOD: X: WINDOW_RIGHT/2-384 diff --git a/mods/cnc/chrome/settings.yaml b/mods/cnc/chrome/settings.yaml index 72c991492f..afed569054 100644 --- a/mods/cnc/chrome/settings.yaml +++ b/mods/cnc/chrome/settings.yaml @@ -152,28 +152,21 @@ Container@SETTINGS_PANEL: Height: 20 Font: Regular Text: Player Stance Colors - Checkbox@SHOW_SHELLMAP: - X: 15 - Y: 185 - Width: 200 - Height: 20 - Font: Regular - Text: Show Shellmap Label@PLAYER: Text: Player: X: 15 - Y: 225 + Y: 195 TextField@PLAYERNAME: Text: Name X: 65 - Y: 215 + Y: 185 Width: 145 Height: 25 MaxLength: 16 ColorPreviewManager@COLOR_MANAGER: DropDownButton@PLAYERCOLOR: X: 215 - Y: 215 + Y: 185 Width: 70 Height: 25 IgnoreChildMouseOver: true diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index ef9c0c2240..d2fddd9e3f 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -165,28 +165,21 @@ Background@SETTINGS_PANEL: Height: 20 Font: Regular Text: Player Stance Colors - Checkbox@SHOW_SHELLMAP: - X: 15 - Y: 195 - Width: 200 - Height: 20 - Font: Regular - Text: Show Shellmap Label@PLAYER: Text: Player: X: 15 - Y: 240 + Y: 205 TextField@PLAYERNAME: Text: Name X: 65 - Y: 230 + Y: 195 Width: 145 Height: 25 MaxLength: 16 ColorPreviewManager@COLOR_MANAGER: DropDownButton@PLAYERCOLOR: X: 215 - Y: 230 + Y: 195 Width: 70 Height: 25 IgnoreChildMouseOver: true From 03236927e54dc7e5b7b913497f85daebaa76ca12 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 10 Dec 2016 18:13:54 +0000 Subject: [PATCH 5/5] Replace TD shellmap with a fixed background. --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 1 - .../Widgets/Logic/CncMainMenuLogic.cs | 29 - mods/cnc/chrome/mainmenu.yaml | 25 +- mods/cnc/maps/blank-shellmap/map.bin | Bin 0 -> 142 bytes mods/cnc/maps/blank-shellmap/map.png | Bin 0 -> 147 bytes mods/cnc/maps/blank-shellmap/map.yaml | 35 + mods/cnc/maps/shellmap/map.bin | Bin 23057 -> 0 bytes mods/cnc/maps/shellmap/map.png | Bin 1018 -> 0 bytes mods/cnc/maps/shellmap/map.yaml | 961 ------------------ mods/cnc/maps/shellmap/rules.yaml | 19 - mods/cnc/maps/shellmap/shellmap.lua | 30 - 11 files changed, 36 insertions(+), 1064 deletions(-) delete mode 100644 OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs create mode 100644 mods/cnc/maps/blank-shellmap/map.bin create mode 100644 mods/cnc/maps/blank-shellmap/map.png create mode 100644 mods/cnc/maps/blank-shellmap/map.yaml delete mode 100644 mods/cnc/maps/shellmap/map.bin delete mode 100644 mods/cnc/maps/shellmap/map.png delete mode 100644 mods/cnc/maps/shellmap/map.yaml delete mode 100644 mods/cnc/maps/shellmap/rules.yaml delete mode 100644 mods/cnc/maps/shellmap/shellmap.lua diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index a4e7d02fea..6d004f6c4f 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -72,7 +72,6 @@ - diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs deleted file mode 100644 index 5821754de8..0000000000 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncMainMenuLogic.cs +++ /dev/null @@ -1,29 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2016 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of - * the License, or (at your option) any later version. For more - * information, see COPYING. - */ -#endregion - -using OpenRA.Mods.Common.Widgets; -using OpenRA.Mods.Common.Widgets.Logic; -using OpenRA.Widgets; - -namespace OpenRA.Mods.Cnc.Widgets.Logic -{ - public class CncMainMenuLogic : MainMenuLogic - { - [ObjectCreator.UseCtor] - public CncMainMenuLogic(Widget widget, World world, ModData modData) - : base(widget, world, modData) - { - var shellmapDecorations = widget.Get("SHELLMAP_DECORATIONS"); - shellmapDecorations.IsVisible = () => menuType != MenuType.None; - shellmapDecorations.Get("RECBLOCK").IsVisible = () => world.WorldTick / 25 % 2 == 0; - } - } -} diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index 6c646725b3..e4e32ad134 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -1,36 +1,13 @@ Container@MENU_BACKGROUND: Width: WINDOW_RIGHT Height: WINDOW_BOTTOM - Logic: CncMainMenuLogic + Logic: MainMenuLogic Children: Container@MUSICBUTTONS: Logic: MusicControllerLogic Children: LogicKeyListener@MUSICCONTROLLER_KEYHANDLER: Container@SHELLMAP_DECORATIONS: - Children: - Image@RETICLE: - X: (WINDOW_RIGHT-WIDTH)/2 - Y: (WINDOW_BOTTOM-HEIGHT)/2 - Width: 512 - Height: 512 - ImageCollection: shellmap - ImageName: reticle - Label@REC: - X: (WINDOW_RIGHT-512)/2+10 - Y: (WINDOW_BOTTOM+512)/2-28 - Height: 18 - Font: Bold - Text: REC - Image@RECBLOCK: - X: (WINDOW_RIGHT-512)/2+40 - Y: (WINDOW_BOTTOM+512)/2-25 - Width: 16 - Height: 16 - ImageCollection: shellmapbits - ImageName: record - Container@SHELLMAP_DISABLED_DECORATIONS: - Visible: false Children: Image@NOD: X: WINDOW_RIGHT/2-384 diff --git a/mods/cnc/maps/blank-shellmap/map.bin b/mods/cnc/maps/blank-shellmap/map.bin new file mode 100644 index 0000000000000000000000000000000000000000..8d718ac90aaaf2b79880b9295a75ca64ffbaa129 GIT binary patch literal 142 vcmZQ#Wng6xWPpGeAoU*$;`-0PgCx%SpMeF8Ad30HQk+N%poTzAC4m9}`+ymo literal 0 HcmV?d00001 diff --git a/mods/cnc/maps/blank-shellmap/map.png b/mods/cnc/maps/blank-shellmap/map.png new file mode 100644 index 0000000000000000000000000000000000000000..d866c8c7b8d9eb90087fb377226b737eaa5473b9 GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^%plCc1|-8Yw(bW~Ea{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaL-l0AZa85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP(skt o#W93qW^zV%`CtCSJQkJ=rK!S2(y!hr03{hbUHx3vIVCg!0NczXhX4Qo literal 0 HcmV?d00001 diff --git a/mods/cnc/maps/blank-shellmap/map.yaml b/mods/cnc/maps/blank-shellmap/map.yaml new file mode 100644 index 0000000000..f7b2177266 --- /dev/null +++ b/mods/cnc/maps/blank-shellmap/map.yaml @@ -0,0 +1,35 @@ +MapFormat: 11 + +RequiresMod: cnc + +Title: Blank Shellmap + +Author: Paul Chote + +Tileset: DESERT + +MapSize: 5,5 + +Bounds: 1,1,1,1 + +Visibility: Shellmap + +Categories: Shellmap + +Players: + PlayerReference@Neutral: + Name: Neutral + OwnsWorld: True + NonCombatant: True + Faction: Random + +Actors: + +Rules: + World: + -SpawnMPUnits: + -MPStartLocations: + -CrateSpawner: + MusicPlaylist: + BackgroundMusic: map1 + DisableWorldSounds: true \ No newline at end of file diff --git a/mods/cnc/maps/shellmap/map.bin b/mods/cnc/maps/shellmap/map.bin deleted file mode 100644 index 91476e7ec0e577152a653a6defbba550578d5ddf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23057 zcmeHPTW;IP5gSVIeco<`m zWnq@}vTP~K9>Q2=S(IgImMv%5Ll~L5j&Upgy1hlEP&&EIu6(ed8Mhp-P zK(6iao@={l$HefDL6h6&#}F}s7;%F!)pg3>hPg8|>8s zdQd&Km&bcE+RKp>>=#2y}WhW zFreew4f_$txHVu6@)huk!QHqLp${<r#3?!`KrkediMkw`!`>&NjgUgtaOM?cGtL5@YNP5n77{A1G$ z5+)a^lKe=h{6)@g{flwPYEmG-d`F#rRGsG{Gj@IL69ax8a4m^i^ z20UZgN(|Vrl|Ps9lfN{KE4DNFeEHdYofk#Wu&mo>eJ%f0L;3e>qEy(j7 z|FV*3sS0MHR?~*#A00ld!OtzkEk`THfC&dRxUxL6 z2kb$8a5&0PM7jmBgPbb!2w}@{+E7x<5cYhCZ58(%df3S)Y#|4s8;1uc`KE`STjQ;1Upr-&1X1VPe}A5K$$nLyAMvksvS5q)E| zEMKua>I%^{a1C_c*>6@n|o*AUkTegZ$8`R(`k4hDf>}1{6lfa@sR>Qu)AbCi_)Zs&( zbH|e-n|OH4qko(jzf71Y`A0kTF61u4T_$A4)d}PYq7$SiARMY4V26pF_(#`?{X57z zo*di6qd}g=_;m)HL1`bc>_NVBmHUnzoacqo3DgPV6J{#5`wqkoBWhr5o!mj)fviTA zdt1Hi@S%^NGl(+;+D9yVSl_XO^Sn?pPE=rQ2XY6|4pI~KdUqxc+Qg$)KMo)I_&I|- zL#TbkvWN8@JJ5xaaiWr=b`bBNZ=zm$XX2nuJR0P&{iquLall;QXCK&y+DG&m>NERG ziL3GPd!`)%c4dxDJZj}}@_FVT@(~j&nSTtJd93rUeTaPo`-ndy_{{#&7}wrIyk{>f zcx=jg*~#Yz+DF{_%OMbwld-W6xsPxk$!C_lF&849@#?QB>t!dOU(!Be)*)3#4uRC? z%sMx=`H$tI@%y%3t~HZ;Q};J6flH`MhJ?msVRu6y6$}`g`q*f>-yXKA@^F9S65^8I z?Q;ve8v<#>iLq}n-^MlXetX!e%ESGQOUO%pCkoYZv%tpRso8a2t+6yQY-y1kKJ@uV zV_>{y&)d!=&lvkM-de`(Vaw{r;lmpKAv~Cx)Y_5Ss+JRGz)ySFa^$gmSfBrxnzX== zX*+A1PQZ+drS`C8<#G7Xk6&bWho1{RF>U7}PL1=7iy3#^9=05LY=5H$KZc(tU}GBo zX%AbDJhs14gP--hWnr2XMgHu?qZZC_bL{r8W#w`5u^RlW=PiqBvtkC!xcHgUUQR!u z20uD>RGSqu#H=cQ+Kwr$ejGg4;79X`?#Y|utzX2_l=gDsdkucp@`EMOAJgMzwCK# z`Pm$Y^fd#0xbN9dPkW#fhSTx9_4*>N&vwjs91V%(JRiyTeoW46LF z{6>exWTqJ~V{_?k$ZbU1+{G#}FlGG8<>7qHR#--cnK5Hy**4TR;%%-COANFhQ(FGX z<>7qHR#|tPR?> zJo_@&+Nf-+8xd5uX^jdwkyZB3FdN(9gh%>&>OL;{d(;l@*dGW z(us~{&YOJvQ19BqK(z_x*;kApM~Fs9N9?M8{eBO1kN6(_c1IhO=S|-F)Gm$T{`z&>^6FQD3d}_N7fg!?S-C4#F)DfaT zd1jwZ%)j$de(~*s+}+CBjquZ+c$9qT=UR-JW8fI{PD~OEA%=*CV`mvh5Jw1(OfQH| z%)j%uFN$v$iATwYPV95}=NQp3(qk+Sp@ys|H>Suh5MS6#o~?^H?sn{)iHV2tFK7qEB-yW}2|1@3$Auj(;`crwJSX?EMN(ES6eu((#-M&$xK_ zAB}5pG7XkGn^SVgKZ}#5=PvN$=Tucrdsz4>eidx-&q4zW4YX=Ngd!1weg~tIi&h7% zPDw;J7p>l-Mo4ED%g*1X>*^xiceuV7upRR%Dm<6cMf89oRwZ2c7DNqEu(fr-jM7RP1+mag^e|UZJGjt>2ki z77H&lu+YFl0}BoO3pCJW{N?RagzT)xmaiXE4n$u@?dGD&v`>Aoj&?w6b0;a}PT{=s zIFdTb*Or`PQ64nseh=k_oc*x&W&XDV9nljgzs<9_x%S#jH-I$M%l}04)DEp!RJ0{*^RKYI^(Cq+L7$g(aDh6 W!{XnC1{NAvXkej%g$CxQfxiH$4p|5Q diff --git a/mods/cnc/maps/shellmap/map.png b/mods/cnc/maps/shellmap/map.png deleted file mode 100644 index 0fd2bf9949def2e0aad11490e94fc170612b1388..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1018 zcmVPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1CL2WK~!i%?V8PT z6fqQpHxM5Kl1(eQx$push4uM0qPj2CPAHQwMJ544%R+ofIKA4 z>%n{Qep(|bI0YK|Al?HU7N8!^p<&!lX^HD}tf3GME1}w2h=;xd^}swR>Ls%+cu&+) zC|WP!`V{1>0Nr4Xnzm$m%>dIL4%Vfb_u3@D9<+xWCeW=FVCp{wdi;9*He59@Mfcl0 zz_cDD^8j;d^7G5fc;7Rkm0_>Q=z0M(y|SPT#cA!&Xs{1xS%dj-h7O8dD# zfG34PHU;P;eIjkH&;-XvJi<6nX}>A|AO`4x)u^rWfQY_=TIWIb3J=h$@7WR_7y{Ho zE9n!=HLRz3j2VkN*l@zR>Tpbv(J`=oP* z08>~_T3n(hKppRmdgMEgV+K0q@lp!Q$2~B>QixOdnx&*Y61oQ7X9oz9xQ9}JN-~%Z za|HC?9AKJU0u7`P)f{k5=~H@d(hKYi0j7ziFr*q9U?TP18+s%@zxh|W6bw*PX&$70 zN1=YTzIlL&l9@-qy&oE2ntKFR3y_W2OvheN>$En7ui;p69j~ru%{8rPpJf5Q{CE!< zdyU*S#LqT0&`Rp}U#&)iw-((0>;UH+K-czsNObSji+F26{SN^S25(KY8S7db>&eIz zw?3(_)^u*TPrcUWwx9aZd*b6uY(^kT^)1+QuU;zN>H(fiat64NGr)zM0WRbWa3N=a z3poQ^$iDz@zZCl92s{35hcs*%)>FGgj((9aRLj8h&@U?`DzkUB*fGcXgC^j=a z`>Ez#f2nhhj2icF+qa}4UK_R2LvhX6C+NIBe3g6p@Nrm-EAIis`e${{bFtQ4uYEWs zUiYhN*b_DGThpW(>$oQGs$q@yI!^WOKPJGKo7jsr_FdcitN