Exemplo n.º 1
0
 public ObjectsEditionMode(NSMBLevel Level, LevelEditorControl EdControl)
     : base(Level, EdControl)
 {
     tabs = new GoodTabsPanel(EdControl);
     SetPanel(tabs);
     tabs.Dock = DockStyle.Fill;
 }
Exemplo n.º 2
0
 public void loadMinimap(NSMBLevel Level, LevelEditorControl EdControl)
 {
     this.Level = Level;
     this.EdControl = EdControl;
     UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, 255, 255, 255));
     loaded = true;
 }
Exemplo n.º 3
0
 public void loadMinimap(NSMBLevel Level, LevelEditorControl EdControl)
 {
     this.Level            = Level;
     this.EdControl        = EdControl;
     UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, 255, 255, 255));
     loaded = true;
 }
Exemplo n.º 4
0
 public ObjectsEditionMode(NSMBLevel Level, LevelEditorControl EdControl)
     : base(Level, EdControl)
 {
     tabs = new GoodTabsPanel(EdControl);
     SetPanel(tabs);
     tabs.Dock = DockStyle.Fill;
     resizeHandles = Properties.Settings.Default.ShowResizeHandles;
 }
Exemplo n.º 5
0
 public ObjectsEditionMode(NSMBLevel Level, LevelEditorControl EdControl)
     : base(Level, EdControl)
 {
     tabs = new GoodTabsPanel(EdControl);
     SetPanel(tabs);
     tabs.Dock     = DockStyle.Fill;
     resizeHandles = Properties.Settings.Default.ShowResizeHandles;
 }
Exemplo n.º 6
0
        public LevelEditor(NSMBLevel Level)
        {
            InitializeComponent();

            this.Level = Level;
            this.GFX = Level.GFX;
            coordinateViewer1.EdControl = levelEditorControl1;
            //This is supposed to reduce flickering on stuff like the side panel...
            //But it doesn't :(
            this.SetStyle(
              ControlStyles.AllPaintingInWmPaint|
              ControlStyles.UserPaint |
              ControlStyles.DoubleBuffer, true); 
            
            if (Properties.Settings.Default.mdi)
                this.MdiParent = MdiParentForm.instance;
            if (Properties.Settings.Default.LevelMaximized)
                this.WindowState = FormWindowState.Maximized;

            smallBlockOverlaysToolStripMenuItem.Checked = Properties.Settings.Default.SmallBlockOverlays;
            showResizeHandles.Checked = Properties.Settings.Default.ShowResizeHandles;

            LanguageManager.ApplyToContainer(this, "LevelEditor");
            this.Text = LanguageManager.Get("General", "EditingSomething") + " " + Level.name;
            // these need to be added manually
            reloadTilesets.Text = LanguageManager.Get("LevelEditor", "reloadTilesets");
            smallBlockOverlaysToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "smallBlockOverlaysToolStripMenuItem");
            showResizeHandles.Text = LanguageManager.Get("LevelEditor", "showResizeHandles");
            setBgImageButton.Text = LanguageManager.Get("LevelEditor", "setBgImageButton");
            removeBgButton.Text = LanguageManager.Get("LevelEditor", "removeBgButton");
            moveBGToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "moveBGToolStripMenuItem");
            openImage.Filter = LanguageManager.Get("Filters", "image");

            levelEditorControl1.LoadUndoManager(undoButton, redoButton);

            Level.enableWrite();
            levelEditorControl1.Initialise(GFX, Level, this);

            oem = new ObjectsEditionMode(Level, levelEditorControl1);
            bgdragem = new BackgroundDragEditionMode(Level, levelEditorControl1);

            levelEditorControl1.SetEditionMode(oem);
            levelEditorControl1.minimapctrl = minimapControl1;

            tools = new ToolsForm(levelEditorControl1);
            sprEvents = new SpriteEventsViewer(levelEditorControl1);
            MinimapForm = new LevelMinimap(Level, levelEditorControl1);
            levelEditorControl1.minimap = MinimapForm;
            MinimapForm.Text = string.Format(LanguageManager.Get("LevelEditor", "MinimapTitle"), Level.name);
            minimapControl1.loadMinimap(Level, levelEditorControl1);
            this.Icon = Properties.Resources.nsmbe;

            if (Properties.Settings.Default.AutoBackup > 0)
            {
                backupTimer.Interval = Properties.Settings.Default.AutoBackup * 60000;
                backupTimer.Start();
            }
        }
Exemplo n.º 7
0
 public LevelMinimap(NSMBLevel Level, LevelEditorControl EdControl)
 {
     InitializeComponent();
     if (Properties.Settings.Default.mdi)
         this.MdiParent = MdiParentForm.instance;
     this.Level = Level;
     this.EdControl = EdControl;
     UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, Color.DarkSlateGray.R, Color.DarkSlateGray.G, Color.DarkSlateGray.B));
 }
