Skip to content

Commit

Permalink
Allowing compressed HScroll array in Generic DLL.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed May 18, 2015
1 parent 730dd2f commit 88e1576
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Generic/Generic.cs
Expand Up @@ -16,12 +16,20 @@ public class Generic : SonicBGScrollSaver.Level
Bitmap bgimg = new Bitmap(1, 1);
int Width, Height;
LevelInfo levelinfo;
double[] hscrollspeeds;

public override void Init(int width, int height)
{
Width = width;
Height = height;
levelinfo = IniSerializer.Deserialize<LevelInfo>("setup.ini");
hscrollspeeds = new double[levelinfo.HScrollSpeeds.Count];
double lastval = 0;
for (int i = 0; i < levelinfo.HScrollSpeeds.Count; i++)
if (levelinfo.HScrollSpeeds[i].HasValue)
lastval = hscrollspeeds[i] = levelinfo.HScrollSpeeds[i].Value;
else
hscrollspeeds[i] = lastval;
if (string.IsNullOrEmpty(levelinfo.Image))
{
LevelData.LoadGame("./setup.ini");
Expand Down Expand Up @@ -78,6 +86,6 @@ internal class LevelInfo
public string Image { get; set; }
[IniName("hscroll")]
[IniCollection(IniCollectionMode.NoSquareBrackets)]
public List<double> HScrollSpeeds { get; set; }
public List<double?> HScrollSpeeds { get; set; }
}
}

0 comments on commit 88e1576

Please sign in to comment.