private void pValuesList_DoubleClick(object sender, EventArgs e) { RSN_LineScrollForm frm1 = new RSN_LineScrollForm(loadedRSDKver, pValuesList.SelectedIndex); CD12_LineScrollForm frm2 = new CD12_LineScrollForm(loadedRSDKver, pValuesList.SelectedIndex); switch (loadedRSDKver) { case 3: frm1.Mapv1 = _RSDK1Background; break; case 2: frm1.Mapv2 = _RSDK2Background; break; case 1: frm2.Mapv3 = _RSDK3Background; break; case 0: frm2.Mapv4 = _RSDK4Background; break; } if (loadedRSDKver <= 1) { frm2.Setup(); if (frm2.ShowDialog(this) == DialogResult.OK) { switch (loadedRSDKver) { case 1: _RSDK3Background = frm2.Mapv3; break; case 0: _RSDK4Background = frm2.Mapv4; break; } RefreshParallaxList(); } } if (loadedRSDKver >= 2) { frm1.Setup(); if (frm1.ShowDialog(this) == DialogResult.OK) { switch (loadedRSDKver) { case 3: _RSDK1Background = frm1.Mapv1; break; case 2: _RSDK2Background = frm1.Mapv2; break; } RefreshParallaxList(); } } }
private void mapPropertiesToolStripMenuItem_Click(object sender, EventArgs e) { RSN_LayerPropertiesForm frm1 = new RSN_LayerPropertiesForm(LoadedRSDKver); CD12_LayerPropertiesForm frm2 = new CD12_LayerPropertiesForm(LoadedRSDKver); frm1.CurLayer = _mapViewer.curlayer; frm2.CurLayer = _mapViewer.curlayer; ushort[][] OldTiles = new ushort[0][]; ushort[][] NewTiles = new ushort[0][]; int OLDwidth = 0; int OLDheight = 0; Console.WriteLine(_mapViewer.curlayer); switch (LoadedRSDKver) { case 3: OldTiles = _RSDK1Background.Layers[curlayer].MapLayout; OLDwidth = _RSDK1Background.Layers[curlayer].width; OLDheight = _RSDK1Background.Layers[curlayer].height; frm1.Mapv1 = _RSDK1Background; frm1.Setup(); break; case 2: OldTiles = _RSDK2Background.Layers[curlayer].MapLayout; OLDwidth = _RSDK2Background.Layers[curlayer].width; OLDheight = _RSDK2Background.Layers[curlayer].height; frm1.Mapv2 = _RSDK2Background; frm1.Setup(); break; case 1: OldTiles = _RSDK3Background.Layers[curlayer].MapLayout; OLDwidth = _RSDK3Background.Layers[curlayer].width; OLDheight = _RSDK3Background.Layers[curlayer].height; frm2.Mapv3 = _RSDK3Background; frm2.Setup(); break; case 0: OldTiles = _RSDK4Background.Layers[curlayer].MapLayout; OLDwidth = _RSDK4Background.Layers[curlayer].width; OLDheight = _RSDK4Background.Layers[curlayer].height; frm2.Mapv4 = _RSDK4Background; frm2.Setup(); break; default: break; } switch (LoadedRSDKver) { case 3: if (frm1.ShowDialog(this) == DialogResult.OK) { _RSDK1Background = frm1.Mapv1; NewTiles = _RSDK1Background.Layers[curlayer].MapLayout; CheckDimensions(LoadedRSDKver, OldTiles, NewTiles, OLDwidth, OLDheight); _mapViewer.DrawLevel(); } break; case 2: if (frm1.ShowDialog(this) == DialogResult.OK) { _RSDK2Background = frm1.Mapv2; NewTiles = _RSDK2Background.Layers[curlayer].MapLayout; CheckDimensions(LoadedRSDKver, OldTiles, NewTiles, OLDwidth, OLDheight); _mapViewer.DrawLevel(); } break; case 1: if (frm2.ShowDialog(this) == DialogResult.OK) { _RSDK3Background = frm2.Mapv3; NewTiles = _RSDK3Background.Layers[curlayer].MapLayout; CheckDimensions(LoadedRSDKver, OldTiles, NewTiles, OLDwidth, OLDheight); _mapViewer.DrawLevel(); } break; case 0: if (frm2.ShowDialog(this) == DialogResult.OK) { _RSDK4Background = frm2.Mapv4; NewTiles = _RSDK4Background.Layers[curlayer].MapLayout; CheckDimensions(LoadedRSDKver, OldTiles, NewTiles, OLDwidth, OLDheight); _mapViewer.DrawLevel(); } break; } }
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; } }