Exemplo n.º 8
0
        public NSMBSprite(NSMBSprite s)
        {
            this.X = s.X;
            this.Y = s.Y;
            this.Type = s.Type;
            this.Level = s.Level;

            this.Data = new byte[6];
            Array.Copy(s.Data, Data, 6);
        }
Exemplo n.º 9
0
 public LevelMinimap(NSMBLevel Level, LevelEditorControl EdControl)
 {
     InitializeComponent();
     if (Properties.Settings.Default.mdi)
     {
         this.MdiParent = MdiParentForm.instance;
     }
     this.Level            = Level;
     this.EdControl        = EdControl;
     UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, Color.DarkSlateGray.R, Color.DarkSlateGray.G, Color.DarkSlateGray.B));
 }
Exemplo n.º 10
0
        public void Initialise(NSMBGraphics GFX, NSMBLevel Level, LevelEditor editor) {
            this.GFX = GFX;
            this.Level = Level;
            this.editor = editor;
            Ready = true;
            hScrollBar.Visible = true;
            vScrollBar.Visible = true;
            ViewablePixels = new Rectangle();
            ViewableBlocks = new Rectangle();
            UpdateScrollbars();
            remakeTileCache();
            DrawingArea.Invalidate();

        }
Exemplo n.º 11
0
 public void Initialise(NSMBGraphics GFX, NSMBLevel Level, LevelEditor editor)
 {
     this.GFX           = GFX;
     this.Level         = Level;
     this.editor        = editor;
     Ready              = true;
     hScrollBar.Visible = true;
     vScrollBar.Visible = true;
     ViewablePixels     = new Rectangle();
     ViewableBlocks     = new Rectangle();
     UpdateScrollbars();
     remakeTileCache();
     DrawingArea.Invalidate();
 }
Exemplo n.º 12
0
        public static NSMBView FromString(string[] strs, ref int idx, NSMBLevel lvl)
        {
            NSMBView v = new NSMBView();

            v.X      = int.Parse(strs[1 + idx]);
            v.Y      = int.Parse(strs[2 + idx]);
            v.Width  = int.Parse(strs[3 + idx]);
            v.Height = int.Parse(strs[4 + idx]);
            v.Number = int.Parse(strs[5 + idx]);
            if (strs[idx] == "ZON")
            {
                idx     += 6;
                v.isZone = true;
                if (lvl.isViewNumberUsed(v.Number, lvl.Zones))
                {
                    v.Number = lvl.getFreeViewNumber(lvl.Zones);
                }
            }
            else
            {
                v.Music             = int.Parse(strs[6 + idx]);
                v.Unknown1          = int.Parse(strs[7 + idx]);
                v.Unknown2          = int.Parse(strs[8 + idx]);
                v.Unknown3          = int.Parse(strs[9 + idx]);
                v.Lighting          = int.Parse(strs[10 + idx]);
                v.FlagpoleID        = int.Parse(strs[11 + idx]);
                v.CameraTop         = int.Parse(strs[12 + idx]);
                v.CameraTopSpin     = int.Parse(strs[13 + idx]);
                v.CameraBottom      = int.Parse(strs[14 + idx]);
                v.CameraBottomSpin  = int.Parse(strs[15 + idx]);
                v.CameraBottomStick = int.Parse(strs[16 + idx]);
                idx += 17;
                if (lvl.isViewNumberUsed(v.Number, lvl.Views))
                {
                    v.Number = lvl.getFreeViewNumber(lvl.Views);
                }
            }
            return(v);
        }
Exemplo n.º 13
0
        public LevelConfig(LevelEditorControl EdControl)
        {
            InitializeComponent();
            this.EdControl = EdControl;
            this.Level = EdControl.Level;

            tabControl1.SelectTab(0);

            LanguageManager.ApplyToContainer(this, "LevelConfig");

            // Load lists
            loadList("Foregrounds", bgTopLayerComboBox);
            loadList("Backgrounds", bgBottomLayerComboBox);
            loadList("Tilesets", tilesetComboBox);

            // Load modifier lists
            ComboBox target = null;
            foreach (string name in LanguageManager.GetList("Modifiers")) {
                string trimmedname = name.Trim();
                if (trimmedname == "") continue;
                if (trimmedname[0] == '-') {
                    switch (trimmedname) {
                        case "-1": target = set1ComboBox; break;
                        case "-2": target = set2ComboBox; break;
                        case "-3": target = set3ComboBox; break;
                        case "-4": target = set4ComboBox; break;
                        case "-5": target = set5ComboBox; break;
                        case "-6": target = set6ComboBox; break;
                        case "-7": target = set7ComboBox; break;
                        case "-8": target = set8ComboBox; break;
                        case "-9": target = set9ComboBox; break;
                        case "-10": target = set10ComboBox; break;
                        case "-16": target = set16ComboBox; break;
                    }
                } else {
                    target.Items.Add(trimmedname);
                }
            }
        }
Exemplo n.º 14
0
        public static NSMBEntrance FromString(string[] strs, ref int idx, NSMBLevel lvl)
        {
            NSMBEntrance e = new NSMBEntrance();

            e.X               = int.Parse(strs[1 + idx]);
            e.Y               = int.Parse(strs[2 + idx]);
            e.CameraX         = int.Parse(strs[3 + idx]);
            e.CameraY         = int.Parse(strs[4 + idx]);
            e.Number          = int.Parse(strs[5 + idx]);
            e.DestArea        = int.Parse(strs[6 + idx]);
            e.ConnectedPipeID = int.Parse(strs[7 + idx]);
            e.DestEntrance    = int.Parse(strs[8 + idx]);
            e.Type            = int.Parse(strs[9 + idx]);
            e.Settings        = int.Parse(strs[10 + idx]);
            e.Unknown1        = int.Parse(strs[11 + idx]);
            e.EntryView       = int.Parse(strs[12 + idx]);
            e.Unknown2        = int.Parse(strs[13 + idx]);
            if (lvl.isEntranceNumberUsed(e.Number))
            {
                e.Number = lvl.getFreeEntranceNumber();
            }
            idx += 14;
            return(e);
        }
Exemplo n.º 15
0
        private void processButton_Click(object sender, EventArgs e)
        {
            if (!findBlockRadioButton.Checked && !findSpriteRadioButton.Checked)
            {
                MessageBox.Show(LanguageManager.Get("DataFinder", "ChooseMode"));
                return;
            }

            StringBuilder output = new StringBuilder();

            if (findBlockRadioButton.Checked)
            {
                output.AppendLine(string.Format(LanguageManager.Get("DataFinder", "BlockInstances"), blockNumberUpDown.Value.ToString()));
            }
            else
            {
                output.AppendLine(string.Format(LanguageManager.Get("DataFinder", "SpriteInstances"), spriteUpDown.Value.ToString()));
            }

            if (findBlockRadioButton.Checked)
            {
                initDataComparer((int)(splitCountUpDown.Value));
            }
            else
            {
                initDataComparer(6);
            }

            for (int i = 0; i < Levels.Count; i++)
            {
                File      levelFile = ROM.FS.getFileByName(LevelFiles[i] + ".bin");
                File      bgFile    = ROM.FS.getFileByName(LevelFiles[i] + "_bgdat.bin");
                NSMBLevel l         = new NSMBLevel(levelFile, bgFile, null);

                string n = Levels[i];
                n += ": ";

                if (findBlockRadioButton.Checked)
                {
                    output.Append(n);
                    int b = (int)(blockNumberUpDown.Value - 1);
                    int s = (int)(splitCountUpDown.Value);

                    if (s == 0)
                    {
                        PrintByteArray(output, l.Blocks[b], 0, l.Blocks[b].Length, n);
                    }
                    else
                    {
                        for (int j = 0; j < l.Blocks[b].Length; j += s)
                        {
                            if (j != 0)
                            {
                                for (int k = 0; k < n.Length; k++)
                                {
                                    output.Append(" ");
                                }
                            }

                            if (j + s < l.Blocks[b].Length)
                            {
                                PrintByteArray(output, l.Blocks[b], j, j + s, n);
                            }
                            else
                            {
                                PrintByteArray(output, l.Blocks[b], j, l.Blocks[b].Length, n);
                            }
                        }
                    }
                }
                else
                {
                    bool printSpace = false;
                    foreach (NSMBSprite s in l.Sprites)
                    {
                        if (s.Type == spriteUpDown.Value)
                        {
                            if (printSpace)
                            {
                                for (int k = 0; k < n.Length; k++)
                                {
                                    output.Append(" ");
                                }
                            }
                            else
                            {
                                output.Append(n);
                            }

                            printSpace = true;
                            PrintByteArray(output, s.Data, 0, 6, n);
                        }
                    }
                }

                l.close();
            }

            if (data != null)
            {
                output.Append("\r\n");
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                {
                    output.Append(String.Format("{0:00} ", i));
                }
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i].Keys.Count == 1)
                    {
                        output.Append(String.Format("{0:X2}", data[i].Keys.GetEnumerator().Current));
                    }
                    else
                    {
                        output.Append("__");
                    }
                    output.Append(" ");
                }
                output.Append("\r\n");
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i].Keys.Count != 1)
                    {
                        output.Append("========================= " + i + ":\r\n");

                        int bestCount = -1;
                        int bestVal   = -1;
                        foreach (byte b in data[i].Keys)
                        {
                            if (data[i][b].Count > bestCount)
                            {
                                bestCount = data[i][b].Count;
                                bestVal   = b;
                            }
                        }

                        bool hideMostUsed  = false;
                        int  mostUsed      = bestVal;
                        int  mostUsedCount = bestCount;
                        bestCount = -1;
                        bestVal   = -1;
                        foreach (byte b in data[i].Keys)
                        {
                            if (data[i][b].Count > bestCount && b != mostUsed)
                            {
                                bestCount = data[i][b].Count;
                                bestVal   = b;
                            }
                        }
                        if (mostUsedCount > bestCount * 2)
                        {
                            hideMostUsed = true;
                        }

                        foreach (byte b in data[i].Keys)
                        {
                            output.Append(String.Format("{0:X2}", b));
                            output.Append(": ");
                            if (hideMostUsed && b == mostUsed)
                            {
                                output.Append(" All Other Levels\r\n");
                            }
                            else
                            {
                                bool writeSpace = false;
                                foreach (string s in data[i][b])
                                {
                                    if (writeSpace)
                                    {
                                        output.Append("    ");
                                    }

                                    writeSpace = true;
                                    output.Append(s + "\r\n");
                                }
                            }
                        }
                    }
                }
            }

            outputTextBox.Text = output.ToString();
        }
