public void loadMinimap(NSMBLevel Level, LevelEditorControl EdControl) { this.Level = Level; this.EdControl = EdControl; UnViewableBlocksBrush = new SolidBrush(Color.FromArgb(120, 255, 255, 255)); loaded = true; }
public ObjectsEditionMode(NSMBLevel Level, LevelEditorControl EdControl) : base(Level, EdControl) { tabs = new GoodTabsPanel(EdControl); SetPanel(tabs); tabs.Dock = DockStyle.Fill; resizeHandles = Properties.Settings.Default.ShowResizeHandles; }
public LevelMinimap(NSMBLevel Level, LevelEditorControl EdControl) { InitializeComponent(); LanguageManager.ApplyToContainer(this, "LevelMinimap"); 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)); }
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(); }
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 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); }
private void mpPatch2_Click(object sender, EventArgs e) { NSMBLevel lvl = new NSMBLevel(new InternalLevelSource("J01_1", "")); 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(new InternalLevelSource("J02_1", "")); 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(new InternalLevelSource("J03_1", "")); 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(new InternalLevelSource("J04_1", "")); 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(new InternalLevelSource("J05_1", "")); 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")); }
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(); } }
public EditionMode(NSMBLevel Level, LevelEditorControl EdControl) { this.Level = Level; this.EdControl = EdControl; }
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++) { NSMBLevel l = new NSMBLevel(new InternalLevelSource(ROM.FS.getFileByName(LevelFiles[i]).id, 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(); }
public BackgroundDragEditionMode(NSMBLevel l, LevelEditorControl edc) : base(l, edc) { }