private TileConfig(Reader reader, bool unc) { if (!reader.ReadBytes(4).SequenceEqual(MAGIC)) { throw new Exception("Invalid tiles config file header magic"); } if (!unc) { using (Reader creader = reader.GetCompressedStream()) { for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath1[i] = new CollisionMask(creader); } for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath2[i] = new CollisionMask(creader); } } } else { for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath1[i] = new CollisionMask(reader); } for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath2[i] = new CollisionMask(reader); } } reader.Close(); }
private TilesConfig(Reader reader, bool compressed) { if (reader.ReadBytes(4).SequenceEqual(MAGIC)) { compressed = true; } else { reader.Seek(-4, SeekOrigin.Current); } if (compressed) { using (Reader creader = reader.GetCompressedStream()) { for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath1[i] = new TileConfig(creader); } for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath2[i] = new TileConfig(creader); } } } else { for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath1[i] = new TileConfig(reader); } for (int i = 0; i < TILES_COUNT; ++i) { CollisionPath2[i] = new TileConfig(reader); } } reader.Close(); }
internal SceneLayer(Reader reader) { IgnoredByte = reader.ReadByte(); Name = reader.ReadRSDKString(); UnknownByte1 = reader.ReadByte(); UnknownByte2 = reader.ReadByte(); Width = reader.ReadUInt16(); Height = reader.ReadUInt16(); UnknownWord1 = reader.ReadUInt16(); UnknownWord2 = reader.ReadUInt16(); ushort scrolling_info_count = reader.ReadUInt16(); for (int i = 0; i < scrolling_info_count; ++i) { ScrollingInfo.Add(new ScrollInfo(reader)); } ScrollIndexes = reader.ReadCompressed(); Tiles = new ushort[Height][]; using (Reader creader = reader.GetCompressedStream()) { for (int i = 0; i < Height; ++i) { Tiles[i] = new ushort[Width]; for (int j = 0; j < Width; ++j) { Tiles[i][j] = creader.ReadUInt16(); } } } }