Exemplo n.º 16
0
 public EditionMode(NSMBLevel Level, LevelEditorControl EdControl)
 {
     this.Level = Level;
     this.EdControl = EdControl;
 }
Exemplo n.º 17
0
        private void mpPatch2_Click(object sender, EventArgs e)
        {
            NSMBLevel lvl = new NSMBLevel(ROM.FS.getFileByName("J01_1.bin"), ROM.FS.getFileByName("J01_1_bgdat.bin"), null);

            NarcReplace("Dat_Field.narc", "I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Field.narc", "I_M_nohara_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Field.narc", "d_2d_PA_I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Field.narc", "NoHaRaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));


            lvl = new NSMBLevel(ROM.FS.getFileByName("J02_1.bin"), ROM.FS.getFileByName("J02_1_bgdat.bin"), null);
            NarcReplace("Dat_Basement.narc", "I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Basement.narc", "I_M_chika3_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Basement.narc", "d_2d_PA_I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Basement.narc", "ChiKa3MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));


            lvl = new NSMBLevel(ROM.FS.getFileByName("J03_1.bin"), ROM.FS.getFileByName("J03_1_bgdat.bin"), null);
            NarcReplace("Dat_Ice.narc", "I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Ice.narc", "I_M_setsugen2_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Ice.narc", "d_2d_PA_I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Ice.narc", "SeTsuGen2MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));


            lvl = new NSMBLevel(ROM.FS.getFileByName("J04_1.bin"), ROM.FS.getFileByName("J04_1_bgdat.bin"), null);
            NarcReplace("Dat_Pipe.narc", "W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Pipe.narc", "W_M_dokansoto_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Pipe.narc", "d_2d_PA_W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Pipe.narc", "dokansotoMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));


            lvl = new NSMBLevel(ROM.FS.getFileByName("J05_1.bin"), ROM.FS.getFileByName("J05_1_bgdat.bin"), null);
            NarcReplace("Dat_Fort.narc", "I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Fort.narc", "I_M_yakata_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Fort.narc", "d_2d_PA_I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Fort.narc", "YaKaTaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));


            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));

            MessageBox.Show(LanguageManager.Get("General", "Completed"));
        }
Exemplo n.º 18
0
 public static NSMBView FromString(string[] strs, ref int idx, NSMBLevel lvl)
 {
     NSMBView v = new NSMBView();
     v.X = int.Parse(strs[1 + idx]);
     v.Y = int.Parse(strs[2 + idx]);
     v.Width = int.Parse(strs[3 + idx]);
     v.Height = int.Parse(strs[4 + idx]);
     v.Number = int.Parse(strs[5 + idx]);
     if (strs[idx] == "ZON") {
         idx += 6;
         v.isZone = true;
         if (lvl.isViewNumberUsed(v.Number, lvl.Zones))
             v.Number = lvl.getFreeViewNumber(lvl.Zones);
     } else {
         v.Music = int.Parse(strs[6 + idx]);
         v.Unknown1 = int.Parse(strs[7 + idx]);
         v.Unknown2 = int.Parse(strs[8 + idx]);
         v.Unknown3 = int.Parse(strs[9 + idx]);
         v.Lighting = int.Parse(strs[10 + idx]);
         v.FlagpoleID = int.Parse(strs[11 + idx]);
         v.CameraTop = int.Parse(strs[12 + idx]);
         v.CameraTopSpin = int.Parse(strs[13 + idx]);
         v.CameraBottom = int.Parse(strs[14 + idx]);
         v.CameraBottomSpin = int.Parse(strs[15 + idx]);
         v.CameraBottomStick = int.Parse(strs[16 + idx]);
         idx += 17;
         if (lvl.isViewNumberUsed(v.Number, lvl.Views))
             v.Number = lvl.getFreeViewNumber(lvl.Views);
     }
     return v;
 }
 public BackgroundDragEditionMode(NSMBLevel l, LevelEditorControl edc) : base(l, edc) { }
Exemplo n.º 20
0
 public static NSMBSprite FromString(string[] strs, ref int idx, NSMBLevel lvl)
 {
     NSMBSprite s = new NSMBSprite(lvl);
     s.X = int.Parse(strs[1 + idx]);
     s.Y = int.Parse(strs[2 + idx]);
     s.Type = int.Parse(strs[3 + idx]);
     s.Data = new byte[6];
     for (int l = 0; l < 6; l++) {
         s.Data[l] = byte.Parse(strs[4 + idx].Substring(l * 2, 2), System.Globalization.NumberStyles.HexNumber);
     }
     idx += 5;
     return s;
 }
Exemplo n.º 21
0
 public EditionMode(NSMBLevel Level, LevelEditorControl EdControl)
 {
     this.Level     = Level;
     this.EdControl = EdControl;
 }
Exemplo n.º 22
0
 public NSMBSprite(NSMBLevel Level)
 {
     this.Level = Level;
 }
Exemplo n.º 23
0
        private void LoadEditor(string LevelFilename, string LevelName, byte[] LevelFile, byte[] BGDatFile, File LevelFileID, File LevelBGDatFileID)
        {
            coordinateViewer1.EdControl = levelEditorControl1;
            //This is supposed to reduce flickering on stuff like the side panel...
            //But it doesn't :(
            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint |
                ControlStyles.DoubleBuffer, true);


            if (Properties.Settings.Default.mdi)
            {
                this.MdiParent = MdiParentForm.instance;
            }
            this.LevelFilename = LevelFilename;

            smallBlockOverlaysToolStripMenuItem.Checked = Properties.Settings.Default.SmallBlockOverlays;
            showResizeHandles.Checked = Properties.Settings.Default.ShowResizeHandles;

            LanguageManager.ApplyToContainer(this, "LevelEditor");
            this.Text = LanguageManager.Get("General", "EditingSomething") + " " + LevelName;
            // these need to be added manually
            reloadTilesets.Text = LanguageManager.Get("LevelEditor", "reloadTilesets");
            smallBlockOverlaysToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "smallBlockOverlaysToolStripMenuItem");
            setBgImageButton.Text        = LanguageManager.Get("LevelEditor", "setBgImageButton");
            removeBgButton.Text          = LanguageManager.Get("LevelEditor", "removeBgButton");
            moveBGToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "moveBGToolStripMenuItem");

            levelEditorControl1.LoadUndoManager(undoButton, redoButton);

            // There's a catch 22 here: Level loading requires graphics. Graphics loading requires level.
            // Therefore, I have a simple loader here which gets this info.
            int  Block1Offset = LevelFile[0] | (LevelFile[1] << 8) | (LevelFile[2] << 16) | (LevelFile[3] << 24);
            int  Block3Offset = LevelFile[16] | (LevelFile[17] << 8) | (LevelFile[18] << 16) | (LevelFile[19] << 24);
            byte TilesetID    = LevelFile[Block1Offset + 0x0C];
            byte BGNSCID      = LevelFile[Block3Offset + 2];

            GFX = new NSMBGraphics();
            GFX.LoadTilesets(TilesetID, BGNSCID);
            if (LevelFileID == null)
            {
                Level = new NSMBLevel(LevelFilename, LevelFile, BGDatFile, GFX);
            }
            else
            {
                Level = new NSMBLevel(LevelFileID, LevelBGDatFileID, LevelFile, BGDatFile, GFX);
            }
            Level.enableWrite();
            levelEditorControl1.Initialise(GFX, Level, this);

            oem      = new ObjectsEditionMode(Level, levelEditorControl1);
            bgdragem = new BackgroundDragEditionMode(Level, levelEditorControl1);

            levelEditorControl1.SetEditionMode(oem);
            levelEditorControl1.minimapctrl = minimapControl1;

            tools       = new ToolsForm(levelEditorControl1);
            MinimapForm = new LevelMinimap(Level, levelEditorControl1);
            levelEditorControl1.minimap = MinimapForm;
            MinimapForm.Text            = string.Format(LanguageManager.Get("LevelEditor", "MinimapTitle"), LevelName);
            minimapControl1.loadMinimap(Level, levelEditorControl1);
            this.Icon = Properties.Resources.nsmbe;

            if (Properties.Settings.Default.AutoBackup > 0)
            {
                backupTimer.Interval = Properties.Settings.Default.AutoBackup * 60000;
                backupTimer.Start();
            }
        }
