Unhardcode more sounds

This commit is contained in:
pchote
2010-02-27 17:01:54 +13:00
parent 3a0c7fc274
commit 1d9f5c8362
8 changed files with 44 additions and 21 deletions

View File

@@ -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<EvaAlertsInfo>();
Sound.Play(eva.ChatBeep);
while (recentLines.Count > logLength) recentLines.RemoveAt(0);
}
}

View File

@@ -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<EvaAlertsInfo>();
// 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<EvaAlertsInfo>();
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<EvaAlertsInfo>();
// 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)

View File

@@ -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<EvaAlertsInfo>();
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);
}
}

View File

@@ -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<EvaAlertsInfo>();
Sound.PlayToPlayer(self.Owner, IsDisabled ? eva.EnablePower : eva.DisablePower);
}
}
}

View File

@@ -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<EvaAlertsInfo>();
Sound.PlayToPlayer(self.Owner,eva.PrimaryBuildingSelected);
}
}
}

View File

@@ -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<EvaAlertsInfo>();
Sound.PlayToPlayer(thief.Owner, eva.CreditsStolen);
}
public IEnumerable<PipType> GetPips(Actor self)

View File

@@ -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<EvaAlertsInfo>();
if (e.DamageState == DamageState.Dead)
Sound.PlayToPlayer(self.Owner,
self.Info.Traits.Get<OwnedActorInfo>().WaterBound ? "navylst1.aud" : "unitlst1.aud");
self.Info.Traits.Get<OwnedActorInfo>().WaterBound ? eva.NavalUnitLost : eva.UnitLost);
}
}
}

View File

@@ -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: