void LoadLevel(string level, int RSDKver) { //Clears the map _mapViewer.DrawLevel(); switch (RSDKver) { case 0: using (Stream strm = File.OpenRead(level)) { _RSDK4Background = new RSDKv4.BGLayout(strm); } using (Stream strm = File.OpenRead(mappings)) { _RSDK4Chunks = new RSDKv4.Tiles128x128(strm); } _loadedTiles = Bitmap.FromFile(tiles); _blocksViewer._RSDK4Chunks = _RSDK4Chunks; _blocksViewer._tiles = _loadedTiles; _blocksViewer._RSDK4Background = _RSDK4Background; _blocksViewer.loadedRSDKver = RSDKver; _blocksViewer.SetChunks(); _blocksViewer.RefreshParallaxList(); _mapViewer._tiles = _loadedTiles; _mapViewer._RSDK4Chunks = _RSDK4Chunks; _mapViewer._RSDK4Background = _RSDK4Background; _mapViewer.loadedRSDKver = RSDKver; _mapViewer.SetLevel(); _mapViewer.DrawLevel(); selectedLayerToolStripMenuItem.DropDownItems.Clear(); for (int i = 0; i < _RSDK4Background.Layers.Count; i++) { selectedLayerToolStripMenuItem.DropDownItems.Add("Background Layer " + i.ToString()); } break; case 1: using (Stream strm = File.OpenRead(level)) { _RSDK3Background = new RSDKv3.BGLayout(strm); } using (Stream strm = File.OpenRead(mappings)) { _RSDK3Chunks = new RSDKv3.Tiles128x128(strm); } _loadedTiles = Bitmap.FromFile(tiles); _blocksViewer._RSDK3Chunks = _RSDK3Chunks; _blocksViewer._tiles = _loadedTiles; _blocksViewer._RSDK3Background = _RSDK3Background; _blocksViewer.loadedRSDKver = RSDKver; _blocksViewer.SetChunks(); _blocksViewer.RefreshParallaxList(); _mapViewer._tiles = _loadedTiles; _mapViewer._RSDK3Chunks = _RSDK3Chunks; _mapViewer._RSDK3Background = _RSDK3Background; _mapViewer.loadedRSDKver = RSDKver; _mapViewer.SetLevel(); _mapViewer.DrawLevel(); selectedLayerToolStripMenuItem.DropDownItems.Clear(); for (int i = 0; i < _RSDK3Background.Layers.Count; i++) { selectedLayerToolStripMenuItem.DropDownItems.Add("Background Layer " + i.ToString()); } break; case 2: using (Stream strm = File.OpenRead(level)) { _RSDK2Background = new RSDKv2.BGLayout(strm); } using (Stream strm = File.OpenRead(mappings)) { _RSDK2Chunks = new RSDKv2.Tiles128x128(strm); } _loadedTiles = Bitmap.FromFile(tiles); _blocksViewer._RSDK2Chunks = _RSDK2Chunks; _blocksViewer._tiles = _loadedTiles; _blocksViewer._RSDK2Background = _RSDK2Background; _blocksViewer.loadedRSDKver = RSDKver; _blocksViewer.SetChunks(); _blocksViewer.RefreshParallaxList(); _mapViewer._tiles = _loadedTiles; _mapViewer._RSDK2Chunks = _RSDK2Chunks; _mapViewer._RSDK2Background = _RSDK2Background; _mapViewer.loadedRSDKver = RSDKver; _mapViewer.SetLevel(); _mapViewer.DrawLevel(); selectedLayerToolStripMenuItem.DropDownItems.Clear(); for (int i = 0; i < _RSDK2Background.Layers.Count; i++) { selectedLayerToolStripMenuItem.DropDownItems.Add("Background Layer " + i.ToString()); } break; case 3: using (Stream strm = File.OpenRead(level)) { _RSDK1Background = new RSDKv1.BGLayout(strm); } using (Stream strm = File.OpenRead(mappings)) { _RSDK1Chunks = new RSDKv1.til(strm); } RSDKv1.gfx gfx = new RSDKv1.gfx(tiles, false); _loadedTiles = gfx.gfxImage; _blocksViewer.loadedRSDKver = LoadedRSDKver; _blocksViewer._tiles = gfx.gfxImage; _blocksViewer._RSDK1Background = _RSDK1Background; _blocksViewer._RSDK1Chunks = _RSDK1Chunks; _blocksViewer.SetChunks(); _blocksViewer.RefreshParallaxList(); _mapViewer.loadedRSDKver = LoadedRSDKver; _mapViewer._tiles = gfx.gfxImage; _mapViewer._RSDK1Background = _RSDK1Background; _mapViewer._RSDK1Chunks = _RSDK1Chunks; _mapViewer.SetLevel(); _mapViewer.DrawLevel(); selectedLayerToolStripMenuItem.DropDownItems.Clear(); for (int i = 0; i < _RSDK1Background.Layers.Count; i++) { selectedLayerToolStripMenuItem.DropDownItems.Add("Background Layer " + i.ToString()); } break; default: break; } }
void LoadLevel(string level) { background.ImportFrom(engineType, level); Chunks.ImportFrom(engineType, mappings); if (engineType != Retro_Formats.EngineType.RSDKvRS) { using (var fs = new FileStream(tiles, FileMode.Open)) { var bmp = new Bitmap(fs); _loadedTiles = (Bitmap)bmp.Clone(); } } else { RSDKvRS.gfx gfx = new RSDKvRS.gfx(tiles); _loadedTiles = gfx.gfxImage; } _blocksViewer._tiles = _loadedTiles; _blocksViewer.SetChunks(); _mapViewer._tiles = _loadedTiles; _mapViewer.SetLevel(); _mapViewer.DrawLevel(); }