Exemplo n.º 24
0
        private void LoadEditor(string LevelFilename, string LevelName, byte[] LevelFile, byte[] BGDatFile, File LevelFileID, File LevelBGDatFileID) {
            coordinateViewer1.EdControl = levelEditorControl1;
            //This is supposed to reduce flickering on stuff like the side panel...
            //But it doesn't :(
            this.SetStyle(
              ControlStyles.AllPaintingInWmPaint|
              ControlStyles.UserPaint |
              ControlStyles.DoubleBuffer, true); 
            

            if (Properties.Settings.Default.mdi)
                this.MdiParent = MdiParentForm.instance;
            this.LevelFilename = LevelFilename;

            smallBlockOverlaysToolStripMenuItem.Checked = Properties.Settings.Default.SmallBlockOverlays;
<<<<<<< HEAD
            showBGs.Checked = Properties.Settings.Default.showBG;
=======
            showResizeHandles.Checked = Properties.Settings.Default.ShowResizeHandles;
>>>>>>> upstream/master

            LanguageManager.ApplyToContainer(this, "LevelEditor");
            this.Text = LanguageManager.Get("General", "EditingSomething") + " " + LevelName;
            // these need to be added manually
            reloadTilesets.Text = LanguageManager.Get("LevelEditor", "reloadTilesets");
            smallBlockOverlaysToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "smallBlockOverlaysToolStripMenuItem");
            setBgImageButton.Text = LanguageManager.Get("LevelEditor", "setBgImageButton");
            removeBgButton.Text = LanguageManager.Get("LevelEditor", "removeBgButton");
            moveBGToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "moveBGToolStripMenuItem");

            levelEditorControl1.LoadUndoManager(undoButton, redoButton);

            // There's a catch 22 here: Level loading requires graphics. Graphics loading requires level.
            // Therefore, I have a simple loader here which gets this info.
            int Block1Offset = LevelFile[0] | (LevelFile[1] << 8) | (LevelFile[2] << 16) | (LevelFile[3] << 24);
            int Block3Offset = LevelFile[16] | (LevelFile[17] << 8) | (LevelFile[18] << 16) | (LevelFile[19] << 24);
            byte TilesetID = LevelFile[Block1Offset + 0x0C];
            byte BGNSCID = LevelFile[Block3Offset + 2];

            GFX = new NSMBGraphics();
            GFX.LoadTilesets(TilesetID, BGNSCID);

            Level = new NSMBLevel(LevelFileID, LevelBGDatFileID, LevelFile, BGDatFile, GFX);
            Level.enableWrite();
            levelEditorControl1.Initialise(GFX, Level, this);

            oem = new ObjectsEditionMode(Level, levelEditorControl1);
            bgdragem = new BackgroundDragEditionMode(Level, levelEditorControl1);

            levelEditorControl1.SetEditionMode(oem);
            levelEditorControl1.minimapctrl = minimapControl1;

            tools = new ToolsForm(levelEditorControl1);
            MinimapForm = new LevelMinimap(Level, levelEditorControl1);
            levelEditorControl1.minimap = MinimapForm;
            MinimapForm.Text = string.Format(LanguageManager.Get("LevelEditor", "MinimapTitle"), LevelName);
            minimapControl1.loadMinimap(Level, levelEditorControl1);
            this.Icon = Properties.Resources.nsmbe;

            if (Properties.Settings.Default.AutoBackup > 0)
            {
                backupTimer.Interval = Properties.Settings.Default.AutoBackup * 60000;
                backupTimer.Start();
            }
        }
