Add Voices and DisableVariants to VoiceInfo, remove the ".aud" for die sounds.
This commit is contained in:
@@ -11,35 +11,33 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using System;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
public class VoiceInfo
|
||||
{
|
||||
public readonly Dictionary<string,string[]> Variants;
|
||||
public readonly Dictionary<string,string[]> Voices;
|
||||
public readonly string DefaultVariant = ".aud" ;
|
||||
public readonly string[] Select = { };
|
||||
public readonly string[] Move = { };
|
||||
public readonly string[] Attack = null;
|
||||
public readonly string[] Die = { };
|
||||
public readonly string[] DisableVariants = { };
|
||||
|
||||
Func<MiniYaml, string, Dictionary<string, string[]>> Load = (y,name) => (y.Nodes.ContainsKey(name))? y.Nodes[name].Nodes.ToDictionary(a => a.Key,
|
||||
a => (string[])FieldLoader.GetValue( "(value)", typeof(string[]), a.Value.Value ))
|
||||
: new Dictionary<string, string[]>();
|
||||
|
||||
public readonly Lazy<Dictionary<string, VoicePool>> Pools;
|
||||
|
||||
public VoiceInfo( MiniYaml y )
|
||||
{
|
||||
FieldLoader.LoadFields(this, y.Nodes, new string[] { "Select", "Move", "Attack", "Die" });
|
||||
Variants = (y.Nodes.ContainsKey("Variants"))? y.Nodes["Variants"].Nodes.ToDictionary(a => a.Key,
|
||||
a => (string[])FieldLoader.GetValue( "(value)", typeof(string[]), a.Value.Value ))
|
||||
: new Dictionary<string, string[]>();
|
||||
FieldLoader.LoadFields(this, y.Nodes, new string[] { "DisableVariants" });
|
||||
Variants = Load(y, "Variants");
|
||||
Voices = Load(y, "Voices");
|
||||
|
||||
Pools = Lazy.New(() =>
|
||||
new Dictionary<string, VoicePool>
|
||||
{
|
||||
{ "Select", new VoicePool(Select) },
|
||||
{ "Move", new VoicePool(Move) },
|
||||
{ "Attack", new VoicePool( Attack ?? Move ) },
|
||||
{ "Die", new VoicePool(Die) },
|
||||
});
|
||||
if (!Voices.ContainsKey("Attack"))
|
||||
Voices.Add("Attack", Voices["Move"]);
|
||||
|
||||
Pools = Lazy.New(() => Voices.ToDictionary( a => a.Key, a => new VoicePool(a.Value) ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,6 +184,7 @@ namespace OpenRA
|
||||
// Returns true if it played a phrase
|
||||
public static bool PlayVoice(string phrase, Actor voicedUnit, string variant)
|
||||
{
|
||||
Console.WriteLine(" Foo: `{0}`", phrase);
|
||||
if (voicedUnit == null) return false;
|
||||
if (phrase == null) return false;
|
||||
|
||||
@@ -197,19 +198,7 @@ namespace OpenRA
|
||||
if (clip == null)
|
||||
return false;
|
||||
|
||||
if (clip.Contains(".")) /* no variants! */
|
||||
{
|
||||
Play(clip);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (vi.Variants.Count == 0)
|
||||
{
|
||||
Play(clip + vi.DefaultVariant);
|
||||
return true;
|
||||
}
|
||||
|
||||
var variantext = vi.Variants.ContainsKey(variant)?
|
||||
var variantext = (vi.Variants.ContainsKey(variant) && !vi.DisableVariants.Contains(phrase))?
|
||||
vi.Variants[variant][voicedUnit.ActorID % vi.Variants.Count] : vi.DefaultVariant;
|
||||
Play(clip + variantext);
|
||||
return true;
|
||||
|
||||
@@ -2,26 +2,32 @@ GenericVoice:
|
||||
Variants:
|
||||
nod: .v01,.v03
|
||||
gdi: .v01,.v03
|
||||
Voices:
|
||||
Select: await1,ready,report1,yessir1
|
||||
Move: ackno,affirm1,noprob,ritaway,roger,ugotit
|
||||
Die: nuyell1.aud,nuyell3.aud,nuyell4.aud,nuyell5.aud
|
||||
Die: nuyell1,nuyell3,nuyell4,nuyell5
|
||||
DisableVariants: Die
|
||||
|
||||
VehicleVoice:
|
||||
Variants:
|
||||
nod: .v00,.v02
|
||||
gdi: .v00,.v02
|
||||
Voices:
|
||||
Select: vehic1,yessir1,report1,await1,unit1
|
||||
Move: ackno,affirm1,movout1
|
||||
|
||||
CivilianMaleVoice:
|
||||
Voices:
|
||||
Select: guyyeah1
|
||||
Move: guyokay1
|
||||
|
||||
CivilianFemaleVoice:
|
||||
Voices:
|
||||
Select: girlyeah
|
||||
Move: girlokay
|
||||
|
||||
CommandoVoice:
|
||||
Voices:
|
||||
Select: rokroll1,yeah1,yes1,yo1
|
||||
Move: cmon1,onit1,gotit1
|
||||
Attack: keepem1,laugh1,bombit1,lefty1
|
||||
|
||||
@@ -4,14 +4,17 @@ GenericVoice:
|
||||
Variants:
|
||||
soviet: .r01,.r03
|
||||
allies: .v01,.v03
|
||||
Voices:
|
||||
Select: await1,ready,report1,yessir1
|
||||
Move: ackno,affirm1,noprob,overout,ritaway,roger,ugotit
|
||||
Die: dedman1.aud,dedman2.aud,dedman3.aud,dedman4.aud,dedman5.aud,dedman6.aud,dedman7.aud,dedman8.aud,dedman10.aud
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
DisableVariants: Die
|
||||
|
||||
VehicleVoice:
|
||||
Variants:
|
||||
soviet: .r00,.r02
|
||||
allies: .v00,.v02
|
||||
Voices:
|
||||
Select: vehic1,yessir1,report1,await1
|
||||
Move: ackno,affirm1
|
||||
|
||||
@@ -19,58 +22,69 @@ ShipVoice:
|
||||
Variants:
|
||||
soviet: .r00,.r02
|
||||
allies: .v00,.v02
|
||||
Voices:
|
||||
Select: vehic1,yessir1,report1,await1
|
||||
Move: ackno,affirm1
|
||||
|
||||
EngineerVoice:
|
||||
Voices:
|
||||
Select: eengin1,eyessir1
|
||||
Move: eaffirm1,emovout1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
MedicVoice:
|
||||
Voices:
|
||||
Select: mrespon1,myessir1
|
||||
Move: maffirm1,mmovout1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
TanyaVoice:
|
||||
Voices:
|
||||
Select: yo1,yes1,yeah1
|
||||
Move: rokroll1,onit1,cmon1
|
||||
Attack: tuffguy1,bombit1,gotit1
|
||||
Die: tandeth1
|
||||
|
||||
DogVoice:
|
||||
Voices:
|
||||
Select:
|
||||
Move: dogy1
|
||||
Attack: dogg5p,dogw3px
|
||||
Die: dogw5,dogw6,dogw7
|
||||
|
||||
SpyVoice:
|
||||
Voices:
|
||||
Select: syessir1,scomnd1
|
||||
Move: sonway1,sindeed1
|
||||
Attack: sking1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
ThiefVoice:
|
||||
Voices:
|
||||
Select: swhat1,syeah1
|
||||
Move: saffirm1,smout1,sokay1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
CivilianMaleVoice:
|
||||
Voices:
|
||||
Select: guyyeah1
|
||||
Move: guyokay1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
CivilianFemaleVoice:
|
||||
Voices:
|
||||
Select: girlyeah
|
||||
Move: girlokay
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
EinsteinVoice:
|
||||
Voices:
|
||||
Select: einah1,einok1,einyes1
|
||||
Move: einah1,einok1,einyes1
|
||||
Die: dedman1,dedman2,dedman3,dedman4,dedman5,dedman6,dedman7,dedman8,dedman10
|
||||
|
||||
ShokVoice:
|
||||
Voices:
|
||||
Select: jchrge1,jjuice1,jjump1,jpower1
|
||||
Move: jdance1,jyes1
|
||||
Attack: jburn1,jcrisp1,jshock1,jlight1
|
||||
|
||||
Reference in New Issue
Block a user