private void importTilesetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            BattlefieldTileset tileset = new BattlefieldTileset();

            tileset = (BattlefieldTileset)Do.Import(tileset);
            if (tileset == null)
            {
                return;
            }
            //
            byte[] oldTileset = Bits.Copy(tileset.Tileset_bytes);
            //
            tileset.Palettes.BUFFER      = Model.ROM;
            this.battlefield.GraphicSetA = tileset.Battlefield.GraphicSetA;
            this.battlefield.GraphicSetB = tileset.Battlefield.GraphicSetB;
            this.battlefield.GraphicSetC = tileset.Battlefield.GraphicSetC;
            this.battlefield.GraphicSetD = tileset.Battlefield.GraphicSetD;
            this.battlefield.GraphicSetE = tileset.Battlefield.GraphicSetE;
            this.tileset.Palettes        = tileset.Palettes;
            this.tileset.Palettes.CopyTo(Model.PaletteSetsBF[palette]);
            this.tileset.Graphics      = tileset.Graphics;
            this.tileset.Tileset_tiles = tileset.Tileset_tiles;
            this.tileset.DrawTileset(this.tileset.Tileset_tiles, this.tileset.Tileset_bytes);
            this.tileset.Assemble(16, 16);
            //
            RefreshBattlefield();
            //
            if (!Bits.Compare(oldTileset, tileset.Tileset_bytes))
            {
                commandStack.Push(new TilesetCommand(tileset, oldTileset, this));
                commandStack.Push(1);
            }
        }
 public void RefreshBattlefield()
 {
     Cursor.Current = Cursors.WaitCursor;
     this.Updating  = true;
     tileset        = new BattlefieldTileset(battlefield, paletteSets[battlefield.PaletteSet]);
     // Update fields
     battlefieldName.SelectedIndex           = index;
     battlefieldGFXSet1Name.SelectedIndex    = battlefield.GraphicSetA;
     battlefieldGFXSet1Num.Value             = battlefield.GraphicSetA;
     battlefieldGFXSet2Name.SelectedIndex    = battlefield.GraphicSetB;
     battlefieldGFXSet2Num.Value             = battlefield.GraphicSetB;
     battlefieldGFXSet3Name.SelectedIndex    = battlefield.GraphicSetC;
     battlefieldGFXSet3Num.Value             = battlefield.GraphicSetC;
     battlefieldGFXSet4Name.SelectedIndex    = battlefield.GraphicSetD;
     battlefieldGFXSet4Num.Value             = battlefield.GraphicSetD;
     battlefieldGFXSet5Name.SelectedIndex    = battlefield.GraphicSetE;
     battlefieldGFXSet5Num.Value             = battlefield.GraphicSetE;
     battlefieldTilesetName.SelectedIndex    = battlefield.TileSet;
     battlefieldTilesetNum.Value             = battlefield.TileSet;
     battlefieldPaletteSetName.SelectedIndex = battlefield.PaletteSet;
     battlefieldPaletteSetNum.Value          = battlefield.PaletteSet;
     SetBattlefieldImage();
     // reload editors
     LoadPaletteEditor();
     LoadGraphicEditor();
     LoadTileEditor();
     this.Updating  = false;
     Cursor.Current = Cursors.Arrow;
 }
 private void exportToBattlefieldToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Tile[] tileset = new Tile[32 * 32];
     tileset = (Tile[])Do.Import(tileset);
     for (int i = 0; i < 32 * 32; i++)
     {
         this.tileset.Tileset_tiles[i] = tileset[i].Copy();
     }
     this.tileset.DrawTileset(this.tileset.Tileset_tiles, this.tileset.Tileset_bytes);
 }
 private void battlefieldTilesetNum_ValueChanged(object sender, EventArgs e)
 {
     if (this.Updating)
     {
         return;
     }
     battlefield.TileSet = (byte)battlefieldTilesetNum.Value;
     battlefieldTilesetName.SelectedIndex = (int)battlefieldTilesetNum.Value;
     tileset = new BattlefieldTileset(battlefield, paletteSets[palette]);
     SetBattlefieldImage();
     // reload editors
     LoadPaletteEditor();
     LoadGraphicEditor();
     LoadTileEditor();
 }
Exemplo n.º 5
0
        private void RefreshFormationBattlefield()
        {
            PaletteSet         paletteSet = paletteSets[battlefields[battlefieldName.SelectedIndex].PaletteSet];
            BattlefieldTileset tileSet    = new BattlefieldTileset(battlefields[battlefieldName.SelectedIndex], paletteSet);

            int[] quadrant1 = Do.TilesetToPixels(tileSet.Tileset_tiles, 16, 16, 0, false);
            int[] quadrant2 = Do.TilesetToPixels(tileSet.Tileset_tiles, 16, 16, 256, false);
            int[] quadrant3 = Do.TilesetToPixels(tileSet.Tileset_tiles, 16, 16, 512, false);
            int[] quadrant4 = Do.TilesetToPixels(tileSet.Tileset_tiles, 16, 16, 768, false);
            int[] pixels    = new int[512 * 512];
            Do.PixelsToPixels(quadrant1, pixels, 512, new Rectangle(0, 0, 256, 256));
            Do.PixelsToPixels(quadrant2, pixels, 512, new Rectangle(256, 0, 256, 256));
            Do.PixelsToPixels(quadrant3, pixels, 512, new Rectangle(0, 256, 256, 256));
            Do.PixelsToPixels(quadrant4, pixels, 512, new Rectangle(256, 256, 256, 256));
            formationBGImage = Do.PixelsToImage(pixels, 512, 512);
            pictureBoxFormation.Invalidate();
        }