Move mission videos to rules.
This commit is contained in:
@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
public Map Map;
|
||||
public List<string> Players = new List<string>();
|
||||
public MapPlayers MapPlayers;
|
||||
public MiniYaml Rules = new MiniYaml("");
|
||||
|
||||
public bool ValidateArguments(string[] args)
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
ReadPacks(file, filename);
|
||||
ReadTrees(file);
|
||||
|
||||
Map.Videos = LoadVideos(file, "BASIC");
|
||||
LoadVideos(file, "BASIC");
|
||||
|
||||
ReadActors(file);
|
||||
|
||||
@@ -93,6 +94,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
Map.FixOpenAreas();
|
||||
|
||||
Map.RuleDefinitions = Rules.Nodes;
|
||||
|
||||
var dest = Path.GetFileNameWithoutExtension(args[1]) + ".oramap";
|
||||
var package = new ZipFile(modData.ModFiles, dest, true);
|
||||
Map.Save(package);
|
||||
@@ -144,10 +147,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
|
||||
public abstract void ReadPacks(IniFile file, string filename);
|
||||
|
||||
static MapVideos LoadVideos(IniFile file, string section)
|
||||
void LoadVideos(IniFile file, string section)
|
||||
{
|
||||
var videos = new MapVideos();
|
||||
|
||||
var videos = new List<MiniYamlNode>();
|
||||
foreach (var s in file.GetSection(section))
|
||||
{
|
||||
if (s.Value != "x" && s.Value != "<none>")
|
||||
@@ -155,25 +157,42 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
switch (s.Key)
|
||||
{
|
||||
case "Intro":
|
||||
videos.BackgroundInfo = s.Value.ToLower() + ".vqa";
|
||||
videos.Add(new MiniYamlNode("BackgroundVideo", s.Value.ToLower() + ".vqa"));
|
||||
break;
|
||||
case "Brief":
|
||||
videos.Briefing = s.Value.ToLower() + ".vqa";
|
||||
videos.Add(new MiniYamlNode("BriefingVideo", s.Value.ToLower() + ".vqa"));
|
||||
break;
|
||||
case "Action":
|
||||
videos.GameStart = s.Value.ToLower() + ".vqa";
|
||||
videos.Add(new MiniYamlNode("StartVideo", s.Value.ToLower() + ".vqa"));
|
||||
break;
|
||||
case "Win":
|
||||
videos.GameWon = s.Value.ToLower() + ".vqa";
|
||||
videos.Add(new MiniYamlNode("WinVideo", s.Value.ToLower() + ".vqa"));
|
||||
break;
|
||||
case "Lose":
|
||||
videos.GameLost = s.Value.ToLower() + ".vqa";
|
||||
videos.Add(new MiniYamlNode("LossVideo", s.Value.ToLower() + ".vqa"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return videos;
|
||||
if (videos.Any())
|
||||
{
|
||||
var worldNode = Rules.Nodes.FirstOrDefault(n => n.Key == "World");
|
||||
if (worldNode == null)
|
||||
{
|
||||
worldNode = new MiniYamlNode("World", new MiniYaml("", new List<MiniYamlNode>()));
|
||||
Rules.Nodes.Add(worldNode);
|
||||
}
|
||||
|
||||
var missionData = worldNode.Value.Nodes.FirstOrDefault(n => n.Key == "MissionData");
|
||||
if (missionData == null)
|
||||
{
|
||||
missionData = new MiniYamlNode("MissionData", new MiniYaml("", new List<MiniYamlNode>()));
|
||||
worldNode.Value.Nodes.Add(missionData);
|
||||
}
|
||||
|
||||
missionData.Value.Nodes.AddRange(videos);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ReadActors(IniFile file)
|
||||
|
||||
Reference in New Issue
Block a user