Load default packages from the default mod
This commit is contained in:
@@ -38,6 +38,7 @@ namespace OpenRa.FileFormats
|
|||||||
|
|
||||||
public class Manifest
|
public class Manifest
|
||||||
{
|
{
|
||||||
|
public readonly string[] Folders = { };
|
||||||
public readonly string[] Packages = { };
|
public readonly string[] Packages = { };
|
||||||
public readonly string[] LegacyRules = { };
|
public readonly string[] LegacyRules = { };
|
||||||
public readonly string[] Rules = { };
|
public readonly string[] Rules = { };
|
||||||
@@ -49,7 +50,8 @@ namespace OpenRa.FileFormats
|
|||||||
var yaml = mods
|
var yaml = mods
|
||||||
.Select(m => MiniYaml.FromFile("mods/" + m + "/mod.yaml"))
|
.Select(m => MiniYaml.FromFile("mods/" + m + "/mod.yaml"))
|
||||||
.Aggregate(MiniYaml.Merge);
|
.Aggregate(MiniYaml.Merge);
|
||||||
|
|
||||||
|
Folders = YamlList(yaml, "Folders");
|
||||||
Packages = YamlList(yaml, "Packages");
|
Packages = YamlList(yaml, "Packages");
|
||||||
LegacyRules = YamlList(yaml, "LegacyRules");
|
LegacyRules = YamlList(yaml, "LegacyRules");
|
||||||
Rules = YamlList(yaml, "Rules");
|
Rules = YamlList(yaml, "Rules");
|
||||||
|
|||||||
@@ -35,6 +35,19 @@ namespace OpenRa
|
|||||||
internal static Session LobbyInfo = new Session();
|
internal static Session LobbyInfo = new Session();
|
||||||
static bool changePending;
|
static bool changePending;
|
||||||
|
|
||||||
|
public static void LoadModPackages(Manifest manifest)
|
||||||
|
{
|
||||||
|
FileSystem.UnmountTemporaryPackages();
|
||||||
|
Timer.Time("reset: {0}");
|
||||||
|
|
||||||
|
foreach (var dir in manifest.Folders)
|
||||||
|
FileSystem.MountTemporary(new Folder(dir));
|
||||||
|
|
||||||
|
foreach (var pkg in manifest.Packages)
|
||||||
|
FileSystem.MountTemporary(new Package(pkg));
|
||||||
|
Timer.Time("mount tempory packages: {0}");
|
||||||
|
}
|
||||||
|
|
||||||
public static void ChangeMap(string mapName)
|
public static void ChangeMap(string mapName)
|
||||||
{
|
{
|
||||||
Timer.Time( "----ChangeMap" );
|
Timer.Time( "----ChangeMap" );
|
||||||
@@ -42,17 +55,12 @@ namespace OpenRa
|
|||||||
var manifest = new Manifest(LobbyInfo.GlobalSettings.Mods);
|
var manifest = new Manifest(LobbyInfo.GlobalSettings.Mods);
|
||||||
Timer.Time( "manifest: {0}" );
|
Timer.Time( "manifest: {0}" );
|
||||||
|
|
||||||
chat.AddLine(Color.White, "Debug", "Map change {0} -> {1}".F(Game.mapName, mapName));
|
|
||||||
Game.changePending = false;
|
Game.changePending = false;
|
||||||
Game.mapName = mapName;
|
Game.mapName = mapName;
|
||||||
SheetBuilder.Initialize(renderer);
|
SheetBuilder.Initialize(renderer);
|
||||||
FileSystem.UnmountTemporaryPackages();
|
|
||||||
Timer.Time( "reset: {0}" );
|
LoadModPackages(manifest);
|
||||||
|
|
||||||
foreach (var pkg in manifest.Packages)
|
|
||||||
FileSystem.MountTemporary(new Package(pkg));
|
|
||||||
Timer.Time( "mount tempory packages: {0}" );
|
|
||||||
|
|
||||||
Rules.LoadRules(mapName, manifest);
|
Rules.LoadRules(mapName, manifest);
|
||||||
Timer.Time( "load rules: {0}" );
|
Timer.Time( "load rules: {0}" );
|
||||||
|
|
||||||
@@ -82,6 +90,7 @@ namespace OpenRa
|
|||||||
Timer.Time( "chrome: {0}" );
|
Timer.Time( "chrome: {0}" );
|
||||||
|
|
||||||
Timer.Time( "----end ChangeMap" );
|
Timer.Time( "----end ChangeMap" );
|
||||||
|
chat.AddLine(Color.White, "Debug", "Map change {0} -> {1}".F(Game.mapName, mapName));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Initialize(string mapName, Renderer renderer, int2 clientSize, int localPlayer, Controller controller)
|
internal static void Initialize(string mapName, Renderer renderer, int2 clientSize, int localPlayer, Controller controller)
|
||||||
|
|||||||
@@ -49,12 +49,13 @@ namespace OpenRa
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadUserSettings(settings);
|
LoadUserSettings(settings);
|
||||||
|
|
||||||
|
// Load the default mod to access required files
|
||||||
|
Game.LoadModPackages(new Manifest(Game.LobbyInfo.GlobalSettings.Mods));
|
||||||
|
|
||||||
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
UiOverlay.ShowUnitDebug = Game.Settings.UnitDebug;
|
||||||
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
WorldRenderer.ShowUnitPaths = Game.Settings.PathDebug;
|
||||||
Renderer.SheetSize = Game.Settings.SheetSize;
|
Renderer.SheetSize = Game.Settings.SheetSize;
|
||||||
|
|
||||||
FileSystem.MountDefaultPackages();
|
|
||||||
|
|
||||||
bool windowed = !Game.Settings.Fullscreen;
|
bool windowed = !Game.Settings.Fullscreen;
|
||||||
renderer = new Renderer(this, GetResolution(settings), windowed);
|
renderer = new Renderer(this, GetResolution(settings), windowed);
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
# Classic Red Alert Mod -- Package Manifest
|
# Classic Red Alert Mod -- Package Manifest
|
||||||
|
|
||||||
|
Folders:
|
||||||
|
./
|
||||||
|
|
||||||
Packages:
|
Packages:
|
||||||
|
main.mix
|
||||||
|
redalert.mix
|
||||||
|
conquer.mix
|
||||||
|
hires.mix
|
||||||
|
general.mix
|
||||||
|
local.mix
|
||||||
|
sounds.mix
|
||||||
|
speech.mix
|
||||||
|
allies.mix
|
||||||
|
russian.mix
|
||||||
|
temperat.mix
|
||||||
|
snow.mix
|
||||||
|
interior.mix
|
||||||
|
|
||||||
LegacyRules:
|
LegacyRules:
|
||||||
mods/ra/rules.ini: More or less original Red Alert rules file.
|
mods/ra/rules.ini: More or less original Red Alert rules file.
|
||||||
|
|||||||
Reference in New Issue
Block a user