messy first pass at fixing map change palette weirdness, etc
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRa.FileFormats
|
||||
{
|
||||
public static class FileSystem
|
||||
{
|
||||
static List<IFolder> mountedFolders = new List<IFolder>();
|
||||
static List<IFolder> temporaryMounts = new List<IFolder>();
|
||||
|
||||
public static void MountDefault( bool useAftermath )
|
||||
{
|
||||
@@ -33,6 +35,18 @@ namespace OpenRa.FileFormats
|
||||
mountedFolders.Add(folder);
|
||||
}
|
||||
|
||||
public static void MountTemporary(IFolder folder)
|
||||
{
|
||||
mountedFolders.Add(folder);
|
||||
temporaryMounts.Add(folder);
|
||||
}
|
||||
|
||||
public static void UnmountTemporaryPackages()
|
||||
{
|
||||
mountedFolders.RemoveAll(f => temporaryMounts.Contains(f));
|
||||
temporaryMounts.Clear();
|
||||
}
|
||||
|
||||
public static Stream Open(string filename)
|
||||
{
|
||||
foreach( IFolder folder in mountedFolders )
|
||||
|
||||
@@ -56,7 +56,9 @@ namespace OpenRa.Game
|
||||
public static void ChangeMap(string mapName)
|
||||
{
|
||||
SheetBuilder.Initialize(renderer);
|
||||
|
||||
SpriteSheetBuilder.Initialize();
|
||||
UnitSheetBuilder.Initialize();
|
||||
FileSystem.UnmountTemporaryPackages();
|
||||
Rules.LoadRules(mapName, usingAftermath);
|
||||
palette = new HardwarePalette(renderer, Rules.Map);
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace OpenRa.Game
|
||||
|
||||
TechTree = new TechTree();
|
||||
Map = new Map( AllRules );
|
||||
FileSystem.Mount( new Package( Rules.Map.Theater + ".mix" ) );
|
||||
FileSystem.MountTemporary( new Package( Rules.Map.Theater + ".mix" ) );
|
||||
TileSet = new TileSet( Map.TileSuffix );
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,12 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class SpriteSheetBuilder
|
||||
{
|
||||
static Dictionary<string, Sprite[]> sprites =
|
||||
new Dictionary<string, Sprite[]>();
|
||||
public static void Initialize()
|
||||
{
|
||||
sprites = new Dictionary<string, Sprite[]>();
|
||||
}
|
||||
|
||||
static Dictionary<string, Sprite[]> sprites;
|
||||
|
||||
public static Sprite LoadSprite(string filename, params string[] exts )
|
||||
{
|
||||
|
||||
@@ -6,8 +6,14 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
static class UnitSheetBuilder
|
||||
{
|
||||
public static readonly List<Sprite> sprites = new List<Sprite>();
|
||||
static Dictionary<string, Range<int>> sequences = new Dictionary<string, Range<int>>();
|
||||
public static void Initialize()
|
||||
{
|
||||
sprites = new List<Sprite>();
|
||||
sequences = new Dictionary<string, Range<int>>();
|
||||
}
|
||||
|
||||
public static List<Sprite> sprites;
|
||||
static Dictionary<string, Range<int>> sequences;
|
||||
|
||||
public static Range<int> GetUnit(string name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user