public void SetScreenImage() { if (MinecartData == null) { return; } if (screenIndex >= L1Indexes.Count) { return; } if (L1Indexes[screenIndex] < 16) { byte[] tilemapL1 = Bits.GetBytes(Model.SSTilemap, L1Indexes[screenIndex] * 256, 256); byte[] tilemapL2; if (Index == 2) { tilemapL2 = Bits.GetBytes(Model.SSTilemap, L2Indexes[screenIndex] * 256, 256); } else { tilemapL2 = new byte[256]; } SideTilemap tilemap = new SideTilemap(tilemapL1, tilemapL2, Tileset, paletteSet); screenImages[screenIndex] = Do.PixelsToImage(tilemap.Pixels, 256, 256); } else { screenImages[screenIndex] = new Bitmap(256, 256); } picture.Invalidate(); }
public void SetScreenImages() { if (MinecartData == null) { return; } screenImages = new List <Bitmap>(); for (int i = 0; i < L1Indexes.Count; i++) { if (L1Indexes[i] < 16) { byte[] tilemapL1 = Bits.GetBytes(Model.SSTilemap, L1Indexes[i] * 256, 256); byte[] tilemapL2; if (Index == 2) { tilemapL2 = Bits.GetBytes(Model.SSTilemap, L2Indexes[i] * 256, 256); } else { tilemapL2 = new byte[256]; } SideTilemap tilemap = new SideTilemap(tilemapL1, tilemapL2, Tileset, paletteSet); Bitmap screenImage = Do.PixelsToImage(tilemap.Pixels, 256, 256); screenImages.Add(new Bitmap(screenImage)); } else { screenImages.Add(new Bitmap(256, 256)); } } picture.Invalidate(); }
public void LoadMinecart() { // if mode7 map if (Index < 2) { labelStartXY.Visible = true; startX.Visible = true; startY.Visible = true; startX.Value = Bits.GetShort(Model.ROM, 0x039670); startY.Value = Bits.GetShort(Model.ROM, 0x039679); // Create map elements PaletteSet = Model.M7PaletteSet; Tileset = new Tileset(Model.M7PaletteSet, TilesetType.Mode7); if (Index == 0) { Tilemap = new Mode7Tilemap(Model.M7TilemapA, Tileset, PaletteSet); } else { Tilemap = new Mode7Tilemap(Model.M7TilemapB, Tileset, PaletteSet); } // Load the screens toggleScreens.Enabled = false; ScreensForm.Hide(); ObjectsForm.Hide(); } // if side-scrolling map else { labelStartXY.Visible = false; startX.Visible = false; startY.Visible = false; // Create map elements PaletteSet = Model.SSPaletteSet; Tileset = new Tileset(Model.SSTileset, Model.SSGraphics, PaletteSet, 16, 16, TilesetType.SideScrolling); Tilemap = new SideTilemap(Model.SSTilemap, null, Tileset, PaletteSet); toggleScreens.Enabled = true; ScreensForm.LoadScreens(); // ObjectsForm toggleScreens.Enabled = true; ScreensForm.Show(dockPanel, DockState.DockTop); ObjectsForm.Left = this.Right + 10; ObjectsForm.Top = this.Top; ObjectsForm.Show(ScreensForm.Pane, DockAlignment.Right, 0.25); ObjectsForm.InitializeObjects(); } // (Re)load editors and forms ReloadPaletteEditor(); ReloadGraphicEditor(); ReloadSpritePaletteEditor(); ReloadSpriteGraphicEditor(); LoadTilesetEditor(); LoadTilemapEditor(); // Rails properties TilesetForm.Rails = state.Rails && Index < 2; }