private NSMBTileset loadTileset(ushort TilesetID) { NSMBGraphics g = new NSMBGraphics(); int TilesetNumber; if (TilesetID == 65535) { // load Jyotyu g.LoadTilesets(0); TilesetNumber = 0; } else if (TilesetID == 65534) { // load Nohara_sub g.LoadTilesets(2); TilesetNumber = 2; } else { // load a normal tileset g.LoadTilesets(TilesetID); TilesetNumber = 1; } return(g.Tilesets[TilesetNumber]); }
public void load(NSMBGraphics g, int TilesetNumber) { this.tnum = TilesetNumber; this.tls = g.Tilesets[tnum]; tilePicker1.init(new Bitmap[] { tls.map16.buffer }, 16); previewObject = new NSMBObject(0, tnum, 0, 0, 6, 6, g); }
public TilesetEditor(ushort TilesetID, string tilesetName) { InitializeComponent(); if (Properties.Settings.Default.mdi) this.MdiParent = MdiParentForm.instance; LanguageManager.ApplyToContainer(this, "TilesetEditor"); Text = string.Format(LanguageManager.Get("TilesetEditor", "_TITLE"), tilesetName); g = new NSMBGraphics(); this.TilesetID = TilesetID; if (TilesetID == 65535) { // load Jyotyu g.LoadTilesets(0); TilesetNumber = 0; } else if (TilesetID == 65534) { // load Nohara_sub g.LoadTilesets(2); TilesetNumber = 2; } else { // load a normal tileset g.LoadTilesets(TilesetID); TilesetNumber = 1; } t = g.Tilesets[TilesetNumber]; t.beginEdit(); objectPickerControl1.Initialise(g); objectPickerControl1.CurrentTileset = TilesetNumber; tilesetObjectEditor1.load(g, TilesetNumber); tilemapEditor1.load(t.map16); imageManager1.addImage(t.graphics); for(int i = 0; i < t.palettes.Length; i++) imageManager1.addPalette(t.palettes[i]); tileBehaviorPicker.init(new Bitmap[] { t.Map16Buffer }, 16); //FIXME // graphicsEditor1.SaveGraphics += new GraphicsEditor.SaveGraphicsHandler(graphicsEditor1_SaveGraphics); descExists = ROM.UserInfo.descriptions.ContainsKey(TilesetID); //Fild in there are descriptions for the tileset deleteDescriptions.Visible = descExists; //Make the appropriate button visible createDescriptions.Visible = !descExists; tilesetObjectEditor1.descBox.Visible = descExists; //Hide or show the description text box tilesetObjectEditor1.descLbl.Visible = descExists; if (descExists) { descriptions = ROM.UserInfo.descriptions[TilesetID]; //Get the descriptions tilesetObjectEditor1.descBox.Text = descriptions[0]; //Fill the description box with that of the first object } this.Icon = Properties.Resources.nsmbe; }
private void deleteDescriptions_Click(object sender, EventArgs e) { if (!descExists) { return; } if (MessageBox.Show(LanguageManager.Get("TilesetEditor", "sureDelDescriptions"), LanguageManager.Get("TilesetEditor", "titleDelDescriptions"), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } ROM.UserInfo.descriptions.Remove(TilesetID); createDescriptions.Visible = true; deleteDescriptions.Visible = false; tilesetObjectEditor1.descBox.Visible = false; tilesetObjectEditor1.descLbl.Visible = false; if (TilesetID != 65535) // The Jyotyu tileset { t.UseNotes = false; } else //Restore the original notes { t.ObjNotes = NSMBGraphics.GetDescriptions(LanguageManager.GetList("ObjNotes")); } descExists = false; objectPickerControl1.Invalidate(true); }
public void Initialise(NSMBGraphics GFXd) { if (inited) return; inited = true; GFX = GFXd; Ready = true; LoadObjects(); }
public void Initialise(NSMBGraphics GFXd, int tileset) { if (inited) return; inited = true; gfx = GFXd; this.tileset = tileset; LoadObjects(); }
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"); 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 NSMBLevel(string fileName, byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { if (fileName == "") isClipboard = true; else ExportedFileName = fileName; isExported = true; LoadLevel(eLevelFile, eBGFile, GFX); }
public void Initialise(NSMBGraphics GFXd, int tileset) { if (inited) { return; } inited = true; gfx = GFXd; this.tileset = tileset; LoadObjects(); }
public void Initialise(NSMBGraphics GFXd) { if (inited) { return; } inited = true; GFX = GFXd; Ready = true; LoadObjects(); }
public NSMBObject(int ObjNum, int Tileset, int X, int Y, int Width, int Height, NSMBGraphics GFX) { this.ObjNum = ObjNum; this.Tileset = Tileset; this.GFX = GFX; this.X = X; this.Y = Y; this.Width = Width; this.Height = Height; CachedObj = new int[Width, Height]; UpdateObjCache(); }
public NSMBObject(NSMBObject o) // clone constructor: returns an identical object { this.ObjNum = o.ObjNum; this.Tileset = o.Tileset; this.GFX = o.GFX; this.X = o.X; this.Y = o.Y; this.Width = o.Width; this.Height = o.Height; CachedObj = new int[Width, Height]; UpdateObjCache(); }
// clone constructor: returns an identical object public NSMBObject(NSMBObject o) { this.ObjNum = o.ObjNum; this.Tileset = o.Tileset; this.GFX = o.GFX; this.X = o.X; this.Y = o.Y; this.Width = o.Width; this.Height = o.Height; CachedObj = new int[Width, Height]; UpdateObjCache(); }
public NSMBLevel(string fileName, byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { if (fileName == "") { isClipboard = true; } else { ExportedFileName = fileName; } isExported = true; LoadLevel(eLevelFile, eBGFile, GFX); }
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 NSMBObject FromString(String[] strs, ref int idx, NSMBGraphics gfx) { NSMBObject o = new NSMBObject( int.Parse(strs[6 + idx]), int.Parse(strs[5 + idx]), int.Parse(strs[1 + idx]), int.Parse(strs[2 + idx]), int.Parse(strs[3 + idx]), int.Parse(strs[4 + idx]), gfx); idx += 7; return(o); }
public NSMBLevel(File levelFile, File bgFile, NSMBGraphics GFX) { LoadLevel(levelFile, bgFile, levelFile.getContents(), bgFile.getContents(), GFX); }
private void LoadLevel(File levelFile, File bgFile, byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { this.LevelFile = levelFile; this.BGFile = bgFile; this.GFX = GFX; int FilePos; for(int x = 0; x < 512; x++) for (int y = 0; y < 256; y++) { levelTilemap[x,y] = (x + y) % 512; } // Level loading time yay. // Since I don't know the format for every block, I will just load them raw. Blocks = new byte[][] { null, null, null, null, null, null, null, null, null, null, null, null, null, null }; FilePos = 0; for (int BlockIdx = 0; BlockIdx < 14; BlockIdx++) { int BlockOffset = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24; FilePos += 4; int BlockSize = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24; FilePos += 4; Blocks[BlockIdx] = new byte[BlockSize]; Array.Copy(eLevelFile, BlockOffset, Blocks[BlockIdx], 0, BlockSize); } // Now objects. int ObjectCount = eBGFile.Length / 10; Objects = new List<NSMBObject>(ObjectCount); FilePos = 0; for (int ObjectIdx = 0; ObjectIdx < ObjectCount; ObjectIdx++) { int ObjID = eBGFile[FilePos] | (eBGFile[FilePos + 1] << 8); int ObjX = eBGFile[FilePos + 2] | (eBGFile[FilePos + 3] << 8); int ObjY = eBGFile[FilePos + 4] | (eBGFile[FilePos + 5] << 8); int ObjWidth = eBGFile[FilePos + 6] | (eBGFile[FilePos + 7] << 8); int ObjHeight = eBGFile[FilePos + 8] | (eBGFile[FilePos + 9] << 8); Objects.Add(new NSMBObject(ObjID & 4095, (ObjID & 61440) >> 12, ObjX, ObjY, ObjWidth, ObjHeight, GFX)); FilePos += 10; } /* * Sprite struct: * Offs Len Dat * 0x0 2 Sprite id * 0x2 2 X * 0x4 2 Y * 0x6 6 Dat * 0xD end */ // Sprites byte[] SpriteBlock = Blocks[6]; int SpriteCount = (SpriteBlock.Length - 2) / 12; Sprites = new List<NSMBSprite>(SpriteCount); FilePos = 0; for (int SpriteIdx = 0; SpriteIdx < SpriteCount; SpriteIdx++) { NSMBSprite Sprite = new NSMBSprite(this); Sprite.Type = SpriteBlock[FilePos] | (SpriteBlock[FilePos + 1] << 8); Sprite.X = SpriteBlock[FilePos + 2] | (SpriteBlock[FilePos + 3] << 8); Sprite.Y = SpriteBlock[FilePos + 4] | (SpriteBlock[FilePos + 5] << 8); Sprite.Data = new byte[6]; FilePos += 6; Sprite.Data[0] = SpriteBlock[FilePos + 1]; Sprite.Data[1] = SpriteBlock[FilePos + 0]; Sprite.Data[2] = SpriteBlock[FilePos + 5]; Sprite.Data[3] = SpriteBlock[FilePos + 4]; Sprite.Data[4] = SpriteBlock[FilePos + 3]; Sprite.Data[5] = SpriteBlock[FilePos + 2]; // Array.Copy(SpriteBlock, FilePos + 6, Sprite.Data, 0, 6); Sprites.Add(Sprite); FilePos += 6; } // Entrances. byte[] EntranceBlock = Blocks[5]; int EntranceCount = EntranceBlock.Length / 20; Entrances = new List<NSMBEntrance>(EntranceCount); FilePos = 0; for (int EntIdx = 0; EntIdx < EntranceCount; EntIdx++) { NSMBEntrance Entrance = new NSMBEntrance(); Entrance.X = EntranceBlock[FilePos] | (EntranceBlock[FilePos + 1] << 8); Entrance.Y = EntranceBlock[FilePos + 2] | (EntranceBlock[FilePos + 3] << 8); Entrance.CameraX = EntranceBlock[FilePos + 4] | (EntranceBlock[FilePos + 5] << 8); Entrance.CameraY = EntranceBlock[FilePos + 6] | (EntranceBlock[FilePos + 7] << 8); Entrance.Number = EntranceBlock[FilePos + 8]; Entrance.DestArea = EntranceBlock[FilePos + 9]; Entrance.ConnectedPipeID = EntranceBlock[FilePos + 10]; Entrance.DestEntrance = EntranceBlock[FilePos + 12]; Entrance.Type = EntranceBlock[FilePos + 14]; Entrance.Settings = EntranceBlock[FilePos + 15]; Entrance.Unknown1 = EntranceBlock[FilePos + 16]; Entrance.EntryView = EntranceBlock[FilePos + 18]; Entrance.Unknown2 = EntranceBlock[FilePos + 19]; //Array.Copy(EntranceBlock, FilePos, Entrance.Data, 0, 20); Entrances.Add(Entrance); FilePos += 20; } // Views ByteArrayInputStream ViewBlock = new ByteArrayInputStream(Blocks[7]); ByteArrayInputStream CamBlock = new ByteArrayInputStream(Blocks[1]); Views = new List<NSMBView>(); while (ViewBlock.lengthAvailable(16)) Views.Add(NSMBView.read(ViewBlock, CamBlock)); // Zones ByteArrayInputStream ZoneBlock = new ByteArrayInputStream(Blocks[8]); Zones = new List<NSMBView>(); while (ZoneBlock.lengthAvailable(12)) Zones.Add(NSMBView.readZone(ZoneBlock)); // Paths ByteArrayInputStream PathBlock = new ByteArrayInputStream(Blocks[10]); ByteArrayInputStream PathNodeBlock = new ByteArrayInputStream(Blocks[12]); Paths = new List<NSMBPath>(); while (!PathBlock.end()) { Paths.Add(NSMBPath.read(PathBlock, PathNodeBlock, false)); } PathBlock = new ByteArrayInputStream(Blocks[9]); PathNodeBlock = new ByteArrayInputStream(Blocks[11]); ProgressPaths = new List<NSMBPath>(); while (!PathBlock.end()) { ProgressPaths.Add(NSMBPath.read(PathBlock, PathNodeBlock, true)); } CalculateSpriteModifiers(); repaintAllTilemap(); }
private NSMBTileset loadTileset(ushort TilesetID) { NSMBGraphics g = new NSMBGraphics(); int TilesetNumber; if (TilesetID == 65535) { // load Jyotyu g.LoadTilesets(0); TilesetNumber = 0; } else if (TilesetID == 65534) { // load Nohara_sub g.LoadTilesets(2); TilesetNumber = 2; } else { // load a normal tileset g.LoadTilesets(TilesetID); TilesetNumber = 1; } return g.Tilesets[TilesetNumber]; }
public NSMBLevel(File levelFile, File bgFile, byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { this.LevelFile = levelFile; this.BGFile = bgFile; LoadLevel(eLevelFile, eBGFile, GFX); }
public PickerTest(NSMBGraphics g) { InitializeComponent(); objectPickerControlNew1.Initialise(g, 1); this.Icon = Properties.Resources.nsmbe; }
public NSMBLevel(File levelFile, File bgFile, NSMBGraphics GFX) { this.LevelFile = levelFile; this.BGFile = bgFile; LoadLevel(levelFile.getContents(), bgFile.getContents(), GFX); }
public static NSMBObject FromString(String[] strs, ref int idx, NSMBGraphics gfx) { NSMBObject o = new NSMBObject( int.Parse(strs[6 + idx]), int.Parse(strs[5 + idx]), int.Parse(strs[1 + idx]), int.Parse(strs[2 + idx]), int.Parse(strs[3 + idx]), int.Parse(strs[4 + idx]), gfx); idx += 7; return o; }
public NSMBLevel(File levelFile, File bgFile, byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { LoadLevel(levelFile, bgFile, eLevelFile, eBGFile, GFX); }
private void LoadLevel(byte[] eLevelFile, byte[] eBGFile, NSMBGraphics GFX) { this.GFX = GFX; int FilePos; for (int x = 0; x < 512; x++) { for (int y = 0; y < 256; y++) { levelTilemap[x, y] = (x + y) % 512; } } // Level loading time yay. // Since I don't know the format for every block, I will just load them raw. Blocks = new byte[][] { null, null, null, null, null, null, null, null, null, null, null, null, null, null }; FilePos = 0; for (int BlockIdx = 0; BlockIdx < 14; BlockIdx++) { int BlockOffset = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24; FilePos += 4; int BlockSize = eLevelFile[FilePos] | (eLevelFile[FilePos + 1] << 8) | (eLevelFile[FilePos + 2] << 16) | eLevelFile[FilePos + 3] << 24; FilePos += 4; Blocks[BlockIdx] = new byte[BlockSize]; Array.Copy(eLevelFile, BlockOffset, Blocks[BlockIdx], 0, BlockSize); } // Now objects. int ObjectCount = eBGFile.Length / 10; Objects = new List <NSMBObject>(ObjectCount); FilePos = 0; for (int ObjectIdx = 0; ObjectIdx < ObjectCount; ObjectIdx++) { int ObjID = eBGFile[FilePos] | (eBGFile[FilePos + 1] << 8); int ObjX = eBGFile[FilePos + 2] | (eBGFile[FilePos + 3] << 8); int ObjY = eBGFile[FilePos + 4] | (eBGFile[FilePos + 5] << 8); int ObjWidth = eBGFile[FilePos + 6] | (eBGFile[FilePos + 7] << 8); int ObjHeight = eBGFile[FilePos + 8] | (eBGFile[FilePos + 9] << 8); Objects.Add(new NSMBObject(ObjID & 4095, (ObjID & 61440) >> 12, ObjX, ObjY, ObjWidth, ObjHeight, GFX)); FilePos += 10; } /* * Sprite struct: * Offs Len Dat * 0x0 2 Sprite id * 0x2 2 X * 0x4 2 Y * 0x6 6 Dat * 0xD end */ // Sprites byte[] SpriteBlock = Blocks[6]; int SpriteCount = (SpriteBlock.Length - 2) / 12; Sprites = new List <NSMBSprite>(SpriteCount); FilePos = 0; for (int SpriteIdx = 0; SpriteIdx < SpriteCount; SpriteIdx++) { NSMBSprite Sprite = new NSMBSprite(this); Sprite.Type = SpriteBlock[FilePos] | (SpriteBlock[FilePos + 1] << 8); Sprite.X = SpriteBlock[FilePos + 2] | (SpriteBlock[FilePos + 3] << 8); Sprite.Y = SpriteBlock[FilePos + 4] | (SpriteBlock[FilePos + 5] << 8); Sprite.Data = new byte[6]; FilePos += 6; Sprite.Data[0] = SpriteBlock[FilePos + 1]; Sprite.Data[1] = SpriteBlock[FilePos + 0]; Sprite.Data[2] = SpriteBlock[FilePos + 5]; Sprite.Data[3] = SpriteBlock[FilePos + 4]; Sprite.Data[4] = SpriteBlock[FilePos + 3]; Sprite.Data[5] = SpriteBlock[FilePos + 2]; // Array.Copy(SpriteBlock, FilePos + 6, Sprite.Data, 0, 6); Sprites.Add(Sprite); FilePos += 6; } // Entrances. byte[] EntranceBlock = Blocks[5]; int EntranceCount = EntranceBlock.Length / 20; Entrances = new List <NSMBEntrance>(EntranceCount); FilePos = 0; for (int EntIdx = 0; EntIdx < EntranceCount; EntIdx++) { NSMBEntrance Entrance = new NSMBEntrance(); Entrance.X = EntranceBlock[FilePos] | (EntranceBlock[FilePos + 1] << 8); Entrance.Y = EntranceBlock[FilePos + 2] | (EntranceBlock[FilePos + 3] << 8); Entrance.CameraX = EntranceBlock[FilePos + 4] | (EntranceBlock[FilePos + 5] << 8); Entrance.CameraY = EntranceBlock[FilePos + 6] | (EntranceBlock[FilePos + 7] << 8); Entrance.Number = EntranceBlock[FilePos + 8]; Entrance.DestArea = EntranceBlock[FilePos + 9]; Entrance.ConnectedPipeID = EntranceBlock[FilePos + 10]; Entrance.DestEntrance = EntranceBlock[FilePos + 12]; Entrance.Type = EntranceBlock[FilePos + 14]; Entrance.Settings = EntranceBlock[FilePos + 15]; Entrance.Unknown1 = EntranceBlock[FilePos + 16]; Entrance.EntryView = EntranceBlock[FilePos + 18]; Entrance.Unknown2 = EntranceBlock[FilePos + 19]; //Array.Copy(EntranceBlock, FilePos, Entrance.Data, 0, 20); Entrances.Add(Entrance); FilePos += 20; } // Views ByteArrayInputStream ViewBlock = new ByteArrayInputStream(Blocks[7]); ByteArrayInputStream CamBlock = new ByteArrayInputStream(Blocks[1]); Views = new List <NSMBView>(); while (ViewBlock.lengthAvailable(16)) { Views.Add(NSMBView.read(ViewBlock, CamBlock)); } // Zones ByteArrayInputStream ZoneBlock = new ByteArrayInputStream(Blocks[8]); Zones = new List <NSMBView>(); while (ZoneBlock.lengthAvailable(12)) { Zones.Add(NSMBView.readZone(ZoneBlock)); } // Paths ByteArrayInputStream PathBlock = new ByteArrayInputStream(Blocks[10]); ByteArrayInputStream PathNodeBlock = new ByteArrayInputStream(Blocks[12]); Paths = new List <NSMBPath>(); while (!PathBlock.end()) { Paths.Add(NSMBPath.read(PathBlock, PathNodeBlock, false)); } PathBlock = new ByteArrayInputStream(Blocks[9]); PathNodeBlock = new ByteArrayInputStream(Blocks[11]); ProgressPaths = new List <NSMBPath>(); while (!PathBlock.end()) { ProgressPaths.Add(NSMBPath.read(PathBlock, PathNodeBlock, true)); } CalculateSpriteModifiers(); repaintAllTilemap(); }
public TilesetEditor(ushort TilesetID, string tilesetName) { InitializeComponent(); if (Properties.Settings.Default.mdi) { this.MdiParent = MdiParentForm.instance; } LanguageManager.ApplyToContainer(this, "TilesetEditor"); savePNG.Filter = LanguageManager.Get("Filters", "png"); openPNG.Filter = LanguageManager.Get("Filters", "png"); saveTileset.Filter = LanguageManager.Get("Filters", "tileset"); openTileset.Filter = LanguageManager.Get("Filters", "tileset"); Text = string.Format(LanguageManager.Get("TilesetEditor", "_TITLE"), tilesetName); g = new NSMBGraphics(); this.TilesetID = TilesetID; if (TilesetID == 65535) { // load Jyotyu g.LoadTilesets(0); TilesetNumber = 0; } else if (TilesetID == 65534) { // load Nohara_sub g.LoadTilesets(2); TilesetNumber = 2; } else { // load a normal tileset g.LoadTilesets(TilesetID); TilesetNumber = 1; } t = g.Tilesets[TilesetNumber]; t.beginEdit(); objectPickerControl1.Initialise(g); objectPickerControl1.CurrentTileset = TilesetNumber; tilesetObjectEditor1.load(g, TilesetNumber); tilemapEditor1.load(t.map16); imageManager1.addImage(t.graphics); for (int i = 0; i < t.palettes.Length; i++) { imageManager1.addPalette(t.palettes[i]); } tileBehaviorPicker.init(new Bitmap[] { t.Map16Buffer }, 16); //FIXME // graphicsEditor1.SaveGraphics += new GraphicsEditor.SaveGraphicsHandler(graphicsEditor1_SaveGraphics); descExists = ROM.UserInfo.descriptions.ContainsKey(TilesetID); //Fild in there are descriptions for the tileset deleteDescriptions.Visible = descExists; //Make the appropriate button visible createDescriptions.Visible = !descExists; tilesetObjectEditor1.descBox.Visible = descExists; //Hide or show the description text box tilesetObjectEditor1.descLbl.Visible = descExists; if (descExists) { descriptions = ROM.UserInfo.descriptions[TilesetID]; //Get the descriptions tilesetObjectEditor1.descBox.Text = descriptions[0]; //Fill the description box with that of the first object } this.Icon = Properties.Resources.nsmbe; }
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(); } }
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(); } }