From 1d9f5c83625a7bb27d3a954905dd94c2c5226e97 Mon Sep 17 00:00:00 2001 From: pchote Date: Sat, 27 Feb 2010 17:01:54 +1300 Subject: [PATCH] Unhardcode more sounds --- OpenRa.Game/Chat.cs | 6 ++++-- OpenRa.Game/Chrome.cs | 19 ++++++++++++------- OpenRa.Game/Player.cs | 7 ++++--- OpenRa.Game/Traits/CanPowerDown.cs | 5 +++-- OpenRa.Game/Traits/Production.cs | 7 ++++--- OpenRa.Game/Traits/StoresOre.cs | 5 +++-- OpenRa.Game/Traits/Unit.cs | 5 +++-- mods/cnc/system.yaml | 11 +++++++++++ 8 files changed, 44 insertions(+), 21 deletions(-) diff --git a/OpenRa.Game/Chat.cs b/OpenRa.Game/Chat.cs index 4ed8e32124..73d9d111c8 100644 --- a/OpenRa.Game/Chat.cs +++ b/OpenRa.Game/Chat.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -21,6 +21,7 @@ using System.Collections.Generic; using System.Drawing; using OpenRa.FileFormats; +using OpenRa.Traits; namespace OpenRa { @@ -68,7 +69,8 @@ namespace OpenRa { Log.Write( "Chat: {0}: {1}", from, text ); recentLines.Add(Tuple.New(c, from, text)); - Sound.Play("rabeep1.aud"); + var eva = Game.world.LocalPlayer.PlayerActor.Info.Traits.Get(); + Sound.Play(eva.ChatBeep); while (recentLines.Count > logLength) recentLines.RemoveAt(0); } } diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 3cd9c7f175..e0f030c822 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -523,13 +523,15 @@ namespace OpenRa if (radarAnimationFrame <= radarSlideAnimationLength) radarOrigin = float2.Lerp(radarClosedOrigin, radarOpenOrigin, radarAnimationFrame * 1.0f / radarSlideAnimationLength); + var eva = Game.world.LocalPlayer.PlayerActor.Info.Traits.Get(); + // Play radar-on sound at the start of the activate anim (open) if (radarAnimationFrame == radarSlideAnimationLength && hasRadar) - Sound.Play("radaron2.aud"); + Sound.Play(eva.RadarUp); // Play radar-on sound at the start of the activate anim (close) if (radarAnimationFrame == radarSlideAnimationLength + radarActivateAnimationLength - 1 && !hasRadar) - Sound.Play("radardn1.aud"); + Sound.Play(eva.RadarDown); // Minimap height if (radarAnimationFrame >= radarSlideAnimationLength) @@ -605,7 +607,8 @@ namespace OpenRa void HandleTabClick(string button) { - Sound.Play("ramenu1.aud"); + var eva = Game.world.LocalPlayer.PlayerActor.Info.Traits.Get(); + Sound.Play(eva.TabClick); var wasOpen = paletteOpen; paletteOpen = (currentTab == button && wasOpen) ? false : true; currentTab = button; @@ -816,13 +819,15 @@ namespace OpenRa if (paletteAnimationFrame <= paletteAnimationLength) paletteOrigin = float2.Lerp(paletteClosedOrigin, paletteOpenOrigin, paletteAnimationFrame * 1.0f / paletteAnimationLength); - // Play radar-on sound at the start of the activate anim (open) + var eva = Game.world.LocalPlayer.PlayerActor.Info.Traits.Get(); + + // Play palette-open sound at the start of the activate anim (open) if (paletteAnimationFrame == 1 && paletteOpen) - Sound.Play("bleep13.aud"); + Sound.Play(eva.BuildPaletteOpen); - // Play radar-on sound at the start of the activate anim (close) + // Play palette-close sound at the start of the activate anim (close) if (paletteAnimationFrame == paletteAnimationLength + -1 && !paletteOpen) - Sound.Play("bleep13.aud"); + Sound.Play(eva.BuildPaletteClose); // Animation is complete if ((paletteAnimationFrame == 0 && !paletteOpen) diff --git a/OpenRa.Game/Player.cs b/OpenRa.Game/Player.cs index d5c1349447..d3d7d77ea7 100644 --- a/OpenRa.Game/Player.cs +++ b/OpenRa.Game/Player.cs @@ -177,16 +177,17 @@ namespace OpenRa var diff = Math.Abs(totalMoney - DisplayCash); var move = Math.Min(Math.Max((int)(diff * displayCashFracPerFrame), displayCashDeltaPerFrame), diff); - + + var eva = PlayerActor.Info.Traits.Get(); if (DisplayCash < totalMoney) { DisplayCash += move; - Sound.PlayToPlayer(this, "cashup1.aud"); + Sound.PlayToPlayer(this, eva.CashTickUp); } else if (DisplayCash > totalMoney) { DisplayCash -= move; - Sound.PlayToPlayer(this, "cashdn1.aud"); + Sound.PlayToPlayer(this, eva.CashTickDown); } } diff --git a/OpenRa.Game/Traits/CanPowerDown.cs b/OpenRa.Game/Traits/CanPowerDown.cs index 4a7c9800cf..29c979ec05 100644 --- a/OpenRa.Game/Traits/CanPowerDown.cs +++ b/OpenRa.Game/Traits/CanPowerDown.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -43,7 +43,8 @@ namespace OpenRa.Traits if (order.OrderString == "PowerDown") { IsDisabled = !IsDisabled; - Sound.PlayToPlayer(self.Owner, IsDisabled ? "bleep12.aud" : "bleep11.aud"); + var eva = self.Owner.PlayerActor.Info.Traits.Get(); + Sound.PlayToPlayer(self.Owner, IsDisabled ? eva.EnablePower : eva.DisablePower); } } } diff --git a/OpenRa.Game/Traits/Production.cs b/OpenRa.Game/Traits/Production.cs index 436f87b86d..6544fea783 100755 --- a/OpenRa.Game/Traits/Production.cs +++ b/OpenRa.Game/Traits/Production.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -137,8 +137,9 @@ namespace OpenRa.Traits } } isPrimary = true; - - Sound.PlayToPlayer(self.Owner, "pribldg1.aud"); + + var eva = self.Owner.PlayerActor.Info.Traits.Get(); + Sound.PlayToPlayer(self.Owner,eva.PrimaryBuildingSelected); } } } diff --git a/OpenRa.Game/Traits/StoresOre.cs b/OpenRa.Game/Traits/StoresOre.cs index 1c57ed5326..e7baaac430 100644 --- a/OpenRa.Game/Traits/StoresOre.cs +++ b/OpenRa.Game/Traits/StoresOre.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -37,7 +37,8 @@ namespace OpenRa.Traits self.Owner.TakeCash(toSteal); thief.Owner.GiveCash(toSteal); - Sound.PlayToPlayer(thief.Owner, "credit1.aud"); + var eva = thief.Owner.PlayerActor.Info.Traits.Get(); + Sound.PlayToPlayer(thief.Owner, eva.CreditsStolen); } public IEnumerable GetPips(Actor self) diff --git a/OpenRa.Game/Traits/Unit.cs b/OpenRa.Game/Traits/Unit.cs index 6831db2642..dce71441f0 100755 --- a/OpenRa.Game/Traits/Unit.cs +++ b/OpenRa.Game/Traits/Unit.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -40,9 +40,10 @@ namespace OpenRa.Traits public void Damaged(Actor self, AttackInfo e) { + var eva = self.Owner.PlayerActor.Info.Traits.Get(); if (e.DamageState == DamageState.Dead) Sound.PlayToPlayer(self.Owner, - self.Info.Traits.Get().WaterBound ? "navylst1.aud" : "unitlst1.aud"); + self.Info.Traits.Get().WaterBound ? eva.NavalUnitLost : eva.UnitLost); } } } diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index f69d7edea4..fb092f8631 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -9,8 +9,19 @@ Player: CancelledAudio: cancel1.aud ClickAudio: button.aud EvaAlerts: + TabClick: button.aud + ChatBeep: target1.aud + RadarUp: comcntr1.aud + RadarDown: powrdn1.aud + BuildPaletteOpen: appear1.aud + BuildPaletteClose: appear1.aud + CashTickUp: clock1.aud + CashTickDown: clock1.aud LowPower: lopower1.aud SilosNeeded: silos1.aud + UnitLost: unitlost.aud + NavalUnitLost: unitlost.aud + PrimaryBuildingSelected: pribldg1.aud PlaceBuilding: SpawnDefaultUnits: