// Spawning
        public TileSwitch Copy(Area area, Tileset tileset)
        {
            TileSwitch copy = new TileSwitch();

            copy.B0b7               = B0b7;
            copy.Height             = Height;
            copy.Layer1             = Layer1;
            copy.Layer2             = Layer2;
            copy.Layer3             = Layer3;
            copy.Alternate          = Alternate;
            copy.Tilemaps_bytesA[0] = Bits.Copy(Tilemaps_bytesA[0]);
            copy.Tilemaps_bytesA[1] = Bits.Copy(Tilemaps_bytesA[1]);
            copy.Tilemaps_bytesA[2] = Bits.Copy(Tilemaps_bytesA[2]);
            copy.TilemapA           = new AreaTilemap(area, tileset, this, false);
            if (this.Alternate)
            {
                copy.Tilemaps_bytesB[0] = Bits.Copy(Tilemaps_bytesB[0]);
                copy.Tilemaps_bytesB[1] = Bits.Copy(Tilemaps_bytesB[1]);
                copy.Tilemaps_bytesB[2] = Bits.Copy(Tilemaps_bytesB[2]);
                copy.TilemapB           = new AreaTilemap(area, tileset, this, true);
            }
            copy.Width = Width;
            copy.X     = X;
            copy.Y     = Y;
            return(copy);
        }
Beispiel #2
0
 private void height_ValueChanged(object sender, EventArgs e)
 {
     if (TileSwitch != null && !this.Updating)
     {
         int oldHeight = TileSwitch.Height;
         TileSwitch.Height = (int)height.Value;
         if (Model.FreeTileSwitchSpace() < 0)
         {
             height.Value = oldHeight;
             MessageBox.Show("Could not change the height. There is not enough free space available.",
                             "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         if (oldHeight != TileSwitch.Height)
         {
             TileSwitch.ResizeTilemaps();
         }
         TileSwitch.TilemapA = new AreaTilemap(area, tileset, TileSwitch, false);
         if (TileSwitch.Alternate)
         {
             TileSwitch.TilemapB = new AreaTilemap(area, tileset, TileSwitch, true);
         }
         //
         SetBytesLeftLabel();
         picture.Invalidate();
     }
 }
Beispiel #3
0
 private void copy_Click(object sender, EventArgs e)
 {
     if (TileSwitch != null)
     {
         copiedTileSwitch = TileSwitch.Copy(area, tileset);
     }
 }
Beispiel #4
0
 private void AddNew(TileSwitch tileSwitch)
 {
     if (Model.FreeTileSwitchSpace() >= tileSwitch.Length)
     {
         this.treeView.Focus();
         if (tileSwitches.TileSwitches.Count < 32)
         {
             if (treeView.Nodes.Count > 0)
             {
                 tileSwitches.Insert(treeView.SelectedNode.Index + 1, tileSwitch);
             }
             else
             {
                 tileSwitches.Insert(0, tileSwitch);
             }
             int index;
             if (treeView.Nodes.Count > 0)
             {
                 index = treeView.SelectedNode.Index;
             }
             else
             {
                 index = -1;
             }
             this.treeView.BeginUpdate();
             this.treeView.Nodes.Clear();
             int i = 0;
             foreach (var var in tileSwitches.TileSwitches)
             {
                 var node = new TreeNode("TILE SWITCH #" + i++.ToString());
                 if (var.Alternate)
                 {
                     node.Nodes.Add("ALTERNATE");
                 }
                 this.treeView.Nodes.Add(node);
             }
             this.treeView.ExpandAll();
             this.treeView.SelectedNode = this.treeView.Nodes[index + 1];
             this.treeView.EndUpdate();
         }
         else
         {
             MessageBox.Show("Could not insert any more tile switches. The maximum number of tile switches allowed per area is 32.",
                             "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     else
     {
         MessageBox.Show("Could not insert the switch. " + Model.MaximumSpaceExceeded("tile switch"),
                         "LAZY SHELL", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Beispiel #5
0
 private void duplicate_Click(object sender, EventArgs e)
 {
     AddNew(TileSwitch.Copy(area, tileset));
 }