From 15a72e893b1103b7dde4727e7324d7bab504017c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 28 Jun 2010 00:23:58 +1200 Subject: [PATCH] Quick hack for theater-specific artwork. Should probably be done better; editor support required. --- OpenRA.Game/Game.cs | 2 +- OpenRA.Game/Graphics/SequenceProvider.cs | 19 ++- mods/cnc/civilian.yaml | 7 +- mods/cnc/sequences-map.xml | 165 ++++++++++++++++++++++- 4 files changed, 179 insertions(+), 14 deletions(-) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 53aa0ac218..6a5b40b670 100644 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -157,7 +157,7 @@ namespace OpenRA world = new World(manifest, map); Timer.Time("world: {0}"); - SequenceProvider.Initialize(manifest.Sequences); + SequenceProvider.Initialize(manifest.Sequences, map.Theater); Timer.Time("ChromeProv, SeqProv: {0}"); chrome = new Chrome(renderer, manifest); diff --git a/OpenRA.Game/Graphics/SequenceProvider.cs b/OpenRA.Game/Graphics/SequenceProvider.cs index d4081118b6..e28517a50b 100644 --- a/OpenRA.Game/Graphics/SequenceProvider.cs +++ b/OpenRA.Game/Graphics/SequenceProvider.cs @@ -31,12 +31,14 @@ namespace OpenRA.Graphics { static Dictionary> units; static Dictionary cursors; + static string currentTheater; - public static void Initialize(params string[] sequenceFiles) + public static void Initialize(string[] sequenceFiles, string theater) { units = new Dictionary>(); cursors = new Dictionary(); - + currentTheater = theater; + foreach (var f in sequenceFiles) LoadSequenceSource(f); } @@ -76,16 +78,23 @@ namespace OpenRA.Graphics public static Sequence GetSequence(string unitName, string sequenceName) { - try { return units[unitName][sequenceName]; } + try { return units[unitName+"@"+currentTheater][sequenceName]; } catch (KeyNotFoundException) { - throw new InvalidOperationException( - "Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName)); + try { return units[unitName][sequenceName]; } + catch (KeyNotFoundException) + { + throw new InvalidOperationException( + "Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName)); + } } } public static bool HasSequence(string unit, string seq) { + if (units.ContainsKey(unit+"@"+currentTheater)) + return units[unit+"@"+currentTheater].ContainsKey(seq); + return units[unit].ContainsKey(seq); } diff --git a/mods/cnc/civilian.yaml b/mods/cnc/civilian.yaml index 00a217b64c..0468a28b7d 100644 --- a/mods/cnc/civilian.yaml +++ b/mods/cnc/civilian.yaml @@ -85,7 +85,12 @@ V18: Valued: Description: Field -# TODO: Remap v20 -> v37 down to v1 -> v18 for desert theater +V31: + Inherits: ^CivBuilding +V32: + Inherits: ^CivBuilding +V33: + Inherits: ^CivBuilding BARB: Inherits: ^Wall diff --git a/mods/cnc/sequences-map.xml b/mods/cnc/sequences-map.xml index 0170fc03ad..350dcd60b0 100644 --- a/mods/cnc/sequences-map.xml +++ b/mods/cnc/sequences-map.xml @@ -133,79 +133,230 @@ + + + + + + + + + + + + + + + + + + - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file