Skip to content

Commit

Permalink
Adding customizable default compression for object art.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed Sep 10, 2015
1 parent 6e1ccd6 commit 8ddef67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions SonLVLAPI/GameInfo.cs
Expand Up @@ -16,6 +16,9 @@ public class GameInfo
[IniName("objlst")]
[IniCollection(IniCollectionMode.SingleLine, Format = "|")]
public string[] ObjectList { get; set; }
[IniName("objartcmp")]
[DefaultValue(CompressionType.Nemesis)]
public CompressionType ObjectArtCompression { get; set; }
[IniName("mapver")]
public EngineVersion MappingsVersion { get; set; }
[IniName("dplcver")]
Expand Down
5 changes: 2 additions & 3 deletions SonLVLAPI/ObjectDefinition.cs
Expand Up @@ -22,7 +22,6 @@ public class ObjectData
[IniCollection(IniCollectionMode.SingleLine, Format = "|")]
public FileInfo[] Art;
[IniName("artcmp")]
[DefaultValue(CompressionType.Nemesis)]
public CompressionType ArtCompression;
[IniName("map")]
public string MapFile;
Expand Down Expand Up @@ -485,7 +484,7 @@ public override void Init(ObjectData data)
{
MultiFileIndexer<byte> art = new MultiFileIndexer<byte>();
foreach (FileInfo file in data.Art)
art.AddFile(new List<byte>(ObjectHelper.OpenArtFile(file.Filename, data.ArtCompression)), file.Offset);
art.AddFile(new List<byte>(ObjectHelper.OpenArtFile(file.Filename, data.ArtCompression == CompressionType.Invalid ? LevelData.Game.ObjectArtCompression : data.ArtCompression)), file.Offset);
byte[] artfile = art.ToArray();
if (data.MapFile != null)
{
Expand Down Expand Up @@ -726,7 +725,7 @@ public override void Init(ObjectData data)
MultiFileIndexer<byte> art = new MultiFileIndexer<byte>();
foreach (XMLDef.ArtFile artfile in mapimg.ArtFiles)
art.AddFile(new List<byte>(ObjectHelper.OpenArtFile(artfile.filename,
artfile.compression == CompressionType.Invalid ? CompressionType.Nemesis : artfile.compression)),
artfile.compression == CompressionType.Invalid ? LevelData.Game.ObjectArtCompression : artfile.compression)),
artfile.offsetSpecified ? artfile.offset : -1);
XMLDef.MapFile map = mapimg.MapFile;
switch (map.type)
Expand Down

0 comments on commit 8ddef67

Please sign in to comment.