diff --git a/Sledge.DataStructures/GameData/Palette.cs b/Sledge.DataStructures/GameData/Palette.cs new file mode 100644 index 000000000..2eed3798e --- /dev/null +++ b/Sledge.DataStructures/GameData/Palette.cs @@ -0,0 +1,12 @@ +namespace Sledge.DataStructures.GameData +{ + public class Palette + { + public byte[] ByteArray { get; private set; } + + public Palette(byte[] pal) + { + ByteArray = pal; + } + } +} diff --git a/Sledge.DataStructures/Sledge.DataStructures.csproj b/Sledge.DataStructures/Sledge.DataStructures.csproj index 47e19582e..7ee826f3f 100644 --- a/Sledge.DataStructures/Sledge.DataStructures.csproj +++ b/Sledge.DataStructures/Sledge.DataStructures.csproj @@ -47,6 +47,7 @@ + diff --git a/Sledge.Editor/Documents/Document.cs b/Sledge.Editor/Documents/Document.cs index b9a70e5e6..3ca9ed192 100644 --- a/Sledge.Editor/Documents/Document.cs +++ b/Sledge.Editor/Documents/Document.cs @@ -44,6 +44,7 @@ public class Document public Game Game { get; set; } public GameEnvironment Environment { get; private set; } public GameData GameData { get; set; } + public Palette Palette { get; set; } public Pointfile Pointfile { get; set; } @@ -107,7 +108,25 @@ public Document(string mapFile, Map map, Game game) GameData.MapSizeHigh = game.OverrideMapSizeHigh; } - TextureCollection = TextureProvider.CreateCollection(Environment.GetGameDirectories(), Game.AdditionalPackages, Game.GetTextureBlacklist(), Game.GetTextureWhitelist()); + // Set up Quake 1/Hexen 2 palette + var palpath = Environment.Root.TraversePath("gfx/palette.lmp"); + var paldata = new byte[768]; + if (palpath != null) + { + try + { + using (var br = new BinaryReader(palpath.Open())) + { + paldata = br.ReadBytes(768); + } + } + catch (Exception) + { + } + } + Palette = new Palette(paldata); + + TextureCollection = TextureProvider.CreateCollection(Environment.GetGameDirectories(), Game.AdditionalPackages, Game.GetTextureBlacklist(), Game.GetTextureWhitelist(), Palette); /* .Union(GameData.MaterialExclusions) */ // todo material exclusions var texList = Map.GetAllTextures(); diff --git a/Sledge.Editor/Extensions/ModelExtensions.cs b/Sledge.Editor/Extensions/ModelExtensions.cs index 3ff087974..bdd2a9200 100644 --- a/Sledge.Editor/Extensions/ModelExtensions.cs +++ b/Sledge.Editor/Extensions/ModelExtensions.cs @@ -83,7 +83,7 @@ private static bool UpdateModels(Document document, MapObject mo, Dictionary - + + + {26a974c9-e495-4fa3-8e87-1e00019d04f5} + Sledge.DataStructures + +