Exemplo n.º 25
0
        public LevelEditor(NSMBLevel Level)
        {
            InitializeComponent();

            this.Level = Level;
            this.GFX   = Level.GFX;
            coordinateViewer1.EdControl = levelEditorControl1;
            //This is supposed to reduce flickering on stuff like the side panel...
            //But it doesn't :(
            this.SetStyle(
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint |
                ControlStyles.DoubleBuffer, true);

            if (Properties.Settings.Default.mdi)
            {
                this.MdiParent = MdiParentForm.instance;
            }
            if (Properties.Settings.Default.LevelMaximized)
            {
                this.WindowState = FormWindowState.Maximized;
            }

            smallBlockOverlaysToolStripMenuItem.Checked = Properties.Settings.Default.SmallBlockOverlays;
            showResizeHandles.Checked = Properties.Settings.Default.ShowResizeHandles;

            LanguageManager.ApplyToContainer(this, "LevelEditor");
            this.Text = LanguageManager.Get("General", "EditingSomething") + " " + Level.name;
            // these need to be added manually
            reloadTilesets.Text = LanguageManager.Get("LevelEditor", "reloadTilesets");
            smallBlockOverlaysToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "smallBlockOverlaysToolStripMenuItem");
            showResizeHandles.Text       = LanguageManager.Get("LevelEditor", "showResizeHandles");
            setBgImageButton.Text        = LanguageManager.Get("LevelEditor", "setBgImageButton");
            removeBgButton.Text          = LanguageManager.Get("LevelEditor", "removeBgButton");
            moveBGToolStripMenuItem.Text = LanguageManager.Get("LevelEditor", "moveBGToolStripMenuItem");
            openImage.Filter             = LanguageManager.Get("Filters", "image");

            levelEditorControl1.LoadUndoManager(undoButton, redoButton);

            Level.enableWrite();
            levelEditorControl1.Initialise(GFX, Level, this);

            oem      = new ObjectsEditionMode(Level, levelEditorControl1);
            bgdragem = new BackgroundDragEditionMode(Level, levelEditorControl1);

            levelEditorControl1.SetEditionMode(oem);
            levelEditorControl1.minimapctrl = minimapControl1;

            tools       = new ToolsForm(levelEditorControl1);
            sprEvents   = new SpriteEventsViewer(levelEditorControl1);
            MinimapForm = new LevelMinimap(Level, levelEditorControl1);
            levelEditorControl1.minimap = MinimapForm;
            MinimapForm.Text            = string.Format(LanguageManager.Get("LevelEditor", "MinimapTitle"), Level.name);
            minimapControl1.loadMinimap(Level, levelEditorControl1);
            this.Icon = Properties.Resources.nsmbe;

            if (Properties.Settings.Default.AutoBackup > 0)
            {
                backupTimer.Interval = Properties.Settings.Default.AutoBackup * 60000;
                backupTimer.Start();
            }
        }
