Skip to content

Commit

Permalink
Store level index
Browse files Browse the repository at this point in the history
  • Loading branch information
tvasenin committed Dec 17, 2017
1 parent 6990f79 commit 1d7ebd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Pre2/AssetConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static class AssetConverter
private static readonly byte[][] LevelTilemaps = new byte[LevelSuffixes.Length][];
private static readonly ushort[][] LevelLuts = new ushort[LevelSuffixes.Length][];
private static readonly byte[][][] LevelLocalTiles = new byte[LevelSuffixes.Length][][];
private static readonly byte[][] LevelDescriptors = new byte[LevelSuffixes.Length][];
public static readonly byte[][] LevelDescriptors = new byte[LevelSuffixes.Length][];

private static readonly byte[][] FrontTiles = ReadTiles(UnpackSqz("FRONT"), NumFrontTiles, DefaultTileInfo);
private static readonly byte[][] UnionTiles = ReadTiles(UnpackSqz("UNION"), NumUnionTiles, DefaultTileInfo);
Expand Down
7 changes: 6 additions & 1 deletion Pre2/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public Kong(BinaryReader br)

public class Level
{
public int LevelIdx;
private byte[] tileProps1;
private byte[] tileProps2;
private byte[] tileProps3;
Expand All @@ -158,8 +159,12 @@ public class Level
private readonly Platform[] platforms = new Platform[16];
private Kong kong;

public Level(byte[] data)
public Level(int levelIdx) : this(levelIdx, AssetConverter.LevelDescriptors[levelIdx])
{ }

private Level(int levelIdx, byte[] data)
{
LevelIdx = levelIdx;
using (BinaryReader br = new BinaryReader(new MemoryStream(data, false)))
{
tileProps1 = br.ReadBytes(256);
Expand Down

0 comments on commit 1d7ebd5

Please sign in to comment.