Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
        private void refreshChunksToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (LoadedRSDKver)
            {
            case 0:
                using (Stream strm = File.OpenRead(mappings))
                {
                    _RSDK4Chunks = new RSDKv4.Tiles128x128(strm);
                }
                _loadedTiles = Bitmap.FromFile(tiles);
                _blocksViewer._RSDK4Chunks  = _RSDK4Chunks;
                _blocksViewer._tiles        = _loadedTiles;
                _blocksViewer.loadedRSDKver = LoadedRSDKver;
                _blocksViewer.SetChunks();

                _mapViewer._tiles           = _loadedTiles;
                _mapViewer._RSDK4Background = _RSDK4Background;
                _mapViewer._RSDK4Chunks     = _RSDK4Chunks;
                _mapViewer.loadedRSDKver    = LoadedRSDKver;
                _mapViewer.SetLevel();
                break;

            case 1:
                using (Stream strm = File.OpenRead(mappings))
                {
                    _RSDK3Chunks = new RSDKv3.Tiles128x128(strm);
                }
                _loadedTiles = Bitmap.FromFile(tiles);
                _blocksViewer._RSDK3Chunks  = _RSDK3Chunks;
                _blocksViewer._tiles        = _loadedTiles;
                _blocksViewer.loadedRSDKver = LoadedRSDKver;
                _blocksViewer.SetChunks();

                _mapViewer._tiles           = _loadedTiles;
                _mapViewer._RSDK3Background = _RSDK3Background;
                _mapViewer._RSDK3Chunks     = _RSDK3Chunks;
                _mapViewer.loadedRSDKver    = LoadedRSDKver;
                _mapViewer.SetLevel();
                break;

            case 2:
                using (Stream strm = File.OpenRead(mappings))
                {
                    _RSDK2Chunks = new RSDKv2.Tiles128x128(strm);
                }
                _loadedTiles = Bitmap.FromFile(tiles);
                _blocksViewer._RSDK2Chunks  = _RSDK2Chunks;
                _blocksViewer._tiles        = _loadedTiles;
                _blocksViewer.loadedRSDKver = LoadedRSDKver;
                _blocksViewer.SetChunks();

                _mapViewer._tiles           = _loadedTiles;
                _mapViewer._RSDK2Background = _RSDK2Background;
                _mapViewer._RSDK2Chunks     = _RSDK2Chunks;
                _mapViewer.loadedRSDKver    = LoadedRSDKver;
                _mapViewer.SetLevel();
                break;

            case 3:
                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._RSDK1Chunks  = _RSDK1Chunks;
                _blocksViewer.SetChunks();

                _mapViewer._tiles           = _loadedTiles;
                _mapViewer._RSDK1Background = _RSDK1Background;
                _mapViewer._RSDK1Chunks     = _RSDK1Chunks;
                _mapViewer.loadedRSDKver    = LoadedRSDKver;
                _mapViewer.SetLevel();
                break;

            default:
                break;
            }
        }
Beispiel #3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.DefaultExt = ".bin";
            dlg.Filter     = "RSDKvB (Sonic 1 & 2 Remakes) Chunk Mappings|128x128Tiles.bin|RSDKv2 (Sonic CD) Chunk Mappings|128x128Tiles.bin|RSDKv1 (Sonic Nexus) Chunk Mappings|128x128Tiles.bin|Retro-Sonic Chunk Mappings|Zone.til";
            if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                curChunk = 0;
                filename = dlg.FileName;
                switch (dlg.FilterIndex - 1) //What RSDK version was loaded?
                {
                case 0:
                    Chunksv1       = null;
                    Chunksv2       = null;
                    Chunksv3       = null;
                    Chunksv4       = new RSDKv4.Tiles128x128(dlg.FileName);
                    Tiles          = new Bitmap(dlg.FileName.Replace("128x128Tiles.bin", "16x16Tiles.gif")); //A Zone's Tileset should be in the same folder as its chunk mappings
                    LoadedChunkVer = (int)RSDKver.RSDK4;
                    LoadTileSet(Tiles);
                    GotoNUD.Maximum = 512;
                    RedrawChunk();
                    break;

                case 1:
                    Chunksv1       = null;
                    Chunksv2       = null;
                    Chunksv3       = new RSDKv3.Tiles128x128(dlg.FileName);
                    Tiles          = new Bitmap(dlg.FileName.Replace("128x128Tiles.bin", "16x16Tiles.gif")); //A Zone's Tileset should be in the same folder as its chunk mappings
                    Chunksv4       = null;
                    LoadedChunkVer = (int)RSDKver.RSDK3;
                    LoadTileSet(Tiles);
                    GotoNUD.Maximum = 512;
                    RedrawChunk();
                    break;

                case 2:
                    Chunksv1       = null;
                    Chunksv2       = new RSDKv2.Tiles128x128(dlg.FileName);
                    Tiles          = new Bitmap(dlg.FileName.Replace("128x128Tiles.bin", "16x16Tiles.gif")); //A Zone's Tileset should be in the same folder as its chunk mappings
                    Chunksv3       = null;
                    Chunksv4       = null;
                    LoadedChunkVer = (int)RSDKver.RSDK2;
                    LoadTileSet(Tiles);
                    GotoNUD.Maximum = 512;
                    RedrawChunk();
                    break;

                default:
                    Chunksv1       = new RSDKv1.til(dlg.FileName);
                    Chunksv2       = null;
                    Chunksv3       = null;
                    Chunksv4       = null;
                    LoadedChunkVer = (int)RSDKver.RSDK1;
                    RSDKv1.gfx gfx = new RSDKv1.gfx(dlg.FileName.Replace("Zone.til", "Zone.gfx"), false);     //A Zone's Tileset should be in the same folder as its chunk mappings
                    Tiles = new Bitmap(gfx.gfxImage);
                    LoadTileSet(Tiles);
                    GotoNUD.Maximum = 256;     // Retro Sonic Only Supports 256 Chunks per File :(
                    RedrawChunk();
                    break;
                }
            }
        }