Exemplo n.º 26
0
        private void mpPatch2_Click(object sender, EventArgs e)
        {
            NSMBLevel lvl = new NSMBLevel(ROM.FS.getFileByName("J01_1.bin"), ROM.FS.getFileByName("J01_1_bgdat.bin"), null);
            NarcReplace("Dat_Field.narc", "I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Field.narc", "I_M_nohara_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Field.narc", "d_2d_PA_I_M_nohara.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Field.narc", "NoHaRaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_tikei_nohara_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_back_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Field.narc", "d_2d_I_M_free_nohara_VS_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));

            lvl = new NSMBLevel(ROM.FS.getFileByName("J02_1.bin"), ROM.FS.getFileByName("J02_1_bgdat.bin"), null);
            NarcReplace("Dat_Basement.narc", "I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Basement.narc", "I_M_chika3_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Basement.narc", "d_2d_PA_I_M_chika3.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Basement.narc", "ChiKa3MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_tikei_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Basement.narc", "d_2d_I_M_back_chika3_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            lvl = new NSMBLevel(ROM.FS.getFileByName("J03_1.bin"), ROM.FS.getFileByName("J03_1_bgdat.bin"), null);
            NarcReplace("Dat_Ice.narc", "I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Ice.narc", "I_M_setsugen2_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Ice.narc", "d_2d_PA_I_M_setsugen2.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Ice.narc", "SeTsuGen2MainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_tikei_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_back_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Ice.narc", "d_2d_I_M_free_setsugen2_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));

            lvl = new NSMBLevel(ROM.FS.getFileByName("J04_1.bin"), ROM.FS.getFileByName("J04_1_bgdat.bin"), null);
            NarcReplace("Dat_Pipe.narc", "W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Pipe.narc", "W_M_dokansoto_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Pipe.narc", "d_2d_PA_W_M_dokansoto.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Pipe.narc", "dokansotoMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_tikei_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_back_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_R_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Pipe.narc", "d_2d_W_M_free_dokansoto_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));

            lvl = new NSMBLevel(ROM.FS.getFileByName("J05_1.bin"), ROM.FS.getFileByName("J05_1_bgdat.bin"), null);
            NarcReplace("Dat_Fort.narc", "I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT));
            NarcReplace("Dat_Fort.narc", "I_M_yakata_hd.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_UNT_HD));
            NarcReplace("Dat_Fort.narc", "d_2d_PA_I_M_yakata.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_PNL));
            NarcReplace("Dat_Fort.narc", "YaKaTaMainUnitChangeData.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_CHK));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_tikei_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0xC], ROM.Data.Table_TS_NCL));

            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NSC));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_back_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x6], ROM.Data.Table_BG_NCL));

            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_UR_nsc.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NSC));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncg.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCG));
            NarcReplace("Dat_Fort.narc", "d_2d_I_M_free_yakata_ncl.bin", ROM.GetFileIDFromTable(lvl.Blocks[0][0x12], ROM.Data.Table_FG_NCL));

            MessageBox.Show(LanguageManager.Get("General", "Completed"));
        }
Exemplo n.º 27
0
 public static NSMBEntrance FromString(string[] strs, ref int idx, NSMBLevel lvl)
 {
     NSMBEntrance e = new NSMBEntrance();
     e.X = int.Parse(strs[1 + idx]);
     e.Y = int.Parse(strs[2 + idx]);
     e.CameraX = int.Parse(strs[3 + idx]);
     e.CameraY = int.Parse(strs[4 + idx]);
     e.Number = int.Parse(strs[5 + idx]);
     e.DestArea = int.Parse(strs[6 + idx]);
     e.ConnectedPipeID = int.Parse(strs[7 + idx]);
     e.DestEntrance = int.Parse(strs[8 + idx]);
     e.Type = int.Parse(strs[9 + idx]);
     e.Settings = int.Parse(strs[10 + idx]);
     e.Unknown1 = int.Parse(strs[11 + idx]);
     e.EntryView = int.Parse(strs[12 + idx]);
     e.Unknown2 = int.Parse(strs[13 + idx]);
     if (lvl.isEntranceNumberUsed(e.Number))
         e.Number = lvl.getFreeEntranceNumber();
     idx += 14;
     return e;
 }
Exemplo n.º 28
0
        private void processButton_Click(object sender, EventArgs e)
        {
            if (!findBlockRadioButton.Checked && !findSpriteRadioButton.Checked) {
                MessageBox.Show(LanguageManager.Get("DataFinder", "ChooseMode"));
                return;
            }

            StringBuilder output = new StringBuilder();
            if (findBlockRadioButton.Checked)
                output.AppendLine(string.Format(LanguageManager.Get("DataFinder", "BlockInstances"), blockNumberUpDown.Value.ToString()));
            else
                output.AppendLine(string.Format(LanguageManager.Get("DataFinder", "SpriteInstances"), spriteUpDown.Value.ToString()));

            if (findBlockRadioButton.Checked)
                initDataComparer((int)(splitCountUpDown.Value));
            else
                initDataComparer(6);

            for (int i = 0; i < Levels.Count; i++)
            {
                File levelFile = ROM.FS.getFileByName(LevelFiles[i] + ".bin");
                File bgFile = ROM.FS.getFileByName(LevelFiles[i] + "_bgdat.bin");
                NSMBLevel l = new NSMBLevel(levelFile, bgFile, null);

                string n = Levels[i];
                n += ": ";

                if (findBlockRadioButton.Checked)
                {
                    output.Append(n);
                    int b = (int)(blockNumberUpDown.Value - 1);
                    int s = (int)(splitCountUpDown.Value);

                    if (s == 0)
                        PrintByteArray(output, l.Blocks[b], 0, l.Blocks[b].Length, n);
                    else
                    {
                        for (int j = 0; j < l.Blocks[b].Length; j += s)
                        {
                            if (j != 0)
                                for (int k = 0; k < n.Length; k++)
                                    output.Append(" ");

                            if(j+s < l.Blocks[b].Length)
                                PrintByteArray(output, l.Blocks[b], j, j+s, n);
                            else
                                PrintByteArray(output, l.Blocks[b], j, l.Blocks[b].Length, n);
                        }
                    }
                }
                else
                {
                    bool printSpace = false;
                    foreach (NSMBSprite s in l.Sprites)
                    {
                        if (s.Type == spriteUpDown.Value)
                        {
                            if (printSpace)
                                for (int k = 0; k < n.Length; k++)
                                    output.Append(" ");
                            else
                                output.Append(n);

                            printSpace = true;
                            PrintByteArray(output, s.Data, 0, 6, n);
                        }
                    }
                }

                l.close();
            }

            if (data != null)
            {
                output.Append("\r\n");
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                    output.Append(String.Format("{0:00} ", i));
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i].Keys.Count == 1)
                        output.Append(String.Format("{0:X2}", data[i].Keys.GetEnumerator().Current));
                    else
                        output.Append("__");
                    output.Append(" ");
                }
                output.Append("\r\n");
                output.Append("\r\n");

                for (int i = 0; i < data.Length; i++)
                {
                    if (data[i].Keys.Count != 1)
                    {
                        output.Append("========================= " + i + ":\r\n");

                        int bestCount = -1;
                        int bestVal = -1;
                        foreach (byte b in data[i].Keys)
                        {
                            if (data[i][b].Count > bestCount)
                            {
                                bestCount = data[i][b].Count;
                                bestVal = b;
                            }
                        }

                        bool hideMostUsed = false;
                        int mostUsed = bestVal;
                        int mostUsedCount = bestCount;
                        bestCount = -1;
                        bestVal = -1;
                        foreach (byte b in data[i].Keys)
                        {
                            if (data[i][b].Count > bestCount && b != mostUsed)
                            {
                                bestCount = data[i][b].Count;
                                bestVal = b;
                            }
                        }
                        if (mostUsedCount > bestCount * 2)
                            hideMostUsed = true;

                        foreach (byte b in data[i].Keys)
                        {
                            output.Append(String.Format("{0:X2}", b));
                            output.Append(": ");
                            if (hideMostUsed && b == mostUsed)
                                output.Append(" All Other Levels\r\n");
                            else
                            {
                                bool writeSpace = false;
                                foreach (string s in data[i][b])
                                {
                                    if (writeSpace)
                                        output.Append("    ");

                                    writeSpace = true;
                                    output.Append(s + "\r\n");
                                }
                            }
                        }
                    }
                }
            }

            outputTextBox.Text = output.ToString();
        }
Exemplo n.º 29
0
 public BackgroundDragEditionMode(NSMBLevel l, LevelEditorControl edc) : base(l, edc)
 {
 }